• Ruby 2.1下的define_method的方法不再是public 2014-03-14

    最近项目打算从1.9.3升级到2.1.1, 目前线上同时跑着1.9.3和2.1.1,但是发现define_method在2.1.1下面生成的方法不再是public,而是根据上下文来判断.比如以下代码:class A private define_method :foo do puts 'foo from A' end end class B ... 查看更多
  • Rails中HTTP Status Codes匹配规则[转发] 2014-03-11

    HTTP status codes and their respective Rails symbol representations. For example, :not_found can be used instead of 404 in a render call:render :file => '404.html.erb', :status => :not_found1xx Informational:... 查看更多
  • Rails4下启动Guard + Spork报错ERROR - Guard::Spork failed to achieve its start 2013-09-13

    Rails4下启动Guard + Spork时候会报错        ERROR - Guard::Spork failed to achieve its <start>, exception was: NoMethodError: private method `raise' called for nil:NilClass临时解决办法:gem 'spork-rails', github:... 查看更多
  • jquery-rails 升级到3.0报错 couldn't find file 'jquery-ui' 2013-05-31

    jquery-rails 升级到3.0报错 couldn't find file 'jquery-ui'For jQuery UI, we recommend the jquery-ui-rails gem, as it includes the jquery-ui css and allows easier customization.As of v3.0, jquery-rails no longer inclu... 查看更多
  • 编写 Objective-C 代码 2013-02-07

    编写 Objective-C 代码如果您没有为 iOS 或 Mac OS X 编过程序,那就需要开始了解主要的程序设计语言 Objective-C。Objective-C 并不是一种很难的语言,如果您花一点时间学习,相信会慢慢领会到它的优雅之处。Objective-C 程序设计语言使您能进行复杂的、面向对象的编程。通过提供用于定义类和方法的语法,它扩展了标准的 ANSI C 程序设计语言。它还促进类和接口(任何类可采用)的动态扩展。如果您熟... 查看更多
  • github抽风解决办法 2013-01-22

    最近github总抽风,搞的不敢发布了,很多好友也问如何解决,其实很简单在本地hosts中 指定 github.com到207.97.227.239即可207.97.227.239 github.com 查看更多
  • Ubuntu11.04下Multi-User安装RVM环境变量无效 2012-11-04

    最近在Ubuntu11.04下Multi-User安装RVM, 发现登录后环境变量无效,必须手动执行source /etc/profile才生效.其实问题是 /etc/profile 中只能执行non-interactive shell, 而/etc/profile.d/rvm.sh 中使用了functions 和 aliases, 于是即使执行了,也没有生效.直接上代码:echo '[[ -s "/etc/profile.d/rvm.sh... 查看更多
  • git新建本地分支自动与远程分支关联 2012-10-09

    今天经过老大的指点,终于一解困惑我多年的这个问题:使用git时候,本地新建分支, push到remote上去后,再次pull下来,会报以下提示:You asked me to pull without telling me which branch you want to merge with, and 'branch.production.merge' in your configuration file does not tell me... 查看更多
  • 设置(更改)Mysql 自增ID的起始值 2012-10-09

    许多时候希望table中数据的id不要从1开始,像qq, id从10000开始代码如下:alter table users AUTO_INCREMENT=10000;而且该语句也适用于修改现有表的id上, 比如大批量删除数据后,想id从654321退回123456开始alter table users AUTO_INCREMENT=123456;但是经过实际测试, 单机的Mysql没有问题, Mysql Cluster下是无效的,可能在主键... 查看更多
  • iptables启动脚本 2012-10-08

    iptables 启动脚本#!/bin/bash case "$1" in start) #Policy iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT #Rules iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT iptab... 查看更多