11 2011 档案
摘要: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,合理添加索引,字符字段必须添加前缀索
阅读全文
摘要:#!/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
阅读全文
摘要:#!/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
阅读全文
摘要:安装 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
阅读全文
摘要: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.
阅读全文

浙公网安备 33010602011771号