Learn French (2) – est, riche, l’, homme, tu, es, rouge, pomme

la femme est riche

the woman is rich

lhomme est riche

the man is rich

la fille / la femme / le garcon / l’homme

the girl / the woman / the boy / the man

tu es une fille

you are a girl

une pomme

an apple



pomme est rouge

apple is red


Install Apache 2.4.9 on Mac OSX 10.9 Mavericks

1. install homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2. install dependencies

brew install pcre
brew install libtool

3. download apache 2.4.x version


4. extract it and then go into the directory

tar zxvf httpd-2.4.9.tar.bz2 && cd httpd-2.4.9

5. after that run the following to confgure:

./configure --prefix=/usr/local/apache-2.4.9 LTFLAGS=--tag=cc

6. if you can’t complie because of llvm-gcc/gpp issue, install the GNU/gcc:

brew install gcc46

7. run the following command should work fine:

./configure --prefix=/usr/local/apache-2.4.9 CC=/usr/local/Cellar/gcc46/4.6.4/bin/gcc-4.6 CPP=/usr/local/Cellar/gcc46/4.6.4/bin/cpp-4.6 LTFLAGS=--tag=CC

8. after the configuration, build it:


8. and install it:

sudo make install

9. Then, we can create symbolic links:

sudo ln -s /usr/local/apache-2.4.9 /usr/local/apache
sudo ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd
sudo ln -s /usr/local/apache/bin/apachectl /usr/sbin/apachectl

10. start apache server:

sudo apachectl start


sudo httpd -k start

11. check apache version:

sudo httpd -v


Server version: Apache/2.4.9 (Unix)
Server built: Jun 11 2014 16:18:15


sudo apachectl status


Apache Server Status for localhost (via ::1)

 Server Version: Apache/2.4.9 (Unix)
 Server MPM: worker
 Server Built: Jun 11 2014 16:18:15

 Current Time: Thursday, 12-Jun-2014 00:45:38 HKT
 Restart Time: Thursday, 12-Jun-2014 00:42:42 HKT
 Parent Server Config. Generation: 1
 Parent Server MPM Generation: 0
 Server uptime: 2 minutes 56 seconds
 Server load: 1.86 1.67 1.69
 Total accesses: 1 - Total Traffic: 2 kB
 CPU Usage: u0 s0 cu0 cs0
 .00568 requests/sec - 11 B/second - 2048 B/request
 1 requests currently being processed, 74 idle workers


 Scoreboard Key:
 "_" Waiting for Connection, "S" Starting up, "R" Reading Request,
 "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
 "C" Closing connection, "L" Logging, "G" Gracefully finishing,
 "I" Idle cleanup of worker, "." Open slot with no current process

12.  if you get ‘Not found ‘ error as below:

Not Found
The requested URL /server-status was not found on this server.

because the mod_status module is not configured, so add the following lines to httpd.conf:

<IfModule mod_status.c>
   # Allow server status reports generated by mod_status,
   # with the URL of http://servername/server-status
   # Change the ".example.com" to match your domain to enable.
   <Location /server-status>
     SetHandler server-status
     Order deny,allow
     Allow from all

Finally restart the apache server, it should work properly!




使用 bootstrappers 產生專案出現問題

想用 bootstrappers 快速產生一個專案卻出現以下問題:

Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
 generate devise:install
/Users/martin/myapp/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:43:in `<top (required)>'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
 from bin/rails:4:in `<main>'
 generate devise User
/Users/martin/myapp/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:43:in `<top (required)>'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
 from /Users/martin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
 from bin/rails:4:in `<main>'
/Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/bootstrappers-4.2.1/lib/bootstrappers/actions.rb:10:in `read': No such file or directory - /Users/martin/myapp/config/initializers/devise.rb (Errno::ENOENT)
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/bootstrappers-4.2.1/lib/bootstrappers/actions.rb:10:in `replace_in_file'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/bootstrappers-4.2.1/lib/bootstrappers/app_builder.rb:53:in `replace_email_sender_for_devise'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/generators/app_base.rb:88:in `build'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/bootstrappers-4.2.1/lib/bootstrappers/generators/app_generator.rb:108:in `setup_devise'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/gems/bootstrappers-4.2.1/bin/bootstrappers:12:in `<top (required)>'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/bin/bootstrappers:23:in `load'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/bin/bootstrappers:23:in `<main>'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
 from /Users/martin/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

看來是 devise 這個套件出了問題。



martin@martins-mba:~/myapp$ rails g devise:install
 create config/initializers/devise.rb
 create config/locales/devise.en.yml
