Ruby's Louvre

每天学习一点点算法

导航

2009年7月5日 #

Receiving Email with Rails

摘要: This article originally appeared in the first issue ofRails Magazine. It is reproduced here not quite verbatim with a couple of corrections and additions.Photo fromespartaon Flickr.IntroductionReceivi... 阅读全文

posted @ 2009-07-05 21:20 司徒正美 阅读(833) 评论(0) 推荐(0) 编辑

安装 sqlite3

摘要: environment.rbconfig.gem ‘sqlite3-ruby’, :lib => ‘sqlite3’ 阅读全文

posted @ 2009-07-05 21:18 司徒正美 阅读(474) 评论(0) 推荐(0) 编辑

Hpricot and utf-8

摘要: I tried to useHpricotto parse a page with special characters in a utf-8 encoding. The docs tell you to do this:require 'rubygems'require 'open-uri'require 'hpricot'doc = Hpricot(open("http://url/"))Ho... 阅读全文

posted @ 2009-07-05 21:15 司徒正美 阅读(545) 评论(0) 推荐(0) 编辑

inet: Beyond Key-Value Store

摘要: It took Ruby some time to go from an infant research project by Matz to a language we've all come to know so well. Now, another Japanese developer (Mikio Hirabayashi) has all the potential to repeat t... 阅读全文

posted @ 2009-07-05 21:11 司徒正美 阅读(581) 评论(0) 推荐(0) 编辑

32 Rack Resources to Get You Started

摘要: RackWhat the heck is Rack and why is it getting so much press lately? Well, from it’s tag-line: “Rack provides an minimal interface between webservers supporting Ruby and Ruby frameworks.&... 阅读全文

posted @ 2009-07-05 21:03 司徒正美 阅读(545) 评论(0) 推荐(0) 编辑

Ruby Best Practices: 今年最好的ruby博客

摘要: It's pretty rare I recommend new blogs to follow on Ruby Inside. Not because I don't like them -I link to their posts all the time!- but because it's hard to tell if a new blog is going to keep going ... 阅读全文

posted @ 2009-07-05 20:47 司徒正美 阅读(877) 评论(0) 推荐(0) 编辑

Scotland On Rails Presentations Now Online: 27 Awesome Videos

摘要: Did you miss theScotland on Railsconference this year? No need to fret though, as Engine Yard are hosting videos ofall the presentationsmade at this popular conference. With 27 presentations covering ... 阅读全文

posted @ 2009-07-05 20:43 司徒正美 阅读(359) 评论(0) 推荐(0) 编辑

Ruby Plus: Another Ruby/Rails Screencast Site

摘要: Ruby Plusis a site offering free Ruby and Rails related screencasts recorded by Bala Paranj, much in the same vein as Ryan Bates'Railscasts. The screencasts are generally similar in length and overall... 阅读全文

posted @ 2009-07-05 20:41 司徒正美 阅读(533) 评论(0) 推荐(0) 编辑

Redcar,一个用ruby写的文本编辑器

摘要: 介绍:Redcar is an open-source programmers' text editor for Gnome (Linux). It is designed to be compatible with Textmate bundles (a work in progress) and is written almost entirely in Ruby - with some Va... 阅读全文

posted @ 2009-07-05 20:30 司徒正美 阅读(910) 评论(0) 推荐(0) 编辑

17个ruby语法视频。

摘要: Tekniqal.com提供了一系列rub语法基础视频,但它们是放在Youtube上的。1.Identifiers2.Whitespace3.Dynamic Typing4.Variables - Scope5.Methods6.Conditions7.Loops8.String Delimiters9.Symbols10.Strings and Mutability11.Ranges12.Cre... 阅读全文

posted @ 2009-07-05 20:18 司徒正美 阅读(631) 评论(1) 推荐(0) 编辑

Ruby XML 插件的性能大比拼: Nokogiri vs LibXML vs Hpricot vs REXML

摘要: Disclaimer: Every time we've run a piece about benchmarking or performance numbers on Ruby Inside, a retraction or significant correction has come out shortly thereafter. Benchmarking is hard, ugly, a... 阅读全文

posted @ 2009-07-05 20:18 司徒正美 阅读(926) 评论(0) 推荐(0) 编辑

ruby的实例方法(写方法,读方法与读写方法)

摘要: ruby比java实现setter与getter更灵活多变。方法1 class Person def name #读方法 @name end def name=(x) #写方法 @name = x end def age #读方法 @age end end 方法2 class Person attr :name, true # Create 读写方法 attr :age # Create 读方... 阅读全文

posted @ 2009-07-05 18:50 司徒正美 阅读(590) 评论(0) 推荐(0) 编辑

ruby模拟多个构造器

摘要: 在ruby中没有像c++或者ruby中的构造器,可是我们依然能够创建出类似的多个构造器: class ColoredRectangle def initialize(r, g, b, s1, s2) @r, @g, @b, @s1, @s2 = r, g, b, s1, s2 end def ColoredRectangle.white_rect(s1, s2) new(0xff, 0xff... 阅读全文

posted @ 2009-07-05 18:07 司徒正美 阅读(796) 评论(0) 推荐(0) 编辑

ruby中的类变量与实例变量

摘要: 首先,在ruby1.8中类变量是所有子类和父类共享的,可以看下面的代码: class IntelligentLife @@home_planet = nil def self.home_planet @@home_planet end def self.home_planet=(x) @@home_planet = x end #... end class Terran 可以看到结果是相同的,都... 阅读全文

posted @ 2009-07-05 17:36 司徒正美 阅读(924) 评论(0) 推荐(0) 编辑

随机生成十六进制颜色

摘要: "#"+rand(255).to_s(16)+rand(255).to_s(16)+rand(255).to_s(16) 阅读全文

posted @ 2009-07-05 17:17 司徒正美 阅读(981) 评论(1) 推荐(1) 编辑