Ruby
djcsch2001
这个作者很懒,什么都没留下…
展开
-
Tk库的使用(1)
# # To change this template, choose Tools | Templates# and open the template in the editor. # Sample code from Programing Ruby, page 248require tkclass Draw def do_press(x, y) @start_x = x @s转载 2008-09-10 14:56:00 · 664 阅读 · 1 评论 -
Tk库的使用(2)
# Sample code from Programing Ruby, page 250require tkclass GifViewer def initialize(filelist) setup_viewer(filelist) end def run Tk.mainloop end def setup_viewer(filelist) @root = TkR转载 2008-09-10 15:02:00 · 9691 阅读 · 0 评论 -
typo(ruby的开源blog)系统的安装
1.要求安装ruby1.8.3以上,并且需要安装rails,版本也要匹配好,否则会出错。(下文用typo4.1和rails1.2.3安装成功)2.下载并安装typo,gem install typo -v"=4.1"3.升级rake,gem update rake4.安装mongrel,gem install mongrel5.进入mysql,建库和表mysql -uroot原创 2008-09-10 15:04:00 · 702 阅读 · 0 评论 -
交互式Shell
irb是从命令行运行的交互式shell在命令行中输入irb后回车,进入交互式ruby模式(1) 可以用load载入rb文件执行,如以下文件code/fib_up_to.rbdef fib_up_to(max)i1,i2=1,1while i1yield i1i1,i2=i2,i1+i2endend%irbirb(main):001:0>load转载 2008-09-10 15:11:00 · 379 阅读 · 0 评论 -
六种调用shell命令的方法
(1) Execute方法$irb>> exec echo "hello $HOMENAME"(2) System方法>>system echo "hello $HOMENAME"(3) 反引号>> today= `date`(4) open3#popen3>>stdin,stdout,stderr=open3.popen3(dc)(5) IO#po原创 2008-09-10 15:12:00 · 451 阅读 · 0 评论 -
SOAP及Web Services
我们可以通过SOAP服务器来访问预先定义好的对象,通过soap/rpc/driver就可做到,这也可以看作是同其他语言交互的一种很好的方式,服务器端存为server.rbrequire soap/rpc/standaloneServerclass InterestCalculator attr_reader :call_count def initialize @call_count原创 2008-09-10 15:15:00 · 401 阅读 · 0 评论 -
请求Google的服务
# Sample code from Programing Ruby, page 239require soap/wsdlDriver以下通过对Google的服务请求,使用Google的一个服务,并使用了WSDL(Web Services Description Language)来完成.(前提是你拥有一个Google Web API的使用账号,并保存在主目录的.goolge_key文件中)r原创 2008-09-10 15:23:00 · 407 阅读 · 0 评论 -
让Apache支持ruby写的cgi程序
ruby apache cgi 配置 1,按说明安装ruby的apache mod2,配置文件如下:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 ####################################原创 2008-09-11 13:41:00 · 1789 阅读 · 0 评论