Some setup you must do manually if you haven't yet:
1. Ensure you have defined default url options in your environments files. Here
 is an example of default_url_options appropriate for a development environment
 in config/environments/development.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
In production, :host should be set to the actual host of your application.
2. Ensure you have defined root_url to *something* in your config/routes.rb.
 For example:
root :to => "home#index"
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
 For example:
<p class="notice"><%= notice %></p>
 <p class="alert"><%= alert %></p>
4. If you are deploying on Heroku with Rails 3.2 only, you may want to set:
config.assets.initialize_on_precompile = false
On config/application.rb forcing your application to not access the DB
 or load models when precompiling your assets.
5. You can copy Devise views (for customization) to your app by running:
rails g devise:views

martin@martins-mba:~/myapp$ rails g devise User
 invoke active_record
 create db/migrate/20140212190200_devise_create_users.rb
 create app/models/user.rb
 invoke test_unit
 create test/models/user_test.rb
 create test/fixtures/users.yml
 insert app/models/user.rb
 route devise_for :users

martin@martins-mba:~/myapp$ rake db:migrate
== DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
 -> 0.0505s
-- add_index(:users, :email, {:unique=>true})
 -> 0.0019s
-- add_index(:users, :reset_password_token, {:unique=>true})
 -> 0.0009s
== DeviseCreateUsers: migrated (0.0538s) =====================================



請問我用bootstrappers新建後,bundle install成功,rake db:c… << Rails 101 « bumblr

ISCSI 設定筆記 (2): Ubuntu 上使用 Initiator 連接 ISCSI Target

尋找指定 IP 的 ISCSI Server 所提供的 ISCSI Target :

iscsiadm -m discovery -t sendtargets -p


iscsiadm -m node -p -o show


iscsiadm -m node -p -o update -n <name> -v <value>


iscsiadm -m node -p --op=update --name=<name> --value=<value>


iscsiadm -m node -p -T "iqn.2013-8.com.osiutino:target0" -o update -n node.session.auth.authmethod -v CHAP
iscsiadm -m node -p -T "iqn.2013-8.com.osiutino:target0" -o update -n node.session.auth.username -v username
iscsiadm -m node -p -T "iqn.2013-8.com.osiutino:target0" -o update -n node.session.auth.password -v password

開機自動連接這個 target:

iscsiadm -m node -p -o update -n node.conn[0].startup = automatic


iscsiadm -m node -p --login


Logging in to [iface: default, target: iqn.2013-8.com.osiutino:target0, portal:,3260] (multiple)
Login to [iface: default, target: iqn.2013-8.com.osiutino:target0, portal:,3260] successful.


iscsiadm -m node -p --logout

若果剛才入登錄成功,在終端機中輸入以下指令即可查閱該 target 的磁碟資訊:

 fdisk -l 

SAN/iSCSI/open-iscsi – Debian Wiki

Ubuntu 12.04 LTS – Configure iSCSI Initiator : Server World

Ubuntu 12.04 LTS – Configure iSCSI Target : Server World

ISCSI 設定筆記 (1): Ubuntu 上架設 ISCSI Server

最近改動一下備份方案,打算掛載多個 iscsi targets 作備份之用,並且順便寫份筆記做個記錄。

利用 ssh 連接到 ubuntu server ,輸入以下指令找出建立 iscsi target 的磁碟:

fdisk -l


Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000cca3d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   500117503   249807873    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          501760   500117503   249807872   8e  Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000abc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  1953525167   976761560   83  Linux

在 sdb1 上建立 physical volume :

pvcreate /dev/sdb1

查看一下 server 上 physical volume(s) 的資訊:


新增 1 個 volume group:

vgcreate vg_target0 /dev/sdb1

如同 pvdisplay, 輸入以下指令即可查看 本機 volume group(s) 資訊:


新增 1 個 100Gb 的 logical volume:

lvcreate -L 100G -n lv_target0 vg_target0

查看這個 LV:



vim /etc/iet/ietd.conf


Target iqn.2013-8.com.osiutino:target0
	LUN 0 Path=/dev/vg_target0/lv_target0,Type=blockio	
	incominguser username password
	alias LUN1


service iscsitarget restart

Using iSCSI On Ubuntu 10.04 (Initiator And Target) | HowtoForge – Linux Howtos and Tutorials

酷爾的家: 在Ubuntu 使用 iSCSI Initiator

鳥哥的 Linux 私房菜 — 網路磁碟裝置:iSCSI伺服器