技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

10 2014 档案

转:优秀程序员写可调试的代码
摘要:原文:http://blog.jobbole.com/61732/所有的程序都需要某种形式的日志记录建立在它们之上,以便我们可以观察到它正在做什么。这尤其在程序出错时就显得非常重要。一个优秀的程序员和一个糟糕的程序员之间的一个不同之处是一个优秀的程序员会增加日志或其他工具以便在程序失败时方便调试。当... 阅读全文

posted @ 2014-10-29 12:50 codestyle 阅读(235) 评论(0) 推荐(0)

转:靠谱的代码和DRY
摘要:http://www.cppblog.com/vczh/archive/2014/07/15/207658.html靠谱的代码和DRY上次有人来要求我写一篇文章谈谈什么代码才是好代码,是谁我已经忘记了,好像是AutoHotkey还是啥的专栏的作者。撇开那些奇怪的条款不谈,靠谱的 代码有一个共同的特点... 阅读全文

posted @ 2014-10-27 12:56 codestyle 阅读(839) 评论(0) 推荐(0)

python将图片转为base64编码
摘要:import base64f = open("m1.jpg", "rb")res = f.read()s = base64.b64encode(res)f = open("hello.txt","w")f.write(s) 阅读全文

posted @ 2014-10-22 11:26 codestyle 阅读(2006) 评论(0) 推荐(0)

自定义等待视图
摘要:AlertView.h#import @interface AlertView : UIView@property (strong, nonatomic) UILabel *messageLabel;@endAlertView.m#import "AlertView.h"@interface Ale... 阅读全文

posted @ 2014-10-18 00:32 codestyle 阅读(359) 评论(0) 推荐(0)

自定义TableViewCell
摘要:BookStoreCell.h#import @interface BookStoreCell : UITableViewCell@property (strong, nonatomic) UIImageView *bookImageView;@property (strong, nonatomic... 阅读全文

posted @ 2014-10-13 22:03 codestyle 阅读(423) 评论(0) 推荐(0)

iOS: Core Data入门
摘要:Core Data是ORM框架,很像.NET框架中的EntityFramework。使用的基本步骤是:在项目属性里引入CoreData.framework (标准库)在项目中新建DataModel (生成*.xcdatamodeld文件)在DataModel里创建Entity为Entity生成头文件... 阅读全文

posted @ 2014-10-10 17:21 codestyle 阅读(239) 评论(0) 推荐(0)

iOS:处理XML文件
摘要:NSXMLParser是标准库类Book.xml 金庸 sfdgasidfhasdfb --> hello,world i'm lishujun sdfsdfs\ aaaasdfsdf ... 阅读全文

posted @ 2014-10-09 19:20 codestyle 阅读(488) 评论(0) 推荐(0)

iOS:等待控件
摘要:定义:@interface ViewController (){ UIActivityIndicatorView *testActivityIndicator;}实例化,开始旋转:-(void) showWaitStatus{ NSLog(@"wait..."); testActi... 阅读全文

posted @ 2014-10-08 20:19 codestyle 阅读(351) 评论(0) 推荐(0)

异步请求HTTP
摘要:代码:@interface HttpProcessor : NSObject { NSMutableData *buffer;}@property BOOL finished;@property (strong, nonatomic) NSString *html;@end@implement... 阅读全文

posted @ 2014-10-08 18:05 codestyle 阅读(504) 评论(0) 推荐(0)

同步的HTTP请求
摘要:代码:#import void request(NSString *urlString){ NSLog(@"BEGIN"); // make request object NSURL *url = [[NSURL alloc]initWithString:urlString]; ... 阅读全文

posted @ 2014-10-08 17:30 codestyle 阅读(662) 评论(0) 推荐(0)

解析JSON字符串
摘要:代码:#import void parseJSON(NSString *text){ NSError *error = nil; NSData *data = [text dataUsingEncoding:NSUTF8StringEncoding]; NSArray *array... 阅读全文

posted @ 2014-10-08 15:41 codestyle 阅读(284) 评论(0) 推荐(0)

切换view的动画
摘要:代码:#import "MainViewController.h"@interface MainViewController ()@end@implementation MainViewController- (void)viewDidLoad{ [super viewDidLoad]; ... 阅读全文

posted @ 2014-10-08 10:27 codestyle 阅读(174) 评论(0) 推荐(0)