2008, 八月 月的彙整

第 2 頁, 共 2 頁

[Ruby] String 轉 Hex

String To Hex

  1. string = "hello"
  2. 0.upto(string.size-1) {|i| print string[i].to_s(16)}

Hex To String

  1. string = "68656c6c6f"
  2. chars=string.scan(/../)
  3. chars.each {|char| print char.to_i(16).chr}

[WordPress] 增加發文快速tag

除了使用quick tag 外掛外,可以用手動的方法…
在 /wp-include/js/quicktags.js 中
找到

  1. edButtons[edButtons.length] =
  2. new edButton('ed_strong'
  3. ,'b'
  4. ,'<strong>'
  5. ,'</strong>'
  6. ,'b'
  7. );

繼續閱讀 ‘[WordPress] 增加發文快速tag’

[Rails] RESTful

RESTful 是一個很方便的…東西?
恩,做了兩篇rails 的學習筆記後,剛剛一直在看 scaffold 產生出來的 views ,有寫東西看不怎麼懂,一問之下才知道用了很多叫 RESTful 的東西,這東西是 rails 2.0 時放進來的~
我上網找了一下資料~ 都還不錯~ 可以看一看~ 看完大概可以了解這東西有多簡略到很神奇 :P

Practical Rails2
RESTful best practices
Advanced RESTful Rails

[Rails] Rails 學習筆記(2)

Rails 把資料庫分成三種~ 開發用資料庫(_development)、測試用資料庫(_test)、成品資料庫(_production)
先建立三個資料庫~分別是(只要在前面加上專案名稱及可)

demo_development
demo_test
demo_production

繼續閱讀 ‘[Rails] Rails 學習筆記(2)’

[Rails] Rails 學習筆記(1)

安裝 Rails 還有相依性套件,到console

gem install rails –include-dependencies

建立新 project

rails demo

啟動內建Webrick 伺服器

ruby script\server

預設prot 是 3000 , 所已啟動 Webrick 後,可以到 http://127.0.0.1:3000/ 看看
繼續閱讀 ‘[Rails] Rails 學習筆記(1)’