上一页 1 ··· 8 9 10 11 12 13 14 下一页

2012年11月15日

respond_to 和 respond_with

摘要: 转自:http://caterpillar.onlyfun.net/Gossip/Rails/RespondToWith.htmlrespond_to可以讓你根據客戶端要求的格式進行不同的格式回應,以RESTful 與 Rails中完成的應用程式首頁為例,若想要客戶端在請求http://localhost:3000/bookmarks.html、http://localhost:3000/bookmarks.xml、http://localhost:3000/bookmarks.json時,分別給HTML、XML、JSON格式回應,可以如下修改:bookmarks_controller.rbc 阅读全文

posted @ 2012-11-15 14:42 小浪鼓 阅读(4321) 评论(0) 推荐(1) 编辑

Rails Migration:更改table的行数据类型

摘要: 1 生成migration文件rails g migration change_data_type_for_fieldname2 更改文件内容class ChangeDataTypeForFieldname < ActiveRecord::Migration def change change_column :talbename, :columnname, :type endend参考文档 阅读全文

posted @ 2012-11-15 14:24 小浪鼓 阅读(984) 评论(0) 推荐(0) 编辑

2012年11月12日

带Gesture的UIView上的UIButton如何响应Action

摘要: 如果你的UIView加上了Tap Gesture,同时这个UIView放上一个UIButton那么当你点击这个UIButton的时候,调用的是Gesture的Action,那么如何解决这个问题呢?很简单,就是判断如果Gesture是点击到按钮上的,那么就不响应,那么这时候直接就进入了UIButton的Action.- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Disallow recognition of tap gest.. 阅读全文

posted @ 2012-11-12 22:29 小浪鼓 阅读(1085) 评论(0) 推荐(0) 编辑

/etc/httpd/conf/httpd.conf

摘要: Apache服务器默认配置的一些基本信息: 转自配置文件:/etc/httpd/conf/http.conf1)"/etc/httpd/conf主要存放了配置文件httpd.conf,这个是最重要的配置文件,Apache的所有主要权限和功能都在这个文件中进行了详细的设置。(2) "/etc/httpd/conf.d"里面存放的是一些额外的参数档,比如php.conf,或者一些自己设定的额外参数等信息。这个目录最大的好处就是可以自己设定自己的参数信息,比如我可以自己建立一个dl.conf,里面配置好相关参数,那么当apache启动的时候,这个文件会自动被读入到主要配 阅读全文

posted @ 2012-11-12 21:14 小浪鼓 阅读(13404) 评论(0) 推荐(1) 编辑

重启nginx

摘要: # /usr/local/nginx/sbin/nginx -s reload 阅读全文

posted @ 2012-11-12 00:45 小浪鼓 阅读(144) 评论(0) 推荐(0) 编辑

2012年11月11日

Linux Apache服务器相关的重要目录

摘要: 与Apache服务器相关的重要目录和文件如下:/etc/httpd/是Apache服务器的根目录/etc/httpd/conf/httpd.conf是Apache服务器的主配置文件/var/www/html/是Apache服务器的文档根目录/etc/init.d/httpd是Apache服务器启动脚本文件/var/log/httpd/access_log是Apache服务器的访问日志文件/var/log/httpd/error_log是Apache服务器的错误日志文件Bin目录中包括了Apache服务器运行和管理所需的执行程序,其中httpd是服务器的执行程序,apachectl是服务器的启动 阅读全文

posted @ 2012-11-11 20:55 小浪鼓 阅读(325) 评论(0) 推荐(0) 编辑

2012年11月10日

unicorn 无缝重启,pids目录是空的问题

摘要: 使用capistrano+unicorn布署Rails网站的时候,进行到最后一步,发现/tmp/pids/下面本应该是unicorn.pid 文件的结果是空的,就会导致cap deploy的时候不能完成,/tmp/pids/unicorn.pid: No such file or directory想了想这是第一次,所以要在服务器短启动unicorn。unicorn_rails -c config/unicorn.rb -D解决了问题。参考 阅读全文

posted @ 2012-11-10 03:04 小浪鼓 阅读(354) 评论(0) 推荐(0) 编辑

2012年11月8日

git rm 之后的文件如何还原

摘要: 使用git stash.1. 假定项目中有一个文件删除之git rm README.rdoc2. 执行git status显示:Saved working directory and index state WIP on master: bfcdf14 test gitHEAD is now at bfcdf14 test git3. 使用git stash list$ git stash liststash@{0}: WIP on master: bfcdf14 test git4. 拿出来使用git stash popgit stash pop 阅读全文

posted @ 2012-11-08 15:09 小浪鼓 阅读(9098) 评论(1) 推荐(0) 编辑

2012年11月3日

app/assets, lib/assets 和 vendor/assets

摘要: Pipeline assets 可以被放置到一个应用程序中这三个位置中的一个:app/assets,lib/assets或者vendor/assets.app/assets放置属于应用程序的资源,比如自选图像,JavaScript 文件和样式文件。lib/assets用于不在应用程序范围内的自有函式库,或者那些跨应用程序共通的函式。vendor/assets用于属于外部实体的资源,比如 JavaScript 插件和CSS框架的代码。 阅读全文

posted @ 2012-11-03 16:14 小浪鼓 阅读(841) 评论(0) 推荐(0) 编辑

2012年11月1日

cattr_accessor 和 attr_accessor 区别

摘要: cattr_accessor是 Ruby on Rails ActiveSupport一部分,不像attr_accessorn是Ruby的语言特色.cattr_accessor 是类级别上的attr_accessor,属于singleton方法。class Counter cattr_accessor :class_count attr_accessor :instance_countend counter1 = Counter.newcounter1.instance_count = 1counter1.class_count = 1 counter2 = Counter.newp co.. 阅读全文

posted @ 2012-11-01 15:46 小浪鼓 阅读(404) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12 13 14 下一页

导航