- 浏览: 132097 次
- 性别:
- 来自: 深圳
-
最新评论
-
kqy929:
最近我也在使用spree-0.9.4,准备改定下。但发现,性能 ...
rails plugins 做一个电子商务系统 -
山雨欲来风满楼:
ruby的这个程序没有时间戳,好像 logger都没有时间戳, ...
logger (ruby) -
dazuiba:
很不可思议,照常理,这个是一个很常见的应用场景,为什么EXTJ ...
combo values in Editor Grid Panels combo值显示问题 -
xu_ch:
有没有helper?
(ruby)String Extensions(字符串、首字母大写,复数单数转换) -
panboxian_2008:
class Publisher(models.Model):
...
ruby 语言 手记
文章列表
去除fcitx的多余输入法:
1、去除五笔、二笔、仓额等。
zhancang@ubuntu:~$ sudo gedit /usr/share/fcitx/data/tables.conf
[sudo] password for zhancang:
#####以#打头的为注释(把不用的全添上#号)
例如:
#[码表]
#名称=五笔字型
#码表=wbx.mb
#调频=0
#拼音=1
#拼音键=z
#自动上屏=1
#模糊=1
#模糊键=z
#自动词组=1
#自动词组长度=4
#词组参与自动造词=1
#保存自动词组=0
#精确匹配=0
#提示编码=0
#符 ...
- 2007-11-29 12:02
- 浏览 1210
- 评论(0)
1 。 在(ruby on rails) 的项目下面,确保public/目录中的 dispatch.fcgi , dispatch.cgi , dispatch.rb 三个文件中
1: 确保第一行内容为本机的ruby的安装目录 。(例如:我本机的是 #!/usr/local/ruby/bin/ruby )
而在5.102上面,因为ruby 是默认安装,所以需把这一行改为 #!/usr/bin/ruby )
2. 在lighttpd.conf文件中,确保以下内容的正确性
必需以具有 ro ...
- 2007-11-19 12:23
- 浏览 1218
- 评论(0)
ruby 代码
# Here is HTTP request class hierarchy.
#
# Net::HTTPRequest
# Net::HTTP::Get
# Net::HTTP::Head
# Net::HTTP::Post
# Net::HTTP::Put
# Net::HTTP::Proppatch
# Net::HTTP::Lock
# Net: ...
- 2007-10-29 14:22
- 浏览 1334
- 评论(0)
MPlayer install:
[皮肤]Abyss-1.6.tar.bz2----->/usr/local/mplayer/Skin
[解码]all-20061022.tar.bz2---->/usr/local/mplayer/codecs
./configure --prefix=/usr/local/mplayer --enable-gui --with-codecsdir=/usr/local/mplayer/codecs --with-win32libdir=/usr/local/mplayer/codecs --with-reallibdir= ...
- 2007-10-25 21:12
- 浏览 1300
- 评论(0)
javascript 摸拟 class
以及 实例变量,实例方法; 类变量,类方法
function Circle(r){
this.r = r; // this.r 这里它变就实例变量
}
Circle.PI = 3.14 // 类方法,只能在Circle上调用
Circle.prototype.area=function(){
return this.r * Circle.PI;
} // 实例方法
Circle.max = function(a,b){
return a.r > b.r ? a : b
} // 类方法
有时候我们大概也需要用到 私有属性
:
第一 ...
- 2007-10-25 17:39
- 浏览 3047
- 评论(0)
如何使用类名来获得类?
如果我有classname = "String时,如何生成SomeClass类的实例呢?主要有两个解决方法。"
ruby 代码
[1] eval(classname).new
[2] Object.const_get(classname).new
第1种方法既简单又可以处理嵌套类(Net::HTTP等),但如果在CGI环境中滥用它的话,将十分危险。
而第2种方法却又无法处理嵌套类的问题。但如果进行以下处理的话,就可以处理嵌套类了。
ruby 代码
# 如果只考虑Ruby 1.8之后的版本的话,可以 ...
- 2007-10-18 21:46
- 浏览 1144
- 评论(0)
topic.to_xml(:skip_instruct => true, :except => [ :id, :bonus_time, :written_on, :replies_count ])
更多方法参考API --> to_xml
ActiveRecord::XmlSerialization
@model[:pc] = .....
可以賦 任何值。
哈希表里包含多层的话可以先把哈希表转为xml 格式,再把它赋给model的一个属性,最后把model转 ...
- 2007-10-13 17:49
- 浏览 1242
- 评论(0)
#!/usr/bin/env ruby
require 'open-uri'
LOOKUP_URL = 'http://toolbar.netcraft.com/site_report?url=%s'
MATCH_RE = /<td><b>IP address<\/b><\/td><td.*?>([\d\.]+)<\/td>/
host = ARGV.select { |arg| arg !~ /^\-/ }.first
open(LOOKUP_URL % host).read = ...
- 2007-10-13 08:37
- 浏览 1568
- 评论(0)
sql 代码
#!/bin/bash
# none 1,2,3,15,20 signal
trap '' 1 2 3 15 20
#clear screen ,close redisplay
clear
stty -echo
#set password
echo -n "Enter your codeword: "
read secretcode
echo
#confirm passwo ...
- 2007-10-12 09:44
- 浏览 1795
- 评论(0)
#response to client
respond_to do |wants|
wants.html { redirect_to(person_list_url) }
wants.js
wants.xml { render :xml => @person.to_xml(:include => @company) }
end
#获取params里传来的xml数据:
#get data from parameters
channel_info_hash ...
- 2007-10-08 20:07
- 浏览 1578
- 评论(1)
当不能使用rake 命令 |||> rake --trace goldberg:install <|||
how to build task 'db:migrate:plugins'
gem install plugin_migrations
gem install RedCloth <web文本编辑器辅助工具>
gem install railroad <A DOT diagram generator for Ruby on Rail applications>
- 2007-10-05 20:16
- 浏览 1125
- 评论(0)
赵毋恤很感动,但仍命士兵包围豫让,豫让请求赵毋恤把衣服给他刺杀,以致报仇之意。
- 2007-09-29 18:21
- 浏览 1612
- 评论(0)
apache 项目中的与log4j对应的ruby版为->log4r
ruby 代码
log = Logger.new(STDOUT) log.level = Logger::WARN log.debug("Created logger") log.info("Program started") log.warn("Nothing to do!") begin File.each_line(path) do |line| unless line =~ /^(\w+) = (.*)$/ ...
- 2007-09-28 14:57
- 浏览 2879
- 评论(3)
字符串截取,
英文单词单数复数转换(Agile Web Development with Rails [Chapter 15||||||||||||||Active Support[P251])
ruby 代码
string = "Now is the time"
puts string.at(2) #=> "w"
puts string.from(8) #=> "he time"
puts string.to(8) #=> ...
- 2007-09-27 20:03
- 浏览 8927
- 评论(2)
<!--[if IE]>
<style type="text/css">
.live_tree {padding: 1px !important;}
table(ID或是html tag_name) {behavior: url(<%= stylesheet_path "csshover.htc" %>);}
</style>
<![endif]-->
- 2007-09-26 21:25
- 浏览 1927
- 评论(1)