07 2013 档案

Ruby require, load include 区别
摘要:Require, load用于文件, *.rbrequire一般用于加载库文件,load加在配置文件,ruquire可省略“.rb",它指挥在第一次时候载入,如在字require就被忽略load加载多次include 用于包含一个文件中的模块require 'webrick' include WEBrick # 可以不用 server = WEBrick::HTTPServer.new(...) server = HTTPServer.new(...) 当你修改一段代码,不用重启服务器,你的代码被reload,这就是load的作用。如果使用require的话多次req 阅读全文

posted @ 2013-07-30 11:12 小浪鼓 阅读(486) 评论(0) 推荐(0)

使用zsh 替换 bash
摘要:摘自:http://macshuo.com/?p=676#wechat_redirectShell是Linux/Unix的一个外壳,你理解成衣服也行。它负责外界与Linux内核的交互,接收用户或其他应用程序的命令,然后把这些命令转化成内核能理解的语言,传给内核,内核是真正干活的,干完之后再把结果返回用户或应用程序。Linux/Unix提供了很多种Shell,常用的Shell有这么几种,sh、bash、csh等,想知道你的系统有几种shell,可以通过以下命令查看:cat /etc/shells 显示如下:/bin/bash/bin/csh/bin/ksh/bin/sh/bin/tcsh/bin 阅读全文

posted @ 2013-07-29 16:45 小浪鼓 阅读(21287) 评论(2) 推荐(0)

Unix/Linux 查看文件大小
摘要:ls -l help.html-rw-r--r-- 1 william wheel 40960 Jul 18 00:59 development.sqlite340960 就是文件的大小。du -h development.sqlite3 40K development.sqlite3这个更明了du -ch *.sqlite3 40K development.sqlite3 0B test.sqlite3 40K totaldu -sh 查看当前文件夹大小du -sh * | sort -n 统计当前文件夹(目录)大小,并按文件大小排序附送:du -sk filename 查看指定文件大小 阅读全文

posted @ 2013-07-28 13:12 小浪鼓 阅读(11631) 评论(0) 推荐(0)

Pry的安装
摘要:Pry 用于rails应用的调试在Gemfile中添加gem 'pry', :group =>:developmentbundle install即可。pry代替irb方法,直接运行:prypry代替rails console方法,运行:pry -r ./config/environment.rb调试rails方法:直接在要调试的地方添加”binding.pry”,”rails server”当运行到这行代码时会自动调出一个pry终端,可以在这里进行交互。退出调试用”exit-all”。如:参考 阅读全文

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

为Gem 添加环境设定
摘要:如果在测试环境中gem "rspec", :group => :test 当多个gem的时候group :test do gem "webrat" get "rspec" end 如果我们现在运行bundle install它将会为所有环境装上其所指定的gem。如果安装除了某一环境之外指定的gem之外的所有gem,可以使用--without选项。例如,除了test环境特定的gem都安装我们可以这么做:bundle install --without=test参考 阅读全文

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

gem install 和 bundle 区别
摘要:bundle install在设置了所有包含在Gemfile中的东西。你也可以传递参数。如果在production模式下,你很清晰的区分了每个app需要的gems。gem install则安装在整个环境中了。本质上讲他们是没有区别的。 阅读全文

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

改变presentModalView大小
摘要:rc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; rc.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:rc animated:YES]; rc.view.superview.frame = CGRectMake(0, 0, 200, 200); 阅读全文

posted @ 2013-07-19 13:09 小浪鼓 阅读(288) 评论(0) 推荐(0)

no such file to load -- bundler/setup
摘要:bundle installrake routesrake aborted!no such file to load -- bundler/setup解决gem install bundler 阅读全文

posted @ 2013-07-17 00:50 小浪鼓 阅读(2694) 评论(0) 推荐(0)

ruby 升级1.8.7到1.9.3
摘要:rvm install ruby 1.9.3 ruby -v如果还是1.8.7.rvm use 1.9.3列出所有版本rvm list设置默认的版本 rvm --default use x.x.x 阅读全文

posted @ 2013-07-16 15:40 小浪鼓 阅读(4297) 评论(2) 推荐(0)

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statemen
摘要:mysql 配置文件目录:/etc/my.cnfroot 密码为空的时候配置文件中下面这句:skip-grant-tablesGRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION;执行这句时候错误:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statementmysql> GRANT ALL PRIVILEGES O 阅读全文

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

Mac OS 安装phpMyAdmin
摘要:http://www.coolestguyplanettech.com/installing-phpmyadmin-on-mac-osx-10-7-lion/ 阅读全文

posted @ 2013-07-15 00:54 小浪鼓 阅读(1157) 评论(0) 推荐(0)

vi 撤销操作
摘要:'u' : 撤销上一个编辑操作'ctrl + r' : 恢复,即回退前一个命令'U' : 行撤销,撤销所有在前一个编辑行上的操作 阅读全文

posted @ 2013-07-13 12:03 小浪鼓 阅读(757) 评论(0) 推荐(0)

Rails 添加新的运行环境
摘要:Rails自带了development、test和production三个environments 我们可以添加Stagingdatabase.ymlstaging: adapter: mysql database: store_staging user: root password: host: localhost 添加enviromnets/staging.rb# ... config.log_level = :debug # ... 创建数据库mysqladmin create store_staging -u root -p rake db:m... 阅读全文

posted @ 2013-07-08 14:51 小浪鼓 阅读(342) 评论(0) 推荐(0)

Sass::SyntaxError related to active_admin/mixins
摘要:in active_admin.css.sass, change:@import "active_admin/mixins";@import "active_admin/base";to@import "active_admin/mixins.css";@import "active_admin/base.css"; 阅读全文

posted @ 2013-07-02 23:25 小浪鼓 阅读(237) 评论(0) 推荐(0)

host.conf 文件
摘要:/etc/host.conf文件的作用是设置名称解析时的先后顺序/etc/hosts文件是在使用host解析时,手动的添加的主机记录/etc/relov.conf文件中设置DNS服务器名称以及缺省的域名等在named.conf中设置一个master区域,在/var/named中设置这个区域文件,添加SOA、A记录等信息。 阅读全文

posted @ 2013-07-02 13:36 小浪鼓 阅读(595) 评论(0) 推荐(0)

nginx 重启命令
摘要:sudo /etc/init.d/nginx Usage:/etc/init.d/nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest} 阅读全文

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

导航