01 2013 档案

facebook api: faUnsupported get request 错误
摘要:这样的链接:http://graph.facebook.com/coorslight不工作,但是http://graph.facebook.com/cocacola确可以,为什么呢?因为facebook设置了年龄,前面的需要17岁以上(喝酒问题)解决:http://graph.facebook.com/coorslight?access_token=xxxxxx 阅读全文

posted @ 2013-01-15 13:42 小浪鼓 阅读(319) 评论(0) 推荐(0)

改变rails的路由中默认的id
摘要:目的: /users/2 -> /users/jack使用to_param方法。不要改变id到string类型,你需要一个属性是唯一的,比如username,无论什么。在view里面,确保传递的参数不要是id 一定要是model<td><%= link_to p.name, parse_place_path(p) %></td>不是<td><%= link_to p.name, parse_place_path(p.id) %></td>在model里面,重新 to_paramdef to_param usernam 阅读全文

posted @ 2013-01-14 16:38 小浪鼓 阅读(1105) 评论(0) 推荐(0)

自定义 UITableViewCell
摘要:自定义Cell当然很简单,subclass UITableViewCell,分2种,一种自己定义Nib文件,一种不使用Nib文件:当然依照个人选择,我喜欢少写代码,使用Nib文件。1. 添加文件继承自 UITableViewCell。2. 使用Nib文件。添加User Interface -> View 文件,IB拖拽一个TableViewCell控件(删除原来的View)。3. 对自定义的Cell进行自定义,当然像你设计的那样的设计。4. 这里我主要说在 UITableView的delegate方法中的使用1)不使用nib文件,当然很简单了- (UITableViewCell *)ta 阅读全文

posted @ 2013-01-11 00:05 小浪鼓 阅读(413) 评论(0) 推荐(0)

Rail 路由设置
摘要:在routes.rb文件中,共列举了5种主要路由,分别为默认路由(Default Routes)、资源路由(RESTful Routes)、命名路由(Named Routes)、嵌套路由(Nested Routes)、正则路由(Regular Routes)。1、默认路由 Default Routes顾名思义,默认路由是创建应用时,Rails自动生成的,位于routes.rb文件的最后一行。1match':controller(/:action(/:id(.:format)))'默认路由由’/'分割为3部分,第一部分解释为控制器,第二部分解释为Action方法,第三部分 阅读全文

posted @ 2013-01-08 14:46 小浪鼓 阅读(269) 评论(0) 推荐(0)

今天Rails都学到了啥
摘要:打算学习rails已经好久了,这两天才认真的开始写代码,结果,哎不写不知道,一写还真有问题,不过幸好都解决了。总结下今天学到的内容:1 Rails的数组真是强大compact 这个函数压缩数组,去除数组的nil;2 join(",") 将字符串连接3 更新modelupdate_attributes 这个方法不用必须更新model的所有属性。form_for 很强大,这个是更新model必须用的。如果不更新model就用 form_tag而form_for 在 EDIT 方法中或者在NEW方法中 当<%= f.submit %>之后,会自动的路由到update 阅读全文

posted @ 2013-01-08 01:23 小浪鼓 阅读(213) 评论(0) 推荐(0)

Ruby: case 语句的使用
摘要:case n when 0 then puts 'Nothing' when 2, 7, 10 then puts 'Other Numbers' else puts 'There is nothing here'endcase name when "Jason" then puts "Hello Jason you are a valued customer, welcome back." when "Peter" then puts "Hello Peter very ni 阅读全文

posted @ 2013-01-07 23:15 小浪鼓 阅读(3586) 评论(0) 推荐(0)

UISearchDisplayController animate Cancel button
摘要:FUCK, SHIT, etc. 一系列脏话,日了等。为啥,因为烦的要命。主要是碰到了一个问题,我要在UIsearchBar的左边加一个按钮,这样UISearchBar的width就变小窄了。但是每次点击Cancel的时候,UISearBar又填充了整个视图的宽度。如下图:解决方法:-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController*)controller{// animate the search bar to the left ie. x=0[UIView animateWithDuration: 阅读全文

posted @ 2013-01-07 17:01 小浪鼓 阅读(901) 评论(0) 推荐(0)

Unsupported configuration plain style unsupported in a navigation item
摘要:在IB上,如果你在bar button Item上添加了Round Rect Button 可能会出现这个错误,这是需要将 BarbuttonItem设置成:Bordered 阅读全文

posted @ 2013-01-07 13:32 小浪鼓 阅读(2304) 评论(2) 推荐(0)

dyld:Library not loaded
摘要:dyld:Library not loaded:/System/Library/Frameworks/AdSupport.framework/AdSupportReferenced from:/var/mobile/Applications/8E09C9AA-CA81-4C26-AEED-B2C632B60A54/Gridlocked.app/GridlockedReason: image not found这个bug主要是添加了 AdSupport.framework, 添加 Accounts.framework 和 Social.framework 的时候也会出现类似的错误,当然在6.0的 阅读全文

posted @ 2013-01-05 22:55 小浪鼓 阅读(2001) 评论(0) 推荐(0)

Rail 路由设置
摘要:在routes.rb文件中,共列举了5种主要路由,分别为默认路由(Default Routes)、资源路由(RESTful Routes)、命名路由(Named Routes)、嵌套路由(Nested Routes)、正则路由(Regular Routes)。1、默认路由 Default Routes顾名思义,默认路由是创建应用时,Rails自动生成的,位于routes.rb文件的最后一行。1match':controller(/:action(/:id(.:format)))'默认路由由’/'分割为3部分,第一部分解释为控制器,第二部分解释为Action方法,第三部分 阅读全文

posted @ 2013-01-04 13:37 小浪鼓 阅读(486) 评论(0) 推荐(0)

Rails 基本路由
摘要:转自:http://caterpillar.onlyfun.net/Gossip/Rails/Routing.htmlconfig/routes.rb中的設定,決定了請求會由哪個控制器的動作處理,這邊要先來介紹Rails中典型路由(Regular route)與命令路由(Named route)設定的方式(注意,routes.rb中越前頭的設定會先套用)。你可以設定整個應用程式的首頁,例如若想要在連結http://localhost:3000時,等同於連結http://localhost:3000/messages/index,可以如下:root :to => 'messages 阅读全文

posted @ 2013-01-04 00:16 小浪鼓 阅读(418) 评论(0) 推荐(0)

转:IOS 关键字self,super,copy, retain, assign , readonly , readwrite, nonatomic、@synthesize、@property、@dyna
摘要:#synthesize关键字: 根据@property设置,自动生成成员变量相应的存取方法,从而可以使用点操作符来方便的存取该成员变量 。@implementation 关键字,表明类的实现 @end 结束self 关键字 :类似于java中的this,是隐藏参数,指向当前调用方法的类。super 关键字 :调用父类的方法。self = [super init] 这里不是判断self与[super init]是否相等,而是判断是否可以成功初始化。[super init]:父类初始化成功的话,通过=给self,这样self成为一个非空对象,整个来说即非false(非NO)。#import 告诉预 阅读全文

posted @ 2013-01-03 21:02 小浪鼓 阅读(172) 评论(0) 推荐(0)

导航