摘要: SyntaxError: Non-ASCII character '\xe6' in file google.py on line 17, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for detailsAd... 阅读全文
posted @ 2014-08-18 14:20 黄伟同学 阅读(206) 评论(0) 推荐(0)
摘要: random.randrange(stop)random.randrange(start,stop[,step])Return a randomly selected element fromrange(start,stop,step). This is equivalent tochoice(ra... 阅读全文
posted @ 2014-08-18 13:44 黄伟同学 阅读(132) 评论(0) 推荐(0)
摘要: for initialization; condition; increment { statements}和 C 语言中一样,分号将循环的定义分为 3 个部分,不同的是,Swift 不需要使用圆括号将“initialization; condition; increment”包括起来。这个循... 阅读全文
posted @ 2014-07-05 22:27 黄伟同学 阅读(494) 评论(0) 推荐(0)
摘要: There's a much simpler solution for this. Try running the following command:sudo /usr/sbin/DevToolsSecurity --enable 阅读全文
posted @ 2014-07-05 16:45 黄伟同学 阅读(398) 评论(0) 推荐(0)
摘要: 1.Convert NSDate into unix timestamp?-(NSTimeInterval)timeIntervalSince19702.Convert timestamp to NSDate format?NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeStamp];3.Trim NSDate to show date only?NSDateFormatter*format =[[NSDateFormatter alloc] init];format.dateFormat =@"dd-MM-yyyy& 阅读全文
posted @ 2014-03-31 23:15 黄伟同学 阅读(139) 评论(0) 推荐(0)
摘要: 判断NSString字符串为空几乎是每一个开发人员肯定会碰到的问题,对于绝大多数人最先闪过大脑的是下面的方法if([yourTextString isEqualToString:@""])但是很遗憾,这样的判断往往经常会出现失败的情况,造成很多莫名其妙的bug,例如如果用这种方法判断UITextField是否为空便会出现问题[yourTextField.text isEqualToString:@""] 上面这行代即时在用户未进行任何输入的情况下,也会为NO,这是什么原因呢?答案其实很简单,yourTextField.text 在最初创建后的值为nil, 阅读全文
posted @ 2014-03-31 13:56 黄伟同学 阅读(456) 评论(0) 推荐(0)
摘要: Calculating the md5 and sha1 hash in iOS sdk is pretty simple -Step 1– The very first thing you need to do is import CommonCrypto’s CommonDigest.h1#import Step 2– Here is the real code for calculating SHA1 and MD5 hash -SHA1 -1234567891011121314151617-(NSString*) sha1:(NSString*)input{const char *cs 阅读全文
posted @ 2014-03-30 19:50 黄伟同学 阅读(205) 评论(0) 推荐(0)