By minitia, on 十一月 10th, 2009, Category: C++ Programming
1.纯虚函数 virtual CMsvOperation* CancelL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection) = 0;
只提供一个接口,靠继承类实现定义。个人理解:symbian导出类函数在freeze时将生成def文件,而pure virtual函数无法生成这样的导出定义。纯虚函数一般作为接口类使用,无所谓导出与否。接口类一般都通过工厂函数来进行实例化。所以不需要使用export_c和import_c关键字
Continue reading 虚函数和纯虚函数链接库的区别 - 全文阅读
By minitia, on 十一月 10th, 2009, Category: Python
主题 debian安装django环境 内容 1、安装python2.5 apt-get/aptitude install python2.5 2、安装mysql 5.0 apt-get/aptitude install mysql-server mysql-client
3、安装apache2 apt-get/aptitude install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-python
4、安装python 与 mysql django接口 apt-get/aptitude install python-django python-mysqldb
or 安装django python setup.py install
finish the django envirement install
By minitia, on 十一月 10th, 2009, Category: Python
对于Python入门不久的同志这可能是一个比较头疼的问题,但对老鸟来说可能已经是老生常谈了.由于网上关于这方面的资料不多,所以这道菜更主要是为小鸟准备的,虽然我也还是一支小鸟.也欢迎老鸟们品尝,并提出您们宝贵的意见. Python是一门跨平台的语言,但并不是说你用Python随便写的一个程序就能在不同的平台都能运行.而相对路径和绝对路径是这方面的典型(相对路径在Windows下可行,而在Linux下提示找不到相应的文件路径),因为Linux和Windows本身结构就存在着较大的差异, 而这差异也给写扩平台的程序造成了困难.我自己尝试过两种方法来解决这个问题,下边就与大家一起分享.
Continue reading 浅谈Python的相对路径与绝对路径 - 全文阅读
By minitia, on 十一月 10th, 2009, Category: Python
两种不同的语言,不同的表达!
Python脚本实现.
“”" File Name : clean.py File Date : 2009/11/5 14:22:56 Author : DannyLai Purpose : Clean the svn files All svn projects have an hide directory “.svn” The python script purpose is to clean the .svn directory in svn projects. “”"
Continue reading 删除工程中svn文件的脚本(Ruby版和Python版) - 全文阅读
By minitia, on 十月 29th, 2009, Category: Python
这里主要是用sort方法对list中的数据进行排序。如果list中元素是tuple这样的类型,则按照tuple里面元素的位置的先后来排序。 代码如下:
Continue reading Python list的排序 - 全文阅读
By minitia, on 十月 28th, 2009, Category: Python
wxpython事件处理evt列表
python中evt处理,可以使用bind将事件触发,绑定至控件,并提供事件处理函数 其evt列表可参考/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode下的*.py文件。*.py文件内有相关的控件列表。
例如: listctrl控件列表事件处理 选中listctrl一行,触发listctrl控件事件wx.EVT_LIST_ITEM_ACTIVATED。
这时,可以使用bind,将listctrl控件事件,与事件处理函数绑定,就可以实现当鼠标,或则光标选中listctrl行时,处理相关的事件。
By minitia, on 十月 28th, 2009, Category: Python
django中model类都是ModelBase的子类。ModelBase是在django.db.models.base中定义的。 如果一个mdoel类是ModelBase的子类,他的属性有: ['DoesNotExist', 'MultipleObjectsReturned', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__getattribute__', '__hash__', '__init__', '__metaclass__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__unicode__', '__weakref__', '_base_manager', '_collect_sub_objects', '_default_manager', '_deferred', '_get_FIELD_display', '_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', '_get_pk_val', '_meta', '_set_pk_val', 'delete', 'objects', 'permissions', 'pk', 'prepare_database_save', 'save', 'save_base', 'serializable_value', 'user_set']
Continue reading django中ModelBase的属性 - 全文阅读
By minitia, on 十月 19th, 2009, Category: Python
先来看个例子: def foo(*args, **kwargs): print ‘args = ‘, args print ‘kwargs = ‘, kwargs print ‘—————————————’ if __name__ == ‘__main__’: foo(1,2,3,4) foo(a=1,b=2,c=3) foo(1,2,3,4, a=1,b=2,c=3) foo(’a', 1, None, a=1, b=’2′, c=3)输出结果如下:
args = (1, 2, 3, 4) kwargs = {} ————————————— args = () kwargs = {’a': 1, ‘c’: 3, ‘b’: 2} ————————————— args = (1, 2, 3, 4) kwargs = {’a': 1, ‘c’: 3, ‘b’: 2} ————————————— args = (’a', 1, None) kwargs = {’a': 1, ‘c’: 3, ‘b’: ‘2′} —————————————
可以看到,这两个是python中的可变参数。*args表示任何多个无名参数,它是一个tuple;**kwargs表示关键字参数,它是一个dict。并且同时使用*args和**kwargs时,必须*args参数列要在**kwargs前,像foo(a=1, b=’2′, c=3, a’, 1, None, )这样调用的话,会提示语法错误“SyntaxError: non-keyword arg after keyword arg”。
呵呵,知道*args和**kwargs是什么了吧。还有一个很漂亮的用法,就是创建字典: def kw_dict(**kwargs): return kwargs print kw_dict(a=1,b=2,c=3) == {’a':1, ‘b’:2, ‘c’:3}
其实python中就带有dict类,使用dict(a=1,b=2,c=3)即可创建一个字典了。
“人生苦短,我用python。”
By minitia, on 十月 16th, 2009, Category: Python
#!/USR/BIN/PYTHON import smtplib,string
class SendMail: def __init__(self,smtpServer,user="",passwd=""): self.smtpServer=smtpServer self.user=user self.passwd=passwd
def sendmail(self,fromAddr,toAddr,subject,msg): server=smtplib.SMTP(self.smtpServer)
if len(self.user)!=0 and len(self.passwd)!=0: server.login(self.user,self.passwd) body=string.join(( "FROM: %s" %fromAddr, "TO: %s" %toAddr, "Subject: %s" %subject, "", msg),"\r\n")
server.sendmail(fromAddr,toAddr,body) server.quit()
if __name__ == "__main__": smDemo=SendMail("192.168.1.100","wuweixin","wwx’s passwd") smDemo.sendmail("wuweixin@pconline.com.cn","121957514@qq.com","SendMail Test","Just Test")
Page 4 of 7 « First ... « 2 3 4 5 6 » ... Last »
|
|
|