`
文章列表
    写下这个题目,我就想起了先贤孔乙己老人。本来的题目就想写Rails的错误提示有几种,其实,这是个看起来很简单的题目,就像回字的写法一样。      首先,错误提示根据来源不同应该分Flash 和 error_message.      众所周知,flash应该是来源于controller,这个设计灵感来源是flash ram闪存,快速和暂时存储。稍微准确的定义是,保存信息直到下一次redirect。那么,这就会遇到问题,如果,我们没有redirect,而是render到另一个页面,那么flash提示就会一直存在。其实,Rails为flash准备以下备用选择:      简单讲就是 ...
   当我们有一个datetime类型的字段希望,能够按照时间段分组,显示统计信息,那么,下面的mysql语句将会用到:    首先,我们有如下表结构 mysql> show columns from alarms; 执行语句如下: select count(*) , floor(event_time/1500)*1500 ...
update(09/10/2012): ruby 1.9.3核心代码了 excel = WIN32OLE.new('Excel.Application') book = excel.workbooks.add sheets = book.worksheets(1) cells = sheets.cells("A1:A5") cells.each do |cell| cell.value = 10 end require 'win32ole' excel = WIN32OLE.new('Excel.Application') exc ...
Update (2011-11-29): 各位看官请注意,Win下的解决方案,instantRails已经不是首选,换Railsinstaller 感谢EngineYard 技术支持,winror一个强大支持 没有Devkit在win下安装gem会别扭死 当前支持如下: Ruby 1.9.2-p290 Rails 3.1.1 Bun ...
update:(2012/10/6) 看到还有开发人员读到这篇,起到了一些作用,并且回复了,实在是感动。一转眼,3年多过去了。想想写这篇的时候,已经今非昔比,感慨啊。不废话了,回来说rails调试 当前的情况是,Ruby1.9.3-194p Rails3.2.8 流行的调试工具gem是debugger 这个debugger更新的目的是,解决ruby1.9后的更新问题,兼容debugger和rvm的问题 未来的趋势的pry rails部分用pry-nav gem 'pry' gem 'pry-remote' gem 'pry-nav' 基本上的使用非常简单,所有的alias都在, ...
brew services restart memcached
需要先搞明白rebase 然后,进这个界面 pick b76d157 b pick a931ac7 c # Rebase df23917..a931ac7 onto df23917 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit ...
rvm ruby-1.9.3-p429 do rvm gemset create union
最近写了个github帐户登录Demo: https://github.com/yankforce/devise_omniauth_github 演示项目地址: http://devise-github.herokuapp.com BASIC版本,只是github omniauth,可以参考这个 https://github.com/bay6/omniauth-github-example demo: http://github-ominiauth.herokuapp.com 主要遇到问题: No route matches “/users/sign_out” devise ra ...
总之,profile不只是bash,在启动加载 bashrc是bash在,起bash session加载 .bashrc is for Bash only, while .profile is used by other shells as well. Another important difference is that .profile is used at the time when you log in, be it on a terminal, or into your desktop. So settings in there will apply always whe ...
sudo aptitude install build-essential bison openssl libreadline5 libreadline5-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclient-dev libqt4-dev libpq-dev build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1 ...
git://github.com/sickill/racksh.git 也是用来做同样的事。 只是可以模拟http请求 # make GET request $rack.get uri, params, env # make POST request $rack.post uri, params, env # make PUT request $rack.put uri, params, env # make DELETE request $rack.delete uri, params, env 写sinatra的时候想找类似 rails consol ...

git revert merge commit

    博客分类:
  • git
0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3 df1acf5f54426d30f12c6b4558c3dd922297aae3 e19b912404ffd3c153ccac3072dbf22396896d2a #要revert的commit是merge git revert -m 2 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3 如何在commit里,search代码 git log -p | grep <pattern> git grep <regexp> $ ...
Problem: An XML parser returns the error “xmlParseEntityRef: no name” Cause: There is a stray ‘&’ (ampersand character) somewhere in the XML text eg. some text & some more text Solution: Solution 1: Remove the ampersand. Solution 2: Encode the ampersand (that is replace the ‘&’ characte ...
1.9.2p320 :001 > require 'htmlentities' 1.9.2p320 :002 > c = HTMLEntities.new #=> #<HTMLEntities:0x007fef0a5b0468 @flavor="xhtml1"> 1.9.2p320 :003 > c.decode "&gt;" #=> ">" 1.9.2p320 :004 > require 'cgi' # => false 1.9.2p320 : ...
Global site tag (gtag.js) - Google Analytics