linux的安裝: 我用的是源碼編譯的方式安裝,作業系統是Red Hat Linux release 7.3 (Valhalla) 到ruby主站下載原始碼,首頁右邊的"Get Ruby now!!" ,目前是1.8.2,搞到手解壓到目錄./configure make make install(需要root許可權,預設安裝到/usr/local下, 如果需要另外指定目錄,請使用 ./configure --prefix=自訂路徑 )這一步我沒有遇到任何問題, 接下來安裝rubygem,
等待今天宿舍的小八提出來要考 DBA ,這個勾起了我的思緒。To be a DBA or to be a Programmer it's a questions。其實我個人比較傾向去做程式設計,可是綜合考慮到我的性格,感覺自己做DBA更合適一點。下午看了一下 Oracle Certified Administrator
此筆記是為了協助理解 "<<" 指令 ruby語言允許我們在一個對象的基礎上定義類,使得我們可以單獨擴充一個對象的行為,例子如下 test="hello" #普通string normal=a.dup #還是普通string class << test def to_s "value is #{self}" end end #test對象已經被更新, normal保持不變 運行完上述代碼以後
今天原本平穩的心情被一些事情所觸動,深埋的東西被拔起的感覺總是痛痛的,不提太多了,還是專心寫文章吧。說說今天這篇文章的關鍵字,看看有沒有你能有用的: Class Hierarchies ,Accessors,Attributes,Class Variables。說白了今天就是Deep in Ruby Class了,不過這個 Deep 不夠
參考書籍:《Agile Web Development With Rails 4th edition》建立新的網站,建立一些預設目錄和檔案:$ rails new <projectname>啟動伺服器,在項目目錄中執行命令:$ rails server預設網站地址 http://localhost:3000/為兩個頁面產生controller$ rails generate controller ControllerName page1 page2.html.erb檔案中 <%
• First and foremost, run your scripts with warnings enabled (the -w command-line option).• If you happen to forget a “,” in an argument list—especially to print—you can produce some very odd error messages.• A parse error at the last line of the
1.先看私人方法能否被繼承class A @@name="Anleb" def ask puts @@name end private :askenda=A.new#a.aska.send(:ask)class B < A endb=B.new#b.askb.send(:ask) 結論:對於private方法,是被繼承的,類變數(類似於靜態變數,屬於所有執行個體),也是可以被繼承的。 2.看類的方法能否被繼承