讀書筆記:閱讀的技法

作者介紹:

佐藤優 ─ 前日本駐俄羅斯外交官,外語除英語外精通捷克語, 韓語及俄羅斯語。初中前讀書量極少,主要看電子類書籍及文學小說。初一後嘗試接觸不同類型書籍,後來在大學研讀神學書和哲學書。現時一個月平圴能讀 300 本,狀態更好能達 500 本。每天需要處理超過 2500 頁 A4 文件,轉換成書的話大概一天要讀完 5 本。

習慣讀書人仕平圴一個月僅可「熟讀」 5 本 ,一年即 60 本,一生才大概 3000 本。由於一生人可以讀的書很有限,因此「速讀」變得非常重要。

速讀守則 :

  1. 必需對該範圍的基礎知識相當穩固,否則只能「熟讀」
  2. 只需要看未懂或新知識的部分
  3. 速讀不是瀏覽

熟讀守則:

  1. 以奇數數目選擇書本,例如 3 本 , 5 本。因為作者間的觀點若果出現衝突,可以採取多數決解決問題,避免進入兩難局面浪費時間。
  2. 試閱書的中間章節,那是書最脆弱的部分。
  3. 集中精力閱讀學術類書籍的最後部分,因為那是作者對該理論總結其證明最有力的部分。
  4. 需要「弄污」書籍做筆記,借用圖書館書籍就不能做,故此建議花點錢買書。
  5. 看書時用鉛筆以方框圈著重要的段落,不宜超過總頁數的 10分1;重要的書頁可以拆角或貼上標籤。
  6. 遇到不明白的地方以 “?” 標注;在書內對作者的觀點寫下個人意見,判斷,一至兩句即可。
  7. 利用方框圈點的重點製作筆記。若果解決了當初不明白的地方,可以把標記擦去。
  8. 同一本書需讀最小 3 次。

讀書術可分成三類:

  1. 超速讀 (5 分鐘),並無需做筆記
  2. 普通速讀 (30 分鐘),做小量筆記
  3. 熟讀 ,做深入筆記

使用 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) =====================================

問題好像就解決了!

Reference:

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