不管是windows还是mac想找个好用的看图软件还是比较难,用的都不怎么合手。以前一直用Picasa3,结果现在google早已经不维护这个项目了。
尝试安装acdsee,浏览功能也还ok,但是预览的时候不能跨目录导致图片较多的时候会出现需要来回切换目录的问题。
不管是windows还是mac想找个好用的看图软件还是比较难,用的都不怎么合手。以前一直用Picasa3,结果现在google早已经不维护这个项目了。
尝试安装acdsee,浏览功能也还ok,但是预览的时候不能跨目录导致图片较多的时候会出现需要来回切换目录的问题。
对于美女的热爱无法自拔 😆 ,经常会去搜索一些美女图片,下载下来,然后找时间慢慢欣赏。主要用途是用作电脑桌面手机桌面,通常会百度或者bing去搜索下找到图片下载。相对来说能够直接用作桌面的图片并不多,多数是尺寸问题,并不是十分合适。但是即使不能直接用,可以用ps修改下图片尺寸,或者欣赏也是好的啊。 🙂
以前曾经从一个网站mzitu.com 爬了一些图片,但是最近访问的时候却发现网站挂了~~
最近做了一个系统由于部分接口需要进行耗时操作,因而不希望用户进行频繁访问,需要进行访问频率限制。如果要自己实现一个访问限制功能相对来说也不会太复杂,并且网上有各种代码可以参考。如果自己不想实现这个代码可以使用 Django Ratelimit 。
Django Ratelimit is a ratelimiting decorator for Django views.
https://travis-ci.org/jsocol/django-ratelimit.png?branch=master
Code: https://github.com/jsocol/django-ratelimit
License: Apache Software License
Issues: https://github.com/jsocol/django-ratelimit/issues
Documentation: http://django-ratelimit.readthedocs.org/
使用方法也相对来说比较简单:
@ratelimit(key='ip', rate='5/m')
def myview(request):
# Will be true if the same IP makes more than 5 POST
# requests/minute.
was_limited = getattr(request, 'limited', False)
return HttpResponse()
@ratelimit(key='ip', rate='5/m', block=True)
def myview(request):
# If the same IP makes >5 reqs/min, will raise Ratelimited
return HttpResponse()
@ratelimit(key='post:username', rate='5/m', method=['GET', 'POST'])
def login(request):
# If the same username is used >5 times/min, this will be True.
# The `username` value will come from GET or POST, determined by the
# request method.
was_limited = getattr(request, 'limited', False)
return HttpResponse()
@ratelimit(key='post:username', rate='5/m')
@ratelimit(key='post:tenant', rate='5/m')
def login(request):
# Use multiple keys by stacking decorators.
return HttpResponse()
@ratelimit(key='get:q', rate='5/m')
@ratelimit(key='post:q', rate='5/m')
def search(request):
# These two decorators combine to form one rate limit: the same search
# query can only be tried 5 times a minute, regardless of the request
# method (GET or POST)
return HttpResponse()
VMProtect protects code by executing it on a virtual machine with non-standard architecture that makes it extremely difficult to analyze and crack the software. Besides that, VMProtect generates and verifies serial numbers, limits free upgrades and much more.
class Ghost(models.Model):
create = models.DateTimeField(default=timezone.now, help_text='创建时间')
update = models.DateTimeField(auto_now=True, help_text='修改时间')
speed = models.IntegerField(default=0, help_text='速度')
name = models.CharField(max_length=64, help_text='名称')
class InstanceTask(models.Model):
create = models.DateTimeField(default=timezone.now, help_text='创建时间')
update = models.DateTimeField(auto_now=True, help_text='修改时间')
name = models.CharField(max_length=64, help_text='副本名称')
class InstanceTaskMap(models.Model):
create = models.DateTimeField(default=timezone.now, help_text='创建时间')
update = models.DateTimeField(auto_now=True, help_text='修改时间')
name = models.CharField(max_length=64, help_text='地图名称')
ghosts = models.ManyToManyField(Ghost, help_text='Ghost')
instance_task = models.ForeignKey(InstanceTask, related_name='instancetask_instancetaskmap', blank=True, null=True,
help_text='副本任务', on_delete=models.SET_NULL)
对于上面的model,如果要在django admin中展示ghosts信息,那么在list_display中直接加入’ghosts’ 会报下面的错误:The value of ‘list_display[1]’ must not be a ManyToManyField.
如果要解决这个问题可以使用下面的代码来展示:
class InstanceTaskMapAdmin(admin.ModelAdmin):
list_display = ('name', 'instance_task', 'id', 'index', 'get_ghost_name', 'introduction')
# https://blog.csdn.net/weixin_42134789/article/details/83686664
def get_ghost_name(self, obj):
ghost_list = []
for g in obj.ghosts.all():
ghost_list.append(g.ghost.name)
return ','.join(ghost_list)
get_ghost_name.short_description = "Ghosts"
如果需要更丰富的信息可以参考上面代码注释中的链接。
群晖的系统其实已经用了好几年了,以前都是用投影仪看电影,但是自从有了小朋友之后投影仪不方便使用了。于是多数时候该用电视来投屏,虽然如此但是在使用的过程中多有不便。需要在电脑上打开网页然后选择投屏位置进行投屏。并且有的视频没有声音。这个貌似主要的原因是群晖的video station没有对应的解码器导致的,网上搜索这个问题的人貌似也蛮多的。
对于上面的状况,晚上也有解决方案,安装ffmpeg解码器,https://tieba.baidu.com/p/5606311062?red_tag=2162405148 但是在实际的时候效果并不是十分力量,依然有一些视频没有声音。
后来想到用DS file来解决问题,因为平时有时候用手机浏览视频都是用的DS file。所以果断安装DS file, 在电视上安装DS file还是比较容易的,但是在登陆界面就比较蛋疼,输入地址 用户名和密码之后,无法用遥控器定位到登陆按钮无法登陆,如果要解决这个问题可以选择记住密码。并且输入过程可以在电视上插个无线鼠标键盘解决,当然,没有无线插个有线的键盘鼠标也是ok的。
Django REST framework is a powerful and flexible toolkit for building Web APIs.
Some reasons you might want to use REST framework:
The Web browsable API is a huge usability win for your developers.
Authentication policies including packages for OAuth1a and OAuth2.
Serialization that supports both ORM and non-ORM data sources.
Customizable all the way down – just use regular function-based views if you don’t need the more powerful features.
Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.
之前虽然也用了Django REST framework 但是序列化函数基本都是自己写的,并没有用框架带的序列化函数。这次不想在搞的那么麻烦,于是使用Django REST framework带的序列化函数。
但是在序列化foreignkey的时候却发现只有id,其余的数据没有。
model定义:
class PlayerGoodsItem(models.Model):
create = models.DateTimeField(default=timezone.now, help_text='创建时间')
update = models.DateTimeField(auto_now=True, help_text='修改时间')
goods_item = models.ForeignKey(GoodsItem, related_name='goodsitem_playergoodsitem', help_text='商品信息',
on_delete=models.CASCADE)
序列化代码:
class PlayerGoodsItemSerializer(serializers.ModelSerializer):
class Meta:
model = PlayerGoodsItem
fields = "__all__"
在计算理论中,确定有限状态自动机或确定有限自动机(英语:deterministic finite automaton, DFA)是一个能实现状态转移的自动机。对于一个给定的属于该自动机的状态和一个属于该自动机字母表{\displaystyle \Sigma }Σ的字符,它都能根据事先给定的转移函数转移到下一个状态
DFA((Deterministic Finite automation))确定性的有穷状态自动机: 从一个状态输入一个字符集合能到达下一个确定的状态。如图:
如上图当AB状态输入a得到状态aB,状态aB输入b得到状态ab; 状态AB输入b得到状态Ab,状态Ab输入a得到状态ab。