码迷,mamicode.com
首页 >  
搜索关键字:note to self    ( 21530个结果)
#Leet Code# Divide Two Integers
描述:不使用 * / % 完成除法操作。O(n)复杂度会超时,需要O(lg(n))复杂度。代码: 1 class Solution: 2 # @return an integer 3 def dividePositive(self, dividend, divisor): 4 ...
分类:其他好文   时间:2014-07-16 19:18:00    阅读次数:298
IOS开发 获取当前视图所在的类名
NSString *stringClass = NSStringFromClass([(UINavigationController *)self.window.rootViewController topViewController].class);
分类:移动开发   时间:2014-07-16 19:00:17    阅读次数:245
pywin32创建一个窗口
```pythonimport win32con,win32guiclass MyWindow(): def __init__(self): #注册一个窗口类 wc = win32gui.WNDCLASS() wc.lpszClassName = 'M...
分类:Windows程序   时间:2014-07-16 18:59:22    阅读次数:843
一个消除if语句的例子
// 一个按钮点击事件,判断点击按钮是那一个显示出他的信息- (IBAction)buttonPressed:(id)sender { if (sender == self.leftButton) { NSLog(@"%@", self.leftButton.currentTit...
分类:其他好文   时间:2014-07-16 18:19:06    阅读次数:167
IOS代码库
1 /* 九宫格计算 */ 2 int totalCol = 5;//指定总列数 3 4 CGFloat viewW = 50;//subview宽度 5 CGFloat viewH = 50;//subview高度 6 7 CGFloat marginX = (self.view.bound...
分类:移动开发   时间:2014-07-16 18:15:23    阅读次数:204
python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
import sys class Stats: def __init__(self, sequence): # sequence of numbers we will process # convert all items to floats for numeri...
分类:编程语言   时间:2014-07-16 18:06:48    阅读次数:257
【leetcode】Linked List Cycle (python)
题目分析见这里 class Solution: # @param head, a ListNode # @return a list node def detectCycle(self, head): if None == head or None == head.next: return None pfast = ...
分类:编程语言   时间:2014-07-16 17:18:53    阅读次数:248
What the difference between __weak and __block reference?
近日遇到一个很细的知识点,关于block的循环引用问题,相比很多人都遇到了,也能顺利解决了,至于block方面的技术文章,那就更多了,这里不再赘述,但是有这样一个问题: What the difference between __weak and __block reference?  使用场景: __block typeof(self) tmpSelf = self; [self meth...
分类:其他好文   时间:2014-07-16 17:09:11    阅读次数:203
【leetcode】Linked List Cycle (python)
class Solution: # @param head, a ListNode # @return a boolean def hasCycle(self, head): if None == head or None == head.next: return False pfast = head ...
分类:编程语言   时间:2014-07-16 09:50:21    阅读次数:271
Lua面向对象设计
面向对象的基础是类,但Lua中没有提供类的概念,所以我们需要利用Lua现有的机制来实现类似于类的有关oop的一整套概念。基本方案是使用table来实现类机制,并且结合使用self参数和冒号操作。我们先来看看self参数和冒号操作符的用法: self参数的使用是很多面向对象语言的要点,大多数OO...
分类:其他好文   时间:2014-07-16 00:43:18    阅读次数:296
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!