- 博客(10)
- 收藏
- 关注
go匿名字段不能序列化的问题
1.type Base struct {Id int `PK`CreatedAt time.TimeUpdatedAt time.TimeSyncedAt time.Time} 2.type Note struct {BaseTitle stringBody string} 3.var note models.N...
2013-04-06 18:38:17
393
ruby GB2312 URL encode
class String def utf8_to_gb2312 encode_convert(self, "gb2312", "UTF-8") end private def encode_convert(s, to, from) require 'iconv' begin converter = Iconv.new(...
2011-03-01 22:34:55
182
gem install google-appengine也被和谐了咩?
装其他gem没问题,装google-appengine就有问题了。HoLin:webcurl holin$ gem install thinBuilding native extensions. This could take a while...Successfully installed thin-1.2.71 gem installedInstalling ri ...
2010-12-31 10:48:17
167
原创 指向127.0.0.1的泛域名
在做二级域名支持的项目的时候,需要配置多个域名都指向127.0.0.1,而且二级域名是动态增加的。 在改/etc/hosts的时候就会有这样的需求:127.0.0.1 *.domain.com 不幸的是/etc/hosts并不支持这样的配置。所以好心人就提供了泛域名解析到127.0.0.1。这样的域名有: lvh.me smackaho.st ...
2010-11-29 23:34:44
714
原创 使用gotofile.tmbundle替代Textmate默认GoTo File功能
Textmate的goto file功能是我最喜欢的功能,打开想要的文件那叫一个快,支持模糊匹配。比如要打开tasks_controller.rb文件,我一般输入taskcon就能找到。但还是有爽的地方,那就是不能指定路径查找,在碰到一大批文件名一样的文件就不是那么好用了。比如Rails项目中的index.html.erb,基本上是一个controller都要有一个,同名文件之多可想而知。...
2010-11-29 23:33:08
253
慎用establish_connection
在一个Rails应用中连接多个数据库,我们常常这么做:class Cookie < ActiveRecord::Base establish_connection :monitor_spider ...end这样,在使用Cookie.find等操作的时候,就会连接到database.yml中monitor_spider配置的数据库上操作。以前...
2010-09-19 20:52:27
376
使用Mechanize发布百度空间博客
官网:http://mechanize.rubyforge.org 登录require 'rubygems'require 'mechanize'require 'logger'# Mechanize.log = Logger.new(STDOUT)agent = Mechanize.new# pp agent.methods.sort.grep(/agent...
2010-08-30 16:16:59
134
Flex/Flash Builder Debugger fails to connect,老是停在57%
在使用Flash Builder 4 Debug的时候,老是停在57%。在网上查了是没有装Flash播放器的debugger版本的原因。看是否是debugger版本的flash player,可以通过这个网站看到:http://flashplayerversion.com/是不是发现了自己的不是Debugger版本??但是,之前已经装过Debugger版本了,我印象很深刻,但为什么现在...
2010-08-25 21:54:44
235
在after_filter中根据paperclip上传的文件做相应处理
Paperclip是很方便的处理上传附件的插件,三下两下就为应用增加上传文件功能。我有个应用场景是在文件上传后,得到文件的行数并保存下来。于是我增加了一个after_filter:after_save :set_item_countattr_accessor :no_after_save_filterdef set_item_countreturn if @no_af...
2010-08-25 10:07:39
106
hpricot_scan.bundle: dlopen no suitable image found. Did find: (LoadError)
原来好好的项目,今天启动的时候提示:/usr/local/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/hpricot_scan.bundle: dlopen(/usr/local/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/hpricot_scan.bundle, 9): no suitable ima...
2010-08-20 10:48:29
364
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人