上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页
'''Add decorator for each method of a class.'''import functoolsimport threadingclass DecorateClass(object): def decorate(self): for name, fn in self.iter(): if callable(fn): ... Read More
posted @ 2011-12-21 17:01 张云贵 Views(3391) Comments(0) Diggs(0) Edit
这是在Python学习小组上介绍的内容,现学现卖、多练习是好的学习方式。 第一步:最简单的函数,准备附加额外功能 # -*- coding:gbk -*-'''示例1: 最简单的函数,表示调用了两次'''def myfunc(): print("myfunc() called.")myfunc()myfunc()第二步:使用装饰函数在函数执行前和执行后分别附加额外功能# -*- c... Read More
posted @ 2011-12-21 10:30 张云贵 Views(139742) Comments(15) Diggs(47) Edit
https://github.com/rhcad/x3pySVN: https://github.com/rhcad/x3py.git/trunkGIT: git clonegit://github.com/rhcad/x3py.gitC++插件框架 x3py 在下列平台编译测试通过:1、Win7 x64, VC++ 9.0 x64 | VC++ 8.0 x86, Console | Python2.7/3.2 | Perl5 | Java 1.62、Win7 x64, TDM GCC 4 + MSYS + Makefile, Console | Python | Perl | Java (P Read More
posted @ 2011-12-02 10:05 张云贵 Views(2977) Comments(3) Diggs(0) Edit
* Add GetLogObserver() export function in LogWriter.plugin so it can be used by oneself regardless PluginManager. * LogHelper.h: Add X3LOG_GROUP(name) and X3LOG_GROUP2(name, extra). * Add LogHelper2.h for non-plugin projects. * Auto call x3UninitializePlugin() when a plugin is unloading. * Ad... Read More
posted @ 2011-11-22 10:01 张云贵 Views(3090) Comments(44) Diggs(0) Edit
今晚看了《iPhone开发秘籍》第8章,还没有看手势部分,记录下列收获。 1、对于视图内的多个小目标控件,要想点击时显示在其他控件前面,就在控件视图类的TouchesBegan:函数中调用“[[self superview] bringSubviewToFront: self];” 2、在视图中添加多个小图像控件: - (void) viewDidLoad{ self.navigati... Read More
posted @ 2011-10-23 22:54 张云贵 Views(460) Comments(0) Diggs(0) Edit
总结:1、在iTouch4上运行检测到的触摸点数最大是5,即只允许5个手指在屏幕上滑动2、视图支持多点触摸:isMultipleTouchEnabled返回YES,或者设置 multipleTouchEnabled属性为YES3、要将多个CGPoint点添加到NSMutableArray,使用 NSStringFromCGPoint 函数,使用 CGPointFromString 从数组中取出坐标TouchesView.h#import <UIKit/UIKit.h>@interface TouchesView : UIView { NSMutableArray* _points; Read More
posted @ 2011-10-22 20:22 张云贵 Views(841) Comments(2) Diggs(0) Edit
总结:1、单点触摸时,获取坐标:[[touches anyObject] locationInView:self];2、需要更新图形显示内容时,调用 [self setNeedsDisplay];3、在绘图事件函数中使用 UIGraphicsGetCurrentContext() 得到画布4、画线使用 StrokePath5、绘图前清除旧的显示内容可使用背景色填充视图范围(本例中可以不要)6、绘图程序一般要支持屏幕自动旋转,在视图控制器的shouldAutorotateToInterfaceOrientation函数中返回YESTouchesView.h:#import <UIKit/U Read More
posted @ 2011-10-22 19:21 张云贵 Views(930) Comments(0) Diggs(0) Edit
1、迭代器简介Python中很多对象都是迭代器,例如列表、元组、字符串、文件、映射、集合。所有可迭代的类必须实现__iter__()函数,得到迭代器对象,通常返回自身(即自身就是迭代器对象);所有的迭代器类都实现了next()函数,当然迭代器类也需要实现__iter__()函数;3.0中是__next__()函数。2、迭代器常见用法用法1: for 变量 in 可迭代对象用法2:if 变量 in 可迭代对象用法3(较少使用):变量 = iter(可迭代对象),然后循环iter.next()得到每个值,直到StopIteration异常出现。如果想重新循环,没有回到开头的函数,可以重新得到迭代器 Read More
posted @ 2011-10-21 21:48 张云贵 Views(1202) Comments(0) Diggs(0) Edit
徐锋在TechED2011上的“用户访谈之道(软件需求获取务实)”讲座,用大量生动贴切的例子,讲述需求访谈的宝贵经验,融合了一个17年需求经验的老道投资人的经验,特别精彩。 强烈建议需求人员去学习,其他人员也可以欣赏演讲艺术、沟通技巧。 PPT: http://vdisk.weibo.com/s/NKrY/1318557219 录音: http://vdisk.weibo.com... Read More
posted @ 2011-10-17 09:43 张云贵 Views(494) Comments(0) Diggs(0) Edit
为了避免手工创建新的插件工程,同时也是学习python,今天用了6个小时边学边试,终于编写完了。 学习到的新知识有: 1、正则表达式一次替换多种子串 2、遍历创建目录 3、回调函数 4、路径模块 5、字典的一些用法 6、主函数、编写习惯、递进开发方式 #!/usr/bin/env python"""Function: Create a plugin ... Read More
posted @ 2011-10-09 15:11 张云贵 Views(1264) Comments(0) Diggs(1) Edit
上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页