ruby on rails推薦的生產運行環境是Linux/FreeBSD/Unix,即Unix系列的作業系統,採用lighttpd+FCGI的解決方案。以下我將以Linux作業系統,lighttpd+FCGI,MySQL資料庫為例,從原始碼編譯安裝開始講解。 在安裝之前,應該確認Linux作業系統已經安裝好gcc編譯器,否則請用Linux安裝光碟片先行安裝gcc編譯器:gcc –v
#關閉命令顯示@echo off#提示資訊echo Now,listing the controller,please not shutdown the DOS File!#切換到當前路徑,.bat檔案和.rb檔案放在一起就可以了set pa=%cd%#執行ruby指令碼ruby test.rbpause 當我們利用cmd命令執行:ruby test.rb的時候,你可能會發現,我們需要cd 到test.rb的目錄,可以利用DOS命令實現這個 路徑,這樣無論你的指令碼在哪,批處理調用ruby
Let’s get back to our jukebox for a moment (remember the jukebox?). At some pointwe’ll be working on the code that handles the user interface—the buttons that peoplepress to select songs and control the jukebox. We’ll need to associate actions
irb(main):022:0* 1.next=> 2irb(main):023:0> "a".next=> "b"irb(main):024:0> "1".next=> "2"irb(main):025:0>效能比較:require 'benchmark'n=(1..1000000).to_adef num_next(first,last) while first != last first=first.next end
class Fixnum attr_accessor :valueendx=1p x.object_idx.value="Anleb"p x.value.object_iddef change(x) p x.object_id p x.value.object_id x=2 #指標改變 x.value="Mr.w" p x.object_id p x.value.object_id
class A def self.ask1 puts "the method of class" end def ask2 puts "the method of instance" endend#類的執行個體對象的方法,方法屬於類所產生New出來的執行個體對象。 p a.methods.length p a.class.instance_methods.length p A.instance_methods.length p