- 博客(60)
- 收藏
- 关注
git server+continuouse integrity
gem install integrity #安装Integrity gemintegrity install --passenger | --thin Install_PATH #在指点的地点安装integrity程序,passenger及thin是看你的WEB服务器使用哪种然后去Install_PATH中编辑config.yml 主要是看使用何种DBintegrity ...
2009-10-28 15:12:26
185
升级到snow 10.6 ROR的解决
http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard叁照些文章安装,不过特别要注意的是,要重新编译ruby,因为原来的ruby是32位的,如果你mysql改用64位后,需要编译msyql gem为64位,而此gem是用ruby来跑,所以ruby必须要在新的环境下重新编译一次即可。...
2009-10-13 23:25:35
136
mac os snow 10.6下反安装mysql
Open Terminalsudo nano /etc/hostconfigEnter your password if you’re not authed yet.Delete the following line: “MYSQLCOM=-YES-”CTRL+X (This is the command for closing NANO, Enter the “Y” key to...
2009-10-13 22:16:50
125
原创 ruby console plugin
前几天在看 screencasts,发现一好插件:Hirb 。这是个扩展命令行的插件,可以以更加易读的形式展现方法返回的内容(比如以 mysql 输出的形式展现 ActiveRecord 实例) gem install cldwalker-hirb --source http://gems.github.com/# Append the following lines into...
2009-10-12 11:09:49
153
原创 Centos5.3源
CentOS的网络源配置文件是: /etc/yum.repos.d/ 下的 CentOS-Base.repo配置方法一般是: 1.终端下 vi /etc/yum.repos.d/CentOS-Base.repo,删除里面原来的所有内容,然后用下面的相应内容替换。2.把下面相应内容,保存为:CentOS-Base.repo,然后用mv命令,替换旧的“/etc/yum.re...
2009-09-24 19:36:20
147
restful_authentication的site_key问题
好久没来写东西了,最近项目太忙,也懒的写啥。不过今天花了两个小时解决了一个很无聊的问题,记一下。restful_authentication是采用随机生成的site_key来加密密码,我们项目在开发过程中经常采用svn加capistrano来修改加部署,这样的话,每次部署后,为了图省事,我们一般用capistrano自动rake auth:gen:site_key,而此时生成的site_key...
2009-08-17 02:56:57
190
centos+rails+php+lighttpd
php: ./configure \ --enable-fastcgi \ --enable-force-cgi-redirect \ 其他配置信息,待空闲后,稍后补充
2008-12-28 16:13:08
107
capistrano2.5使用
gem install capistrano到项目目录中运行capify .会自动产生 ./Capfile./config/deploy.rb #主配置文件 set :application, "numed_collection"set :repository, "svn://×.×.×.×/numed_collection"set :deploy_to, "/data/w...
2008-12-10 10:48:12
100
ubuntu下rmagick快速安装(备忘)
sudo apt-get install libmagick9-dev ruby1.8-devsudo gem install rmagicksudo apt-get install imagemagicksudo gem install rmagick
2008-12-09 21:54:33
137
关于rails的route的性能
今天跟蛋黄讨论关于route的性能问题,经过跟踪调试发现,具名路由的实现相当简单,并且性能也相当好。在服务器启动时,map.resources会生成相应的路由的对象,比如map.resources :blogs会生成若干个named routes地址的对象比如: edit_blog,对象类型是ActionController::Routing::Route,其中有个to_s...
2008-12-05 12:20:10
175
原创 ubuntu8.10 dpkg备份和恢复安装包列表
1. 执行备份操作:dpkg --get-selections > installed-software.log,这将当前系统中已安装的软件保存到 installed-software.log 中。 2. 在还原时使用 dpkg --set-selections < installed-software.log 导入软件列表,再利用 dselect 工具安装软件。 ...
2008-12-04 15:46:55
517
原创 sphinx在ubuntu8.1下安装与使用
参考 dlee 的 http://www.iteye.com/topic/200065在安装mmseg的过程中出错的解决办法以及自己整理一下在ubuntu8.1下的完整安装与使用 g++更换到4.1版本,python使用2.5编译coreseek通过李沫南还开发了一个支持中文全文检索的Sphinx定制版本——Coreseek,除了支持中文的全文检索外,Coreseek最大的特点是支...
2008-12-03 21:40:52
180
private的一个问题
首先,要明白这几个ruby的原理1、默认(包括你所用的定义方法)在顶层定义的都是private的实例方法2、private方法是不允许指明接收者的,其接收者只能是隐含的selfdef x11puts "in x11"enddef x11=(t) puts tendx11self.x11="ddd"当前定义了两个方法,都是private的,可以puts self.private_methods.s...
2008-07-03 15:34:02
124
rails1.2.3的在rubyforge更新到1.0.0以后产生的问题解决
运行时提示已active0.4.5.不能active1.0.0,那直接删除0.4.5的gem就行了。
2008-06-17 17:38:17
102
Ruby中闭包与block
转道友Blog中的一小段code说明ruby中的闭包procs = [] (1..3).each do |i| procs << lambda { puts i } end procs.each { |p| p.call } # Output: # 1 # 2 # 3 ########################...
2008-06-17 08:01:26
161
截取中文
def trc_utf8(text, length = 40, t_string = "...") l=0 char_array=text.unpack("U*") char_array.each_with_index do |c,i| l = l+ (c<127 ? 0.5 : 1) if l>...
2008-06-13 21:45:26
130
提升mysql性能(转)
TCMalloc(Thread-Caching Malloc)是google开发的开源工具──“google-perftools”中的成员。与标准的glibc库的malloc相比,TCMalloc在内存的分配上效率和速度要高得多,可以在很大程度上提高MySQL服务器在高并发情况下的性能,降低系统负载。 TCMalloc的实现原理和测试报告请见一篇文章:《TCMalloc:线程缓存的Malloc...
2008-06-07 09:15:57
213
用ruby抓取gzip网页
require 'net/http'require 'uri'module Net class HTTP def HTTP.get_with_headers(uri,headers=nil) uri=URI.parse(uri) if uri.respond_to? :to_str start(uri.host,uri.port) do |http| re...
2008-05-26 19:42:41
196
抓取网页时转换字符集出现问题(问题已解决)
用ruby写个网页抓取的小东东,遇到问题:环境:ubuntu8.04+netbeans6.1+ruby1.8.6在ruby中使用Net::HTTP.get_response抓取一个GB2312编码的网页后转换成utf8全是乱码,主要代码部分如下resp=Net::HTTP.get_response(URL,URI)body=resp.body[0,resp.size-1]r=Iconv....
2008-05-26 16:21:33
159
让url更人性化_acts_as_slugable
== Installation<tt>./script/plugin install http://code.dunae.ca/acts_as_slugable</tt>== Usage examplesIn your target table, add a column to hold the URL slug.=== With scope class Page <...
2008-05-26 09:29:11
90
在ror项目中使用paypal
http://www.codyfauser.com/2008/1/17/paypal-express-payments-with-activemerchant
2008-05-21 18:18:41
86
memcached+libmemcached+memcache_client
ubuntu下安装memcached非常简单运行也很简单 ./memcached -d -m 2048 -l 10.0.0.40 -p 11211如果要使用caffeine,请参考http://blog.methodmissing.com/2007/6/4/get-your-caffeine-on/本人是使用的 memcache-clientgem install memcache-c...
2008-05-02 16:33:01
203
acts_as_taggable_on_steroids代替原acts_as_taggable
1、安装ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids2、 class Post < ActiveRecord::Base acts_as_taggable end3、p = Post.find(:...
2008-04-23 09:45:31
128
ferret+acts_as_ferret+RMMSeg全文索引+中文分词的使用
首先,在ubuntu下要安装atp-get install build-essential zlib1g-devruby需要安装dev包1、安装ferretsudo gem install ferret2、安装acts_as_ferret可用gemsudo gem install acts_as_ferret或用pluginssvn://projects.jkraemer.ne...
2008-04-22 13:21:26
213
rails测试驱动开发中的一些知识点滴
def setup @controller=***.new @request=ActionController::TestRequest.new @response=ActionController::TestResponse.newend assert_template 测试是否装载了正确的viewassert_tag 'form',:attributes=>{:acti...
2008-04-21 19:28:59
116
又一个处理图片的插件
http://fleximage.rubyforge.org/examples/ Home: http://fleximage.rubyforge.org/ Repository: svn://rubyforge.org/var/svn/fleximage Effect examples: http://fleximage.rubyforge.org/examples resi...
2007-08-30 17:14:12
204
routes笔记
例:ruby 代码map.admin_report 'report/:year', :controller => 'admin', :action => 'report' Having this named route in routes.rb tells Rails to create two ne...
2007-08-28 15:22:15
129
validations常用方法
ruby 代码 validates_inclusion_of :class_level, :in => %w( Freshmen Sophomore Junior Senior), :message=>"must be: Freshmen, Sophomore, Junior, or Senior" r...
2007-08-25 16:00:33
270
activescaffold插件的基本使用(爆爽的东东)
http://www.activescaffold.com/三步曲1、Install the latest version of the plugin:ruby 代码 ./script/plugin install http://activescaffold.googlecode.com/svn/tags/active_scaffold 2、Add this to ...
2007-08-13 10:29:22
212
rails中使用tzinfo-timezone实现各时区时间转换
结合http://marklunds.com/articles/one/311和手册,完整的一个实现各时区时间转换的一个例子:首先保证服务器安装tzinfo插件 gem install tzinfo1、配置环境ruby 代码 ActiveRecord::Base.default_timezone = :utc 2、相应的类中ruby 代码 require 't...
2007-08-11 14:48:01
586
dhtml日历插件和show flash messages on cached pages
Show flash messages on cached pagesruby 代码ruby script/plugin install svn://rubyforge.org/var/svn/pivotalrb/cacheable_flash/trunk 时间日历插件http://dry.4thebusiness.com/info/dhtml_calendarruby 代码ruby scr...
2007-08-11 14:47:25
193
ruby中rmgaick给图片加版权信息和水印(中文水印)
根据imagemagick和一些网站的资料,总结了常用的加水印(特别是中文)的代码。require 'rubygems'require 'RMagick'#在图片中嵌入中文文字ruby 代码 def t1 img=Magick::Image.read('path\read_image1.jpg').first #图片路径,用相对路径即...
2007-07-30 19:30:26
471
migration的外键支持
migration默认是不支持外键的,原因是一部分数据库如MySQL ISAM和SQLite不支持外键,同时外键也会给Rails的test fixture导入数据造成麻烦(这个好像有个很麻烦的解决办法)。不过还是有个插件提供了外键的导出(rake db:schema:dump)和导入(rake db:schema:load)(可惜migration中无法正常使用)。 <o:p><...
2007-07-06 15:39:06
490
小技巧
1、<%=select :news,:news_types_id,NewsType.find(:all).map{|c|[c.typename,c.typeid]}%>实现关联的内容建立选择框,如建新闻的时候把新闻类型取出来,供选择。2、flash[:error]=@member.errors.full_messages.join('<br/>') ,把型的错误记...
2007-07-04 08:19:21
54
ruby on rails报告
nubyonrails.com/pages/gruffruby 代码 sudo gem install gruff # Install the plugin ./script/plugin install http://topfunky.net/svn/plugins/gruff # Make a ...
2007-07-03 08:42:19
75
form_tag的小问题
<%form_tag ({:action => 'update',:id => @photo}, :multipart=> true ) do %>要加上小括号,和大括号,否则,处理有错,另外参数顺序不能错了。,原因在于形参是*方式接受。唉,有时语言太灵活了也痛苦呀,呵呵。虽然这很简单,手册中也有详细的信息。但还是记下来,因为,ruby/rails中经常因此产生...
2007-06-30 20:18:28
317
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人