- 博客(109)
- 收藏
- 关注
原创 用 tsocks 完美解决 bundle 慢的问题
sudo apt-get install tsocks gstm vi /etc/tsocks.conf local = 127.0.0.1/255.255.255.255 # Set the IP of your SSH server server = 127.0.0.1 server_type = 5 server_port = 1234 sudo ssh -qTf...
2011-10-12 16:02:24
433
原创 安装 Ruby Enterprise Edition 出罕见错误
[code="java"]make[1]: Entering directory `/tmp/ruby-enterprise-1.8.7-2011.03/source/ ext/gdbm' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/tmp/ruby-enterprise-1.8.7-2011.03/...
2011-05-30 10:09:20
393
自制小工具 一键贴图
# 鼠标右单击即可上传图片 # 地址要短 # 要直接到剪贴板 [code="ruby"] require 'rubygems' require "win32/clipboard" include Win32 $filename = ARGV[0] TYPES = %w{.jpg .gif .png .jpeg} def upload_file(file) ...
2010-07-07 21:23:57
541
原创 Rails 在搜索表单中用 OpenStruct
# in controller require 'ostruct' def index @search = OpenStruct.new(params[:search]) end # in view {:action => "index"}, :html => {:method => :get} do |f| %> 简单, 喜欢...
2010-02-01 22:02:02
290
vim 去掉自动注释和自动回车
经常 putty 到 服务器的 vim 粘贴一段小代码进去如 [code="ruby"] # aaa # bb class Book # zzz end [/code] 结果成了这样 [code="ruby"]# aaa # # bb # class Book # # zzz # end # #[/code] 原因是开启了自动注释和自...
2009-08-13 09:59:56
670
rails snippet on vim
rails snippet on vim 1. install snipMate http://www.vim.org/scripts/script.php?script_id=2540 2. install rails.snippet http://github.com/scrooloose/snipmate-snippets/tree/master 感谢,几位辛苦...
2009-06-13 13:36:54
245
让 chrome 支持 google bookmarks
1 任意将一个连接拖到 chrome 的 toolbar 上 2 右单击 修改, 将网址改为 [code="javascript"] javascript:void(function(){var d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,s=s1?s1()...
2009-04-24 13:24:58
432
vim 插件推荐 dbext.vim
地址: http://www.vim.org/scripts/script.php?script_id=356 安装后 运行 [code="java"] :DBSetOption user=tiger:passwd=scott:dbname=xxx_db :Select id,login from users [/code] 在vim 的新窗口中就会出现 [cod...
2008-12-29 13:07:48
630
1
用Ruby 来调用 mssql(sqlserver) 的 ntext 等 unicode 类型
访问数量库时用 [code="ruby"] DBI.connect(ODBC_NAME,ODBC_USER, ODBC_PWD) do |db| db.do('set textsize 9999') # 如果没有这句会抛错 db.select_all("select * from end [/code] unicode -> utf8 or gb2312 [...
2008-12-22 11:52:47
250
chrome 文件上传问题会出现 content_type 为空的问题
前两天 我们的 Rails 项目 中错误日志中显示, 附件有问题。 反复测试发是 Chrome 搞得鬼, 如果你上传 zip chrome 居然让你的附件的 content_type 为空 ?? 毕竟是beta版...
2008-12-14 23:10:15
818
Google App Engine Hello World
1 先注册 http://code.google.com/appengine/ 注意输入手机号码时格式为 +86137xxxxxxxx 一个Google 帐号只能发几次, 如果你的号码发送不了, 试着重新注册一个Google 帐号, 我就是这样解决的 另外有些人说只能支持联通, 我的是移动,可以支持 2 安装 python2.5 :http://www.py...
2008-11-20 00:21:34
317
007大破量子危机 有点失望
今天跟老婆一起去看了这部电影 觉得不值电影票钱 除了“普京邦德”的动作一样刺激外 剧情, 惊险, 性感的邦女郎, 都没有
2008-11-11 23:19:02
1021
忽然发现Google拼音输入法还有个好处 中文分词
中文分词 对搜索引擎来说是个大麻烦, Google有了拼音输入法后, 就能及时收集到又新双全的中文词库, 李彦宏 也应搞个输入法才行
2008-10-31 22:17:13
485
原创 openssl-blacklist 装不起来
预装的apt库 改为中文后就会少这个包 [code="java"]sudo vi /etc/apt/sources.list [/code] add [code="java"]deb http://security.ubuntu.com/ubuntu gutsy-security main [/code] [code="java"]sudo apt-get update[...
2008-09-26 00:55:09
334
原创 svn: warning: cannot set LC_CTYPE locale
[code="java"] [root@server local]# svn svn: warning: cannot set LC_CTYPE locale svn: warning: environment variable LANG is en_US.UTF-8 svn: warning: please check that your locale name is correct ...
2008-09-25 10:28:37
579
原创 perl: warning: Falling back to the standard locale
使用 apt-get 时出现提示 [code="java"] perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "zh_CN.UTF-8" are supp...
2008-09-24 17:12:29
728
原创 Ubuntu 装不完的 localedef
因为缺乏耐心 我强制中止了系统升级. 结果出问题了 每次 apt-get 都提示 "E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem." 我按提示 dpkg --configure -a 结果是永远的等待 google 了一天才找到...
2008-09-24 17:09:49
356
Phusion Passenger 布署后没有日志 production.log 空白
看 http://www.modrails.com/documentation/Users guide.html 6.3.7. My Rails application's log file is not being written to 就是文件的拥有者不能是 root [code="java"]sudo useradd testuser sudo chown tes...
2008-09-20 12:41:14
300
原创 搞笑 段子 什么是: 自恋 无语 绝望
中午笑了很久 1、“幸福”就是猫吃鱼,狗吃肉,奥特曼打小怪兽 2、“代沟”就是我问老爸觉得“菊花台”怎么样,他说没喝过 3、“自恋”就是下辈子我一定要投胎做女人,然后嫁个象我这样的男人 4、“无语”就是法官问:你为什么印假钞?罪犯说:真钞我不会印。 5、“绝望”就是饭馆点了两菜,吃第一个:“世上还有比这更难吃的吗?!”吃第二个“靠!还真有! ...
2008-09-03 12:54:09
397
驱动 EPSON TM-U220PDmodel m188d ATM 301gSC 下载
这个驱动实太难找, 下载也非常麻烦. 为了不让别人再做重复的事, 我加了链接 http://sites.google.com/site/alvin2ye/Home/EPSONTM-U220PDmodelm188d_ATM_301gSC.exe_?attredirects=0 请把 exe_ 改为 exe...
2008-09-03 08:07:44
1833
今天终于忍不住 把项目从 Rails2.0 升级到 Rails2.1
更新完 vendor/rails 更新完 一大堆的插件(这里最麻烦) 本地测试过后,上传到服务器.时却遇到又有麻烦 1. gem 要升级到 1.2 2. 运行 mongrel 时提示 mongrel 找不到?? 奇怪我只是升级 gem 怎么 mongrel 没了 3. 重装吧 gem install mongrel 4. rake 也和 mongrel 一样 重装 gem ...
2008-08-20 17:43:49
183
2008年8月8日 我和老婆的结婚照上报了
[img]http://www.iteye.com/upload/picture/pic/19769/50090eed-4306-3c9c-a06c-c2627f008575.jpg?1218556685[/img] 2008年8月8日 领结婚照 :D 好彩头 留下纪念 可惜拍得不好. 温州晚报 第二版 在此多谢我的同学们 ...
2008-08-12 23:59:55
184
uninitialized constant Gem::GemRunner (NameError)
vi /usr/bin/gem 在 require 'rubygems' 后面加上 require 'rubygems/gem_runner'
2008-07-29 09:30:03
926
ruby 又一BUG 折磨了我很久 请大家注意了
[code="ruby"] irb(main):001:0> "%.0f" % 144.5 => "145" irb(main):002:0> exit E:\Projects\test>ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] [/code] [code] irb(main):001...
2008-06-12 08:48:46
299
Winxp 网卡自动禁用 只有重启才能启用
朋友的 Dell 1400 出现网卡自动禁用 只有重启才能启用 网上搜到解决方案, 计下 设备管理器 右键选中网卡,属性,电源管理 将“允许计算机关闭此设备以节省电源”去除勾选,然后确定 ...
2008-06-03 10:29:27
1066
rails 的测试的 bug 当你的 model 的 after_create 中有raise 时
app/models/part.rb [code="ruby"] class Part < ActiveRecord::Base def after_create raise "no way" if self.name == "test" end end [/code] app/controllers/parts_controller.rb [code...
2008-05-01 16:39:19
255
奇怪的错误 already initialized constant OPTIONS 及解决方案
agideo@ats1:~/apps/app_name$ ruby script/server -e production => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d ...
2008-03-13 23:41:15
1387
小心石头之 Ruby 是指针还是实例
[code="java"] x = "abc" y = x x = "xyz" puts y # abc xx = "abc" yy = xx xx.gsub!(/c/, 'a') puts yy # aba [/code]
2008-01-19 09:39:43
327
Rails ajax 的联动的下拉框
# app\controllers\examples_controller.rb ruby 代码 class ExamplesController < ApplicationController def ajax_select @items = %w{AA BB} end ...
2007-11-28 16:59:25
269
小心石头 之 lose a fixtures (彻底解决)
1. 经常出现是的本机的 rake test 正常 但是 CC上却是错的, 花了N个小时后发现是 少了一个fixtures 原因是 本机与CC 服务器加载CC的顺序不一样. 随手写一个rake 来解决这个问题 ruby 代码 namespace :test do task :each_file do test_f...
2007-11-05 13:11:08
389
rails 在ubuntu 与 winxp 上的速度比较 (rake test)
在其它文章中看到 用rails ubuntu 性能最好 目前的项目 rake test 的速度让人受不了 就在自己家的电脑上小试了一把. 环境 CPU 赛扬 2.0 内存 512M 硬盘1 Ubuntu 7.04 (已经升级过了 到 7.10) Rails 1.2.2 mysql Ver 14.12 Distrib 5.0.38, for pc-linux-gnu (i486) usi...
2007-10-25 09:25:07
235
隐藏运行一个bat
新建一个 *.vbs 文件将以下两句复制进去 Set shell = Wscript.createobject("wscript.shell") a = shell.run ("c:\windows\msdot\auto.bat",0) OK了 另外 1、#隐藏窗口; 2、#普通激活; 3、#最小化激活; 4、#最大化激活; 5、#普通不激活; 6、#最小化不激活。如果省略本参数,默认为...
2007-07-30 17:04:00
322
读 Agile Web Development with Rails Second Edition 读书笔记 (四)
单元测试中 product.errors.invalid? 的用法 p 181 # product.rb validates_presence_of :title def test_invalid_with_empty+attributes product = Product.new assert !product.valid? assert product.errors.inval...
2007-07-30 12:36:39
209
读 Agile Web Development with Rails Second Edition 读书笔记 (三)
1.类级的变量 及 form.select 中 prompt 的作用 及 validates_inclusion_of 的用法 p 137 ruby 代码 form.select :pay_type, Order::PAYMENT_TYPES, :prompt => "select a payment method" class Order <...
2007-07-30 12:10:23
209
读 Agile Web Development with Rails Second Edition 读书笔记 (二)
1. button_to 在客户端生成表单 用于POST 提交 用法同 link_to p 92 [code]button_to "Add to Cart", :action => add_to_cart %>[/code] 2. 把session存进数据库 p 97 1) rake db:sessions:create 2) rake db:migrate 3) [code...
2007-07-19 13:51:26
209
读 Agile Web Development with Rails Second Edition 读书笔记 (一)
1.针对 decimal 字段的 Migration p71 [code]add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0[/code] 2.很开的字符串可以用 %{..} 这样的符号 p 80 [code]%{ This book.. get you up....
2007-07-19 09:17:30
228
Time in Text Field
http://railscasts.com/episodes/32 <!-- tasks/_form.rhtml --><%= f.text_field :due_at %> # models/task.rbdef due_at_string due_at.to_s(:db)enddef due_at_string=(due_at_str) self.d...
2007-07-16 11:27:02
246
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