星期一和星期二兩天上了一個Microsoft辦的課程叫做Secure Application Development,是不是有點奇怪呢?因為通常Microsoft及Secure都不會同時出現在同一句句子之中。:) 這只是一個基本課程,最令我覺得奇怪的是其他同學,他們在Training Center的電腦上Gmail,用remote desktop連上在公司的PC,這些人的InfoSec意識實在太低,要他們寫出Secure的Application真是有點……
星期一和星期二兩天上了一個Microsoft辦的課程叫做Secure Application Development,是不是有點奇怪呢?因為通常Microsoft及Secure都不會同時出現在同一句句子之中。:) 這只是一個基本課程,最令我覺得奇怪的是其他同學,他們在Training Center的電腦上Gmail,用remote desktop連上在公司的PC,這些人的InfoSec意識實在太低,要他們寫出Secure的Application真是有點……
從報紙上看到香港仔一名 14 歲中三學生,因入侵 8 間學校內聯網伺服器而遭警方拘捕,而報紙上都稱這位 14 歲中三學生少年“黑客”,『黑客』這個詞彙和『電腦病毒』一樣被濫用,所有Trojan horse, Worm, Virus 一律都被稱作『電腦病毒』,而所有Hacker, Cracker, Script Kiddie 一律都被稱作『黑客』,其實這位 14 歲中三學生少年“黑客”只可以稱作 Script Kiddie,因他在Internet上 download 一些 cracking 的 program來入侵學校的 Server 。
Hacker與Cracker
一般報紙上所講的“黑客”就是指Cracker,在 The New Hacker Dictionary中
由於 Rails 2 已經推出了一段日子,我也來寫寫 Rails 2 要注意的地方。
Rails 2.0 is RESTful by default
我也來講講人稱 Sexy migration 的 ActiveRecord Migration,在 Rails 2.0 之前,migration 是長成這樣子的︰
1 2 3 4 5 6 7 8 9 10 11 12 13 | # db/migrate/001_create_customers.rb class CreateCustomers < ActiveRecord::Migration def self.up create_table :posts do |t| t.column :first_name, :string t.column :last_name, :string end end def self.down drop_table :customers end end |
到了 Rails 2.0,migration 就變成這樣子︰
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # db/migrate/001_create_customers.rb class CreateCustomers < ActiveRecord::Migration def self.up create_table :posts do |t| t.string :first_name t.string :last_name t.timestamps end end def self.down drop_table :customers end end |
除此之外,還新增了一個 rake task︰rake db:rollback,在以前,要 rollback 就只有用 rake db:migrate VERSION=xx 來做,新的 rake task 比較好用,不需要再去理會 version。
換了 Server 後,今天又買了新玩具 - Intel D201GLY2 Fanless miniITX motherboard with onboard Intel Celeron 220 CPU。打算把它打造成平價的 Solaris in a box,安裝 Solaris 10 U4 8/07 的過程都算順利,安裝完成後 reboot 問題就來了,這部 Solaris in a box 就進入了 reboot hell,不停地 reboot,只要一到 loading kernel 就 reboot,好吧試試修改 GRUB 的 parameter,在 GRUB boot menu 按 “e”,再按 “e”修改加入 “kernel/unix” 指定使用32bit kernel,而 64bit kernel 是在 “kernel/amd64/unix,修改後再按 “b”,今次沒有進入 reboot hell 了 。
看來是 64bit kernel 的問題,但Celeron 220 CPU 是 support EM64T 的,也就是運行 64bit 的 Solaris 10 是應該沒有問題的,好吧只好暫時用 32bit kernel 吧。reboot hell 的問題暫時解決後,就要 install LAN Card Driver,雖然這一張是 intel 的 motherboard,但卻使用了 SiS 的晶片組,而 Solaris 10 U4 並中沒有 SiS LAN Card 的Driver,所以要使用 Free SiS Solaris Driver。
下一步就是要替 Solaris in a box 打造一個合適的機箱
很久沒有寫 blog 了,可能因為假期關係,整個人都很懶散。
今天終於把本站的 Server 換了,其實一早就想把本站的 Server 由原來的 Mac Mini 換成普通的 PC,這樣就可以把 Mac Mini 帶回家給老婆使用。
新 Server 的 configuration 如下︰
| Intel motherboard D945GCNL |
| Intel Pentium Dual Core E2160 1.8GHz |
| Kingston 1GB DDR2-667 Ram X 2 |
| Seagate 250G SATAII Harddrive |
| Asus 20X SATA DVD/RW |
Rails 2.0.2 is out, this version fixed the rake rails:freeze:gem problem with RubyGens 0.9.5, this version is a drop-in replacement for Rails 2.0. From the release announcement.
Rails 2.0.2 contains a bunch of smaller fixes to various bugs, no show-stopping action, just further polish. But it also contains a few new defaults. The major change is mysql is no longer the default database. SQLite3 is the new default database, SQLite3 is shipped with Leopard. Use
$ rails -d mysql dummy_app
to set the default database to mysql.
Rails 2.0.1 已經正式推出了,而我也把我的 development machine update 到 2.0.1,但假如現在要 create 一個新的 Rails project,但又要用回 Rails 的舊版本如 1.2.6,應該怎麼辦呢?
做法很簡單,只要 create 新的 project 時指定版本即可
$ rails _1.2.6_ dummy_app
Update 10/12/2007 : It’s fixed in edge changeset 8336, it make rails:freeze:gems work with RubyGems 0.9.5. You can update to edge or follow the change set to update your frameworks.rake
When I try to create my own Rails 2.0 API documentation for reference. I encounter the cannot freeze gems problem. After a little googling, I’ve found the temporary fix. Until there is a solution I’ll stick with this fix.
1. create a dummy_app
rails dummy_app
2. edit /Library/Ruby/Gems/1.8/gems/rails-2.0.1/lib/tasks/framework.rake, add the following below line 6
[original]
line 6: require ‘rubygems’[Fix]
line 6: require ‘rubygems’
line 7: require ‘rubygems/gem_runner’
3. delete the empty directory under vendor directory
4. rake rails:freeze:gems
5. echo >vendor/rails/activesupport/README
6. rake doc:rails
7. There is no step 7.
經過差不多一年的 Development effort,Rails 2.0 終於正式推出,Rails 2.0比上一版本 Rails 1.2改善了很多,例如 RESTful 的語法,Action Pack: Multiple View,Active Record 速度上的改進,更簡易的 Active Record: Migration,ActionController::HttpAuthentication 等。
詳情可以到 Rails 的 blog 看看。相信很多的 Rails 書也要跟著改版了,我想 AWDR 也很快會出第三版。
Javascript - The Definitive Guide 5th Ed.
CSS - The Definitive Guide 3rd Ed
RESTful Web Services
Ajax on Rails
Rails Cookbook
Ruby Cookbook