摘要: https://code.google.com/p/django-simple-captcha/下载后 python setup.py installdjango-simple-captcha\captcha 拷贝到django app目录 就是 manage.py 同一级目录修改 setting.py INSTALLED_APPS 加入一条 "yourApp.captcha"urls.py urlpatterns 加入一条 url(r'^captcha/', include('captcha.urls')),你的forms.py 顶部加入一 阅读全文
posted @ 2011-12-23 15:46 秋丰 阅读(391) 评论(0) 推荐(0)
摘要: net use * /del /y 阅读全文
posted @ 2011-12-13 14:14 秋丰 阅读(808) 评论(0) 推荐(0)
摘要: 举例mysql> explain select * from event;+----+-------------+-------+------+---------------+------+---------+------+------+-------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+-------+------+---------------+------+---------+------+------+ 阅读全文
posted @ 2011-12-02 16:12 秋丰 阅读(175) 评论(0) 推荐(0)
摘要: 1,尽量简单应用mysql,不要让mysql去做运算。比如 md5 order by Rand()2, 一个数据库的表不要太多,表的字段数不要太多。数据库设计遵循平衡原则,适当牺牲范式,加入冗余,在代码复杂度,性能,设计规范三项中取得平衡。3,拒绝大sql ,大事务, 大批量。4,选择合适的字段。 比如int有几种,每一种占有的空间不一样,范围也不一样。不需要存负数使用无符号字段。例如ip用int UNSIGNED存就比varchar(15)效率更高 5,优先使用ENUM或SET ,避免使用null字段。6,少用text,blob字段,并拆分到单独的表。7,合理添加索引,字符字段必须添加前缀索 阅读全文
posted @ 2011-11-22 20:39 秋丰 阅读(259) 评论(0) 推荐(0)
摘要: #!/usr/bin/env python#coding:utf-8from wx import *attrs = dir(wx.App) + dir(wx.Frame) + dir(wx.Panel) + dir(wx.StaticText) + dir(wx.TextCtrl) + dir(wx)attrs.sort()attrs_unique = {}.fromkeys(attrs).keys()lines = "\n".join(attrs_unique)h = open(r'd:\python.txt','w+')h.write(l 阅读全文
posted @ 2011-11-19 15:23 秋丰 阅读(241) 评论(0) 推荐(1)
摘要: #!/usr/bin/env python#coding:utf-8 import wxclass MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"My Frame",size=(300,300)) panel = wx.Panel(self,-1) panel.Bind(wx.EVT_MOTION,self.OnMove) wx.StaticText(panel,-1,"Pos:",pos=(10,12)) self.posCtrl = wx.TextCtrl 阅读全文
posted @ 2011-11-08 11:08 秋丰 阅读(315) 评论(0) 推荐(0)
摘要: 安装 http://cx-freeze.sourceforge.net/ C:\Python27\Scripts\cxfreeze.bat python路径要修改对在需要编译的 .py 文件同文件夹新建一个 setup.py 代码为#!/usr/bin/env pythonfrom cx_Freeze import setup,Executablesetup(name = "",version = "",description= "",executables = [Executable("tk.py")]) #把t 阅读全文
posted @ 2011-11-02 18:01 秋丰 阅读(572) 评论(0) 推荐(0)
摘要: hello world 例子#!/usr/bin/env pythonimport Tkintertop = Tkinter.Tk()label= Tkinter.Label(top,text='hello world!!') label.pack()Tkinter.mainloop()Button 例子 点击按钮后程序退出#!/usr/bin/env pythonimport Tkintertop = Tkinter.Tk()quit= Tkinter.Button(top,text='hello world!!',command=top.quit)quit. 阅读全文
posted @ 2011-11-02 16:59 秋丰 阅读(411) 评论(0) 推荐(0)
摘要: 配置文件为" autoload _vimrcautocmd! bufwritepost _vimrc source %" disable VI's compatible modeset nocompatibleset fileencodings=ucs-bom,utf-8,chineseset fileencoding=utf-8" use chinese helpset helplang=cnif has("gui_running")set guifont=Yahei_Mono:h11:cGB2312colorscheme ocean 阅读全文
posted @ 2011-10-29 00:07 秋丰 阅读(721) 评论(0) 推荐(0)
摘要: """file 文件地址 可以是 request.FILES[''] 格式path 新格式图片地址"""def img_convert(file,path): import Image image = Image.open(file) image.convert('RGB') image.save(path,image.format)"""生成缩略图file 图片地址 或者 request.FILES['file']width 缩略图宽height 缩略图高 阅读全文
posted @ 2011-10-28 15:43 秋丰 阅读(1103) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示