From 4919bea6473d60ea6841cc83ee657bc11b5f8958 Mon Sep 17 00:00:00 2001 From: Iceskysl Date: Sun, 24 Jun 2012 23:55:35 +0800 Subject: [PATCH] add .gitignore --- app/models/post.rb | 2 +- lib/im_wp_xml.rb | 7 +- log/development.log | 22799 ++++++++++++++++ tmp/cache/8ED/600/site_config%3Amenu_html | Bin 482 -> 482 bytes tmp/cache/95A/F70/site_config%3Asite_title | Bin 124 -> 124 bytes tmp/cache/9BC/9D0/site_config%3Asite_slogan | Bin 193 -> 194 bytes tmp/cache/9C7/990/site_config%3Afooter_html | Bin 950 -> 950 bytes tmp/cache/9CB/950/site_config%3Asite_author | Bin 121 -> 119 bytes tmp/cache/A84/740/site_config%3Aabout_me_html | Bin 551 -> 550 bytes .../8E0/site_config%3Asite_author_username | Bin 124 -> 124 bytes .../980/site_config%3Asite_author_password | Bin 125 -> 124 bytes tmp/pids/server.pid | 2 +- 12 files changed, 22807 insertions(+), 3 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index b25ab1d..8355caa 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -31,7 +31,7 @@ class Post attr_accessible :title, :body, :tag_list,:category_id,:created_at attr_accessor :tag_list - validates_presence_of :title, :body, :tag_list,:category_id + validates_presence_of :title,:category_id # scopes scope :normal, where(:state => STATE[:normal]) diff --git a/lib/im_wp_xml.rb b/lib/im_wp_xml.rb index 5b37acc..f78d728 100644 --- a/lib/im_wp_xml.rb +++ b/lib/im_wp_xml.rb @@ -28,7 +28,12 @@ def self.do_im puts "#{i}: #{title} : #{date_string} : #{category_string} : #{tags}" c = Category.where(:name => category_string).first c = Category.create(:name => category_string) unless c - Post.create(:category_id => c.id, :title => title, :body => content ,:tag_list => tags,:created_at =>date ) + + begin + Post.create(:category_id => c.id, :title => title, :body => content ,:tag_list => tags || "notag",:created_at =>date, :state => 1 ) + rescue => e + Rails.logger.error(" #{e}") + end end end diff --git a/log/development.log b/log/development.log index 62454a8..e3b1ca5 100644 --- a/log/development.log +++ b/log/development.log @@ -14888,3 +14888,22802 @@ MONGODB iceylog_development['sites'].find({:deleted_at=>nil}).limit(15) Rendered shared/_aside.html.erb (36.5ms) Rendered shared/_google_analytics.html.erb (0.0ms) Completed 200 OK in 61ms (Views: 53.9ms | Mongo: 6.5ms) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"site_configs"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"mongoid.auto_increment_ids"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"categories"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"pages"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"posts"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"sites"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"site_configs"}).limit(-1) +MONGODB iceylog_development['site_configs'].find({:key=>"site_title"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_title"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_title", "value"=>"Iceylog", "_id"=>1}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_slogan"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_slogan"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_slogan", "value"=>"Focus on Android,iPhone,Web,Business,Architecture,Agile,Technic and beyond…", "_id"=>2}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author", "value"=>"Icey", "_id"=>3}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_username"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_username"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_username", "value"=>"iceylog", "_id"=>4}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_password"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_password"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_password", "value"=>"password", "_id"=>5}]) +MONGODB iceylog_development['site_configs'].find({:key=>"about_me_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"about_me_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"about_me_html", "value"=>"
\n

IceskYsl, 简称Ice, 80后, 典型巨蟹男, 移动互联网创业者; Google产品重度依赖者, Mac, Android, iPhone, BB 非典型用户;关注创新,技术,产品和一切新奇的玩意儿;
求学武汉, 毕业南下深圳, 尔后北漂在京, 至今数年有余; 追寻内心的想法, 不随波逐流, 爱折腾, 爱旅行, 孩子气, 享受工作, 安静的做喜欢的事情...

\n
\n", "_id"=>6}]) +MONGODB iceylog_development['site_configs'].find({:key=>"menu_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"menu_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"menu_html", "value"=>" \t\n", "_id"=>7}]) +MONGODB iceylog_development['site_configs'].find({:key=>"footer_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"footer_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"footer_html", "value"=>"

Copyright ©2007-2012 - Lovingly authored by IceskYsl - All my work is MIT licensed, Open and Free.

\n

\n Powered by Iceylog - Theme by IceskYsl@1.s.t \n - Build by Markdown,\n GitHub, \n Disqus\n

\t\n", "_id"=>8}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"categories"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"默认分类"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"默认分类", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>1}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"pages"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"about"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"about", "title"=>"About", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>1}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"book"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"book", "title"=>"Book", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>2}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"movie"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"movie", "title"=>"Movie", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>3}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"music"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"music", "title"=>"Music", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>4}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"team"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"team", "title"=>"Team", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>5}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"travel"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"travel", "title"=>"travel", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>6}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"toolkit"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"toolkit", "title"=>"Toolkit", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>7}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"posts"}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["demo", "tag"], "comments_count"=>0, "category_id"=>1, "title"=>"blog post title", "body"=>"This is a new post body,support **Markdown** format..", "updated_at"=>2012-06-24 15:34:43 UTC, "body_html"=>"

This is a new post body,support Markdown format..

\n", "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>1}]) +MONGODB iceylog_development['categories'].find({:_id=>1}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>1}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"sites"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{"$or"=>[{:url=>"http://www.iceskysl.com"}]}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"sites"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['sites'].insert([{"name"=>"Iceskysl Blog", "url"=>"http://www.iceskysl.com", "favicon"=>"http://www.google.com/profiles/c/favicons?domain=www.iceskysl.com", "updated_at"=>2012-06-24 15:34:43 UTC, "created_at"=>2012-06-24 15:34:43 UTC, "_id"=>1}]) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Ruby & Rails"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Ruby & Rails", "updated_at"=>2012-06-24 15:35:07 UTC, "created_at"=>2012-06-24 15:35:07 UTC, "_id"=>2}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Database"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Database", "updated_at"=>2012-06-24 15:35:07 UTC, "created_at"=>2012-06-24 15:35:07 UTC, "_id"=>3}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:35:07 UTC, "body_html"=>"

点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

\n\n

Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

\n\n

1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

\n\n

2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

\n\n
    \n
  1. #eeww… we don’t like this one.

  2. \n
  3. if(x.nil?)

  4. \n
  5. x = get_some_object   4.  end\n
    \n
  6. \n
\n", "_id"=>2}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Tips"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Tips", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>4}]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"04. 无心呢喃 | Buzz"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"04. 无心呢喃 | Buzz", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>5}]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"01. 视觉观察 | Observe"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"01. 视觉观察 | Observe", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>6}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Mac & *UNIX"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Mac & *UNIX", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>7}]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Security"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Security", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>8}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Architecture"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Architecture", "updated_at"=>2012-06-24 15:35:08 UTC, "created_at"=>2012-06-24 15:35:08 UTC, "_id"=>9}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:35:08 UTC, "body_html"=>"

在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

\n", "_id"=>3}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Html/css/js"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Html/css/js", "updated_at"=>2012-06-24 15:35:09 UTC, "created_at"=>2012-06-24 15:35:09 UTC, "_id"=>10}]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
$ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
\r\n
[iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

\n\n

1、Java版本(JDK)

\n\n

$ java -version
\njava version "1.4.2_11"
\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

\n\n

2、weblogic版本

\n\n

查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

\n\n

$ cat log.txt
\n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
\nrelease 8.1.3.0 [Added]

\n\n

3、Oracle版本

\n\n

(1)用客户端连接到数据库,执行select * from v$instance查看version项
\n(2)select * from product_component_version
\n(3)或查询V$VERSION查看组件级信息

\n\n

4、内核
\n$ uname -a
\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
\n[iceskysl@oj-web03 logs]$ cat /proc/version
\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
\n$df

\n\n", "_id"=>4}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

\n\n

According to the official Ruby security advisory, the vulnerable Rubies are:

\n\n\n\n

Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

\n\n

(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

\n", "_id"=>5}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

\n\n

以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
\n
\n参考文档:
\n1、acts_as_sphinx plugin
\n2、JavaEye3.0开发手记之三 - 狮身人面
\n3、使用libmmseg实现Ruby的中文分词功能
\n4、Plugins - Ultrasphinx
\n5、Rails程序员Sphinx中文全文检索安装指南
\n6、Sphinx

\n", "_id"=>6}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

\n\n

参考资料:

\n\n

1.rsync的安装和使用

\n\n
    \n
  1. rsync
  2. \n
\n", "_id"=>7}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

\n\n

而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

\n\n

另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

\n\n

用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

\n", "_id"=>8}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

\n\n

有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

\n\n

顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

\n\n

从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

\n\n

先占座,以后慢慢补充。

\n", "_id"=>9}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
\r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. require 'digest/md5'    
  2. \r\n\t
  3. #增加一个Helper方法    
  4. \r\n\t
  5. def gravatar_url_for(email, options = {})        
  6. \r\n\t
  7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
  8. \r\n\t
  9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
  10. \r\n\t
  11.        }.merge(options))      
  12. \r\n\t
  13. end    
  14. \r\n
\r\n
\r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. # plain old gravatar url      
  2. \r\n\t
  3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
  4. \r\n\t
  5.     
  6. \r\n\t
  7. # gravatar url with a rating threshold       
  8. \r\n\t
  9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
  10. \r\n\t
  11.     
  12. \r\n\t
  13. # show the avatar       
  14. \r\n\t
  15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
  16. \r\n\t
  17.     
  18. \r\n\t
  19. # show the avatar with size specified, in case it's served slowly      
  20. \r\n\t
  21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
  22. \r\n\t
  23.   
  24. \r\n\t
  25. # link the avatar to some/url    
  26. \r\n\t
  27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
  28. \r\n
\r\n
\r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
\nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

\n\n

这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

\n\n

使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

\n\n

<!--more-->

\n\n

1、首先在`application_helper.rb中增加一个helper方法
\n
\nRuby代码
\n
\n require 'digest/md5'    
\n #增加一个Helper方法    
\n def gravatar_url_for(email, options = {})        
\n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
\n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
\n        }.merge(options))      
\n end    
\n
\n
\n 

\n\n

2、然后就可以在view里面直接使用了
\n
\nRuby代码
\n
\n # plain old gravatar url      
\n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
\n     
\n # gravatar url with a rating threshold       
\n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
\n     
\n # show the avatar       
\n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
\n     
\n # show the avatar with size specified, in case it's served slowly      
\n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
\n   
\n # link the avatar to some/url    
\n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
\n
\n
\nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

\n\n

 

\n", "_id"=>10}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. # vulnerable controller code  
  2. \r\n\t
  3. User.find(:all:limit => params[:limit])  
  4. \r\n\t
  5.   
  6. \r\n\t
  7. User.find(:all:limit => 10, :offset => params[:offset])  
  8. \r\n\t
  9.   
  10. \r\n\t
  11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
  12. \r\n\t
  13. # you got a big problem ...  
  14. \r\n
\r\n
\r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

\n\n

大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

\n\n

 
\n
\nRuby代码
\n
\n # vulnerable controller code  
\n User.find(:all, :limit => params[:limit])  
\n   
\n User.find(:all, :limit => 10, :offset => params[:offset])  
\n   
\n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
\n # you got a big problem ...  
\n
\n
\n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

\n\n

幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

\n\n

现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

\n\n

参考文档: Why you should upgrade to Rails 2.1  0 

\n", "_id"=>11}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
\niceskysl@IceskYsl:/opt/devroot$ df
\n文件系统           1K-块        已用     可用 已用% 挂载点
\n/dev/sda8             10309796   9547180    238900  98% /
\nvarrun                  772952       228    772724   1% /var/run
\nvarlock                 772952         0    772952   0% /var/lock
\nudev                    772952        72    772880   1% /dev
\ndevshm                  772952         0    772952   0% /dev/shm
\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
\n/dev/sda7                93307     92784         0 100% /boot
\n/dev/sda9              9614116   5557504   3568240  61% /home
\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

\n\n

可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

\n", "_id"=>12}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. before_filter :set_wap_content_type:only => :wap  
  2. \r\n\t
  3.   
  4. \r\n\t
  5. def set_wap_content_type  
  6. \r\n\t
  7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
  8. \r\n\t
  9. end  
  10. \r\n
\r\n
\r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
\r\n
XML/HTML代码
\r\n
    \r\n\t
  1. <?xml version=”1.0″?>  
  2. \r\n\t
  3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
  4. \r\n\t
  5. <wml>  
  6. \r\n\t
  7. <card title=”<%= @title %>>  
  8. \r\n\t
  9. <p align=”center”>  
  10. \r\n\t
  11. <%= @content_for_layout %>  
  12. \r\n\t
  13. </p>  
  14. \r\n\t
  15. </card>  
  16. \r\n\t
  17. </wml>  
  18. \r\n
\r\n
\r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. def wap  
  2. \r\n\t
  3.   @title = \"San Francisco Sailing Weather\"  
  4. \r\n\t
  5.   render(:layout => \"wml\")  
  6. \r\n\t
  7. end  
  8. \r\n
\r\n
\r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
\r\n
XML/HTML代码
\r\n
    \r\n\t
  1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
  2. \r\n\t
  3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
  4. \r\n\t
  5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
  6. \r\n
\r\n
\r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. Mime::Type.register \"text/vnd.wap.wml\":wml  
  2. \r\n
\r\n
\r\n
\r\n2、判断请求类型```\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. # application.rb  
  2. \r\n\t
  3. before_filter :adjust_format_for_beta  
  4. \r\n\t
  5.   
  6. \r\n\t
  7. ...  
  8. \r\n\t
  9.   
  10. \r\n\t
  11. def adjust_format_for_beta  
  12. \r\n\t
  13.   request.format = :beta if beta_request?   
  14. \r\n\t
  15. end  
  16. \r\n\t
  17.   
  18. \r\n\t
  19. def beta_request?  
  20. \r\n\t
  21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
  22. \r\n\t
  23. end  
  24. \r\n
\r\n
\r\n
\r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
\r\n
XML/HTML代码
\r\n
    \r\n\t
  1. xml.instruct! :xml, :version => \"1.0\"  
  2. \r\n\t
  3. xml.wml \"xml:lang\" => \"en-gb\" do  
  4. \r\n\t
  5.   xml.card :title => \"My title here\" do  
  6. \r\n\t
  7.     xml.p \"Something interesting here\"  
  8. \r\n\t
  9.     xml.p \"Something else interesting here.\"  
  10. \r\n\t
  11.   end  
  12. \r\n\t
  13. end  
  14. \r\n
\r\n
\r\n
\r\n4、添加输出类型支持```\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. def index  
  2. \r\n\t
  3.   respond_to do |format|  
  4. \r\n\t
  5.     format.html  
  6. \r\n\t
  7.     format.wml  
  8. \r\n\t
  9.   end  
  10. \r\n\t
  11. end  
  12. \r\n
\r\n
\r\n
\r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

\n\n

总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

\n\n

一、按照一般方式支持

\n\n

这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

\n\n

1、在app/controllers/application.rb中增加对WAP格式输出的支持
\n
\nRuby代码
\n
\n before_filter :set_wap_content_type, :only => :wap  
\n   
\n def set_wap_content_type  
\n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
\n end  
\n
\n
\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
\n
\nXML/HTML代码
\n
\n <?xml version=”1.0″?>  
\n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
\n <wml>  
\n <card title=”<%= @title %>”>  
\n <p align=”center”>  
\n <%= @content_for_layout %>  
\n </p>  
\n </card>  
\n </wml>  
\n
\n
\n3、在我的controller中(index)中增加一个action用来响应WAP请求。
\n
\nRuby代码
\n
\n def wap  
\n   @title = "San Francisco Sailing Weather"  
\n   render(:layout => "wml")  
\n end  
\n
\n
\n4、添加相应的view模板app/views/index/wap.rhtml
\n
\nXML/HTML代码
\n
\n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
\n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
\n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
\n
\n
\n 

\n\n

二、使用Rails2支持的多模板类型支持

\n\n

在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

\n\n

1、添加MIME格式支持

\n\n

在config/environment.rb中增加MIME的格式支持,方式如下:
\n
\nRuby代码
\n
\n Mime::Type.register "text/vnd.wap.wml", :wml  
\n
\n
\n
\n2、判断请求类型
\n<div class="codeText">
\n<div class="codeHead">Ruby代码</div>
\n<ol class="dp-rb" start="1">
\n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
\n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
\n <li class="alt"><span>  </span></li>
\n <li><span>...  </span></li>
\n <li class="alt"><span>  </span></li>
\n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
\n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
\n <li><span><span class="keyword">end</span><span>  </span></span></li>
\n <li class="alt"><span>  </span></li>
\n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
\n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
\n <li><span><span class="keyword">end</span><span>  </span></span></li>
\n</ol>
\n</div>
\n<pre style="font-size: 90%;">
\n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

\n
\nXML/HTML代码
\n
\n xml.instruct! :xml, :version => "1.0"  
\n xml.wml "xml:lang" => "en-gb" do  
\n   xml.card :title => "My title here" do  
\n     xml.p "Something interesting here"  
\n     xml.p "Something else interesting here."  
\n   end  
\n end  
\n
\n
\n
\n4、添加输出类型支持
\n<div class="codeText">
\n<div class="codeHead">Ruby代码</div>
\n<ol class="dp-rb" start="1">
\n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
\n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
\n <li class="alt"><span>    format.html  </span></li>
\n <li><span>    format.wml  </span></li>
\n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
\n <li><span><span class="keyword">end</span><span>  </span></span></li>
\n</ol>
\n</div>
\n<pre style="font-size: 90%;">
\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

\n参考资文章:

\n\n

1、Making your Rails app mobile with WAP and WML
\n2、Ruby on Rails (and some WAP)
\n3、Redesign your site in place using Rails custom mime types

\n\n

参考资料:

\n\n

W3schools WAP tutorial
\nW3schools WML reference
\nWeb based WAP Emulator

\n\n

 

\n", "_id"=>13}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

工作需要,出差北京,晚上7点飞机,深圳到北京。

\n\n

第一次去北京,充满期待,有请我吃饭的没?

\n", "_id"=>14}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

\n\n

一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

\n\n

同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

\n\n

我在等什么....

\n\n

或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

\n", "_id"=>15}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"03. 技术归总 | Technic"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"03. 技术归总 | Technic", "updated_at"=>2012-06-24 15:35:09 UTC, "created_at"=>2012-06-24 15:35:09 UTC, "_id"=>11}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
\r\n
Java代码
\r\n
    \r\n\t
  1. public String getIpAddr(HttpServletRequest request) {
  2. \r\n\t
  3. String ip = request.getHeader(\"x-forwarded-for\");
  4. \r\n\t
  5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
  6. \r\n\t
  7. ip = request.getHeader(\"Proxy-Client-IP\");
  8. \r\n\t
  9. }
  10. \r\n\t
  11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
  12. \r\n\t
  13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
  14. \r\n\t
  15. }
  16. \r\n\t
  17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
  18. \r\n\t
  19. ip = request.getRemoteAddr();
  20. \r\n\t
  21. }
  22. \r\n\t
  23. return ip;
  24. \r\n\t
  25. }
  26. \r\n
\r\n
\r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

\n\n

我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

\n\n

最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

\n\n

如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

\n\n

经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

\n\n

给出一份还算靠谱的代码,如下:
\n
\nJava代码
\n
\n public String getIpAddr(HttpServletRequest request) {
\n String ip = request.getHeader("x-forwarded-for");
\n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
\n ip = request.getHeader("Proxy-Client-IP");
\n }
\n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
\n ip = request.getHeader("WL-Proxy-Client-IP");
\n }
\n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
\n ip = request.getRemoteAddr();
\n }
\n return ip;
\n }
\n
\n
\n如果有人遇到类似问题,请多加留意,呵呵。

\n\n

PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

\n\n

参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

\n", "_id"=>16}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
\n-----------------使用---------------
\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
\n
\n1.创建git的数据库
\nC:\\Git\\bin>git init-db

\n\n

2.生成一个文件xxx并加入到git中
\nC:\\Git\\bin>echo hello > xxx
\nC:\\Git\\bin>git add xxx

\n\n

3.提交[以上两步与标准教程还是一样的,关键是这一步]
\nC:\\Git\\bin>set home=c:\\
\nC:\\Git\\bin>git config --global user.name "clq"
\nC:\\Git\\bin>git commit -m "test"

\n\n

一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

\n\n

4.改一下xxx文件
\necho world >> xxx

\n\n

5.查看一下它和我们原来对比的有什么不同
\nC:\\Git\\bin>git diff

\n\n

结果如下
\ndiff --git a/xxx b/xxx
\nindex 907cd4b..360c7f4 100644
\n--- a/xxx
\n+++ b/xxx
\n@@ -1 +1,2 @@
\nhello
\n+world
\n(END)

\n\n

用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
\n提交可以用一个命令来完成
\ngit commit -m "" -a xxx

\n\n

省去git add

\n\n

C:\\Git\\bin>git show xxx
\n查看最近一次提交的信息.

\n\n

C:\\Git\\bin>git commit -a -m"aa"

\n\n

提交全部更改过的文件.

\n", "_id"=>17}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
\n
\n http://rspec.info/
\n Telling a good story - Rspec stories from the trenches
\n Slides from RailsConf
\n rspec plain text stories + webrat = chunky bacon!
\n http://chinaonrails.com/topic/view/220.html
\n Story Driven Development with Rails - Part I: Up and Running
\n
\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

\n", "_id"=>18}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Android & Java"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Android & Java", "updated_at"=>2012-06-24 15:35:09 UTC, "created_at"=>2012-06-24 15:35:09 UTC, "_id"=>12}]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

Thin version 1.0.0 (codename That's What She Said) is out!

\n\n

Yes 1.0! That doesn't mean it's bug free or anything. But, it does
\nmean that it's been running on a number of servers and no show stopper
\nbugs have been found since a while.

\n\n

Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

\n\n

== What's new?

\n\n
    \n
  • Fixed vlad.rake to allow TCP or socket [hellekin]
  • \n
  • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
  • \n
  • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
  • \n
  • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
  • \n
  • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
  • \n
  • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
  • \n
  • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
  • \n
  • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
  • \n
  • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
  • \n
  • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
  • \n
  • Update halycon adapter loader [mtodd]
  • \n
\n\n

== Get it!

\n\n

Install Thin from RubyForge:

\n\n

gem install thin

\n\n

Or using my mirror:

\n\n

gem install thin --source http://code.macournoyer.com

\n\n

参考文档:
\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

\n", "_id"=>19}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
\r\n
Manifest:
\r\n
    \r\n\t
  1. README                - You're reading it now.  
  2. \r\n\t
  3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
  4. \r\n\t
  5. CHANGES               - sneetchalizer's cvs/svn commit log.  
  6. \r\n\t
  7. sneetchalizer         - The script itself.  
  8. \r\n\t
  9. sneetchalizer.1       - The manpage for sneetchalizer.  
  10. \r\n\t
  11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
  12. \r\n\t
  13. install.rb            - A quick and dirty script to install the sneetchalizer.  
  14. \r\n
\r\n
\r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
\r\n
XML/HTML代码
\r\n
    \r\n\t
  1. General options:  
  2. \r\n\t
  3.   
  4. \r\n\t
  5. -h or --help  
  6. \r\n\t
  7.     Print quick or full usage details respectively.  
  8. \r\n\t
  9. -r or --recursive  
  10. \r\n\t
  11.     Search directory arguments recursively for files to convert.  
  12. \r\n\t
  13. -d or --delete  
  14. \r\n\t
  15.     delete input files after successful conversion. May not be safe yet!!!  
  16. \r\n\t
  17. -v or --verbose  
  18. \r\n\t
  19.     makes sneetchalizer more chatty.  
  20. \r\n\t
  21. -s or --show-output  
  22. \r\n\t
  23.     shows output from conversion tool.  
  24. \r\n\t
  25. -p or --pretend  
  26. \r\n\t
  27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
  28. \r\n\t
  29. -t or --terminate  
  30. \r\n\t
  31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
  32. \r\n\t
  33. -D ARG or --out-directory=ARG  
  34. \r\n\t
  35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
  36. \r\n\t
  37. --strict and --pedantic  
  38. \r\n\t
  39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
  40. \r\n\t
  41. --stasis  
  42. \r\n\t
  43.     Preserve timestamp (mtime) of original file.  
  44. \r\n\t
  45. --threads [N]  
  46. \r\n\t
  47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
  48. \r\n\t
  49. --sanitize  
  50. \r\n\t
  51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
  52. \r\n\t
  53. -n [FORMAT] or --rename[=FORMAT]  
  54. \r\n\t
  55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
  56. \r\n\t
  57.   
  58. \r\n\t
  59.         * %t Song title  
  60. \r\n\t
  61.         * %b Album title  
  62. \r\n\t
  63.         * %n Track number  
  64. \r\n\t
  65.         * %a Artist name  
  66. \r\n\t
  67.         * %y Year  
  68. \r\n\t
  69.         * %g Genre  
  70. \r\n\t
  71.         * %c Comment field  
  72. \r\n\t
  73.   
  74. \r\n\t
  75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
  76. \r\n\t
  77.   
  78. \r\n\t
  79. Bitrate/Quality/Compression options:  
  80. \r\n\t
  81.   
  82. \r\n\t
  83. -b or --bitrate  
  84. \r\n\t
  85.     mp3/ogg/m4a bitrate.  
  86. \r\n\t
  87. -q or --quality  
  88. \r\n\t
  89.     mp3/ogg quality.  
  90. \r\n\t
  91.   
  92. \r\n\t
  93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
  94. \r\n\t
  95.   
  96. \r\n\t
  97. -c or --compression  
  98. \r\n\t
  99.     flac/mac compression level.  
  100. \r\n\t
  101.   
  102. \r\n\t
  103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
  104. \r\n\t
  105.   
  106. \r\n\t
  107. Format Options:  
  108. \r\n\t
  109.   
  110. \r\n\t
  111. --out=format  
  112. \r\n\t
  113.     output format. Default is wav.  
  114. \r\n\t
  115. --in=format[,format..]  
  116. \r\n\t
  117.     input format(s). Default is wav.  
  118. \r\n\t
  119.   
  120. \r\n\t
  121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
  122. \r\n\t
  123.   
  124. \r\n\t
  125. Tagging Options:  
  126. \r\n\t
  127.   
  128. \r\n\t
  129. --tt or --title  
  130. \r\n\t
  131.     Set 'title' tag.  
  132. \r\n\t
  133. --ta or --artist  
  134. \r\n\t
  135.     Set 'artist' tag.  
  136. \r\n\t
  137. --tl or --album  
  138. \r\n\t
  139.     Set 'album' tag.  
  140. \r\n\t
  141. --ty or --year  
  142. \r\n\t
  143.     Set 'year' tag.  
  144. \r\n\t
  145. --tc or --comment  
  146. \r\n\t
  147.     Set 'comment' tag.  
  148. \r\n\t
  149. --tg or --genre  
  150. \r\n\t
  151.     Set 'genre' tag.  
  152. \r\n\t
  153. --tn or --trackn  
  154. \r\n\t
  155.     Set 'track number' tag.  
  156. \r\n\t
  157.   
  158. \r\n\t
  159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
  160. \r\n\t
  161.   
  162. \r\n\t
  163. Alternative Encoder/Decoder Options:  
  164. \r\n\t
  165.   
  166. \r\n\t
  167. --gogo  
  168. \r\n\t
  169.     use gogo to encode mp3 files.  
  170. \r\n\t
  171. --bladeenc  
  172. \r\n\t
  173.     use bladeenc to encode mp3 files.  
  174. \r\n\t
  175.   
  176. \r\n\t
  177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
  178. \r\n\t
  179.   
  180. \r\n\t
  181. Special Options:  
  182. \r\n\t
  183.   
  184. \r\n\t
  185. --in-optionhook=ARG  
  186. \r\n\t
  187.     add ARG to infile conversion command. Possibly dangerous!  
  188. \r\n\t
  189. --out-optionhook=ARG  
  190. \r\n\t
  191.     add ARG to outfile conversion command. Possibly dangerous!   
  192. \r\n
\r\n
\r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
\r\n
使用示例:
\r\n
    \r\n\t
  1. $ sneetchalizer song.mp3  
  2. \r\n\t
  3.   
  4. \r\n\t
  5. The most simple possible example, creates 'song.wav'.  
  6. \r\n\t
  7.   
  8. \r\n\t
  9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
  10. \r\n\t
  11.   
  12. \r\n\t
  13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
  14. \r\n\t
  15.   
  16. \r\n\t
  17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
  18. \r\n\t
  19.   
  20. \r\n\t
  21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
  22. \r\n\t
  23.   
  24. \r\n\t
  25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
  26. \r\n\t
  27.   
  28. \r\n\t
  29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
  30. \r\n\t
  31.   
  32. \r\n\t
  33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
  34. \r\n\t
  35.   
  36. \r\n\t
  37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
  38. \r\n\t
  39.   
  40. \r\n\t
  41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
  42. \r\n\t
  43.   
  44. \r\n\t
  45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
  46. \r\n
\r\n
\r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

\n\n\n

sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

\n\n

其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

\n\n

使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

\n\n

1、安装方法

\n\n

直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
\n
\nManifest:
\n
\n README                - You're reading it now.  
\n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
\n CHANGES               - sneetchalizer's cvs/svn commit log.  
\n sneetchalizer         - The script itself.  
\n sneetchalizer.1       - The manpage for sneetchalizer.  
\n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
\n install.rb            - A quick and dirty script to install the sneetchalizer.  
\n
\n
\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

\n\n

2、参数解释

\n\n

不翻译了,都挺简单明了的,如下:
\n
\nXML/HTML代码
\n
\n General options:  
\n   
\n -h or --help  
\n     Print quick or full usage details respectively.  
\n -r or --recursive  
\n     Search directory arguments recursively for files to convert.  
\n -d or --delete  
\n     delete input files after successful conversion. May not be safe yet!!!  
\n -v or --verbose  
\n     makes sneetchalizer more chatty.  
\n -s or --show-output  
\n     shows output from conversion tool.  
\n -p or --pretend  
\n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
\n -t or --terminate  
\n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
\n -D ARG or --out-directory=ARG  
\n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
\n --strict and --pedantic  
\n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
\n --stasis  
\n     Preserve timestamp (mtime) of original file.  
\n --threads [N]  
\n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
\n --sanitize  
\n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
\n -n [FORMAT] or --rename[=FORMAT]  
\n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
\n   
\n         * %t Song title  
\n         * %b Album title  
\n         * %n Track number  
\n         * %a Artist name  
\n         * %y Year  
\n         * %g Genre  
\n         * %c Comment field  
\n   
\n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
\n   
\n Bitrate/Quality/Compression options:  
\n   
\n -b or --bitrate  
\n     mp3/ogg/m4a bitrate.  
\n -q or --quality  
\n     mp3/ogg quality.  
\n   
\n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
\n   
\n -c or --compression  
\n     flac/mac compression level.  
\n   
\n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
\n   
\n Format Options:  
\n   
\n --out=format  
\n     output format. Default is wav.  
\n --in=format[,format..]  
\n     input format(s). Default is wav.  
\n   
\n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
\n   
\n Tagging Options:  
\n   
\n --tt or --title  
\n     Set 'title' tag.  
\n --ta or --artist  
\n     Set 'artist' tag.  
\n --tl or --album  
\n     Set 'album' tag.  
\n --ty or --year  
\n     Set 'year' tag.  
\n --tc or --comment  
\n     Set 'comment' tag.  
\n --tg or --genre  
\n     Set 'genre' tag.  
\n --tn or --trackn  
\n     Set 'track number' tag.  
\n   
\n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
\n   
\n Alternative Encoder/Decoder Options:  
\n   
\n --gogo  
\n     use gogo to encode mp3 files.  
\n --bladeenc  
\n     use bladeenc to encode mp3 files.  
\n   
\n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
\n   
\n Special Options:  
\n   
\n --in-optionhook=ARG  
\n     add ARG to infile conversion command. Possibly dangerous!  
\n --out-optionhook=ARG  
\n     add ARG to outfile conversion command. Possibly dangerous!   
\n
\n
\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

\n\n

3、使用示例

\n\n

如下简要的写几个使用的示例:
\n
\n使用示例:
\n
\n $ sneetchalizer song.mp3  
\n   
\n The most simple possible example, creates 'song.wav'.  
\n   
\n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
\n   
\n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
\n   
\n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
\n   
\n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
\n   
\n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
\n   
\n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
\n   
\n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
\n   
\n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
\n   
\n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
\n   
\n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
\n
\n
\n4、注意事项

\n\n

本脚本只是粘合剂,其他的tool还是需要另外安装的。

\n\n

其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

\n\n\n

 

\n", "_id"=>20}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

\n\n

对dbanotes等表示感谢。

\n\n

WikiPedia 技术架构学习分享
\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

\n\n

YouTube 的架构扩展
\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

\n\n

LinkedIn 架构笔记
\nhttp://www.dbanotes.net/arch/linkedin.html

\n\n

LinkedIn 架构与开发过程
\nhttp://www.dbanotes.net/arch/linkedin_soa.html

\n\n

Internet Archive 的海量存储浅析
\nhttp://www.dbanotes.net/database/internet_archive_storage.html

\n\n

Tailrank 网站架构
\nhttp://www.dbanotes.net/review/tailrank_arch.html

\n\n

Twitter 的架构扩展: 100 倍性能提升
\nhttp://www.dbanotes.net/arch/twitter_arch.html

\n\n

财帮子(caibangzi.com)网站架构
\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

\n\n

Yupoo! 的网站技术架构
\nhttp://www.dbanotes.net/arch/yupoo_arch.html

\n\n

37Signals 架构
\nhttp://www.dbanotes.net/arch/37signals_arch.html

\n\n

Flickr 的访问统计实现以及其他
\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

\n\n

PlentyOfFish 网站架构学习
\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

\n\n

Yahoo!社区架构
\nhttp://www.dbanotes.net/arch/yahoo_arch.html

\n\n

有关 Alexa 与 AOL 部署集群文件系统
\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

\n\n

eBay 的存储一瞥
\nhttp://www.dbanotes.net/arch/ebay_storage.html

\n\n

eBay 的数据量
\nhttp://www.dbanotes.net/database/ebay_storage.html

\n\n

eBay 的数据库分布扩展架构
\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

\n\n

eBay 的数据层扩展经验
\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

\n\n

eBay 的应用服务器规模
\nhttp://www.dbanotes.net/web/ebay_application_server.html

\n\n

性能扩展问题要趁早
\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

\n\n

Scaling an early stage startup
\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

\n\n

Facebook 的 PHP 性能与扩展性
\nhttp://www.dbanotes.net/arch/facebook_php.html

\n\n

Skype 用 PostgreSQL 支撑海量用户
\nhttp://www.dbanotes.net/arch/skype_postgresql.html

\n\n

闲谈 Web 图片服务器
\nhttp://www.dbanotes.net/web/web_image_server.html

\n\n

说说北京奥运购票系统瘫痪这事儿
\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

\n\n

Architectures You’ve Always Wondered About
\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

\n\n

eBay’s Architectural Principles
\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

\n\n

Building a large scale SaaS app
\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

\n\n

Scaling an early stage startup
\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

\n\n

互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
\nhttp://www.flashmov.com/blog_1632.html

\n\n

QQ游戏百万人同时在线服务器架构实现
\nhttp://www.libing.net.cn/read.php?41

\n\n

大型Web2.0站点构建技术初探
\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

\n\n

Web站点数据库分布存储浅谈
\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

\n\n

QQ的架构讨论
\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

\n\n

Notes from Scaling MySQL - Up or Out
\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

\n\n

Yapache-Yahoo! Apache 的秘密
\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

\n\n

Scalability Best Practices: Lessons from eBay
\nhttp://www.infoq.com/articles/ebay-scalability-best-practices

\n", "_id"=>21}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
快捷键定义作用
cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
<tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
nNext message查看邮件时,定位光标到
pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
uReturn to conversation list刷新页面、返回收件箱或返回会话列表
yArchive*\r\nRemove from current view\r\n

删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

\r\n\r\n
    \r\n\t
  • 在“已加星标示”中,<Y>可取消选中会话的星号;
  • \r\n\t
  • 在查看有标签的邮件时,<Y>可取消标签。
  • \r\n\t
  • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
  • \r\n
\r\n
xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
sStar a message or conversation为会话或消息加星标。
!Report spam将消息标记为垃圾邮件并从会话中删除
rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
<Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
y then oArchive and next存档选中的会话并打开下一个
g then aGo to 'All Mail'转到“所有邮件”
g then sGo to 'Starred'转到“已加星标”
g then cGo to 'Contacts'转到“通讯录”
g then dGo to 'Drafts'转到“草稿”
g then iGo to 'Inbox'转到“收件箱”
/Search将光标定位到搜索栏中的输入框中
\r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:35:09 UTC, "body_html"=>"

Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
\n
\n
\n
\n快捷键
\n定义
\n作用
\n
\n
\nc
\nCompose 
\n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
\n
\n
\n<tab> then <Enter>
\nSend message
\n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
\n
\n
\nk
\nMove to newer conversation
\n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
\n
\n
\nj
\nMove to older conversation
\n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
\n
\n
\nn
\nNext message
\n查看邮件时,定位光标到
\n
\n
\np
\nPrevious message
\n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
\n
\n
\no or <Enter>
\nOpen
\n打开会话。在“Conversation View”中,也可用于打开消息。
\n
\n
\nu
\nReturn to conversation list
\n刷新页面、返回收件箱或返回会话列表
\n
\n
\ny
\nArchive*
\nRemove from current view
\n
\n删除会话或消息。
\n在收件箱中,<Y>可“存档”选中的会话

\n\n

在“已加星标示”中,<Y>可取消选中会话的星号;
\n 在查看有标签的邮件时,<Y>可取消标签。
\n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
\n
\n
\n
\n
\nx
\nSelect conversation
\n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
\n
\n
\ns
\nStar a message or conversation
\n为会话或消息加星标。
\n
\n
\n!
\nReport spam
\n将消息标记为垃圾邮件并从会话中删除
\n
\n
\nr
\nReply
\n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
\n
\n
\na
\nReply all
\n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
\n
\n
\nf
\nForward
\n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
\n
\n
\n<Esc>
\nEscape from input field
\nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
\n
\n
\ny then o
\nArchive and next
\n存档选中的会话并打开下一个
\n
\n
\ng then a
\nGo to 'All Mail'
\n转到“所有邮件”
\n
\n
\ng then s
\nGo to 'Starred'
\n转到“已加星标”
\n
\n
\ng then c
\nGo to 'Contacts'
\n转到“通讯录”
\n
\n
\ng then d
\nGo to 'Drafts'
\n转到“草稿”
\n
\n
\ng then i
\nGo to 'Inbox'
\n转到“收件箱”
\n
\n
\n/
\nSearch
\n将光标定位到搜索栏中的输入框中
\n
\n
\n
\n 

\n", "_id"=>22}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

\n\n

安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

\n\n

使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

\n\n

--fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

\n\n

示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

\n\n

Request log analyzer, by Willem van Bergen and Bart ten Brinke

\n\n

Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

\n\n

Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

\n\n

Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

\n\n

Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

\n\n

Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

\n\n

Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

\n\n

Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

\n\n

Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

\n\n

Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

\n\n

Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

\n", "_id"=>23}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

其他参考文档:

\r\n\r\n
    \r\n\t
  1. 日志分割文档
  2. \r\n\t
  3. Apache和Resin产生大容量日志的解决办法
  4. \r\n\t
  5. Nginx的日志回滚
  6. \r\n
\r\n

", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

\n\n

其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

\n\n

1、Nginx Log Rotation

\n\n

Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
\n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

\n\n

2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
\n其他参考文档:

\n\n

日志分割文档
\n Apache和Resin产生大容量日志的解决办法
\n Nginx的日志回滚
\n

\n", "_id"=>24}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
    \r\n\t
  • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
  • \r\n\t
  • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
  • \r\n
\r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. %w[benchmark pp rexml/document].each { |x| require x }  
  2. \r\n\t
  3.   
  4. \r\n\t
  5. ##################################  
  6. \r\n\t
  7. # Parsing Delicious API Response #  
  8. \r\n\t
  9. ##################################  
  10. \r\n\t
  11. xml = File.read('posts.xml')  
  12. \r\n\t
  13. puts Benchmark.measure {  
  14. \r\n\t
  15.   doc, posts = REXML::Document.new(xml), []  
  16. \r\n\t
  17.   doc.elements.each('posts/post'do |p|  
  18. \r\n\t
  19.     posts << p.attributes  
  20. \r\n\t
  21.   end  
  22. \r\n\t
  23.   # pp posts  
  24. \r\n\t
  25. }  
  26. \r\n\t
  27.   
  28. \r\n\t
  29. ################################  
  30. \r\n\t
  31. # Parsing Twitter API Response #  
  32. \r\n\t
  33. ################################  
  34. \r\n\t
  35. xml = File.read('timeline.xml')  
  36. \r\n\t
  37. puts Benchmark.measure {  
  38. \r\n\t
  39.   doc, statuses = REXML::Document.new(xml), []  
  40. \r\n\t
  41.   doc.elements.each('statuses/status'do |s|  
  42. \r\n\t
  43.     h = {:user => {}}  
  44. \r\n\t
  45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
  46. \r\n\t
  47.       h[a.intern] = s.elements[a].text  
  48. \r\n\t
  49.     end  
  50. \r\n\t
  51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
  52. \r\n\t
  53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
  54. \r\n\t
  55.     end  
  56. \r\n\t
  57.     statuses << h  
  58. \r\n\t
  59.   end  
  60. \r\n\t
  61.   # pp statuses  
  62. \r\n\t
  63. }  
  64. \r\n
\r\n
\r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. %w[benchmark pp rubygems].each { |x| require x }  
  2. \r\n\t
  3. gem 'hpricot''>= 0.6'  
  4. \r\n\t
  5. require 'hpricot'  
  6. \r\n\t
  7.   
  8. \r\n\t
  9. ##################################  
  10. \r\n\t
  11. # Parsing Delicious API Response #  
  12. \r\n\t
  13. ##################################  
  14. \r\n\t
  15. xml = File.read('posts.xml')  
  16. \r\n\t
  17. puts Benchmark.measure {  
  18. \r\n\t
  19.   doc, posts = Hpricot::XML(xml), []  
  20. \r\n\t
  21.   (doc/:post).each do |p|  
  22. \r\n\t
  23.     posts << p.attributes  
  24. \r\n\t
  25.   end  
  26. \r\n\t
  27.   # pp posts  
  28. \r\n\t
  29. }  
  30. \r\n\t
  31.   
  32. \r\n\t
  33. ################################  
  34. \r\n\t
  35. # Parsing Twitter API Response #  
  36. \r\n\t
  37. ################################  
  38. \r\n\t
  39. xml = File.read('timeline.xml')  
  40. \r\n\t
  41. puts Benchmark.measure {  
  42. \r\n\t
  43.   doc, statuses = Hpricot::XML(xml), []  
  44. \r\n\t
  45.   (doc/:status).each do |s|  
  46. \r\n\t
  47.     h = {:user => {}}  
  48. \r\n\t
  49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
  50. \r\n\t
  51.       h[a.intern] = s.at(a).innerHTML  
  52. \r\n\t
  53.     end  
  54. \r\n\t
  55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
  56. \r\n\t
  57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
  58. \r\n\t
  59.     end  
  60. \r\n\t
  61.     statuses << h  
  62. \r\n\t
  63.   end  
  64. \r\n\t
  65.   # pp statuses  
  66. \r\n\t
  67. }  
  68. \r\n
\r\n
\r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
\r\n
Ruby代码
\r\n
    \r\n\t
  1. %w[benchmark pp rubygems].each { |x| require x }  
  2. \r\n\t
  3. gem 'libxml-ruby''>= 0.8.3'  
  4. \r\n\t
  5. require 'xml'  
  6. \r\n\t
  7.   
  8. \r\n\t
  9. ##################################  
  10. \r\n\t
  11. # Parsing Delicious API Response #  
  12. \r\n\t
  13. ##################################  
  14. \r\n\t
  15. xml = File.read('posts.xml')  
  16. \r\n\t
  17. puts Benchmark.measure {  
  18. \r\n\t
  19.   parser, parser.string = XML::Parser.new, xml  
  20. \r\n\t
  21.   doc, posts = parser.parse, []  
  22. \r\n\t
  23.   doc.find('//posts/post').each do |p|  
  24. \r\n\t
  25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
  26. \r\n\t
  27.   end  
  28. \r\n\t
  29.   # pp posts  
  30. \r\n\t
  31. }  
  32. \r\n\t
  33.   
  34. \r\n\t
  35. ################################  
  36. \r\n\t
  37. # Parsing Twitter API Response #  
  38. \r\n\t
  39. ################################  
  40. \r\n\t
  41. xml = File.read('timeline.xml')  
  42. \r\n\t
  43. puts Benchmark.measure {  
  44. \r\n\t
  45.   parser, parser.string = XML::Parser.new, xml  
  46. \r\n\t
  47.   doc, statuses = parser.parse, []  
  48. \r\n\t
  49.   doc.find('//statuses/status').each do |s|  
  50. \r\n\t
  51.     h = {:user => {}}  
  52. \r\n\t
  53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
  54. \r\n\t
  55.       h[a.intern] = s.find(a).first.content  
  56. \r\n\t
  57.     end  
  58. \r\n\t
  59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
  60. \r\n\t
  61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
  62. \r\n\t
  63.     end  
  64. \r\n\t
  65.     statuses << h  
  66. \r\n\t
  67.   end  
  68. \r\n\t
  69.   # pp statuses  
  70. \r\n\t
  71. }  
  72. \r\n
\r\n
\r\n``三、结论``````\r\n
\r\n
结果如下:
\r\n
    \r\n\t
  1. =rexml  
  2. \r\n\t
  3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
  4. \r\n\t
  5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
  6. \r\n\t
  7.   
  8. \r\n\t
  9. =hpricot  
  10. \r\n\t
  11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
  12. \r\n\t
  13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
  14. \r\n\t
  15.   
  16. \r\n\t
  17. =libxml-ruby  
  18. \r\n\t
  19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
  20. \r\n\t
  21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
  22. \r\n
\r\n
\r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
\n一、原料
\n
\n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
\n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
\n
\n二、解析过程
\n1、REXML

\n\n

Pros: In the standard library
\nCons: Slow, I don’t like the name
\n
\nRuby代码
\n
\n %w[benchmark pp rexml/document].each { |x| require x }  
\n   
\n ##################################  
\n # Parsing Delicious API Response #  
\n ##################################  
\n xml = File.read('posts.xml')  
\n puts Benchmark.measure {  
\n   doc, posts = REXML::Document.new(xml), []  
\n   doc.elements.each('posts/post') do |p|  
\n     posts << p.attributes  
\n   end  
\n   # pp posts  
\n }  
\n   
\n ################################  
\n # Parsing Twitter API Response #  
\n ################################  
\n xml = File.read('timeline.xml')  
\n puts Benchmark.measure {  
\n   doc, statuses = REXML::Document.new(xml), []  
\n   doc.elements.each('statuses/status') do |s|  
\n     h = {:user => {}}  
\n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
\n       h[a.intern] = s.elements[a].text  
\n     end  
\n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
\n       h[:user][a.intern] = s.elements['user'].elements[a].text  
\n     end  
\n     statuses << h  
\n   end  
\n   # pp statuses  
\n }  
\n
\n
\n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
\n
\nRuby代码
\n
\n %w[benchmark pp rubygems].each { |x| require x }  
\n gem 'hpricot', '>= 0.6'  
\n require 'hpricot'  
\n   
\n ##################################  
\n # Parsing Delicious API Response #  
\n ##################################  
\n xml = File.read('posts.xml')  
\n puts Benchmark.measure {  
\n   doc, posts = Hpricot::XML(xml), []  
\n   (doc/:post).each do |p|  
\n     posts << p.attributes  
\n   end  
\n   # pp posts  
\n }  
\n   
\n ################################  
\n # Parsing Twitter API Response #  
\n ################################  
\n xml = File.read('timeline.xml')  
\n puts Benchmark.measure {  
\n   doc, statuses = Hpricot::XML(xml), []  
\n   (doc/:status).each do |s|  
\n     h = {:user => {}}  
\n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
\n       h[a.intern] = s.at(a).innerHTML  
\n     end  
\n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
\n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
\n     end  
\n     statuses << h  
\n   end  
\n   # pp statuses  
\n }  
\n
\n
\n3、libxml-ruby

\n\n

Pros: Blistering fast
\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
\n
\nRuby代码
\n
\n %w[benchmark pp rubygems].each { |x| require x }  
\n gem 'libxml-ruby', '>= 0.8.3'  
\n require 'xml'  
\n   
\n ##################################  
\n # Parsing Delicious API Response #  
\n ##################################  
\n xml = File.read('posts.xml')  
\n puts Benchmark.measure {  
\n   parser, parser.string = XML::Parser.new, xml  
\n   doc, posts = parser.parse, []  
\n   doc.find('//posts/post').each do |p|  
\n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
\n   end  
\n   # pp posts  
\n }  
\n   
\n ################################  
\n # Parsing Twitter API Response #  
\n ################################  
\n xml = File.read('timeline.xml')  
\n puts Benchmark.measure {  
\n   parser, parser.string = XML::Parser.new, xml  
\n   doc, statuses = parser.parse, []  
\n   doc.find('//statuses/status').each do |s|  
\n     h = {:user => {}}  
\n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
\n       h[a.intern] = s.find(a).first.content  
\n     end  
\n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
\n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
\n     end  
\n     statuses << h  
\n   end  
\n   # pp statuses  
\n }  
\n
\n
\n<code class="ruby"><strong>三、结论</strong>
\n<div class="codeText">
\n<div class="codeHead">结果如下:</div>
\n<ol class="dp-xml" start="1">
\n <li class="alt"><span><span>=rexml  </span></span></li>
\n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
\n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
\n <li><span>  </span></li>
\n <li class="alt"><span>=hpricot  </span></li>
\n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
\n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
\n <li><span>  </span></li>
\n <li class="alt"><span>=libxml-ruby  </span></li>
\n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
\n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
\n</ol>
\n</div>
\n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
``

\n", "_id"=>25}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

\n\n

1、在hosts文件添加DNS映射

\n\n

65.74.177.129 github.com
\n65.74.177.129 www.github.com

\n\n

2、使用其他的DNS服务器

\n\n

可以使用OpenDNS,比较见效。

\n", "_id"=>26}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
    \r\n\t
  • All without sharing your password off-site
  • \r\n\t
  • especially when there isn’t one like with OpenID
  • \r\n
\r\n其基本流程为:\r\n
    \r\n\t
  1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
  2. \r\n\t
  3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
  4. \r\n\t
  5. You store the RequestToken in your database or in the users session object
  6. \r\n\t
  7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
  8. \r\n\t
  9. Your user is asked by the service provider to authorize your RequestToken
  10. \r\n\t
  11. Your user clicks yes and is redirected to your CallBack URL
  12. \r\n\t
  13. Your callback action exchanges the RequestToken for an AccessToken
  14. \r\n\t
  15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
  16. \r\n\t
  17. ????
  18. \r\n\t
  19. PROFIT!!!
  20. \r\n
\r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

\n\n

OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
\n
\nOAuth’s Goal
\nWebsite X can access your protected data at API Y
\n
\n All without sharing your password off-site
\n especially when there isn’t one like with OpenID
\n
\n其基本流程为:
\n
\n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
\n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
\n You store the RequestToken in your database or in the users session object
\n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
\n Your user is asked by the service provider to authorize your RequestToken
\n Your user clicks yes and is redirected to your CallBack URL
\n Your callback action exchanges the RequestToken for an AccessToken
\n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
\n ????
\n PROFIT!!!
\n
\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
\n
\n参考文档:
\n
\n Developing OAuth clients in Ruby
\n How to turn your rails site into an OAuth Provider 
\n OAuth不断获得动力 
\n Rails plugin for OAuth
\n OAuth implementation for Ruby
\n 豆瓣 API 认证授权说明
\n The How of OAuth --这个PPT挺不错
\n

\n", "_id"=>27}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

晒历史的脚本:
\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
\n330 ll
\n214 cd
\n72 cat
\n38 exit
\n29 more
\n27 tail
\n20 vi
\n17 cp
\n16 ps
\n15 down
\n记录下而已~

\n", "_id"=>28}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

\n

(以下技巧是基于SDK 1.0的)

\n

一、申请Apikey,并放在正确的位置

\n

这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

\n

1、XML布局文件中

\n

<view android:id="@+id/mv"
\n   class="com.google.android.maps.MapView"
\n   android:layout_width="fill_parent"
\n   android:layout_height="fill_parent"
\n   android:layout_weight="1"
\n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
\n   />

\n

2、java中

\n

        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

\n

二、记得导入uses-library

\n

由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

\n

<uses-library android:name="com.google.android.maps" />
\n

\n

否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

\n

三、需要给予一定的权限

\n

因为要使用GoogleMAP的service,所以需要
\n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

\n

如果需要GPS等应用,还需要

\n

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

\n

四、Activity需要继承自MapActivity

\n

类似如下代码;

\n

package com.iceskysl.showmap;
\n
\nimport com.google.android.maps.MapActivity;
\n
\nimport android.os.Bundle;
\n
\npublic class ShowMap extends MapActivity {
\n    /** Called when the activity is first created. */
\n    @Override
\n    public void onCreate(Bundle savedInstanceState) {
\n        super.onCreate(savedInstanceState);
\n        setContentView(R.layout.main);
\n    }
\n
\n    @Override
\n    protected boolean isRouteDisplayed() {
\n        // TODO Auto-generated method stub
\n        return false;
\n    }
\n}
\n

", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
\n(以下技巧是基于SDK 1.0的)
\n一、申请Apikey,并放在正确的位置
\n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
\n1、XML布局文件中
\n<view android:id="@+id/mv"
\n   class="com.google.android.maps.MapView"
\n   android:layout_width="fill_parent"
\n   android:layout_height="fill_parent"
\n   android:layout_weight="1"
\n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
\n   />
\n2、java中
\n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
\n二、记得导入uses-library
\n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
\n<uses-library android:name="com.google.android.maps" />
\n
\n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
\n三、需要给予一定的权限
\n因为要使用GoogleMAP的service,所以需要
\n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
\n如果需要GPS等应用,还需要
\n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
\n四、Activity需要继承自MapActivity
\n类似如下代码;
\npackage com.iceskysl.showmap;
\n
\nimport com.google.android.maps.MapActivity;
\n
\nimport android.os.Bundle;
\n
\npublic class ShowMap extends MapActivity {
\n    /** Called when the activity is first created. */
\n    @Override
\n    public void onCreate(Bundle savedInstanceState) {
\n        super.onCreate(savedInstanceState);
\n        setContentView(R.layout.main);
\n    }
\n
\n    @Override
\n    protected boolean isRouteDisplayed() {
\n        // TODO Auto-generated method stub
\n        return false;
\n    }
\n}

\n", "_id"=>29}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

\n", "_id"=>30}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

\r\n

明天回去工作,新年新气象,希望一切顺利.

", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
\n明天回去工作,新年新气象,希望一切顺利.

\n", "_id"=>31}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
\n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
\n
\nMicrosoft Windows XP [版本 5.1.2600]
\n(C) 版权所有 1985-2001 Microsoft Corp.
\n
\nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
\nubyonrails.org
\nERROR:  Error installing rails:
\n        actionpack requires rack (>= 0.9.0, runtime)
\n
\nC:\\Documents and Settings\\Administrator>gem install rack
\nSuccessfully installed rack-0.9.1
\n1 gem installed
\nInstalling ri documentation for rack-0.9.1...
\nInstalling RDoc documentation for rack-0.9.1...
\n
\nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
\nubyonrails.org
\nSuccessfully installed actionpack-2.3.0
\nSuccessfully installed actionmailer-2.3.0
\nSuccessfully installed activeresource-2.3.0
\nSuccessfully installed rails-2.3.0
\n4 gems installed
\nInstalling ri documentation for actionpack-2.3.0...
\nInstalling ri documentation for actionmailer-2.3.0...
\nInstalling ri documentation for activeresource-2.3.0...
\nInstalling RDoc documentation for actionpack-2.3.0...
\nInstalling RDoc documentation for actionmailer-2.3.0...
\nInstalling RDoc documentation for activeresource-2.3.0...
\n
\nC:\\Documents and Settings\\Administrator>

", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
\n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
\n
\nMicrosoft Windows XP [版本 5.1.2600]
\n(C) 版权所有 1985-2001 Microsoft Corp.
\n
\nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
\nubyonrails.org
\nERROR:  Error installing rails:
\n        actionpack requires rack (>= 0.9.0, runtime)
\n
\nC:\\Documents and Settings\\Administrator>gem install rack
\nSuccessfully installed rack-0.9.1
\n1 gem installed
\nInstalling ri documentation for rack-0.9.1...
\nInstalling RDoc documentation for rack-0.9.1...
\n
\nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
\nubyonrails.org
\nSuccessfully installed actionpack-2.3.0
\nSuccessfully installed actionmailer-2.3.0
\nSuccessfully installed activeresource-2.3.0
\nSuccessfully installed rails-2.3.0
\n4 gems installed
\nInstalling ri documentation for actionpack-2.3.0...
\nInstalling ri documentation for actionmailer-2.3.0...
\nInstalling ri documentation for activeresource-2.3.0...
\nInstalling RDoc documentation for actionpack-2.3.0...
\nInstalling RDoc documentation for actionmailer-2.3.0...
\nInstalling RDoc documentation for activeresource-2.3.0...
\n
\nC:\\Documents and Settings\\Administrator>

\n", "_id"=>32}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

\n

    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
\n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

\n

\n

Order.scoped_by_customer_id(12)
Order.scoped_by_customer_id(12).find(:all,
:conditions => "status = 'open'")
Order.scoped_by_customer_id(12).scoped_by_status("open")
```\n

\n

\n

\n

\n

参考:

\n

http://guides.rubyonrails.org/2_3_release_notes.html

\n

http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
\n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
\n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
\n
\nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
\n
\n
\n
\n
\n Lead Contributor: Yaroslav Markin
\n
\n
\n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
\n
\n
\n
\n参考:
\nhttp://guides.rubyonrails.org/2_3_release_notes.html
\nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

\n", "_id"=>33}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

\n

\n

\n
Ruby代码
\n
    \n
  1. def URLDecode(str)  
  2. \n
  3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
  4. \n
  5. end  
  6. \n
  7.    
  8. \n
  9. def URLEncode(str)  
  10. \n
  11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
  12. \n
  13. end  
  14. \n
\n
\n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

\n

看下他的写法:

\n

\n

\n
Ruby代码
\n
    \n
  1. # File lib/cgi-lib.rb, line 134  
  2. \n
  3.   def CGI::escape(str)  
  4. \n
  5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
  6. \n
  7.   end  
  8. \n
  9.   
  10. \n
  11. # File lib/cgi-lib.rb, line 139  
  12. \n
  13.   def CGI::unescape(str)  
  14. \n
  15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
  16. \n
  17.   end  
  18. \n
\n
\n

\n

 

", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
\n
\n
\nRuby代码
\n
\n def URLDecode(str)  
\n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
\n end  
\n    
\n def URLEncode(str)  
\n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
\n end  
\n
\n
\n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
\n看下他的写法:
\n
\n
\nRuby代码
\n
\n # File lib/cgi-lib.rb, line 134  
\n   def CGI::escape(str)  
\n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
\n   end  
\n   
\n # File lib/cgi-lib.rb, line 139  
\n   def CGI::unescape(str)  
\n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
\n   end  
\n
\n
\n
\n 

\n", "_id"=>34}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
\n
\nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
\n
\nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

\n
\n
Ruby代码
\n
    \n
  1. module Builder  
  2. \n
  3.   class XmlBase  
  4. \n
  5.     def _escape(text)  
  6. \n
  7.       text  
  8. \n
  9.     end  
  10. \n
  11.   end  
  12. \n
  13. end   
  14. \n
\n
\n


\nWhat's the proper way to do this?
\n
\nPS:
\nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
\n
\nmore infos:
\nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

\n

 

", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
\n
\nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
\n
\nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
\n
\nRuby代码
\n
\n module Builder  
\n   class XmlBase  
\n     def _escape(text)  
\n       text  
\n     end  
\n   end  
\n end   
\n
\n
\n
\nWhat's the proper way to do this?
\n
\nPS:
\nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
\n
\nmore infos:
\nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
\n 

\n", "_id"=>35}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
\n
Ruby代码
\n
    \n\t
  1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
  2. \n
\n
\nor:\n
\n
Ruby代码
\n
    \n\t
  1. def newpass( len )
  2. \n\t
  3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
  4. \n\t
  5. newpass = \"\"
  6. \n\t
  7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
  8. \n\t
  9. return newpass
  10. \n\t
  11. end
  12. \n
\n
", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
\n
\nRuby代码
\n
\n Array.new(6) { (rand(122-97) + 97).chr }.join
\n
\n
\n
\nor:
\n
\nRuby代码
\n
\n def newpass( len )
\n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
\n newpass = ""
\n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
\n return newpass
\n end
\n

\n", "_id"=>36}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

\n

here is some tips:
\n
\n1、Install MYSQL:sudo port install mysql5
\n
2、init some tables:sudo mysql_install_db5
\n
3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
\n

\n

Here is some userfull resource links:
\nhttp://www.macruby.org/trac/wiki/Troubleshooting
\nhttp://www.caibaohua.com/blog/2008/12/02/51/
\nhttp://haoxiai.net/shujuku/mysql/102114.html

", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

here is some tips:
\n
\n1、Install MYSQL:sudo port install mysql5
\n2、init some tables:sudo mysql_install_db5
\n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
\n
\nHere is some userfull resource links:
\nhttp://www.macruby.org/trac/wiki/Troubleshooting
\nhttp://www.caibaohua.com/blog/2008/12/02/51/
\nhttp://haoxiai.net/shujuku/mysql/102114.html

\n", "_id"=>37}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

Some tips for mount&umount ,maybe give you some help..

\n

cdrom:
\n# mount -t is09660 /dev/cdrom /mnt/cdrom
\n# umount /mnt/cdrom
\n
\nfloppy:
\n# mount /dev/fd0 /mnt/floppy
\n#umount /mnt/floppy
\n
\nusb:
\n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
\n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
\n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
\n4.#umount /mnt/usb
\n
\nhda:
\n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
\n2.then use 'make /mnt/vfat' to create a mount point;
\n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
\n4.#umount /mnt/vfat

\n

and some usefull resource links and docs here:

\n

http://unix-cd.com/unixcd12/article_3967.html

\n

http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

Some tips for mount&umount ,maybe give you some help..
\ncdrom:

\n\n

mount -t is09660 /dev/cdrom /mnt/cdrom

\n\n

umount /mnt/cdrom

\n\n

floppy:

\n\n

mount /dev/fd0 /mnt/floppy

\n\n

umount /mnt/floppy

\n\n

usb:
\n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
\n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
\n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
\n4.#umount /mnt/usb
\n
\nhda:
\n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
\n2.then use 'make /mnt/vfat' to create a mount point;
\n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
\n4.#umount /mnt/vfat
\nand some usefull resource links and docs here:
\nhttp://unix-cd.com/unixcd12/article_3967.html
\nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

\n", "_id"=>38}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

\n

\"\"

\n

\"\"

\n

 

\n

and here is some resource link url:

\n

http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

\n

http://tech.ddvip.com/2008-10/122492041983595.html

", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
\n
\n
\n 
\nand here is some resource link url:
\nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
\nhttp://tech.ddvip.com/2008-10/122492041983595.html

\n", "_id"=>39}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
\nLighttpd has this feature and there is a mod_xsendfile for Apache2.
\nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
\nThere are two main differences:

\n
    \n
  1. The header must contain a URI
  2. \n
  3. The location should be defined as internal; to prevent the client going directly to the URI
  4. \n
\n

\n

\n
Ruby代码
\n
    \n
  1. location /files {  
  2. \n
  3.     root /var/www;  
  4. \n
  5.     internal;  
  6. \n
  7. }  
  8. \n
\n
\n
\n
Ruby代码
\n
    \n
  1. // Get requested file name  
  2. \n
  3. path = @params["path"]  
  4. \n
  5.   
  6. \n
  7. # ...  
  8. \n
  9. # Perform any required security checks, validation   
  10. \n
  11. # and/or stats accounting  
  12. \n
  13. # ...  
  14. \n
  15.   
  16. \n
  17. # And redirect user to internal location  
  18. \n
  19. response.headers['X-Accel-Redirect'] = "/files/" + path  
  20. \n
\n
\n

\n

some userfull link resource come here:

\n\n

 

", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
\nLighttpd has this feature and there is a mod_xsendfile for Apache2.
\nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
\nThere are two main differences:
\n
\n The header must contain a URI
\n The location should be defined as internal; to prevent the client going directly to the URI
\n
\n
\n
\nRuby代码
\n
\n location /files {  
\n     root /var/www;  
\n     internal;  
\n }  
\n
\n
\n
\nRuby代码
\n
\n // Get requested file name  
\n path = @params["path"]  
\n   
\n # ...  
\n # Perform any required security checks, validation   
\n # and/or stats accounting  
\n # ...  
\n   
\n # And redirect user to internal location  
\n response.headers['X-Accel-Redirect'] = "/files/" + path  
\n
\n
\n
\nsome userfull link resource come here:
\n
\n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
\n http://wiki.codemongers.com/NginxXSendfile
\n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
\n
\n 

\n", "_id"=>40}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
\n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
\n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
\n
\nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
\n
\n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
\n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
\n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
\n4. you will notice it generate memcached key as mentioned above.
\n
\nI track it,and got this:

\n
\n
Ruby代码
\n
    \n
  1. def setup_memcache(config)  
  2. \n
  3.   config[:namespace] << "-\#{RAILS_ENV}"  
  4. \n
  5.   
  6. \n
  7.   silence_warnings do  
  8. \n
  9.     Object.const_set :CACHE, memcache_klass.new(config)  
  10. \n
  11.   end  
  12. \n
  13.   
  14. \n
  15.   CACHE.servers = Array(config.delete(:servers))  
  16. \n
  17.   
  18. \n
  19.   setup_session_store   if config[:sessions]  
  20. \n
  21.   setup_fragment_store! if config[:fragments]  
  22. \n
  23.   setup_fast_hash!      if config[:fast_hash]  
  24. \n
  25.   setup_fastest_hash!   if config[:fastest_hash]  
  26. \n
  27.   
  28. \n
  29.   CACHE  
  30. \n
  31. end  
  32. \n
\n
\n

shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

\n

some userfull link resources...

\n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
\n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
\n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
\n
\nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
\n
\n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
\n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
\n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
\n4. you will notice it generate memcached key as mentioned above.
\n
\nI track it,and got this:
\n
\nRuby代码
\n
\n def setup_memcache(config)  
\n   config[:namespace] << "-\#{RAILS_ENV}"  
\n   
\n   silence_warnings do  
\n     Object.const_set :CACHE, memcache_klass.new(config)  
\n   end  
\n   
\n   CACHE.servers = Array(config.delete(:servers))  
\n   
\n   setup_session_store   if config[:sessions]  
\n   setup_fragment_store! if config[:fragments]  
\n   setup_fast_hash!      if config[:fast_hash]  
\n   setup_fastest_hash!   if config[:fastest_hash]  
\n   
\n   CACHE  
\n end  
\n
\n
\nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
\nsome userfull link resources...
\n
\n http://errtheblog.com/posts/22-sessions-n-such
\n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
\n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
\n http://railscasts.com/episodes/115-caching-in-rails-2-1

\n", "_id"=>41}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

\n

In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

\n
\n

String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

\n
\n

\n

\n
C++代码
\n
    \n
  1. import Android.Provider.Settings.System;  
  2. \n
  3. ...  
  4. \n
  5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
  6. \n
\n
\nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

\n

Some userfull link resource come here:

\n
    \n
  • http://strazzere.com/blog/?tag=android_id
  • \n
  • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
  • \n
  • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
  • \n
  • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
  • \n
  • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
  • \n
\n

 

", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
\nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
\n
\nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
\n
\n
\n
\nC++代码
\n
\n import Android.Provider.Settings.System;  
\n ...  
\n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
\n
\n
\nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
\nSome userfull link resource come here:
\n
\n http://strazzere.com/blog/?tag=android_id
\n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
\n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
\n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
\n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
\n
\n 

\n", "_id"=>42}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

\n
\n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>43}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>44}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>45}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>46}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>47}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>48}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>49}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>50}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>51}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>52}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>53}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>54}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>55}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>56}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>57}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>58}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>59}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>60}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>61}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>62}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>63}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>64}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>65}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>66}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>67}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>68}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>69}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>70}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>71}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>72}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>73}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>74}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>75}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>76}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>77}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>78}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>79}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>80}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>81}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>82}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>83}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>84}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>85}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>86}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>87}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>88}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>89}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"02. 产品设计 | PM"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"02. 产品设计 | PM", "updated_at"=>2012-06-24 15:35:10 UTC, "created_at"=>2012-06-24 15:35:10 UTC, "_id"=>13}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>90}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>91}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>92}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>93}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>94}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>95}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>96}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>97}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>98}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>99}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>100}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>101}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>102}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>103}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>104}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>105}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>106}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>107}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>108}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>109}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>110}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>111}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>112}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>113}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>114}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>115}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>116}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>117}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>118}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>119}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>120}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>121}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>122}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>123}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>124}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>125}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>126}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>127}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>128}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>129}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>130}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>131}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>132}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>133}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>134}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>135}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>136}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:35:10 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>137}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) + + +Started GET "/" for 127.0.0.1 at 2012-06-24 23:35:42 +0800 +Processing by IndexController#index as HTML +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(10).sort([["updated_at", :desc], ["created_at", :desc]]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) + Rendered index/index.html.erb within layouts/application (30.9ms) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(15).sort([["updated_at", :desc], ["created_at", :desc]]) +MONGODB iceylog_development['categories'].find({}).limit(15) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['sites'].find({:deleted_at=>nil}).limit(15) + Rendered shared/_aside.html.erb (12.2ms) + Rendered shared/_google_analytics.html.erb (2.7ms) +Completed 200 OK in 294ms (Views: 224.2ms | Mongo: 6.9ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:36:03 +0800 +Processing by Cpanel::HomeController#index as HTML +Filter chain halted as :require_admin rendered or redirected +Completed 401 Unauthorized in 1ms + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:36:03 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB [DEBUG] Cursor#close 7982392450387980729 +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (100.2ms) +Completed 200 OK in 110ms (Views: 106.4ms | Mongo: 2.8ms) + +ActionController::RoutingError (No route matches [GET] "/assets/bg.png"): + actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' + actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' + railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app' + railties (3.2.3) lib/rails/rack/logger.rb:16:in `call' + /Users/ice/.rvm/gems/ruby-1.9.2-p290-patch/bundler/gems/quiet_assets-c42e29264a61/lib/quiet_assets.rb:12:in `call_with_quiet_assets' + actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call' + rack (1.4.1) lib/rack/methodoverride.rb:21:in `call' + rack (1.4.1) lib/rack/runtime.rb:17:in `call' + activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call' + rack (1.4.1) lib/rack/lock.rb:15:in `call' + actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call' + railties (3.2.3) lib/rails/engine.rb:479:in `call' + railties (3.2.3) lib/rails/application.rb:220:in `call' + rack (1.4.1) lib/rack/content_length.rb:14:in `call' + railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call' + rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service' + /Users/ice/.rvm/rubies/ruby-1.9.2-p290-patch/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' + /Users/ice/.rvm/rubies/ruby-1.9.2-p290-patch/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' + /Users/ice/.rvm/rubies/ruby-1.9.2-p290-patch/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' + + + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:37:03 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 6104635536010615949 +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (81.4ms) +Completed 200 OK in 90ms (Views: 85.9ms | Mongo: 1.5ms) + + +Started GET "/cpanel/posts?page=2" for 127.0.0.1 at 2012-06-24 23:37:38 +0800 +Processing by Cpanel::PostsController#index as HTML + Parameters: {"page"=>"2"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 9022113709587440562 +MONGODB iceylog_development['posts'].find({}).skip(30).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (17.4ms) +Completed 200 OK in 26ms (Views: 21.4ms | Mongo: 1.4ms) + + +Started GET "/cpanel/posts?page=5" for 127.0.0.1 at 2012-06-24 23:37:48 +0800 +Processing by Cpanel::PostsController#index as HTML + Parameters: {"page"=>"5"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['posts'].find({}).skip(120).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (10.5ms) +Completed 200 OK in 44ms (Views: 14.4ms | Mongo: 27.1ms) + + +Started GET "/cpanel/posts?page=3" for 127.0.0.1 at 2012-06-24 23:39:50 +0800 +Processing by Cpanel::PostsController#index as HTML + Parameters: {"page"=>"3"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 2447949089420486569 +MONGODB iceylog_development['posts'].find({}).skip(60).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (42.4ms) +Completed 200 OK in 62ms (Views: 46.0ms | Mongo: 1.6ms) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"site_configs"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"mongoid.auto_increment_ids"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"categories"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"pages"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"posts"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"sites"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"site_configs"}).limit(-1) +MONGODB iceylog_development['site_configs'].find({:key=>"site_title"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_title"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_title", "value"=>"Iceylog", "_id"=>1}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_slogan"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_slogan"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_slogan", "value"=>"Focus on Android,iPhone,Web,Business,Architecture,Agile,Technic and beyond…", "_id"=>2}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author", "value"=>"Icey", "_id"=>3}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_username"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_username"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_username", "value"=>"iceylog", "_id"=>4}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_password"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_password"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_password", "value"=>"password", "_id"=>5}]) +MONGODB iceylog_development['site_configs'].find({:key=>"about_me_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"about_me_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"about_me_html", "value"=>"
    \n

    IceskYsl, 简称Ice, 80后, 典型巨蟹男, 移动互联网创业者; Google产品重度依赖者, Mac, Android, iPhone, BB 非典型用户;关注创新,技术,产品和一切新奇的玩意儿;
    求学武汉, 毕业南下深圳, 尔后北漂在京, 至今数年有余; 追寻内心的想法, 不随波逐流, 爱折腾, 爱旅行, 孩子气, 享受工作, 安静的做喜欢的事情...

    \n
    \n", "_id"=>6}]) +MONGODB iceylog_development['site_configs'].find({:key=>"menu_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"menu_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"menu_html", "value"=>" \t\n", "_id"=>7}]) +MONGODB iceylog_development['site_configs'].find({:key=>"footer_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"footer_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"footer_html", "value"=>"

    Copyright ©2007-2012 - Lovingly authored by IceskYsl - All my work is MIT licensed, Open and Free.

    \n

    \n Powered by Iceylog - Theme by IceskYsl@1.s.t \n - Build by Markdown,\n GitHub, \n Disqus\n

    \t\n", "_id"=>8}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"categories"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"默认分类"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"默认分类", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>1}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"pages"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"about"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"about", "title"=>"About", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>1}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"book"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"book", "title"=>"Book", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>2}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"movie"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"movie", "title"=>"Movie", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>3}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"music"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"music", "title"=>"Music", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>4}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"team"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"team", "title"=>"Team", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>5}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"travel"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"travel", "title"=>"travel", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>6}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"toolkit"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"toolkit", "title"=>"Toolkit", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>7}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"posts"}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["demo", "tag"], "comments_count"=>0, "category_id"=>1, "title"=>"blog post title", "body"=>"This is a new post body,support **Markdown** format..", "updated_at"=>2012-06-24 15:43:35 UTC, "body_html"=>"

    This is a new post body,support Markdown format..

    \n", "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>1}]) +MONGODB iceylog_development['categories'].find({:_id=>1}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>1}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"sites"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{"$or"=>[{:url=>"http://www.iceskysl.com"}]}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"sites"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['sites'].insert([{"name"=>"Iceskysl Blog", "url"=>"http://www.iceskysl.com", "favicon"=>"http://www.google.com/profiles/c/favicons?domain=www.iceskysl.com", "updated_at"=>2012-06-24 15:43:35 UTC, "created_at"=>2012-06-24 15:43:35 UTC, "_id"=>1}]) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Ruby & Rails"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Ruby & Rails", "updated_at"=>2012-06-24 15:43:49 UTC, "created_at"=>2012-06-24 15:43:49 UTC, "_id"=>2}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Database"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Database", "updated_at"=>2012-06-24 15:43:49 UTC, "created_at"=>2012-06-24 15:43:49 UTC, "_id"=>3}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:43:49 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>2}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Tips"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Tips", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>4}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"04. 无心呢喃 | Buzz"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"04. 无心呢喃 | Buzz", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>5}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"01. 视觉观察 | Observe"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"01. 视觉观察 | Observe", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>6}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Mac & *UNIX"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Mac & *UNIX", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>7}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Security"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Security", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>8}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Architecture"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Architecture", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>9}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:43:50 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>3}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Html/css/js"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Html/css/js", "updated_at"=>2012-06-24 15:43:50 UTC, "created_at"=>2012-06-24 15:43:50 UTC, "_id"=>10}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>4}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>5}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>6}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>7}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>8}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>9}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>10}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>11}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>12}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>13}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>14}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>15}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"03. 技术归总 | Technic"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"03. 技术归总 | Technic", "updated_at"=>2012-06-24 15:43:51 UTC, "created_at"=>2012-06-24 15:43:51 UTC, "_id"=>11}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>16}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>17}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>18}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Android & Java"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Android & Java", "updated_at"=>2012-06-24 15:43:51 UTC, "created_at"=>2012-06-24 15:43:51 UTC, "_id"=>12}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>19}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>20}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>21}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>22}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>23}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>24}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>25}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>26}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>27}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>28}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>29}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>30}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>31}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>32}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>33}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>34}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>35}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>36}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>37}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>38}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>39}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>40}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>41}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>42}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>43}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>44}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>45}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>46}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>47}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>48}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>49}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>50}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>51}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>52}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>53}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>54}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>55}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>56}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>57}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>58}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>59}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>60}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>61}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>62}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>63}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>64}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>65}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>66}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>67}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>68}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>69}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>70}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>71}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>72}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>73}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>74}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>75}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>76}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>77}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>78}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>79}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>80}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>81}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>82}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>83}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>84}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>85}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>86}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>87}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>88}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:43:51 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>89}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"02. 产品设计 | PM"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"02. 产品设计 | PM", "updated_at"=>2012-06-24 15:43:52 UTC, "created_at"=>2012-06-24 15:43:52 UTC, "_id"=>13}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>90}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>91}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>92}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>93}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>94}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>95}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>96}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>97}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>98}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>99}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>100}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>101}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>102}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>103}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>104}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>105}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>106}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>107}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>108}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>109}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>110}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>111}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>112}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>113}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>114}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>115}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>116}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>117}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>118}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>119}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>120}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>121}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>122}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>123}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>124}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>125}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>126}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>127}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>128}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>129}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>130}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>131}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>132}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>133}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>134}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>135}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>136}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:43:52 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>137}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:45:28 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>138}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>139}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>140}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>141}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>142}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>143}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>144}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>145}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>146}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>147}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>148}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>149}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>150}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>151}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>152}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>153}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>154}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:45:29 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>155}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>156}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>157}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>158}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>159}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>160}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>161}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>162}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>163}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>164}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>165}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>166}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>167}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>168}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>169}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>170}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>171}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>172}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>173}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>174}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>175}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>176}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>177}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>178}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>179}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>180}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>181}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>182}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>183}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>184}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>185}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>186}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>187}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>188}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>189}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>190}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>191}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>192}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>193}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>194}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>195}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>196}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>197}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>198}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>199}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>200}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>201}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>202}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>203}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>204}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>205}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>206}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>207}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>208}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>209}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>210}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>211}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>212}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>213}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>214}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>215}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>216}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>217}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>218}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>219}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>220}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>221}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>222}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>223}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>224}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>225}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>226}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>227}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>228}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>229}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>230}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>231}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>232}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>233}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>234}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>235}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>236}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>237}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>238}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>239}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>240}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>241}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>242}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>243}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>244}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>245}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>246}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>247}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>248}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>249}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>250}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>251}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>252}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>253}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>254}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>255}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>256}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>257}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>258}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>259}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>260}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>261}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>262}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>263}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>264}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>265}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>266}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>267}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>268}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>269}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>270}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>271}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>272}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:45:30 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>273}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:45:35 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>274}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:45:35 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>275}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>276}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>277}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>278}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>279}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>280}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>281}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>282}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>283}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>284}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>285}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>286}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>287}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>288}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>289}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>290}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>291}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>292}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>293}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>294}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>295}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>296}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>297}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>298}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>299}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>300}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>301}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>302}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>303}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>304}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>305}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>306}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>307}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>308}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>309}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>310}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:45:36 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>311}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>312}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>313}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>314}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>315}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>316}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>317}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>318}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>319}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>320}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>321}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>322}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>323}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>324}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>325}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>326}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>327}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>328}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>329}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>330}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>331}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>332}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>333}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>334}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>335}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>336}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>337}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>338}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>339}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>340}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>341}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>342}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>343}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>344}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>345}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>346}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>347}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>348}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>349}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>350}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>351}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>352}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>353}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>354}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>355}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>356}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>357}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>358}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>359}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>360}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>361}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>362}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>363}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>364}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>365}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>366}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>367}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>368}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>369}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>370}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>371}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>372}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>373}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>374}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>375}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>376}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>377}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>378}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>379}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>380}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>381}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>382}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>383}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>384}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>385}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>386}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>387}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>388}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>389}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>390}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>391}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>392}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>393}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>394}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>395}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>396}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>397}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>398}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:45:37 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>399}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:46:45 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>400}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>401}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>402}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>403}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>404}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>405}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>406}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>407}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>408}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>409}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>410}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>411}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>412}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>413}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:46:46 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>414}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>415}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>416}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>417}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>418}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>419}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>420}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>421}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>422}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>423}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>424}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>425}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>426}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>427}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>428}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>429}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>430}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>431}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>432}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>433}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>434}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>435}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>436}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>437}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>438}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>439}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>440}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>441}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>442}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>443}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>444}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>445}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>446}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>447}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>448}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>449}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>450}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>451}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>452}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>453}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>454}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>455}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>456}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>457}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>458}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>459}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>460}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>461}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>462}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>463}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>464}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>465}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>466}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>467}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>468}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>469}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>470}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>471}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>472}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>473}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>474}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>475}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>476}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>477}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>478}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>479}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>480}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>481}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>482}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>483}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>484}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>485}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>486}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>487}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>488}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>489}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>490}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>491}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>492}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>493}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>494}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>495}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>496}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>497}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>498}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>499}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>500}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>501}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>502}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>503}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>504}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>505}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>506}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>507}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>508}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>509}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>510}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>511}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>512}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>513}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>514}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>515}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>516}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>517}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>518}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>519}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>520}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>521}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>522}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:46:47 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>523}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>524}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>525}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>526}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>527}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>528}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>529}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>530}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>531}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>532}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>533}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>534}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:46:48 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>535}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Making rhtml better", "body"=>"It’s even easier like this:in app/views/layouts/application.rhtml:<%= xhtml_doctype :strict %><%= html_tag :lang => Globalize::Locale.active.language.iso_639_1 %><%= @content_for_layout %><%= end_html_tag %>and in app/helpers/application_helper.rb:module ApplicationHelper # Renders an xhtml doctype declaration for the document's prolog. Defaults to xhtml transitional. # <tt>xhtml_doctype :strict</tt> def xhtml_doctype( doctype=:transitional ) doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype case doctype when :transitional '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' when :strict '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' when :frameset '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' end end # Displays an html tag, complete with xhtml namespace and language. Accepts language as an option, but defaults to English. # <tt>html_tag :lang => 'de'</tt> def html_tag( options={} ) options[:lang] ||= 'en' lang = options.delete( :lang ) "<html xmlns=\\"http://www.w3.org/1999/xhtml\\" lang=\\"\#{lang}\\" xml:lang=\\"\#{lang}\\" \#{options.map { |k,v| "\#{k}=\\"\#{v}\\"" }.join( ' ' )}>" end # End html tag. def end_html_tag; "</html>" endend", "created_at"=>2007-05-19 01:37:13 UTC, "updated_at"=>2012-06-24 15:47:00 UTC, "body_html"=>"

    It’s even easier like this:in app/views/layouts/application.rhtml:<%= xhtml_doctype :strict %><%= html_tag :lang => Globalize::Locale.active.language.iso_639_1 %><%= @content_for_layout %><%= end_html_tag %>and in app/helpers/application_helper.rb:module ApplicationHelper # Renders an xhtml doctype declaration for the document's prolog. Defaults to xhtml transitional. # <tt>xhtml_doctype :strict</tt> def xhtml_doctype( doctype=:transitional ) doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype case doctype when :transitional '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;' when :strict '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;' when :frameset '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">;' end end # Displays an html tag, complete with xhtml namespace and language. Accepts language as an option, but defaults to English. # <tt>html_tag :lang => 'de'</tt> def html_tag( options={} ) options[:lang] ||= 'en' lang = options.delete( :lang ) "<html xmlns=&quot;http://www.w3.org/1999/xhtml\\" lang=&quot;\#{lang}&quot; xml:lang=&quot;\#{lang}&quot; \#{options.map { |k,v| "\#{k}=&quot;\#{v}&quot;" }.join( ' ' )}>" end # End html tag. def end_html_tag; "</html>" endend

    \n", "_id"=>536}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Quick add slashes filter for Rails", "body"=>"读后:有的时候,需要在提交的URL后面自动加上"/",这个方法实现这样一个需求,你还可以扩展下去,比如在域名前加"http:\\\\"这样的字符。def add_slash unless %r{/$}.match(@request.path) redirect_to @request.path << '/' endendThis ensures you always have the trailing slash at the end of your URLs. Maybe it could be done better, but for now it works. Django has some stock middleware that does just this, as well as ensuring the first part of the hostname is ‘www’. The point is that your resource can be accessed with one and only one URL, rather than with potentially 4 combinations of / and www. I have no hard evidence, but this is supposedly good for teh Google, and some people find it elegant.I am thinking about maybe whipping up a module of such utilities that you could include in your ApplicationController and never think about again.", "created_at"=>2007-05-19 01:34:51 UTC, "updated_at"=>2012-06-24 15:47:00 UTC, "body_html"=>"

    读后:有的时候,需要在提交的URL后面自动加上"/",这个方法实现这样一个需求,你还可以扩展下去,比如在域名前加"http:\\"这样的字符。def add_slash unless %r{/$}.match(@request.path) redirect_to @request.path << '/' endendThis ensures you always have the trailing slash at the end of your URLs. Maybe it could be done better, but for now it works. Django has some stock middleware that does just this, as well as ensuring the first part of the hostname is ‘www’. The point is that your resource can be accessed with one and only one URL, rather than with potentially 4 combinations of / and www. I have no hard evidence, but this is supposedly good for teh Google, and some people find it elegant.I am thinking about maybe whipping up a module of such utilities that you could include in your ApplicationController and never think about again.

    \n", "_id"=>537}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>"Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:其API都很简单,详细的可以看这个页面上的介绍:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl只有一个构造器:FeedControl四个函数:1.addFeed(url, label) //添加需要显示的FEED的URL2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:feedControl.draw( document.getElementById("feedControl"), { drawMode : google.feeds.FeedControl.DRAW_MODE_TABBED });feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下: * google.feeds.LINK_TARGET_BLANK - links will open in a new window * google.feeds.LINK_TARGET_SELF - links will open in the current window * google.feeds.LINK_TARGET_TOP - links will open in the topmost frame * google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame. * anything-else - the value of target in the resulting anchor element is set to linkTarget附录其网站上的说明:---------------This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:var feedControl = new google.feeds.FeedControl();feedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");feedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");feedControl.draw(document.getElementById("feedControl"));In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed. * Basic FeedControl - feedcontrol.html * Tabbed FeedControl - tabbed.html * Sidebar Style FeedControl - sidebar.html * AJAX Feed API Playground Blog", "created_at"=>2007-05-19 01:32:26 UTC, "updated_at"=>2012-06-24 15:47:00 UTC, "body_html"=>"

    Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:其API都很简单,详细的可以看这个页面上的介绍:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl只有一个构造器:FeedControl四个函数:1.addFeed(url, label) //添加需要显示的FEED的URL2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:feedControl.draw( document.getElementById("feedControl"), { drawMode : google.feeds.FeedControl.DRAW_MODE_TABBED });feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下: * google.feeds.LINK_TARGET_BLANK - links will open in a new window * google.feeds.LINK_TARGET_SELF - links will open in the current window * google.feeds.LINK_TARGET_TOP - links will open in the topmost frame * google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame. * anything-else - the value of target in the resulting anchor element is set to linkTarget附录其网站上的说明:---------------This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:var feedControl = new google.feeds.FeedControl();feedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");feedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");feedControl.draw(document.getElementById("feedControl"));In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed. * Basic FeedControl - feedcontrol.html * Tabbed FeedControl - tabbed.html * Sidebar Style FeedControl - sidebar.html * AJAX Feed API Playground Blog

    \n", "_id"=>538}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Counting Distinct Records In Rails", "body"=>"If you ever need to count your Rails records based on a distinct column, here is a simple solution:Gift.count_by_sql("select count(distinct url) from gifts")In this example, I am counting the number of distinct gift urls from my gifts table.", "created_at"=>2007-05-19 01:30:32 UTC, "updated_at"=>2012-06-24 15:47:00 UTC, "body_html"=>"

    If you ever need to count your Rails records based on a distinct column, here is a simple solution:Gift.count_by_sql("select count(distinct url) from gifts")In this example, I am counting the number of distinct gift urls from my gifts table.

    \n", "_id"=>539}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Appending to a string(ROR中的+=和<<操作符的比较)", "body"=>"If you come from another language, you might be tempted to use the += operator when appending to a string. 1. my_str = "Marco " 2. my_str += "Polo"It works… but there is a better way to do it : the << method. 1. my_str = "Marco " 2. my_str << "Polo"#UPDATEI have removed my initial claim about operator precedence as it isn’t really accurate. There is a much better reason to use << instead of += when appending to a string... something I didn't even realize (Thanks to Gregory). += will create a new String instance and will assign it to your left object. On the other hand, << will append the new string directly into your already existing left object. One could argue that += is only different than << and not better, but to me << is what you'll want to use 99% of the time (if not 100%) when appending to a String. I have yet to see a real case where one would want to "lose" it's existing String instance just to get a new one containing the exact same value.You can also use the << method with arrays : 1. [1,2,3] << 4 #gives [1,2,3,4]、 Be careful however when using << with Fixnum/Bignum instances. With these objects, the << method will shift the bits of your integer to the left. If you want to do a summation (append style that is), you will have to use +=", "created_at"=>2007-05-19 01:29:16 UTC, "updated_at"=>2012-06-24 15:47:00 UTC, "body_html"=>"

    If you come from another language, you might be tempted to use the += operator when appending to a string. 1. my_str = "Marco " 2. my_str += "Polo"It works… but there is a better way to do it : the << method. 1. my_str = "Marco " 2. my_str << "Polo"#UPDATEI have removed my initial claim about operator precedence as it isn’t really accurate. There is a much better reason to use << instead of += when appending to a string... something I didn't even realize (Thanks to Gregory). += will create a new String instance and will assign it to your left object. On the other hand, << will append the new string directly into your already existing left object. One could argue that += is only different than << and not better, but to me << is what you'll want to use 99% of the time (if not 100%) when appending to a String. I have yet to see a real case where one would want to "lose" it's existing String instance just to get a new one containing the exact same value.You can also use the << method with arrays : 1. [1,2,3] << 4 #gives [1,2,3,4]、 Be careful however when using << with Fixnum/Bignum instances. With these objects, the << method will shift the bits of your integer to the left. If you want to do a summation (append style that is), you will have to use +=

    \n", "_id"=>540}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>541}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"有感史诗般对决的澳网决赛", "body"=>"我不打网球,从来不打,也不会打,但是就像冰壶一样,我喜欢看网球~年后上班第一天的晚上窝在沙发里看书,看到电视里在直播网球,一看是澳网决赛,小德vs纳豆,第四盘~立马来了精神~\n\n", "created_at"=>2012-01-29 07:09:37 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    我不打网球,从来不打,也不会打,但是就像冰壶一样,我喜欢看网球~年后上班第一天的晚上窝在沙发里看书,看到电视里在直播网球,一看是澳网决赛,小德vs纳豆,第四盘~立马来了精神~

    \n", "_id"=>542}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"CodeGear公司准备发布Ruby", "body"=>"CodeGear公司本周宣布他们将在2007年下半年发布针对rails的开发者Ruby集成开发环境(IDE)……  隶属Borland软件公司的开发工具业务公司CodeGear公布了即将发布的被称为“Ruby IDE”的部分信息,其主要特征包括: *   A full set of development and deployment modules including Ruby, Rails, Gems and Database. *   全面支持Ruby和Rails,具有代码完成、重构、类型浏览和导航等开发特性。 *   创新性的管理器集成了命令行的功能和IDE、向导与代码浏览器的易用性,提高了生产率。 *   可视化和导航依赖可以无缝的利用各种资源进行工作,不管它们的关系、位置或格式。 *   完整的开发和部署模块包括Ruby、Rails、 Gems和数据库。  Ruby IDE所包含的技术将有利于推动开源技术发展。CodeGear已经表示他们将为Ruby提供补丁及分发代码以支持Eclipse动态语言工具包的支持。  CodeGear生产战略事务副总裁Michael Swindell 在该公司发布的一次讲话中说到:“Ruby on Rails已经成为一个重要的Web应用程序开发平台,因为它使得利用最少的代码开发丰富、数据驱动Web2.0应用更快更简单。然而,生产力背后的“魔法”对开发人员“现实世界”生产力水平上Web应用的构建,开发和维护带来了新的挑战。”  Swindell说到:“我们新的Ruby on Rails 技术通过不再是仅仅编辑和调试Ruby脚本解决了这些挑战。它提供了一个综合的以Rails为中心的开发环境,该集成环境即适用于新手也适用于流线开发专家。同时,基于CodeGear IDE 的创新性,这是我们开发的第一个可同时吸引命令行开发者,IDE开发者和可视化开发者的工具。”来源:IT专家网", "created_at"=>2007-05-19 23:05:07 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    CodeGear公司本周宣布他们将在2007年下半年发布针对rails的开发者Ruby集成开发环境(IDE)……  隶属Borland软件公司的开发工具业务公司CodeGear公布了即将发布的被称为“Ruby IDE”的部分信息,其主要特征包括: *   A full set of development and deployment modules including Ruby, Rails, Gems and Database. *   全面支持Ruby和Rails,具有代码完成、重构、类型浏览和导航等开发特性。 *   创新性的管理器集成了命令行的功能和IDE、向导与代码浏览器的易用性,提高了生产率。 *   可视化和导航依赖可以无缝的利用各种资源进行工作,不管它们的关系、位置或格式。 *   完整的开发和部署模块包括Ruby、Rails、 Gems和数据库。  Ruby IDE所包含的技术将有利于推动开源技术发展。CodeGear已经表示他们将为Ruby提供补丁及分发代码以支持Eclipse动态语言工具包的支持。  CodeGear生产战略事务副总裁Michael Swindell 在该公司发布的一次讲话中说到:“Ruby on Rails已经成为一个重要的Web应用程序开发平台,因为它使得利用最少的代码开发丰富、数据驱动Web2.0应用更快更简单。然而,生产力背后的“魔法”对开发人员“现实世界”生产力水平上Web应用的构建,开发和维护带来了新的挑战。”  Swindell说到:“我们新的Ruby on Rails 技术通过不再是仅仅编辑和调试Ruby脚本解决了这些挑战。它提供了一个综合的以Rails为中心的开发环境,该集成环境即适用于新手也适用于流线开发专家。同时,基于CodeGear IDE 的创新性,这是我们开发的第一个可同时吸引命令行开发者,IDE开发者和可视化开发者的工具。”来源:IT专家网

    \n", "_id"=>543}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails view部分学习笔记", "body"=>"rails的view部分,是在controller执行完成后,通过显式或隐式调用render 寻找相关模板文件, 如 : rhtml 和rxml,并根据其生成相关页面推送至用户端。为了减少重复性,rails提供了一些复用机制:1、 layout 任何一个controller都可以有自己的layout(跟controller同名),该layout在其所有的action中共用。如果 controller没有设定自己的layout,rails会寻找application (controller的父类)的layout,当然也可以通过程序指定layout如: layout "standard" 或 render(:layout => "layouts/simple")也可以不使用layout用:render(:layout => false)在layout模板中需要有 : , 以表明实际内容的渲染位置。2、 action渲染模板缺省与action同名,也可以自己指定如:render(:action => "actionname") render(:template => 'controller/name')render(:file => 'dir/template')3、 partial除上述之外,rails还提供了局部页面模板,它用作当一些共享元件在很多页面都有使用是,可以提出成为一个局部页面模板,以提高复用性。通常把这些共享的局部模板放在目录: app/views/shared, 通过在模板中执行下面语句使用: 除了:object 还可以使用 :collection, :locals, :spacer_template 等参数另外,rails还提供组件的概念。为了提供ajax的支持, rails还提供了另外一种模板 rjs。rjs模板可以生成javascript代码。", "created_at"=>2007-05-19 22:30:36 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    rails的view部分,是在controller执行完成后,通过显式或隐式调用render 寻找相关模板文件, 如 : rhtml 和rxml,并根据其生成相关页面推送至用户端。为了减少重复性,rails提供了一些复用机制:1、 layout 任何一个controller都可以有自己的layout(跟controller同名),该layout在其所有的action中共用。如果 controller没有设定自己的layout,rails会寻找application (controller的父类)的layout,当然也可以通过程序指定layout如: layout "standard" 或 render(:layout => "layouts/simple")也可以不使用layout用:render(:layout => false)在layout模板中需要有 : , 以表明实际内容的渲染位置。2、 action渲染模板缺省与action同名,也可以自己指定如:render(:action => "actionname") render(:template => 'controller/name')render(:file => 'dir/template')3、 partial除上述之外,rails还提供了局部页面模板,它用作当一些共享元件在很多页面都有使用是,可以提出成为一个局部页面模板,以提高复用性。通常把这些共享的局部模板放在目录: app/views/shared, 通过在模板中执行下面语句使用: 除了:object 还可以使用 :collection, :locals, :spacer_template 等参数另外,rails还提供组件的概念。为了提供ajax的支持, rails还提供了另外一种模板 rjs。rjs模板可以生成javascript代码。

    \n", "_id"=>544}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"取各个板块的最近发帖方法", "body"=>"在论坛或者别的上面程序中,首页都会显示各个论坛板块的最新的帖子,请问这个是怎么实现的,按照我的设想,应该是这个的:@posts=Post.find(:all,:order=>"forum_id,create_at DESC" )然后在显示的时候按照forum_id来显示各自板块的最新帖子,但是这个在RHTML中怎么取出最新的帖子呢??我只能完全遍历,如下:<% @posts.each do |post| %><%= post.title %><% end %>这样就会全部显示出来,而我想要得只是每个板块的最新的那一个帖子,希望指教一二,谢了...--------1.个人参考Post.find_by_sql("select *,max(create_at) from post group forum_id"2.这样也许好一点:ruby 代码 1. forums = Forum.find :all 2. @last_post_of_forum = [] 3. for forum in forums 4. @last_post_of_forum << Post.find :first,:conditions=>['forum_id=?',forum.id], 5. :order => "create_at DESC",:limit => 1 1. end 或者你可以在models 中设置(参考自beast)。ruby 代码 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end views/form/index.rhtml代码 1. <td class="inv lp"> 2. <% if forum.posts.last %> 3. <%= time_ago_in_words(forum.posts.last.created_at) %><br /> 4. by <strong><%= h(forum.posts.last.user.display_name) %></strong> 5. <% end %> 6. </td>", "created_at"=>2007-05-19 22:29:27 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在论坛或者别的上面程序中,首页都会显示各个论坛板块的最新的帖子,请问这个是怎么实现的,按照我的设想,应该是这个的:@posts=Post.find(:all,:order=>"forum_id,create_at DESC" )然后在显示的时候按照forum_id来显示各自板块的最新帖子,但是这个在RHTML中怎么取出最新的帖子呢??我只能完全遍历,如下:<% @posts.each do |post| %><%= post.title %><% end %>这样就会全部显示出来,而我想要得只是每个板块的最新的那一个帖子,希望指教一二,谢了...--------1.个人参考Post.find_by_sql("select *,max(create_at) from post group forum_id"2.这样也许好一点:ruby 代码 1. forums = Forum.find :all 2. @last_post_of_forum = [] 3. for forum in forums 4. @last_post_of_forum << Post.find :first,:conditions=>['forum_id=?',forum.id], 5. :order => "create_at DESC",:limit => 1 1. end 或者你可以在models 中设置(参考自beast)。ruby 代码 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end views/form/index.rhtml代码 1. <td class="inv lp"> 2. <% if forum.posts.last %> 3. <%= time_ago_in_words(forum.posts.last.created_at) %><br /> 4. by <strong><%= h(forum.posts.last.user.display_name) %></strong> 5. <% end %> 6. </td>

    \n", "_id"=>545}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ROR与MySQL的中文显示", "body"=>"一、安装数据库:1、安装5.0版本。2、在安装时选择"utf-8"编码。3、如果安装时未选"utf-8",可用 MySQL Administrator 的 “Startup Variables”/”Advanced” 更改 Def. Char Set 为 “utf-8” 。或者编辑MySQL目录下的my.ini文件:[mysql]default-character-set=utf8SET NAMES 'utf8'[mysqld]default-character-set=utf84、安裝 MySQL Tools :MySQL Administrator ,MySQL Query Browser5、在MySQL Query Browser中执行:SHOW VARIABLES LIKE 'character_set_%'; 查询系统的字符串均为utf8。6、建立数据库。选择MyISAM,InnoDB都可以,不过后者支持事务处理,这是它的诱人之处。7、建立表。在用MySQL Query Browser创建表时,可再次指定字符集。并可以对数据库的存储引擎进行修改。二、开发工具:使用“RedRails”。并在其“属性”选项中选择编码为"utf-8"格式。这样,你的所有文件就都是utf8格式了。三、修改文件:A、将public/dispatch.cgi文件的#!/path/to/ruby后面加上-Ku -rjcodeB、修改app/controller/application.rb文件。class ApplicationController < ActionController::Basebefore_filter :set_charsetdef set_charset@headers["Content-Type"] = "text/html; charset=utf-8"endend四、问题:浏览器,与代码内的中文的显示都可以了。但数据库中的表为什么还是乱码呢?此问题按james的意见,对database.yml文件进行了修改,数据库显示中文正常。你的数据库连接串也需要加上utf-8的设置,如:在database.yml中需要加上development:adapter: mysqldatabase: databaseusername: rootpassword:host: localhostencoding: utf8五、问题二:如果一个表选择MyISAM引擎时,可为一个表建立两个外键约束,但若是InnDB引擎时,建立一个外键约束还可以,但建立两个外键约束时,会提示error:150错误,创建失败。总结一下:一、在MySql这边: 将Charecter设置成为utf8二、application.rbbefore_filter :configure_charsetsdef configure_charsets@response.headers["Content-Type"] = "text/html; charset=utf-8"# Set connection charset. MySQL 4.0 doesn’t support this so it# will throw an error, MySQL 4.1 needs thissuppress(ActiveRecord::StatementInvalid) doActiveRecord::Base.connection.execute 'SET NAMES UTF8'endend三、environment.rb$KCODE = 'u'require 'jcode'", "created_at"=>2007-05-19 22:26:33 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    一、安装数据库:1、安装5.0版本。2、在安装时选择"utf-8"编码。3、如果安装时未选"utf-8",可用 MySQL Administrator 的 “Startup Variables”/”Advanced” 更改 Def. Char Set 为 “utf-8” 。或者编辑MySQL目录下的my.ini文件:[mysql]default-character-set=utf8SET NAMES 'utf8'[mysqld]default-character-set=utf84、安裝 MySQL Tools :MySQL Administrator ,MySQL Query Browser5、在MySQL Query Browser中执行:SHOW VARIABLES LIKE 'characterset%'; 查询系统的字符串均为utf8。6、建立数据库。选择MyISAM,InnoDB都可以,不过后者支持事务处理,这是它的诱人之处。7、建立表。在用MySQL Query Browser创建表时,可再次指定字符集。并可以对数据库的存储引擎进行修改。二、开发工具:使用“RedRails”。并在其“属性”选项中选择编码为"utf-8"格式。这样,你的所有文件就都是utf8格式了。三、修改文件:A、将public/dispatch.cgi文件的#!/path/to/ruby后面加上-Ku -rjcodeB、修改app/controller/application.rb文件。class ApplicationController < ActionController::Basebefore_filter :set_charsetdef set_charset@headers["Content-Type"] = "text/html; charset=utf-8"endend四、问题:浏览器,与代码内的中文的显示都可以了。但数据库中的表为什么还是乱码呢?此问题按james的意见,对database.yml文件进行了修改,数据库显示中文正常。你的数据库连接串也需要加上utf-8的设置,如:在database.yml中需要加上development:adapter: mysqldatabase: databaseusername: rootpassword:host: localhostencoding: utf8五、问题二:如果一个表选择MyISAM引擎时,可为一个表建立两个外键约束,但若是InnDB引擎时,建立一个外键约束还可以,但建立两个外键约束时,会提示error:150错误,创建失败。总结一下:一、在MySql这边: 将Charecter设置成为utf8二、application.rbbefore_filter :configure_charsetsdef configure_charsets@response.headers["Content-Type"] = "text/html; charset=utf-8"# Set connection charset. MySQL 4.0 doesn’t support this so it# will throw an error, MySQL 4.1 needs thissuppress(ActiveRecord::StatementInvalid) doActiveRecord::Base.connection.execute 'SET NAMES UTF8'endend三、environment.rb$KCODE = 'u'require 'jcode'

    \n", "_id"=>546}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在防火墙后安装Rails", "body"=>"说到安装Rails,一般提到的方法就是使用rubygem,如果安装的是One-Click Installer – Windows版的ruby,里面自动附带了rubygem,如果不是,并且想用gem安装rails的话,到这里下载gem,http://rubyforge.org/frs/?group_id=126将它解压到任何目录下,到解压后的目录下,运行ruby setup.rb安装gem.如果还没有使用One-Click Installer,建议去装一个。下载地址如下:http://rubyforge.org/frs/?group_id=167然后是安装rails,官方网站上就明确教导大家用gem install rails --include-dependencies来安装rails。使用代理服务器上网的话,还可以通过指定参数 -p http://<代理服务器名>@<端口> 来进行安装。gem install rails -p http://<代理服务器名>@<端口>如果你的机器位于防火墙之后,或者有种种连接限制的环境下,则可以通过下载gem文件,用gem install ***.gem(保存到windows后会发现,gem文件的后缀实际上是.gem. tar)来进行安装。所有的gem文件都可以从以下网页下载:http://rubyforge.vm.bytemark.co.uk/gems/由于各个包之间有相互依赖的关系,所以安装的时候有安装顺序问题。不过即使安装顺序错误也问题不大,会有提示需要***.gem文件的*.*.*版本,去下载并安装就行了。保存gem文件后,转到gem文件所在目录,执行以下安装:笔者的安装顺序是1.)gem install rake-0.7.1.gem.tar2.) gem install activesupport-1.14.4.gem.tar3.) gem install activerecord-1.12.5.gem.tar4.) gem install actionpack-1.12.5.gem.tar5.) gem install actionmailer-1.2.5.gem.tar6.) gem install actionwebservice-1.1.6.gem.tar7.) gem install rails-1.1.6.gem.tar由于rake,active***.action***,rails等gem文件版本众多,笔者也不知道那个版本比较好,就全部挑了最新版进行安装。不过如果假如知道rails的1.1.4版比较稳定,可以将上面的顺序反过来,先试装rails,如果出错,出错信息里会包含所需要的gem(比如 actionwebservice)的版本,这样逆序找到所需的所有gem包之后,再顺序安装rake->active***-> action**->rails就可以了。 最后成功安装rails后,可以通过rails –v来确认安装,能看到C:\\>rails -vRails 1.1.6恭喜你,安装rails成功了。", "created_at"=>2007-05-19 22:25:12 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    说到安装Rails,一般提到的方法就是使用rubygem,如果安装的是One-Click Installer – Windows版的ruby,里面自动附带了rubygem,如果不是,并且想用gem安装rails的话,到这里下载gem,http://rubyforge.org/frs/?group_id=126ruby将它解压到任何目录下,到解压后的目录下,运行 setup.rb安装gem.如果还没有使用One-Click Installer,建议去装一个。下载地址如下:http://rubyforge.org/frs/?group_id=167然后是安装rails,官方网站上就明确教导大家用gem install rails --include-dependencies来安装rails。使用代理服务器上网的话,还可以通过指定参数 -p http://<代理服务器名>@<端口> 来进行安装。gem install rails -p http://<代理服务器名>@<端口>如果你的机器位于防火墙之后,或者有种种连接限制的环境下,则可以通过下载gem文件,用gem install .gem(保存到windows后会发现,gem文件的后缀实际上是.gem. tar)来进行安装。所有的gem文件都可以从以下网页下载:http://rubyforge.vm.bytemark.co.uk/gems/由于各个包之间有相互依赖的关系,所以安装的时候有安装顺序问题。不过即使安装顺序错误也问题不大,会有提示需要.gem文件的..版本,去下载并安装就行了。保存gem文件后,转到gem文件所在目录,执行以下安装:笔者的安装顺序是1.)gem install rake-0.7.1.gem.tar2.) gem install activesupport-1.14.4.gem.tar3.) gem install activerecord-1.12.5.gem.tar4.) gem install actionpack-1.12.5.gem.tar5.) gem install actionmailer-1.2.5.gem.tar6.) gem install actionwebservice-1.1.6.gem.tar7.) gem install rails-1.1.6.gem.tar由于rake,active.action,rails等gem文件版本众多,笔者也不知道那个版本比较好,就全部挑了最新版进行安装。不过如果假如知道rails的1.1.4版比较稳定,可以将上面的顺序反过来,先试装rails,如果出错,出错信息里会包含所需要的gem(比如 actionwebservice)的版本,这样逆序找到所需的所有gem包之后,再顺序安装rake->active-> action->rails就可以了。 最后成功安装rails后,可以通过rails –v来确认安装,能看到C:&gt;rails -vRails 1.1.6恭喜你,安装rails成功了。

    \n", "_id"=>547}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"纯CSS实现圆角效果", "body"=>"以前都是用背景图片来实现的,需要先切割好图片,很不方便,现在参考老外的一个做法,用纯CSS就可以实现这个效果,比起图片来,自然漂亮的多,下面是实现代码:<style type="text/css">#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}#xsnazzy h1 {font-size:2.5em; color:#fff;}#xsnazzy h2 {font-size:2em;color:#06a; border:0;}#xsnazzy p {padding-bottom:0.5em;}#xsnazzy h2 {padding-top:0.5em;}#xsnazzy {background: transparent; margin:1em;}.xtop, .xbottom {display:block; background:transparent; font-size:1px;}.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}.xb1, .xb2, .xb3 {height:1px;}.xb2, .xb3, .xb4 {background:#ccc; border-left:1px solid #08c; border-right:1px solid #08c;}.xb1 {margin:0 5px; background:#08c;}.xb2 {margin:0 3px; border-width:0 2px;}.xb3 {margin:0 2px;}.xb4 {height:2px; margin:0 1px;}.xboxcontent {display:block; background:#ccc; border:0 solid #08c; border-width:0 1px;}</style><div id="xsnazzy"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b><div class="xboxcontent"><h1>Snazzy Borders</h1><p>Based on Nifty Corners By Alessandro Fulciniti<br />http://pro.html.it/esempio/nifty/</p></div><b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>需要看效果的可以复制到本地,保存为HTML格式,打开就可以看到效果了..", "created_at"=>2007-05-19 22:23:05 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    以前都是用背景图片来实现的,需要先切割好图片,很不方便,现在参考老外的一个做法,用纯CSS就可以实现这个效果,比起图片来,自然漂亮的多,下面是实现代码:<style type="text/css">#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}#xsnazzy h1 {font-size:2.5em; color:#fff;}#xsnazzy h2 {font-size:2em;color:#06a; border:0;}#xsnazzy p {padding-bottom:0.5em;}#xsnazzy h2 {padding-top:0.5em;}#xsnazzy {background: transparent; margin:1em;}.xtop, .xbottom {display:block; background:transparent; font-size:1px;}.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}.xb1, .xb2, .xb3 {height:1px;}.xb2, .xb3, .xb4 {background:#ccc; border-left:1px solid #08c; border-right:1px solid #08c;}.xb1 {margin:0 5px; background:#08c;}.xb2 {margin:0 3px; border-width:0 2px;}.xb3 {margin:0 2px;}.xb4 {height:2px; margin:0 1px;}.xboxcontent {display:block; background:#ccc; border:0 solid #08c; border-width:0 1px;}</style><div id="xsnazzy"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b><div class="xboxcontent"><h1>Snazzy Borders</h1><p>Based on Nifty Corners By Alessandro Fulciniti<br />http://pro.html.it/esempio/nifty/</p></div><b; class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>需要看效果的可以复制到本地,保存为HTML格式,打开就可以看到效果了..

    \n", "_id"=>548}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"去掉CSS中的链接图片的外边框", "body"=>"在ROR的实际开发中,遇到这么一个情况:例如凡是有图片的地方,在图片外面显示了一个边框,很不好看,找了下资料,可以这样修复:1.如果是直接用image_tag来实现的 ,则加上:border => 0,结果如下:<%= link_to(image_tag("/images/btn_home.png", :border => 0), {:controller => "code"}) %>2.如果这个图片使用的是CSS中的DIV格式,则需要添加:border: 0就可以了.归结为:when images are used in links they put a border around them.To disable this globally (as most people do) add "img {border: 0}" to your css.", "created_at"=>2007-05-19 22:21:02 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在ROR的实际开发中,遇到这么一个情况:例如凡是有图片的地方,在图片外面显示了一个边框,很不好看,找了下资料,可以这样修复:1.如果是直接用image_tag来实现的 ,则加上:border => 0,结果如下:<%= link_to(image_tag("/images/btn_home.png", :border => 0), {:controller => "code"}) %>2.如果这个图片使用的是CSS中的DIV格式,则需要添加:border: 0就可以了.归结为:when images are used in links they put a border around them.To disable this globally (as most people do) add "img {border: 0}" to your css.

    \n", "_id"=>549}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"CSS控制整个框架居中显示", "body"=>"在整个ROR开发过程中,需要把整个框架居中,于是设置如下:body { margin:0 auto; font-family:arial; color:#000; width:900px; font-size:12pt;}按理论上这样就可以达到CSS居中控制DIV,但确不行,经过一上午的研究,终于搞定。添加3W的一段定义,应该是告诉IE按这种格式解析HTML。其实主要是因为我是手动写的代码,如果我用VS2005,这段是会自动添加的。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">", "created_at"=>2007-05-19 22:19:39 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在整个ROR开发过程中,需要把整个框架居中,于是设置如下:body { margin:0 auto; font-family:arial; color:#000; width:900px; font-size:12pt;}按理论上这样就可以达到CSS居中控制DIV,但确不行,经过一上午的研究,终于搞定。添加3W的一段定义,应该是告诉IE按这种格式解析HTML。其实主要是因为我是手动写的代码,如果我用VS2005,这段是会自动添加的。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html; xmlns="http://www.w3.org/1999/xhtml">

    \n", "_id"=>550}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby操作时间对象", "body"=>"在开发过程中,难免需要对时间对象进行一系列操作,比如统计新发的文章,统计在线会员等,如下是对时间对象的操作方法:distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)Reports the approximate distance in time between two Time or Date objects or integers as seconds. Set include_seconds to true if you want more detailed approximations when distance < 1 min, 29 secs Distances are reported base on the following table:0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1 minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours 23 hrs, 59 mins, 29 secs <-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days 29 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 31 secs # => [2..12] months 1 yr minus 30 secs <-> 2 yrs minus 31 secs # => about 1 year 2 yrs minus 30 secs <-> max time or date # => over [2..X] yearsWith include_seconds = true and the difference < 1 minute 29 seconds 0-4 secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19 secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs # => less than a minute 60-89 secs # => 1 minuteExamples: from_time = Time.now distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute distance_of_time_in_words(from_time, from_time + 15.seconds, true) # => less than 20 secondsNote: Rails calculates one year as 365.25 days.[ show source ] # File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 4848: def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)49: from_time = from_time.to_time if from_time.respond_to?(:to_time)50: to_time = to_time.to_time if to_time.respond_to?(:to_time)51: distance_in_minutes = (((to_time - from_time).abs)/60).round52: distance_in_seconds = ((to_time - from_time).abs).round53: 54: case distance_in_minutes55: when 0..156: return (distance_in_minutes == 0) ? 'less than a minute' : '1 minute' unless include_seconds57: case distance_in_seconds58: when 0..4 then 'less than 5 seconds'59: when 5..9 then 'less than 10 seconds'60: when 10..19 then 'less than 20 seconds'61: when 20..39 then 'half a minute'62: when 40..59 then 'less than a minute'63: else '1 minute'64: end65: 66: when 2..44 then "\#{distance_in_minutes} minutes"67: when 45..89 then 'about 1 hour'68: when 90..1439 then "about \#{(distance_in_minutes.to_f / 60.0).round} hours"69: when 1440..2879 then '1 day'70: when 2880..43199 then "\#{(distance_in_minutes / 1440).round} days"71: when 43200..86399 then 'about 1 month'72: when 86400..525959 then "\#{(distance_in_minutes / 43200).round} months"73: when 525960..1051919 then 'about 1 year'74: else "over \#{(distance_in_minutes / 525960).round} years"75: end76: enddistance_of_time_in_words_to_now(from_time, include_seconds = false)Alias for time_ago_in_words", "created_at"=>2007-05-19 22:18:11 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在开发过程中,难免需要对时间对象进行一系列操作,比如统计新发的文章,统计在线会员等,如下是对时间对象的操作方法:distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)Reports the approximate distance in time between two Time or Date objects or integers as seconds. Set include_seconds to true if you want more detailed approximations when distance < 1 min, 29 secs Distances are reported base on the following table:0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1 minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours 23 hrs, 59 mins, 29 secs <-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days 29 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 31 secs # => [2..12] months 1 yr minus 30 secs <-> 2 yrs minus 31 secs # => about 1 year 2 yrs minus 30 secs <-> max time or date # => over [2..X] yearsWith include_seconds = true and the difference < 1 minute 29 seconds 0-4 secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19 secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs # => less than a minute 60-89 secs # => 1 minuteExamples: from_time = Time.now distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute distance_of_time_in_words(from_time, from_time + 15.seconds, true) # => less than 20 secondsNote: Rails calculates one year as 365.25 days.[ show source ] # File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 4848: def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)49: from_time = from_time.to_time if from_time.respond_to?(:to_time)50: to_time = to_time.to_time if to_time.respond_to?(:to_time)51: distance_in_minutes = (((to_time - from_time).abs)/60).round52: distance_in_seconds = ((to_time - from_time).abs).round53: 54: case distance_in_minutes55: when 0..156: return (distance_in_minutes == 0) ? 'less than a minute' : '1 minute' unless include_seconds57: case distance_in_seconds58: when 0..4 then 'less than 5 seconds'59: when 5..9 then 'less than 10 seconds'60: when 10..19 then 'less than 20 seconds'61: when 20..39 then 'half a minute'62: when 40..59 then 'less than a minute'63: else '1 minute'64: end65: 66: when 2..44 then "\#{distance_in_minutes} minutes"67: when 45..89 then 'about 1 hour'68: when 90..1439 then "about \#{(distance_in_minutes.to_f / 60.0).round} hours"69: when 1440..2879 then '1 day'70: when 2880..43199 then "\#{(distance_in_minutes / 1440).round} days"71: when 43200..86399 then 'about 1 month'72: when 86400..525959 then "\#{(distance_in_minutes / 43200).round} months"73: when 525960..1051919 then 'about 1 year'74: else "over \#{(distance_in_minutes / 525960).round} years"75: end76: enddistance_of_time_in_words_to_now(from_time, include_seconds = false)Alias for time_ago_in_words

    \n", "_id"=>551}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给当前链接加上class属性", "body"=>"在WEB系统中,如果能给当前链接加上一些标识,那是一件比较high的事。link_to_unless_current 可以做到把当前的链接中去掉链接,不能指定我们自己的class类别,于是我们可以自己DIR,如下:写一个新的css类,例如叫:current然后把下面这个help方法加到您的help.rb中,然后在rhtml中进行引用,如下:def link_to_with_current_class_if_current(name, options = {}, html_options = {}, *parameters_for_method_reference) html_options[:class] = "current" if current_page?(options) link_to(name, options, html_options, *parameters_for_method_reference)end", "created_at"=>2007-05-19 22:16:18 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在WEB系统中,如果能给当前链接加上一些标识,那是一件比较high的事。link_to_unless_current 可以做到把当前的链接中去掉链接,不能指定我们自己的class类别,于是我们可以自己DIR,如下:写一个新的css类,例如叫:current然后把下面这个help方法加到您的help.rb中,然后在rhtml中进行引用,如下:def link_to_with_current_class_if_current(name, options = {}, html_options = {}, *parameters_for_method_reference) html_options[:class] = "current" if current_page?(options) link_to(name, options, html_options, *parameters_for_method_reference)end

    \n", "_id"=>552}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏最后四位字符", "body"=>"在这样一个需求中,可能会用到这个特性,需要把一个人的信用卡的最后几位(手机号码的最后几位)隐藏掉,用*代替,可以用这样来实现。。def mask_number(number) number.to_s.size < 5 ? number.to_s : (('*' * number.to_s[0..-5].length) + number.to_s[-4..-1])end 直接传递一个字符串或者数字都可以。。", "created_at"=>2007-05-19 22:14:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在这样一个需求中,可能会用到这个特性,需要把一个人的信用卡的最后几位(手机号码的最后几位)隐藏掉,用代替,可以用这样来实现。。def mask_number(number) number.to_s.size < 5 ? number.to_s : (('' * number.to_s[0..-5].length) + number.to_s[-4..-1])end 直接传递一个字符串或者数字都可以。。

    \n", "_id"=>553}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随机产生密码.", "body"=>"在WEB应用中,可能需要随机产生密码,比如一个用户的密码丢了,填写自己的取回密码的油箱后,可以随机产生一个密码给他,实现代码很简单,如下:def new_random_password self.password= Digest::SHA1.hexdigest("--\#{Time.now.to_s}--\#{login}--")[0,6] self.password_confirmation = self.passwordend然后在需要的地方调用就OK了.", "created_at"=>2007-05-19 22:13:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在WEB应用中,可能需要随机产生密码,比如一个用户的密码丢了,填写自己的取回密码的油箱后,可以随机产生一个密码给他,实现代码很简单,如下:def new_random_password self.password= Digest::SHA1.hexdigest("--\#{Time.now.to_s}--\#{login}--")[0,6] self.password_confirmation = self.passwordend然后在需要的地方调用就OK了.

    \n", "_id"=>554}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保证上传文件名字的唯一性", "body"=>"上传文件是都需要用到的功能,可以用以下代码实现:src_filename = params[:file][:name] if !src_filename.original_filename.empty? hashed_name = Digest::SHA1.hexdigest(Time.now.to_s) filename = "\#{RAILS_ROOT}/public/attachments/" + hashed_name + "_" + src_filename.original_filename if File.open(filename, 'w'){ |f| f.write(src_filename.read) } attachment = Attachment.new attachment.name = src_filename.original_filename attachment.hashed_name = hashed_name attachment.size = src_filename.size comment.attachments << attachment end end 当然,还有做一些后缀校验等。。。", "created_at"=>2007-05-19 22:11:32 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    上传文件是都需要用到的功能,可以用以下代码实现:srcfilename = params[:file][:name] if !src_filename.original_filename.empty? hashed_name = Digest::SHA1.hexdigest(Time.now.to_s) filename = "\#{RAILS_ROOT}/public/attachments/" + hashed_name + "" + src_filename.original_filename if File.open(filename, 'w'){ |f| f.write(src_filename.read) } attachment = Attachment.new attachment.name = src_filename.original_filename attachment.hashed_name = hashed_name attachment.size = src_filename.size comment.attachments << attachment end end 当然,还有做一些后缀校验等。。。

    \n", "_id"=>555}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"聚焦你的页面上的第一个输入框", "body"=>"如果可以在用户打开一个注册或者发表文章的页面,能把光标直接聚焦到第一个输入框,或许会改善不少的用户体验,我们在ROR中可以轻松实现,把如下代码粘贴到你的application.js 中,并保证在你的布局RHTML文件中包含这个js文件:"javascript_include_tag :defaults".Event.observe(window, 'load', function() { var e = $A(document.getElementsByTagName('*')).find(function(e) { return (e.tagName.toUpperCase() == 'INPUT' && (e.type == 'text' || e.type == 'password')) || e.tagName.toUpperCase() == 'TEXTAREA' || e.tagName.toUpperCase() == 'SELECT'; }); if (e) e.focus();}); 你也可以对你特定的需求进行编辑。。", "created_at"=>2007-05-19 22:06:30 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    如果可以在用户打开一个注册或者发表文章的页面,能把光标直接聚焦到第一个输入框,或许会改善不少的用户体验,我们在ROR中可以轻松实现,把如下代码粘贴到你的application.js 中,并保证在你的布局RHTML文件中包含这个js文件:"javascript_include_tag :defaults".Event.observe(window, 'load', function() { var e = $A(document.getElementsByTagName('*')).find(function(e) { return (e.tagName.toUpperCase() == 'INPUT' && (e.type == 'text' || e.type == 'password')) || e.tagName.toUpperCase() == 'TEXTAREA' || e.tagName.toUpperCase() == 'SELECT'; }); if (e) e.focus();}); 你也可以对你特定的需求进行编辑。。

    \n", "_id"=>556}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"把Google等Spider挡在门外", "body"=>"有的时候,您可能不想GOOGLE或者其他的网络蜘蛛(Spider)造访您的站点(比如一个私密的同学录或者个人财富系统等),您可以在ApplicationController 里面加入如下这个方法:class ApplicationController < ActionController::Base before_filter :disable_link_prefetching private def disable_link_prefetching if request.env["HTTP_X_MOZ"] == "prefetch" logger.debug "prefetch detected: sending 403 Forbidden" render_nothing "403 Forbidden" return false end endend其他Spider的防范可以参考这个来实现,就是提取请求来源的参数标志,然后加以阻挡就可以了。", "created_at"=>2007-05-19 22:04:43 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候,您可能不想GOOGLE或者其他的网络蜘蛛(Spider)造访您的站点(比如一个私密的同学录或者个人财富系统等),您可以在ApplicationController 里面加入如下这个方法:class ApplicationController < ActionController::Base before_filter :disable_link_prefetching private def disable_link_prefetching if request.env["HTTP_X_MOZ"] == "prefetch" logger.debug "prefetch detected: sending 403 Forbidden" render_nothing "403 Forbidden" return false end endend其他Spider的防范可以参考这个来实现,就是提取请求来源的参数标志,然后加以阻挡就可以了。

    \n", "_id"=>557}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"按时间归档的Routes写法", "body"=>"在博客等系统中,通常需要按时间进行归档,这个Routes可以这样写。。如下:# allow neat perma urlsmap.connect 'articles/:year/:month/:day', :controller => 'articles', :action => 'find_by_date', :year => /\\d{4}/, :day => nil, :month => nilmap.connect 'articles/:year/:month/:day/:title', :controller => 'articles', :action => 'permalink', :year => /\\d{4}/", "created_at"=>2007-05-19 22:00:07 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在博客等系统中,通常需要按时间进行归档,这个Routes可以这样写。。如下:# allow neat perma urlsmap.connect 'articles/:year/:month/:day', :controller => 'articles', :action => 'find_by_date', :year => /\\d{4}/, :day => nil, :month => nilmap.connect 'articles/:year/:month/:day/:title', :controller => 'articles', :action => 'permalink', :year => /\\d{4}/

    \n", "_id"=>558}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"find out the current url / uri in *.rhtml file", "body"=>"// find out the current url / uri in *.rhtml file// is quite simple with the request object<% page = request.request_uri %>page: <%= page %>// but then different urls mean the same page// (../admin = ../admin/ = ../admin/index = ..admin/index/)// and maybe the id is unwanted too (../admin/show/8)// so below is an alternative with control on which parameter is used<% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %>page: <%= page %>", "created_at"=>2007-05-19 21:58:09 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    // find out the current url / uri in *.rhtml file// is quite simple with the request object<% page = request.request_uri %>page: <%= page %>// but then different urls mean the same page// (../admin = ../admin/ = ../admin/index = ..admin/index/)// and maybe the id is unwanted too (../admin/show/8)// so below is an alternative with control on which parameter is used<% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %>page: <%= page %>

    \n", "_id"=>559}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"Firefox doesn't display a popup for the alt attribute for images. While this is according to spec, it's slightly annoying to put the same text in both the alt and the title. Put the following in your ApplicationHelper to copy the alt to the title for every image. Please don't tell me how wrong this is. I don't care.module ApplicationHelper def image_tag(location, options) options[:title] ||= options[:alt] super(location, options) endend", "created_at"=>2007-05-19 21:56:35 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Firefox doesn't display a popup for the alt attribute for images. While this is according to spec, it's slightly annoying to put the same text in both the alt and the title. Put the following in your ApplicationHelper to copy the alt to the title for every image. Please don't tell me how wrong this is. I don't care.module ApplicationHelper def image_tag(location, options) options[:title] ||= options[:alt] super(location, options) endend

    \n", "_id"=>560}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"特别留意XSS攻击", "body"=>"跨站点脚本攻击有一个前提:攻击者能够将他们自己编写的JavaScript脚本放进网页,并且这些页面在显示时与他们想要的cookie相关联。幸运的是,这种攻击很容易提防——不要允许任何外来的东西直接显示在页面上就行了[1]。在将任何一个字符串显示在网页上之前,一定要将其中的HTML元字符(“<”和“>”)转换成对应的HTML实体(“&lt;”和 “&gt;”),这样不管攻击者在表单或者URL参数中输入了什么文本,浏览器都只会将其显示为普通文本,不会对其做任何HTML解释。即便不考虑安全问题,你也同样应该考虑这样做,因为如果允许用户输入HTML标签,页面的布局很容易被搞乱。如果使用Textile或者Markdown这样的标记语言,一定要倍加小心,因为它们允许用户在页面上添加HTML片段。Rails提供了h(string)辅助方法(实际上是html_escape()方法的别名),该方法正是用于在Rails视图中执行上述文本替换的。在这个容易遭受攻击的网站里,负责编写“查看留言”功能的人可以将表单写成这样,以消除安全问题:<div class="comment"><%= h(order.comment) %></div>Joe问……干吗不直接扔掉<script>标签呢?既然问题出在用户可以把<script>标签插进我们显示的内容中,也许你会想,直接把这些标签找到并删除不就是最简单的解决办法吗?可惜,这不管用。浏览器在很多情况下都会执行JavaScript,情况之多也许会令你吃惊。(譬如说, onclick=属性、<img>标签的scr=属性都可以是JavaScript的来源。)而且这也不仅仅是JavaScript的问题 ——如果允许用户在网页上放进超链接,就可能有人用它来干坏事。你可以试着检查所有这些情况,不过相比之下,HTML转义替换的方式要更安全,而且更不容易出错。所以,请养成习惯,在把任何变量放进视图显示之前,使用h()方法对其进行转义替换——即便你认为它来自一个可以信赖的来源。同时,在阅读别人的代码时,也得留意其中使用h()方法的地方——有些人在使用h()方法时喜欢不加括号,这可能让代码变得更加难懂。有时你确实需要把包含HTML的字符串放进视图模板,此时可以使用sanitize()方法,该方法可以去除其中可能造成危险的部分。不过,你最好仔细检查sanitize()方法是否能够提供你所需要的保护:每周都有新的HTML攻击手段出现,令人防不胜防。", "created_at"=>2007-05-19 21:54:46 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    跨站点脚本攻击有一个前提:攻击者能够将他们自己编写的JavaScript脚本放进网页,并且这些页面在显示时与他们想要的cookie相关联。幸运的是,这种攻击很容易提防——不要允许任何外来的东西直接显示在页面上就行了[1]。在将任何一个字符串显示在网页上之前,一定要将其中的HTML元字符(“<”和“>”)转换成对应的HTML实体(“&lt;”和 “&gt;”),这样不管攻击者在表单或者URL参数中输入了什么文本,浏览器都只会将其显示为普通文本,不会对其做任何HTML解释。即便不考虑安全问题,你也同样应该考虑这样做,因为如果允许用户输入HTML标签,页面的布局很容易被搞乱。如果使用Textile或者Markdown这样的标记语言,一定要倍加小心,因为它们允许用户在页面上添加HTML片段。Rails提供了h(string)辅助方法(实际上是html_escape()方法的别名),该方法正是用于在Rails视图中执行上述文本替换的。在这个容易遭受攻击的网站里,负责编写“查看留言”功能的人可以将表单写成这样,以消除安全问题:<div class="comment"><%= h(order.comment) %></div>Joe问……干吗不直接扔掉<script>标签呢?既然问题出在用户可以把<script>标签插进我们显示的内容中,也许你会想,直接把这些标签找到并删除不就是最简单的解决办法吗?可惜,这不管用。浏览器在很多情况下都会执行JavaScript,情况之多也许会令你吃惊。(譬如说, onclick=属性、<img>标签的scr=属性都可以是JavaScript的来源。)而且这也不仅仅是JavaScript的问题 ——如果允许用户在网页上放进超链接,就可能有人用它来干坏事。你可以试着检查所有这些情况,不过相比之下,HTML转义替换的方式要更安全,而且更不容易出错。所以,请养成习惯,在把任何变量放进视图显示之前,使用h()方法对其进行转义替换——即便你认为它来自一个可以信赖的来源。同时,在阅读别人的代码时,也得留意其中使用h()方法的地方——有些人在使用h()方法时喜欢不加括号,这可能让代码变得更加难懂。有时你确实需要把包含HTML的字符串放进视图模板,此时可以使用sanitize()方法,该方法可以去除其中可能造成危险的部分。不过,你最好仔细检查sanitize()方法是否能够提供你所需要的保护:每周都有新的HTML攻击手段出现,令人防不胜防。

    \n", "_id"=>561}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"神奇好用的find_or_create_by", "body"=>"简单来说,find_or_create_by 就是先去找说数据库里面有没有这个数据,如果没有他就顺手帮你建立一个。很简单的概念,但是却又非常频繁用到。使用方式如下今天有一个 User Model 有两个 attribute ,其中一个是 name ,另外一个是 email。 如果我们想要找出一个名叫做 'abc' 的使用者,如果没这个人,就创造一个,然后将他指定到 a 这个 Object 。使用方是就是a = User.find_or_create_by_name('abc')仔细去翻 SQL Code,我们可以发现SELECT * FROM users WHERE (userss.`name` = `abc` ) LIMIT 1BEGININSERT INTO users (`name`, `email`) VALUES('abc', '')COMMIT如果想要更进一步,我们想找出名叫做 'abc' ,并且 email 是 abc@example.com 的使用者,并且将他指定到 Object a。使用方是就是a = User.find_or_create_by_name_and_email('abc' , 'abc@example.com')SQL code 就是SELECT * FROM users WHERE (users.`name` = `abc` and users.`name` = `abc@example.com`) LIMIT 1BEGININSERT INTO users (`name`, `email`) VALUES('abc', 'abc@example.com')COMMIT我果然应该多花点时间再重新阅读 Ruby on Rails 的书好了,那么方便的东西居然都不知道。", "created_at"=>2007-05-19 21:52:24 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    简单来说,find_or_create_by 就是先去找说数据库里面有没有这个数据,如果没有他就顺手帮你建立一个。很简单的概念,但是却又非常频繁用到。使用方式如下今天有一个 User Model 有两个 attribute ,其中一个是 name ,另外一个是 email。 如果我们想要找出一个名叫做 'abc' 的使用者,如果没这个人,就创造一个,然后将他指定到 a 这个 Object 。使用方是就是a = User.find_or_create_by_name('abc')仔细去翻 SQL Code,我们可以发现SELECT * FROM users WHERE (userss.name = abc ) LIMIT 1BEGININSERT INTO users (name, email) VALUES('abc', '')COMMIT如果想要更进一步,我们想找出名叫做 'abc' ,并且 email 是 abc@example.com 的使用者,并且将他指定到 Object a。使用方是就是a = User.find_or_create_by_name_and_email('abc' , 'abc@example.com')SQL code 就是SELECT * FROM users WHERE (users.name = abc and users.name = abc@example.com) LIMIT 1BEGININSERT INTO users (name, email) VALUES('abc', 'abc@example.com')COMMIT我果然应该多花点时间再重新阅读 Ruby on Rails 的书好了,那么方便的东西居然都不知道。

    \n", "_id"=>562}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby对RSS(XML)的实例解析", "body"=>"有时候你可能想备份下原来的博客,或者对写的文章做些备份之类的,用RUBY很间就可以实现,下面是我的这个应用中所用的,针对用户推荐的文章,给出文章的RSS地址,然后写些自己的感受或者评论,就可以把提交的那个RSS文章取过来的。下面是代码:<code> @topic.body = '引言:' + @topic.body + '<br/>' feed = RSS::Parser.parse(open(params[:uri]).read, false) @topic.body += '<br />*来源:*' + feed.channel.title @topic.body += '<br />*地址:*' + feed.channel.link feed.items.each do |item| @topic.body += '<br />*标题:*' + item.title @topic.body += '<br />*内容摘要:*<br />' + item.description end </code>对了,你还需要在前面加上对库的引用,如下:require 'rss/2.0'require 'open-uri'另外,刚刚看到Javaeye上一个老兄写了一个差不多的,我就不多写了,大家可以参考下,地址如下:http://www.javaeye.com/blog/57538", "created_at"=>2007-06-01 23:25:45 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有时候你可能想备份下原来的博客,或者对写的文章做些备份之类的,用RUBY很间就可以实现,下面是我的这个应用中所用的,针对用户推荐的文章,给出文章的RSS地址,然后写些自己的感受或者评论,就可以把提交的那个RSS文章取过来的。下面是代码:<code> @topic.body = '引言:' + @topic.body + '<br/>' feed = RSS::Parser.parse(open(params[:uri]).read, false) @topic.body += '<br />来源:' + feed.channel.title @topic.body += '<br />地址:' + feed.channel.link feed.items.each do |item| @topic.body += '<br />标题:' + item.title @topic.body += '<br />内容摘要:<br />' + item.description end </code>对了,你还需要在前面加上对库的引用,如下:require 'rss/2.0'require 'open-uri'另外,刚刚看到Javaeye上一个老兄写了一个差不多的,我就不多写了,大家可以参考下,地址如下:http://www.javaeye.com/blog/57538

    \n", "_id"=>563}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"How to Transfer Files using SSH and Ruby", "body"=>"老外(Matthew Bass)写了一篇文章*Automating File Uploads with SSH and Ruby.*放在InfoQ上,其说明了如何使用Net-SSH 和 Net-SFTP 库实现了使用SSH备份文件到远程主机上的Ruby实现,如果你有类似方面的需求,可以好好看看这篇文章,地址在:http://www.infoq.com/articles/ruby-file-upload-ssh-intro", "created_at"=>2007-05-31 07:55:46 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    老外(Matthew Bass)写了一篇文章*Automating File Uploads with SSH and Ruby.*放在InfoQ上,其说明了如何使用Net-SSH 和 Net-SFTP 库实现了使用SSH备份文件到远程主机上的Ruby实现,如果你有类似方面的需求,可以好好看看这篇文章,地址在:http://www.infoq.com/articles/ruby-file-upload-ssh-intro

    \n", "_id"=>564}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introduction to ActiveMessaging for Rails", "body"=>"ActiveMessaging是个感觉很不错的一个插件,通过它你可以发送、接收MO,总得来说很有诱惑力,还没有看完,下面这篇文章对这个东西做了详细的介绍,感兴趣的可以自己去看看,我就不翻译了,等我自己试用后,可以再些些心得什么的。*introduction*Rails has already planted its flag firmly in the ground of database driven web applications. *ActiveMessaging*is a Rails plugin framework that extends the borders of Rails territory by adding simplified messaging integration. With ActiveMessaging and Rails now you can loosely integrate with systems as disparate as mainframes sending MQ messages or J2EE webapps, offload processing long-running tasks, or create applications with event or message-driven architectures. As others have put it, ActiveMessaging is trying to do for messaging what ActiveRecord does for databases. This article will introduce you to ActiveMessaging and related technologies, and get you started using it in your Rails applications now.http://www.infoq.com/articles/intro-active-messaging-rails", "created_at"=>2007-05-30 21:12:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    ActiveMessaging是个感觉很不错的一个插件,通过它你可以发送、接收MO,总得来说很有诱惑力,还没有看完,下面这篇文章对这个东西做了详细的介绍,感兴趣的可以自己去看看,我就不翻译了,等我自己试用后,可以再些些心得什么的。*introduction*Rails has already planted its flag firmly in the ground of database driven web applications. *ActiveMessaging*is a Rails plugin framework that extends the borders of Rails territory by adding simplified messaging integration. With ActiveMessaging and Rails now you can loosely integrate with systems as disparate as mainframes sending MQ messages or J2EE webapps, offload processing long-running tasks, or create applications with event or message-driven architectures. As others have put it, ActiveMessaging is trying to do for messaging what ActiveRecord does for databases. This article will introduce you to ActiveMessaging and related technologies, and get you started using it in your Rails applications now.http://www.infoq.com/articles/intro-active-messaging-rails

    \n", "_id"=>565}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"清除HTML标签中的危险字符", "body"=>"很多时候,我们需要处理用户输入,为了适合WEB2的特性,做为开发者我们也会设计很对个途径让用户参与进去,但是“盖茨”大叔说得很对:*凡是用户的输入都是有害的!*一点不假,有时候用户可能是无意的或者一些不怀好意的用户会输入一些我们并不想让他们输入的东西,以防止破坏页面结构或者造成其他的危害(比如SQL注射和XSS攻击),所以我们需要对用户的输入认真的检验和过滤。在页面上显示的时候,我们可以选择+h()+或者+sanitize+或者+strip_tags+等等rails提供的方法进行过滤,但是这些危险的字符还适度会存在数据库,或许有一天就会引爆了呢,所以呢,最好的办法是在存入数据库的时候就做一些过滤或转换,一下一点点代码段只是一个小例子,真实世界中需要过滤和清除的危险字符是很多的,大家注意主机收集和完善,也希望大家一起来实现这个功能,做一个通用的 helper方法。<code> def stripped_html(html) # this is a copynpaste of the routine in article.rb # so the one in article.rb can change w/o breaking this. self.html.gsub(/<[^>]*>/,'').to_url end</code>对于HTML标签的过滤和清除,你有什么好的方法么?欢迎分享!", "created_at"=>2007-05-29 21:24:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很多时候,我们需要处理用户输入,为了适合WEB2的特性,做为开发者我们也会设计很对个途径让用户参与进去,但是“盖茨”大叔说得很对:凡是用户的输入都是有害的!*一点不假,有时候用户可能是无意的或者一些不怀好意的用户会输入一些我们并不想让他们输入的东西,以防止破坏页面结构或者造成其他的危害(比如SQL注射和XSS攻击),所以我们需要对用户的输入认真的检验和过滤。在页面上显示的时候,我们可以选择+h()+或者+sanitize+或者+strip_tags+等等rails提供的方法进行过滤,但是这些危险的字符还适度会存在数据库,或许有一天就会引爆了呢,所以呢,最好的办法是在存入数据库的时候就做一些过滤或转换,一下一点点代码段只是一个小例子,真实世界中需要过滤和清除的危险字符是很多的,大家注意主机收集和完善,也希望大家一起来实现这个功能,做一个通用的 helper方法。<code> def stripped_html(html) # this is a copynpaste of the routine in article.rb # so the one in article.rb can change w/o breaking this. self.html.gsub(/<[^>]>/,'').to_url end</code>对于HTML标签的过滤和清除,你有什么好的方法么?欢迎分享!

    \n", "_id"=>566}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"理解REST软件架构", "body"=>"*导读:*infoq上的这篇REST构架分析的文章还是不错,从HTTP协议开始介绍了REST的构架理念,值得看看,再花点时间好好理解下REST。一种思维方式影响了软件行业的发展。REST软件架构是当今世界上最成功的互联网的超媒体分布式系统。它让人们真正理解我们的网络协议HTTP本来面貌。它正在成为网络服务的主流技术,同时也正在改变互联网的网络软件开发的全新思维方式。AJAX技术和Rails框架把REST软件架构思想真正地在实际中很好表现出来。今天微软也已经应用REST并且提出把我们现有的网络变成为一个语义网,这种网络将会使得搜索更加智能化。详细内容,请查看:http://www.infoq.com/cn/articles/rest-architecure", "created_at"=>2007-05-28 08:34:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    *导读:*infoq上的这篇REST构架分析的文章还是不错,从HTTP协议开始介绍了REST的构架理念,值得看看,再花点时间好好理解下REST。一种思维方式影响了软件行业的发展。REST软件架构是当今世界上最成功的互联网的超媒体分布式系统。它让人们真正理解我们的网络协议HTTP本来面貌。它正在成为网络服务的主流技术,同时也正在改变互联网的网络软件开发的全新思维方式。AJAX技术和Rails框架把REST软件架构思想真正地在实际中很好表现出来。今天微软也已经应用REST并且提出把我们现有的网络变成为一个语义网,这种网络将会使得搜索更加智能化。详细内容,请查看:http://www.infoq.com/cn/articles/rest-architecure

    \n", "_id"=>567}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"日期上的迭代问题", "body"=>"给定一个时间点,希望得到其他时间点的解决方案如下,Ruby 的所有时间对象都可像数字一样用在值域中。Date和DateTime对象按天递增,而Time对象按秒递增:*例子*require 'date'(Date.new(1976, 7, 2)..Date.new(1976, 7, 4)).each { |x| puts x }1976-07-021976-07-031976-07-04span = DateTime.new(1776, 7, 2, 1, 30, 15)..DateTime.new(1776, 7, 4, 7, 0,0)span.each { |x| puts x } 1776-07-02T01:30:15Z 1776-07-03T01:30:15Z 1776-07-04T01:30:15Z(Time.at(100)..Time.at(102)).each { |x| puts x } Wed Dec 31 19:01:40 EST 1969 Wed Dec 31 19:01:41 EST 1969 Wed Dec 31 19:01:42 EST 1969Ruby 的Date类定义了*step*和*upto*两种方便的由数字使用的迭代器:the_first = Date.new(2004, 1, 1)the_fifth = Date.new(2004, 1, 5)the_first.upto(the_fifth) { |x| puts x } 2004-01-01 2004-01-02 2004-01-03 2004-01-04 2004-01-05*讨论*Ruby的日期对象在内部被存储为数字,并且一定范围的这种对象可被视为一定范围的数字。对于Date和DateTime对象而言,内部表示是儒略历日期:每次在一定范围的这种对象上累加一天。对于Time对象而言,内部表示是自Unix 纪元以来的秒数:每次在一定范围的Time对象上累加一秒。*Time*没有定义step和upto方法,但添加它们也很简单:class Timebq. def step(other_time, increment) raise ArgumentError, "step can't be 0" if increment == 0 increasing = self < other_time if (increasing && increment < 0) || (!increasing && increment > 0) yield self return end d = self begin yield d d += increment end while (increasing ? d <= other_time : d >= other_time) enddef upto(other_time) step(other_time, 1) { |x| yield x } endendthe_first = Time.local(2004, 1, 1)the_second = Time.local(2004, 1, 2)the_first.step(the_second, 60 * 60 * 6) { |x| puts x } Thu Jan 01 00:00:00 EST 2004 Thu Jan 01 06:00:00 EST 2004 Thu Jan 01 12:00:00 EST 2004 Thu Jan 01 18:00:00 EST 2004 Fri Jan 02 00:00:00 EST 2004the_first.upto(the_first) { |x| puts x } Thu Jan 01 00:00:00 EST 2004", "created_at"=>2007-05-27 05:09:33 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    给定一个时间点,希望得到其他时间点的解决方案如下,Ruby 的所有时间对象都可像数字一样用在值域中。Date和DateTime对象按天递增,而Time对象按秒递增:*例子*require 'date'(Date.new(1976, 7, 2)..Date.new(1976, 7, 4)).each { |x| puts x }1976-07-021976-07-031976-07-04span = DateTime.new(1776, 7, 2, 1, 30, 15)..DateTime.new(1776, 7, 4, 7, 0,0)span.each { |x| puts x } 1776-07-02T01:30:15Z 1776-07-03T01:30:15Z 1776-07-04T01:30:15Z(Time.at(100)..Time.at(102)).each { |x| puts x } Wed Dec 31 19:01:40 EST 1969 Wed Dec 31 19:01:41 EST 1969 Wed Dec 31 19:01:42 EST 1969Ruby 的Date类定义了*step*和*upto*两种方便的由数字使用的迭代器:the_first = Date.new(2004, 1, 1)the_fifth = Date.new(2004, 1, 5)the_first.upto(the_fifth) { |x| puts x } 2004-01-01 2004-01-02 2004-01-03 2004-01-04 2004-01-05*讨论*Ruby的日期对象在内部被存储为数字,并且一定范围的这种对象可被视为一定范围的数字。对于Date和DateTime对象而言,内部表示是儒略历日期:每次在一定范围的这种对象上累加一天。对于Time对象而言,内部表示是自Unix 纪元以来的秒数:每次在一定范围的Time对象上累加一秒。*Time*没有定义step和upto方法,但添加它们也很简单:class Timebq. def step(other_time, increment) raise ArgumentError, "step can't be 0" if increment == 0 increasing = self < other_time if (increasing && increment < 0) || (!increasing && increment > 0) yield self return end d = self begin yield d d += increment end while (increasing ? d <= other_time : d >= other_time) enddef upto(other_time) step(other_time, 1) { |x| yield x } endendthe_first = Time.local(2004, 1, 1)the_second = Time.local(2004, 1, 2)the_first.step(the_second, 60 * 60 * 6) { |x| puts x } Thu Jan 01 00:00:00 EST 2004 Thu Jan 01 06:00:00 EST 2004 Thu Jan 01 12:00:00 EST 2004 Thu Jan 01 18:00:00 EST 2004 Fri Jan 02 00:00:00 EST 2004the_first.upto(the_first) { |x| puts x } Thu Jan 01 00:00:00 EST 2004

    \n", "_id"=>568}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Textile Editor Helper", "body"=>"*Textile*是一种语言标记格式,目前在ROR领域用的相当多,本着简洁好用的原则,这套规则就像PHP领域内的BBCODE一样流行,但是一直一来,都是靠手工去写这些标识符号,很不方便,也曾萌发了写一套可视化的东西来,可惜一直没有时间和精力,今天看到slate blog的blog上有关于这个的东西,感觉就是自己想实现的那个,看了下视频(http://www.youtube.com/watch?v=wQYedmbsJf4)和DEMO(http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper/demo),果然是的,试用了下,很方便,效果很好,再各种浏览器下都表现不错,推荐给大家。可以先看下它的功能:安装也挺方便的:+script/plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/+使用:bq. # 1. run rake textile_editor_helper:install 2. for the textarea(s) that you want to add the TEH toolbar to replace the text area tag(s) with: <%= textile_editor 'object', 'field' -%> just like writing a text area tag, same options 3. at the end of your form put in the following code: <%= textile_editor_initialize -%> Important! 4. save your view and check it out*注意*:To use Textile, you must install the RedCloth gem first.", "created_at"=>2007-05-24 21:08:58 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    *Textile*是一种语言标记格式,目前在ROR领域用的相当多,本着简洁好用的原则,这套规则就像PHP领域内的BBCODE一样流行,但是一直一来,都是靠手工去写这些标识符号,很不方便,也曾萌发了写一套可视化的东西来,可惜一直没有时间和精力,今天看到slate blog的blog上有关于这个的东西,感觉就是自己想实现的那个,看了下视频(http://www.youtube.com/watch?v=wQYedmbsJf4)和DEMO(http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper/demo),果然是的,试用了下,很方便,效果很好,再各种浏览器下都表现不错,推荐给大家。可以先看下它的功能:安装也挺方便的:+script/plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/+bq使用:. # 1. run rake textile_editor_helper:install 2. for the textarea(s) that you want to add the TEH toolbar to replace the text area tag(s) with: <%= textile_editor 'object', 'field' -%> just like writing a text area tag, same options 3. at the end of your form put in the following code: <%= textile_editor_initialize -%> Important! 4. save your view and check it out*注意*:To use Textile, you must install the RedCloth gem first.

    \n", "_id"=>569}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装mongrel服务器", "body"=>"需要安装这个的很简单,下面就是我在自己机子上安装的时候的过程演示,比起Apache等的配置,这个东西好多了。D:\\>gem install mongrelSelect which gem to install for your platform (i386-mswin32) 1. mongrel 1.0.1 (mswin32) 2. mongrel 1.0.1 (ruby) 3. mongrel 1.0 (mswin32) 4. mongrel 1.0 (ruby) 5. Skip this gem 6. Cancel installation> 1Install required dependency gem_plugin? [Yn] yInstall required dependency cgi_multipart_eof_fix? [Yn] ySuccessfully installed mongrel-1.0.1-mswin32Successfully installed gem_plugin-0.2.2Successfully installed cgi_multipart_eof_fix-2.1Installing ri documentation for mongrel-1.0.1-mswin32...Installing ri documentation for gem_plugin-0.2.2...Installing ri documentation for cgi_multipart_eof_fix-2.1...Installing RDoc documentation for mongrel-1.0.1-mswin32...Installing RDoc documentation for gem_plugin-0.2.2...Installing RDoc documentation for cgi_multipart_eof_fix-2.1...D:\\>", "created_at"=>2007-05-23 22:27:14 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    需要安装这个的很简单,下面就是我在自己机子上安装的时候的过程演示,比起Apache等的配置,这个东西好多了。D:&gt;gem install mongrelSelect which gem to install for your platform (i386-mswin32) 1. mongrel 1.0.1 (mswin32) 2. mongrel 1.0.1 (ruby) 3. mongrel 1.0 (mswin32) 4. mongrel 1.0 (ruby) 5. Skip this gem 6. Cancel installation> 1Install required dependency gem_plugin? [Yn] yInstall required dependency cgi_multipart_eof_fix? [Yn] ySuccessfully installed mongrel-1.0.1-mswin32Successfully installed gem_plugin-0.2.2Successfully installed cgi_multipart_eof_fix-2.1Installing ri documentation for mongrel-1.0.1-mswin32...Installing ri documentation for gem_plugin-0.2.2...Installing ri documentation for cgi_multipart_eof_fix-2.1...Installing RDoc documentation for mongrel-1.0.1-mswin32...Installing RDoc documentation for gem_plugin-0.2.2...Installing RDoc documentation for cgi_multipart_eof_fix-2.1...D:&gt;

    \n", "_id"=>570}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"如何再虚拟主机上安装gem", "body"=>"有的时候,虚拟主机提供商并不能按照每个用户的需求安装全部的gem,这个时候,我们就需要自己动手了,如下是我在一家虚拟主机上的安装builder的过程,主要就是先FTP把gem包放上去,然后本地安装的时候使用一个--install-dir来指定安装到的目录。<code>[1ster@1ster.cn@bee-00 gemdir]$ gem install builder-2.1.1.gem --install-dir /var/***/***/1ster.cn/gemdirSuccessfully installed builder, version 2.1.1Installing ri documentation for builder-2.1.1...Installing RDoc documentation for builder-2.1.1...</code>", "created_at"=>2007-05-23 19:03:10 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候,虚拟主机提供商并不能按照每个用户的需求安装全部的gem,这个时候,我们就需要自己动手了,如下是我在一家虚拟主机上的安装builder的过程,主要就是先FTP把gem包放上去,然后本地安装的时候使用一个--install-dir来指定安装到的目录。<code>[1ster@1ster.cn@bee-00 gemdir]$ gem install builder-2.1.1.gem --install-dir /var///1ster.cn/gemdirSuccessfully installed builder, version 2.1.1Installing ri documentation for builder-2.1.1...Installing RDoc documentation for builder-2.1.1...</code>

    \n", "_id"=>571}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"初始化数据库", "body"=>"我们使用创建表的时候,是不想想初始化一些数据呢,比如一个默认的分类什么的,可以使用migration按照下面这个来实现: <code> def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words end</code>", "created_at"=>2007-05-22 21:32:41 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    我们使用创建表的时候,是不想想初始化一些数据呢,比如一个默认的分类什么的,可以使用migration按照下面这个来实现: <code> def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words end</code>

    \n", "_id"=>572}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"15步创建一个测试驱动(TDD)的Rails应用~", "body"=>"题外话:这个文章展示了一种测试驱动(TDD)的开发模式,针对Rails的基本步骤,原文很清楚,我就随便翻译下关键的部分,见下:原文地址:http://andrzejonsoftware.blogspot.com/2007/05/15-tdd-steps-to-create-rails.html15 TDD steps to create a Rails applicationIntroductionSeveral times recently, I have been asked how to develop a Rails application using the Test Driven Development approach. I'm not an expert here, but I've put together some notes on how to start working on a Rails application whilst being test-driven all the time.As an example I will use a word-learning web application. The simplest use case is to display a random word object (with its polish translation) from the database.Every time we refresh we want to see a different word.1. Create a new Rails applicationsrails my_appcd my_appRun tests with 'rake test'. It fails due to missing database configuration.2. Set up the databases - config/database.ymlThe code below assumes sqlite3 databases. development: adapter: sqlite3 database: db/my_app_development.sqlite test: adapter: sqlite3 database: db/my_app_test.sqlite'rake test' now runs fine.3. Create a Word class with a corresponding unit testscript/generate model Word4. Write a unit test for the Word class. Edit the test/unit/word_test.rb. def test_word_is_english_and_polish word = Word.new :eng=>'never', :pl=>'nigdy' assert_equal 'never', word.eng assert_equal 'nigdy', word.pl end'rake test' now fails due to missing words table.5. Edit db/migrate/001_create_words.rbWe are using a migration here in order to create a table. It's a recommended way of dealing with database changes. def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words endThe sample words that we are adding use Word.new .. lines, will be added to the development database. It's important to distinguish the 'test' and 'development' database. The first one is only used during tests. The latter is used by default when you start the application.Apply the migration with 'rake db:migrate'.'rake test' now succeeds with the following:'1 tests, 2 assertions, 0 failures, 0 errors'6. Fixtures and test for word.random. Edit word_test again.It's not easy to test a method which behaves randomly. Let's assume that it's enough to test that if we have only two words in our database then one of them should be called at least once per 10 calls.fixtures :wordsdef test_random results = [] 10.times {results << Word.random.eng} assert results.include?("yes")endNote the 'fixtures :words' line. Edit the 'words.yml' file.yes: id: 1 pl: 'tak' eng: 'yes'no: id: 2 pl: 'nie' eng: 'no'This will be loaded to the test database before every run of tests.7. Implement the Word.random method def self.random all = Word.find :all all[rand(all.size)] endWarning: The code above could be slow for many words in a database (we retrieve all words only for selecting a random element). It's good enough for our needs.8. Generate the Words controller with a 'learn' actionscript/generate controller Words learn9. Write a test for the learn methodJust as there is a one-to-one ratio between unit tests and models, so there is between functional tests and controllers. The Controller's responsibility is to retrieve objects from the Model layer and pass them to the View. Let's test the View part first. We use the 'assigns' collection which contains all the objects passed to the View.def test_learn_passes_a_random_word get 'learn' assert_kind_of Word, assigns('word')end10. Make the Test Passdef learn @word = Word.newend11. Write more tests in the words_controller_testHow can we test that controller uses the Word.random method? We don't want to duplicate the tests for the Word.random method.Mocks to the rescue! We will only test that the controller calls the Word.random method. The returned value will be faked with a prepared word.Let's install the mocha framework:gem install mochaNow we can use 'expects' and 'returns' methods.'expects' is used for setting an expectation on an object or a class. In this case we expect that the 'random' method will be called. We also set a return value by using 'returns' method. Setting a return value means faking (stubbing) the real method. The real Word.random won't be called. If an expectation isn't met the test fails.require 'mocha'def test_learn_passes_a_random_word random_word = Word.new Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word')end'rake test' now fails. The Word.method wasn't called.12. Rewrite the implementationdef learn @word = Word.randomend'rake test' now passes.13. Test that a word is displayed:Extend the existing test with assert_tag calls.def test_learn_passes_a_random_word random_word = Word.new(:pl=>'czesc', :eng=>'hello') Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word') assert_tag :tag=>'div', :child => /czesc/ assert_tag :tag=>'div', :child => /hello/end14. Implement the view - learn.rhtml <div> <%= word.eng %> <%= word.pl %> </div>15. Manual testingscript/serverGo to 'http://localhost:3000/words/learn'.Refresh several times.If you want to read more about testing in Rails go to the Guide To Testing The Rails.", "created_at"=>2007-05-22 21:30:02 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    题外话:这个文章展示了一种测试驱动(TDD)的开发模式,针对Rails的基本步骤,原文很清楚,我就随便翻译下关键的部分,见下:原文地址:http://andrzejonsoftware.blogspot.com/2007/05/15-tdd-steps-to-create-rails.html15 TDD steps to create a Rails applicationIntroductionSeveral times recently, I have been asked how to develop a Rails application using the Test Driven Development approach. I'm not an expert here, but I've put together some notes on how to start working on a Rails application whilst being test-driven all the time.As an example I will use a word-learning web application. The simplest use case is to display a random word object (with its polish translation) from the database.Every time we refresh we want to see a different word.1. Create a new Rails applicationsrails my_appcd my_appRun tests with 'rake test'. It fails due to missing database configuration.2. Set up the databases - config/database.ymlThe code below assumes sqlite3 databases. development: adapter: sqlite3 database: db/my_app_development.sqlite test: adapter: sqlite3 database: db/my_app_test.sqlite'rake test' now runs fine.3. Create a Word class with a corresponding unit testscript/generate model Word4. Write a unit test for the Word class. Edit the test/unit/word_test.rb. def test_word_is_english_and_polish word = Word.new :eng=>'never', :pl=>'nigdy' assert_equal 'never', word.eng assert_equal 'nigdy', word.pl end'rake test' now fails due to missing words table.5. Edit db/migrate/001_create_words.rbWe are using a migration here in order to create a table. It's a recommended way of dealing with database changes. def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words endThe sample words that we are adding use Word.new .. lines, will be added to the development database. It's important to distinguish the 'test' and 'development' database. The first one is only used during tests. The latter is used by default when you start the application.Apply the migration with 'rake db:migrate'.'rake test' now succeeds with the following:'1 tests, 2 assertions, 0 failures, 0 errors'6. Fixtures and test for word.random. Edit word_test again.It's not easy to test a method which behaves randomly. Let's assume that it's enough to test that if we have only two words in our database then one of them should be called at least once per 10 calls.fixtures :wordsdef test_random results = [] 10.times {results << Word.random.eng} assert results.include?("yes")endNote the 'fixtures :words' line. Edit the 'words.yml' file.yes: id: 1 pl: 'tak' eng: 'yes'no: id: 2 pl: 'nie' eng: 'no'This will be loaded to the test database before every run of tests.7. Implement the Word.random method def self.random all = Word.find :all all[rand(all.size)] endWarning: The code above could be slow for many words in a database (we retrieve all words only for selecting a random element). It's good enough for our needs.8. Generate the Words controller with a 'learn' actionscript/generate controller Words learn9. Write a test for the learn methodJust as there is a one-to-one ratio between unit tests and models, so there is between functional tests and controllers. The Controller's responsibility is to retrieve objects from the Model layer and pass them to the View. Let's test the View part first. We use the 'assigns' collection which contains all the objects passed to the View.def test_learn_passes_a_random_word get 'learn' assert_kind_of Word, assigns('word')end10. Make the Test Passdef learn @word = Word.newend11. Write more tests in the words_controller_testHow can we test that controller uses the Word.random method? We don't want to duplicate the tests for the Word.random method.Mocks to the rescue! We will only test that the controller calls the Word.random method. The returned value will be faked with a prepared word.Let's install the mocha framework:gem install mochaNow we can use 'expects' and 'returns' methods.'expects' is used for setting an expectation on an object or a class. In this case we expect that the 'random' method will be called. We also set a return value by using 'returns' method. Setting a return value means faking (stubbing) the real method. The real Word.random won't be called. If an expectation isn't met the test fails.require 'mocha'def test_learn_passes_a_random_word random_word = Word.new Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word')end'rake test' now fails. The Word.method wasn't called.12. Rewrite the implementationdef learn @word = Word.randomend'rake test' now passes.13. Test that a word is displayed:Extend the existing test with assert_tag calls.def test_learn_passes_a_random_word random_word = Word.new(:pl=>'czesc', :eng=>'hello') Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word') assert_tag :tag=>'div', :child => /czesc/ assert_tag :tag=>'div', :child => /hello/end14. Implement the view - learn.rhtml <div> <%= word.eng %> <%= word.pl %> </div>15. Manual testingscript/serverGo to 'http://localhost:3000/words/learn'.Refresh several times.If you want to read more about testing in Rails go to the Guide To Testing The Rails.

    \n", "_id"=>573}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"拟出的一些ROR的题目~", "body"=>"题外话:\t学习ROR这么久了,也没有时间仔细整理下到底学会了什么,今天一个朋友想招几个ROR的程序员,让我帮忙出几个题目,结合自己学的,也邀请了对岸的兄弟CFC帮忙,一起整理了以下这些问题,可能还不够严谨,有好的建议请提哈!有时间的可以对照着问题看看自己的答案是什么,欢迎留言!一、热身题1、ROR是什么的简写?2、你多大了,从你接触ROR到现在大概有多少时间了?3、你学习ROR之前还学习过哪些语言?为什么会来学ROR呢?4、你接触ROR后,被它的哪些特性(或者说哪些和别的语言不一样的地方)打动过呢?5、列举几个你了解的开源ROR项目?他们各自都是做什么的?二、基础题6. 现有一个User Model,我想要查ID为10, 30, 36三笔数据,请问如何做?7. 现有一个User Model,内有username、password两个字段,我想要做User Login的功能,使用哪个方法可以用最方便的方式去做Query动作?8. 网友们传来的数据总是不安全的!我想要个别处理params[:info](params[:info]内有nickname、email、body三个子参数),请问我可以怎样在存入Database前,过滤各个元素? 9. 请用Iterator来为User Model新增一笔数据吧(字段有:username, password, nickname, email, url)。10. ROR中有一些奇特的约定,尽自己的能力列举你认为ROR中很方便的约定吧?并简要说明怎么用,越多越好。三、应用题目11、对于一个用户输入的Email地址,我该怎么检查它,以最大限度的保证该Email地址的可用性及其真实性呢?给出你的思路和ROR实现的代码段。12、我想要这么一个效果,请问怎么做,我有一个大分类TYPE1,还有个小分类category,如如何实现级联效果,比如我点选第一个下拉框中的一个值,对应更新后面那个和他级联的下拉框中的值。13、我有一个数据表Topic,包含字段有(id,title,body,created_at,owner, category_id),请问你怎么就这个表生成一全量的RSS订阅(比如我想要的订阅地址为:/feed/index)和一个针对每个category的RSS订阅(比如我想要的订阅地址为:/feed/category/rails订阅rails的RSS,rails是分类表中的一个)。14、目前,经理想知道从A地址(例如10.1.3.1)到B地址(例如211.54.2.45)的网络状况,让你尽快的想个办法,可以指定源地址和目标地址,并且可以指定发送包的大小或者需要发送的文件,让你计算出发送完需要多少时间。你该怎么做呢?15、你晓得Trackback(引用)功能么?不知道的话可以上网上搜索下,请简要说明下Trackback的特点和实现原理;你认为目前这种Trackback有什么不足或者缺陷么?如果有,请问有什么办法改良或者完善么?给出你的Trackback实现代码片段(包括。四、拓展题16、你是怎么认识RESTful 的,你认为它的精髓在哪里,谈谈你是怎么认识这个东西的,它可以带给我们什么好处。17、你实际部署过Rails应用么?你会选择什么做为你的服务器;如果你是买的一个虚拟主机空间,你想跑几个Rails应用,该怎么部署呢?谈谈您的部署经验和好的方法以及您的维护经验~", "created_at"=>2007-05-22 08:27:43 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    题外话: 学习ROR这么久了,也没有时间仔细整理下到底学会了什么,今天一个朋友想招几个ROR的程序员,让我帮忙出几个题目,结合自己学的,也邀请了对岸的兄弟CFC帮忙,一起整理了以下这些问题,可能还不够严谨,有好的建议请提哈!有时间的可以对照着问题看看自己的答案是什么,欢迎留言!一、热身题1、ROR是什么的简写?2、你多大了,从你接触ROR到现在大概有多少时间了?3、你学习ROR之前还学习过哪些语言?为什么会来学ROR呢?4、你接触ROR后,被它的哪些特性(或者说哪些和别的语言不一样的地方)打动过呢?5、列举几个你了解的开源ROR项目?他们各自都是做什么的?二、基础题6. 现有一个User Model,我想要查ID为10, 30, 36三笔数据,请问如何做?7. 现有一个User Model,内有username、password两个字段,我想要做User Login的功能,使用哪个方法可以用最方便的方式去做Query动作?8. 网友们传来的数据总是不安全的!我想要个别处理params:info,请问我可以怎样在存入Database前,过滤各个元素? 9. 请用Iterator来为User Model新增一笔数据吧(字段有:username, password, nickname, email, url)。10. ROR中有一些奇特的约定,尽自己的能力列举你认为ROR中很方便的约定吧?并简要说明怎么用,越多越好。三、应用题目11、对于一个用户输入的Email地址,我该怎么检查它,以最大限度的保证该Email地址的可用性及其真实性呢?给出你的思路和ROR实现的代码段。12、我想要这么一个效果,请问怎么做,我有一个大分类TYPE1,还有个小分类category,如如何实现级联效果,比如我点选第一个下拉框中的一个值,对应更新后面那个和他级联的下拉框中的值。13、我有一个数据表Topic,包含字段有(id,title,body,created_at,owner, category_id),请问你怎么就这个表生成一全量的RSS订阅(比如我想要的订阅地址为:/feed/index)和一个针对每个category的RSS订阅(比如我想要的订阅地址为:/feed/category/rails订阅rails的RSS,rails是分类表中的一个)。14、目前,经理想知道从A地址(例如10.1.3.1)到B地址(例如211.54.2.45)的网络状况,让你尽快的想个办法,可以指定源地址和目标地址,并且可以指定发送包的大小或者需要发送的文件,让你计算出发送完需要多少时间。你该怎么做呢?15、你晓得Trackback(引用)功能么?不知道的话可以上网上搜索下,请简要说明下Trackback的特点和实现原理;你认为目前这种Trackback有什么不足或者缺陷么?如果有,请问有什么办法改良或者完善么?给出你的Trackback实现代码片段(包括。四、拓展题16、你是怎么认识RESTful 的,你认为它的精髓在哪里,谈谈你是怎么认识这个东西的,它可以带给我们什么好处。17、你实际部署过Rails应用么?你会选择什么做为你的服务器;如果你是买的一个虚拟主机空间,你想跑几个Rails应用,该怎么部署呢?谈谈您的部署经验和好的方法以及您的维护经验~

    \n", "_id"=>574}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"SuperRedCloth介绍~", "body"=>"SuperRedCloth项目就是开发中的RedCloth,也就是RedCloth 4。目标是尽可能地增强RedCloth: 1. 令到RedCloth比原来小2/3 2. 一般情况下将会快10倍以上 3. 消除Textile格式中的二义性安装:$ gem install superredcloth --source http://code.whytheluckystiff.net使用:1.首先在helpers/application_helper.rb 中覆盖textilize方法(这个方法在Rails 1.2中使用的是RedCloth),我们覆盖它,如下:<code> def textilize(text) require_library_or_gem "superredcloth" unless Object.const_defined?(:SuperRedCloth) if text.blank? "" else textilized = SuperRedCloth.new(text) textilized.to_html end end # def textilize</code>2.然后在VIEW可以直接使用,如:<code><%= textilize @page.body %></code>官方主页:http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth", "created_at"=>2007-05-21 21:20:43 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    SuperRedCloth项目就是开发中的RedCloth,也就是RedCloth 4。目标是尽可能地增强RedCloth: 1. 令到RedCloth比原来小2/3 2. 一般情况下将会快10倍以上 3. 消除Textile格式中的二义性安装:$ gem install superredcloth --source http://code.whytheluckystiff.net使用:1.首先在helpers/application_helper.rb 中覆盖textilize方法(这个方法在Rails 1.2中使用的是RedCloth),我们覆盖它,如下:<code> def textilize(text) require_library_or_gem "superredcloth" unless Object.const_defined?(:SuperRedCloth) if text.blank? "" else textilized = SuperRedCloth.new(text) textilized.to_html end end # def textilize</code>2.然后在VIEW可以直接使用,如:<code><%= textilize @page.body %></code>官方主页:http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth

    \n", "_id"=>575}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"calendar_helper.rb", "body"=>"在博客或者其他WEB开发中,有的时候可能想显示一个日历表格,ROR下有个老兄也写了一个helper,功能比较完善,可以按照自己的喜好进行定制,其默认需要的参数是年、月,其他都是定制参数,比如CSS等,代码如参考(http://www.jvoorhis.com/downloads/calendar_helper.rb)使用的时候放在helper里面就可以了。 # Example usage: # calendar(:year => 2005, :month => 6) # This generates the simplest possible 作者主页:http://www.jvoorhis.com/pages/calendar-helper", "created_at"=>2007-05-21 21:13:27 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在博客或者其他WEB开发中,有的时候可能想显示一个日历表格,ROR下有个老兄也写了一个helper,功能比较完善,可以按照自己的喜好进行定制,其默认需要的参数是年、月,其他都是定制参数,比如CSS等,代码如参考(http://www.jvoorhis.com/downloads/calendar_helper.rbhelper里面就可以了。)使用的时候放在 # Example usage: # calendar(:year => 2005, :month => 6) # This generates the simplest possible 作者主页:http://www.jvoorhis.com/pages/calendar-helper

    \n", "_id"=>576}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Get XML or YAML output of your data quickly", "body"=>"It's not necessary to create a Builder .rxml template to export data as XML. ActiveRecord has a to_xml method that will output the object or result set in XML format. It works with simple objects, to complete tables with includes. Examples:User.find(:all).to_xmlPost.find(:all, :include => [:comments]).to_xmlYAML is also supported, by using to_yaml instead.", "created_at"=>2007-05-21 07:27:24 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    It's not necessary to create a Builder .rxml template to export data as XML. ActiveRecord has a to_xml method that will output the object or result set in XML format. It works with simple objects, to complete tables with includes. Examples:User.find(:all).to_xmlPost.find(:all, :include => [:comments]).to_xmlYAML is also supported, by using to_yaml instead.

    \n", "_id"=>577}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给你的ROR配置一些通用的常量", "body"=>"这个需求应该是来自于对一些常量的配置和修改上,比如网站的title等等,如果你想做出一个比较通用的WEB系统,那么这个常量的可修改性就是个不可少的需求!我们的做法是可以放在数据库里面,然后去读取,这个方法显然是可行的,但是我们还可以这么来作,放在一个YAML文件里,把你需要的变量写在这个文件里面,需要注意格式的正确性,然后就可以在程序中引用了,步骤如下:1.在你的/config/environment.rb的上方写上:require 'yaml'2.在你的/config/environment.rb的下发写上: YOUR_APP_CONFIG = YAML::load(File.open("\#{RAILS_ROOT}/config/appconfig.yml"))3.然后你就可以在程序里面进行变量的引用了,如下: YOUR_APP_CONFIG"variable"]如果想改变,只要修改这个文件就OK;如果想增加,则只需要在这个文件里面再增加一个变量就好了。。是不是很方便呀~~", "created_at"=>2007-05-21 06:41:49 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这个需求应该是来自于对一些常量的配置和修改上,比如网站的title等等,如果你想做出一个比较通用的WEB系统,那么这个常量的可修改性就是个不可少的需求!我们的做法是可以放在数据库里面,然后去读取,这个方法显然是可行的,但是我们还可以这么来作,放在一个YAML文件里,把你需要的变量写在这个文件里面,需要注意格式的正确性,然后就可以在程序中引用了,步骤如下:1.在你的/config/environment.rb的上方写上:require 'yaml'2.在你的/config/environment.rb的下发写上: YOUR_APP_CONFIG = YAML::load(File.open("\#{RAILS_ROOT}/config/appconfig.yml"))3.然后你就可以在程序里面进行变量的引用了,如下: YOUR_APP_CONFIG"variable"]如果想改变,只要修改这个文件就OK;如果想增加,则只需要在这个文件里面再增加一个变量就好了。。是不是很方便呀~~

    \n", "_id"=>578}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"说说Blog中的Trackback(引用)功能", "body"=>"什么是Trackback呢?简单说来,Trackback是网站与网站之间互相通告的一种方法。它能让甲对乙说:“这篇文章可能是你感兴趣的”,要实现这一动作,甲向乙发送一个 Trackback Ping(引用通告)即可。在这种情况下,一个ping就是一条从一个web服务器发送到另一个服务器的短消息(a small message)。Trackback Ping是由Moveable Type发明的规范,他们说Trackback是:<blockquote>"a framework for peer-to-peer communication and notifications between web sites"。</blockquote>这里是他们的Trackback技术规范文档:http://www.movabletype.org/docs/mttrackback.html举个例子来说明一下。比如B在A的Blog中看了一篇我感兴趣的文章,对这篇文章B自己有一些看法,如果按照传统BBS的做法,B需要在A这篇文章下发表自己的评论,但这样做的话B的文字只能存在于A的网站上,B无法再维护自己的这篇评论。另一个情况是B在自己的Blog中也在写一篇相类似的文章,B希望A也能来看一看B的这篇,传统BBS的习惯还是得到A的文章下发一篇回复,把B的URL贴过去。但有了Trackback Ping,我们的Blog不再需要这样做。Blog 跟BBS有点重要的不同,Blog是一种个人创作,用Blog来发表自己的东西,保存自己的东西,即使是对他人Blog文章的评论也要在自己的Blog中永久保留下来。通过Trackbak,我就可以在自己的Blog中发表文章,同时把自己这篇文章的URL地址Ping到A的那篇文章上去。这样,所有阅读A文章的人也能通过Trackback顺藤摸瓜地来我的Blog看我的文章。所以,当我们的Blog有了Trackback Ping功能,那么谁都可以通过Trackback Ping来发表意见和评论了。这样,多家Blog网站就通过相关话题而联接起来。各种评论在Internet上相互连接而织成一张大网。因此,可以说, Trackback创造出了Blog与BBS、Diary完全不同的文化,Blog的世界通过Trackback而变成真正的无限互连。作为Blogger,让我们习惯于这样讨论问题和做评论吧:把内容写在自己的Blog里面,Trackback Ping到别人的Blog。这个概念是论坛模式里从来没有的,称为Remote Commenting。如何在Blog中实现Trackback?在有Trackback功能的Blog系统中,每篇Blog文章都有两个URL,一个是要访问这篇文章所使用的URL,另一个就是Trackback Ping URL(引用通告地址),它是用来接受来自其他Blog网站Trackback Ping的程序。当我发表文章的时候,想要通知鱼头的话,只需要把鱼头那篇文章的Trackback Ping URL贴到我这边文章中来,我提交文章时,系统就会按照这个URL发送一个Ping给A的那篇文章。而鱼头则将在自己的文章下看到类似这样的一个引用通告:标题: 1ster的文章来自: 1ster的Blog摘要: 1ster的文章内容摘要...地址: http://1ster的文章地址这个Trackback Ping是通过标准的HTTP协议从我的Blog发送到鱼头的Blog的,我的Blog发送一个POST格式的HTTP请求到A那篇文章的 Trackback Ping URL。这个请求的content type是application/x-www-form-URLencoded,它大概是这个样子的:POST http://A文章的TrackbackPingURLContent-Type: application/x-www-form-URLencodedtitle=1ster的文章&url=http://1ster的文章地址&excerpt=1ster的文章摘要&blog_name=1ster的Blog早期版本的Trackback规范中,Ping是GET方式的HTTP请求,现在不再支持GET方式,只能用POST方式。参数包括: * title - 文章的标题 * excerpt - 文章的摘要。在Movable Type系统中,如果摘录信息超过255个字符将会被截断为252个字符,并在后面增加...三个字符 * url - 文章的永久连接。象其它永久连接一样,这个连接应可能准确地在页面中定位文章的入口,因有疑问时这个链接会用到 * blog_name - 发表文章的blog的名称在上述的参数中只有url是必须的。如果title没有提供,url的值将被用作标题。当我的Blog发出这个Trackback Ping后,将接收一个简单的XML格式应答,如果Ping成功,那么应答的格式如下:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response></blockquote>而失败应答的格式为:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>The error message</message></response></blockquote>", "created_at"=>2007-05-21 05:54:26 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    什么是Trackback呢?简单说来,Trackback是网站与网站之间互相通告的一种方法。它能让甲对乙说:“这篇文章可能是你感兴趣的”,要实现这一动作,甲向乙发送一个 Trackback Ping(引用通告)即可。在这种情况下,一个ping就是一条从一个web服务器发送到另一个服务器的短消息(a small message)。Trackback Ping是由Moveable Type发明的规范,他们说Trackback是:<blockquote>"a framework for peer-to-peer communication and notifications between web sites"。</blockquote>这里是他们的Trackback技术规范文档:http://www.movabletype.org/docs/mttrackback.html举个例子来说明一下。比如B在A的Blog中看了一篇我感兴趣的文章,对这篇文章B自己有一些看法,如果按照传统BBS的做法,B需要在A这篇文章下发表自己的评论,但这样做的话B的文字只能存在于A的网站上,B无法再维护自己的这篇评论。另一个情况是B在自己的Blog中也在写一篇相类似的文章,B希望A也能来看一看B的这篇,传统BBS的习惯还是得到A的文章下发一篇回复,把B的URL贴过去。但有了Trackback Ping,我们的Blog不再需要这样做。Blog 跟BBS有点重要的不同,Blog是一种个人创作,用Blog来发表自己的东西,保存自己的东西,即使是对他人Blog文章的评论也要在自己的Blog中永久保留下来。通过Trackbak,我就可以在自己的Blog中发表文章,同时把自己这篇文章的URL地址Ping到A的那篇文章上去。这样,所有阅读A文章的人也能通过Trackback顺藤摸瓜地来我的Blog看我的文章。所以,当我们的Blog有了Trackback Ping功能,那么谁都可以通过Trackback Ping来发表意见和评论了。这样,多家Blog网站就通过相关话题而联接起来。各种评论在Internet上相互连接而织成一张大网。因此,可以说, Trackback创造出了Blog与BBS、Diary完全不同的文化,Blog的世界通过Trackback而变成真正的无限互连。作为Blogger,让我们习惯于这样讨论问题和做评论吧:把内容写在自己的Blog里面,Trackback Ping到别人的Blog。这个概念是论坛模式里从来没有的,称为Remote Commenting。如何在Blog中实现Trackback?在有Trackback功能的Blog系统中,每篇Blog文章都有两个URL,一个是要访问这篇文章所使用的URL,另一个就是Trackback Ping URL(引用通告地址),它是用来接受来自其他Blog网站Trackback Ping的程序。当我发表文章的时候,想要通知鱼头的话,只需要把鱼头那篇文章的Trackback Ping URL贴到我这边文章中来,我提交文章时,系统就会按照这个URL发送一个Ping给A的那篇文章。而鱼头则将在自己的文章下看到类似这样的一个引用通告:标题: 1ster的文章来自: 1ster的Blog摘要: 1ster的文章内容摘要...地址: http://1ster的文章地址这个Trackback Ping是通过标准的HTTP协议从我的Blog发送到鱼头的Blog的,我的Blog发送一个POST格式的HTTP请求到A那篇文章的 Trackback Ping URL。这个请求的content type是application/x-www-form-URLencoded,它大概是这个样子的:POST http://A文章的TrackbackPingURLContent-Type: application/x-www-form-URLencodedtitle=1ster的文章&url=http://1ster的文章地址&excerpt=1ster的文章摘要&blog_name=1ster的Blog早期版本的Trackback规范中,Ping是GET方式的HTTP请求,现在不再支持GET方式,只能用POST方式。参数包括: * title - 文章的标题 * excerpt - 文章的摘要。在Movable Type系统中,如果摘录信息超过255个字符将会被截断为252个字符,并在后面增加...三个字符 * url - 文章的永久连接。象其它永久连接一样,这个连接应可能准确地在页面中定位文章的入口,因有疑问时这个链接会用到 * blog_name - 发表文章的blog的名称在上述的参数中只有url是必须的。如果title没有提供,url的值将被用作标题。当我的Blog发出这个Trackback Ping后,将接收一个简单的XML格式应答,如果Ping成功,那么应答的格式如下:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response></blockquote>而失败应答的格式为:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>The error message</message></response></blockquote>

    \n", "_id"=>579}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"witter发布Gem包提供witter主要功能", "body"=>"witter越来越火了,这个提供IM服务的应用,越来越受到大家的关注,越来越多的人加入其中,昨天台湾的一个朋友还说对witter的这个IM功能很感兴趣,想了解是怎么实现的,呵呵~witter通过网络或者SMS(短消息)使得你和自己的朋友取得及时沟通。你有没有考虑过给自己的WebApp加上这样的功能呢,现在借助witter发布的Gem包,可以很方便的实现这个功能了,更多说明请到http://www.rubyinside.com/twitter-gem-twitterize-your-ruby-application-498.html查看,我这里稍微说下用法,如下:# to post an update to twitter$ twitter post "posting from the twitter gem"# to see you and your friends timeline$ twitter timeline命令行接口很简单,支持YAML配置,也支持Ruby的API:twit.update('me got dizzy this time')# Show your friends' statustwit.timeline(:friends).each do |s| puts s.text, s.user.nameendUse RubyGems as usual to install it:gem install twitter --include-dependenciesps:One note, the gem uses hpricot to parse the xml and there is an annoying bug that reared it's head in the 0.5+ versions (it doesn't like xml elements named text). That said, be sure to sudo gem install hpricot --source http://code.whytheluckystiff.net -v 0.4.86 and uninstall any hpricot versions 0.5+.", "created_at"=>2007-05-20 21:17:49 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    witter越来越火了,这个提供IM服务的应用,越来越受到大家的关注,越来越多的人加入其中,昨天台湾的一个朋友还说对witter的这个IM功能很感兴趣,想了解是怎么实现的,呵呵~witter通过网络或者SMS(短消息)使得你和自己的朋友取得及时沟通。你有没有考虑过给自己的WebApp加上这样的功能呢,现在借助witter发布的Gem包,可以很方便的实现这个功能了,更多说明请到http://www.rubyinside.com/twitter-gem-twitterize-your-ruby-application-498.html#查看,我这里稍微说下用法,如下: to post an update to twitter$ twitter post "posting from the twitter gem"# to see you and your friends timeline$ twitter timeline命令行接口很简单,支持YAML配置,也支持Ruby的API:twit.update('me got dizzy this time')# Show your friends' statustwit.timeline(:friends).each do |s| puts s.text, s.user.nameendUse RubyGems as usual to install it:gem install twitter --include-dependenciesps:One note, the gem uses hpricot to parse the xml and there is an annoying bug that reared it's head in the 0.5+ versions (it doesn't like xml elements named text). That said, be sure to sudo gem install hpricot --source http://code.whytheluckystiff.net -v 0.4.86 and uninstall any hpricot versions 0.5+.

    \n", "_id"=>580}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"简单的require写法", "body"=>"当你需要加载多个require的时候,是不是写了很多的require ×××什么的呢,就像JAVA一样,前面一对的import一样,其实我们可以这样写,是不是更方便快捷呢~%w(uri net/http yaml rubygems hpricot active_support).each { |f| require f }如上,少了不少字符吧~", "created_at"=>2007-05-20 20:58:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    当你需要加载多个require的时候,是不是写了很多的require ×××什么的呢,就像JAVA一样,前面一对的import一样,其实我们可以这样写,是不是更方便快捷呢~%w(uri net/http yaml rubygems hpricot active_support).each { |f| require f }如上,少了不少字符吧~

    \n", "_id"=>581}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现防垃圾的Trackback思路", "body"=>"Trackback可谓是WEB2.0的一个特征吧,Trackback的特征和好处我就不多说了,Trackback大部分人刚接触到肯定会觉得很迷惑,不知道怎么用。其实它也没有那么神秘,以下介绍一下我对Trackback的理解。 简单说trackback是一个点对点通信和网站间互相通告的框架。这句话也讲不明白. 那就拿实例来说: <blockquote>A在他的博客A.com上写了一篇文章 支持Trackback 引用地址为:http://a.com/trackback.php?id=1 B想写一篇文章回复A,惯用方法是我在A文章的下面写评论,但是Trackback带来了新的革命:B可以把文章写在自己的blog上,而同时又能在A的文章下面显示B这篇文章的部分内容。这就是利用了Trackback,那么A想要看别人评论的全文就要到B的网站上去,这样就带来了网站之间的互通,这才是Blog的精髓。虽然在国内大部分还习惯用comment的方式。 Trackback与comment不同的地方在于,你可以更好的控制自己的文章,按规定当你在你网站修改文章的时候,A网站上的你的内容同步改动.甚至删除 </blockquote>实现Trackback的原理也很简单,但是正是因为这种简单的机理,使得很多垃圾,造成“垃圾泛滥”,我想按照下面说得方法应该可以防范:1.加验证码2.编码-解码或者把这两个结合起来,在RUBY中可以使用base64编码,如下:decode64(str) 对经过Base64编码的str字符串进行解码。encode64(str) 对str字符串进行Base64编码。这样在生成Trackback地址的时候,可以把指定如下几个参数:1.私有的Key,在APP的配置文件(可以使用YML或者数据库)中指定一个私人的Key,然后生成Trackback地址时用这个key+文章创建时间,按照一定的规则截取,然后加上文章的ID以及编码规则(UTF-8、GBK等)组合一个字符串,再BASE64编码下,赋给一个指定的变量(比如code),/trackback/code=MjcyCXV0Zi04CTExNzkzNTkzNjQJMA%3D%3D,接收的时候先encode64解码,再验证Key等是不是正确的,如果正确的,就入库,否则抛弃。PS:还可以进一步,对这个地址先不显示,如果读者需要这个,就按照页面上的点一个“点击显示引用URL”,然后用个AJAX实现,就不怕网络爬虫了~以上是我的思路,页是参考别人的一些思路综合起来的,希望对大家有用,如果你有更好的想法,反应和我交流~", "created_at"=>2007-05-20 18:37:36 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Trackback可谓是WEB2.0的一个特征吧,Trackback的特征和好处我就不多说了,Trackback大部分人刚接触到肯定会觉得很迷惑,不知道怎么用。其实它也没有那么神秘,以下介绍一下我对Trackback的理解。 简单说trackback是一个点对点通信和网站间互相通告的框架。这句话也讲不明白. 那就拿实例来说: <blockquote>A在他的博客A.com上写了一篇文章 支持Trackback 引用地址为:http://a.com/trackback.php?id=1 B想写一篇文章回复A,惯用方法是我在A文章的下面写评论,但是Trackback带来了新的革命:B可以把文章写在自己的blog上,而同时又能在A的文章下面显示B这篇文章的部分内容。这就是利用了Trackback,那么A想要看别人评论的全文就要到B的网站上去,这样就带来了网站之间的互通,这才是Blog的精髓。虽然在国内大部分还习惯用comment的方式。 Trackback与comment不同的地方在于,你可以更好的控制自己的文章,按规定当你在你网站修改文章的时候,A网站上的你的内容同步改动.甚至删除 </blockquote>实现Trackback的原理也很简单,但是正是因为这种简单的机理,使得很多垃圾,造成“垃圾泛滥”,我想按照下面说得方法应该可以防范:1.加验证码2.编码-解码或者把这两个结合起来,在RUBY中可以使用base64编码,如下:decode64(str) 对经过Base64编码的str字符串进行解码。encode64(str) 对str字符串进行Base64编码。这样在生成Trackback地址的时候,可以把指定如下几个参数:1.私有的Key,在APP的配置文件(可以使用YML或者数据库)中指定一个私人的Key,然后生成Trackback地址时用这个key+文章创建时间,按照一定的规则截取,然后加上文章的ID以及编码规则(UTF-8、GBK等)组合一个字符串,再BASE64编码下,赋给一个指定的变量(比如code),/trackback/code=MjcyCXV0Zi04CTExNzkzNTkzNjQJMA%3D%3D,接收的时候先encode64解码,再验证Key等是不是正确的,如果正确的,就入库,否则抛弃。PS:还可以进一步,对这个地址先不显示,如果读者需要这个,就按照页面上的点一个“点击显示引用URL”,然后用个AJAX实现,就不怕网络爬虫了~以上是我的思路,页是参考别人的一些思路综合起来的,希望对大家有用,如果你有更好的想法,反应和我交流~

    \n", "_id"=>582}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog插件开发指南", "body"=>"一、什么是1stlog 1stlog是由1sters.com开发的一款基于RubyOnRails的博客系统,主要针对中国用户,符合中国用户的使用习惯,功能强大,结构合理,易于扩展和定制,是一款很有前景的博客系统。二、为什么要开发插件插件是对原有功能的扩充,以集成实现更多的更有特色的功能,主版本保证可扩展性,提供扩展的方法,制定开发规范和流程,方便不同需求的人可以快速的开发自己需要的插件;也可以把自己的插件分享给别人使用,甚至被1stlog开发官方收录,进入正式版本,为开源的RoR做出自己的贡献。三、怎样开发插件 1stlog是基于RubyOnRals开发,严格遵循MVC构架思想,本着数据层和表现出分离的原则,使用RoR的组件原理,可以很方便的开发插件,且整合使用简单,下面将就一个具体的例子说明如何进行插件开发。四、插件开发实例解析 目标:下面将实例说明如何进行插件的开发,我们的目标是使用Youtube提供的API,结合一组Youtube的Ruby代码lib,在1stlog上扩充一个展示您在Youtube上视频的小插件,该插件可以根据提供的USERNAME取其在Youtube上收藏的影片。详细指南请参考附件,或者到如下两个URL查看:http://code.google.com/p/1stlog/wiki/CreatePluginFor1stlogGuidehttp://docs.google.com/View?docid=dhf86kr9_28g7jthk", "created_at"=>2007-06-17 08:14:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    一、什么是1stlog 1stlog是由1sters.com开发的一款基于RubyOnRails的博客系统,主要针对中国用户,符合中国用户的使用习惯,功能强大,结构合理,易于扩展和定制,是一款很有前景的博客系统。二、为什么要开发插件插件是对原有功能的扩充,以集成实现更多的更有特色的功能,主版本保证可扩展性,提供扩展的方法,制定开发规范和流程,方便不同需求的人可以快速的开发自己需要的插件;也可以把自己的插件分享给别人使用,甚至被1stlog开发官方收录,进入正式版本,为开源的RoR做出自己的贡献。三、怎样开发插件 1stlog是基于RubyOnRals开发,严格遵循MVC构架思想,本着数据层和表现出分离的原则,使用RoR的组件原理,可以很方便的开发插件,且整合使用简单,下面将就一个具体的例子说明如何进行插件开发。四、插件开发实例解析 目标:下面将实例说明如何进行插件的开发,我们的目标是使用Youtube提供的API,结合一组Youtube的Ruby代码lib,在1stlog上扩充一个展示您在Youtube上视频的小插件,该插件可以根据提供的USERNAME取其在Youtube上收藏的影片。详细指南请参考附件,或者到如下两个URL查看:http://code.google.com/p/1stlog/wiki/CreatePluginFor1stlogGuidehttp://docs.google.com/View?docid=dhf86kr9_28g7jthk

    \n", "_id"=>583}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog演示环境搭建好了", "body"=>"在bluehost上搭建了一套演示环境,欢迎大家使用,体验,谢谢~演示地址:"1stlog":http://1stlog.1sters.com/管理登录:"1stlogAdmin":http://1stlog.1sters.com/index/login登录帐号:1stlog登录密码:1stlog请大家不要修改密码,数据库定时清空,谢谢~如果发现哪里用着不爽或者bug,欢迎提出,我尽快修改,谢谢~", "created_at"=>2007-06-15 16:46:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在bluehost上搭建了一套演示环境,欢迎大家使用,体验,谢谢~演示地址:"1stlog":http://1stlog.1sters.com/管理登录:"1stlogAdmin":http://1stlog.1sters.com/index/login登录帐号:1stlog登录密码:1stlog请大家不要修改密码,数据库定时清空,谢谢~如果发现哪里用着不爽或者bug,欢迎提出,我尽快修改,谢谢~

    \n", "_id"=>584}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在bluehost上部署ROR应用1stlog.", "body"=>"前段时间搞了个bluehost,看他支持ror,一直不敢用,今天部署了套1stlog,还真不简单,总结下下遇到的困难和应对的措施。*1.绑定域名*我把1stlog.1sters.com这个二级域名绑定到bluehost上,很快就生效了。*2.添加域名绑定*把前面我指向的1stlog.1sters.com绑定进去。*3.建立数据库和用户*在bluehost的控制面板上创建MYSQL数据库和用户,注意要给该用户赋权。OK,准备好了,我们开始安装吧。*4.dispatcher配置*首先遇到的就是dispatcher路径(/public/dispatch.rb)Set dispatcher path in "typo/public/dispatch.rb" 把#require "dispatcher" 修改为:#require "/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher"*5.遇到的是数据库编码*由于必须使用UTF-8,而在它的控制面板里面创建的数据库默认是latin1_swedish_ci的,找了一会,发现可以在phpMyadmin里面进行修改(幸好还有phpmyadmin)。点上面的“操作”标签,然后选择最下面的“整理”,选择utf8_unicode_ci就可以了。*6.配置FastCGI*紧接着来的是FastCGI的配置(在public/.htaccess),需要修改如下几个地方:AddHandler fastcgi-script .fcgi RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]添加一行:SetEnv RAILS_ENV production *7.dispatch.fcgi修改*确认#!/usr/bin/env ruby*8.然后给dispatch.fcgi执行权限*。这个很容易遗忘。。*9.初始化数据库*rake db:migrate VERSION=0*10.安装RedCloth*这个竟然默认是没有安装的,只能自己来装了,先下载(wget或者你用FTP传上去)gzip -d RedCloth-3.0.4.tar.gz --解压tar xvf RedCloth-3.0.4.tar --解tarmv RedCloth-3.0.4 redcloth --改个名字(可以不做)然后需要自己加载:在environment.rb里面加入: config.load_paths += %W( vendor/redcloth/lib ).map {|dir| "\#{RAILS_ROOT}/\#{dir}"}.select { |dir| File.directory?(dir) }require 'redcloth'*11.把log和tmp目录及其子目录属性修改为777*恩,差不多了吧,应该没有忘记什么吧:)", "created_at"=>2007-06-15 16:40:29 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    前段时间搞了个bluehost,看他支持ror,一直不敢用,今天部署了套1stlog,还真不简单,总结下下遇到的困难和应对的措施。1.绑定域名*我把1stlog.1sters.com这个二级域名绑定到bluehost上,很快就生效了。*2.添加域名绑定*把前面我指向的1stlog.1sters.com绑定进去。*3.建立数据库和用户*在bluehost的控制面板上创建MYSQL数据库和用户,注意要给该用户赋权。OK,准备好了,我们开始安装吧。*4.dispatcher配置*首先遇到的就是dispatcher路径(/public/dispatch.rb)Set dispatcher path in "typo/public/dispatch.rb" 把#require "dispatcher" 修改为:#require "/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher"*5.遇到的是数据库编码*由于必须使用UTF-8,而在它的控制面板里面创建的数据库默认是latin1_swedish_ci的,找了一会,发现可以在phpMyadmin里面进行修改(幸好还有phpmyadmin)。点上面的“操作”标签,然后选择最下面的“整理”,选择utf8_unicode_ci就可以了。*6.配置FastCGI*紧接着来的是FastCGI的配置(在public/.htaccess),需要修改如下几个地方:AddHandler fastcgi-script .fcgi RewriteRule ^(.)$ dispatch.fcgi [QSA,L]添加一行:SetEnv RAILS_ENV production *7.dispatch.fcgi修改*确认#!/usr/bin/env ruby*8.然后给dispatch.fcgi执行权限*。这个很容易遗忘。。*9.初始化数据库*rake db:migrate VERSION=0*10.安装RedCloth*这个竟然默认是没有安装的,只能自己来装了,先下载(wget或者你用FTP传上去)gzip -d RedCloth-3.0.4.tar.gz --解压tar xvf RedCloth-3.0.4.tar --解tarmv RedCloth-3.0.4 redcloth --改个名字(可以不做)然后需要自己加载:在environment.rb里面加入: config.load_paths += %W( vendor/redcloth/lib ).map {|dir| "\#{RAILS_ROOT}/\#{dir}"}.select { |dir| File.directory?(dir) }require 'redcloth'*11.把log和tmp目录及其子目录属性修改为777*恩,差不多了吧,应该没有忘记什么吧:)

    \n", "_id"=>585}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby版的YouTube库接口", "body"=>"YouTube的快速窜红,得到很多人的喜爱,加上被google收购以后,直觉告诉我们,肯定会推出类似google其他产品的API,果不其然,马上就推出了YouTube REST API,然后在rubyforge看到支持这个API的Ruby库,试了下,很简单好用,如下:1.先要安装% gem install youtubeBulk updating Gem source index for: http://gems.rubyforge.orgInstall required dependency xml-simple? [Yn] ySuccessfully installed youtube-0.8.6Successfully installed xml-simple-1.0.11Installing ri documentation for youtube-0.8.6...Installing RDoc documentation for youtube-0.8.6...2.申请developer id到http://youtube.com/my_profile_dev申请一个developer id。3.使用如下展示的是他的一个例子,很简单哈~<code> require 'rubygems' require 'youtube' youtube = YouTube::Client.new 'DEVELOPER_ID' profile = youtube.profile('br0wnpunk') puts "age: " + profile.age.to_s favorites = youtube.favorite_videos('br0wnpunk') puts "number of favorite videos: " + favorites.size.to_s friends = youtube.friends('paolodona') puts "number of friends: " + friends.size.to_s puts "friend name: " + friends[0].user videos = youtube.videos_by_tag('iron maiden') puts "number of videos by tag iron maiden: " + videos.size.to_s videos = youtube.videos_by_user('whytheluckystiff') puts "number of videos by why: " + videos.size.to_s puts "title: " + videos[0].title videos = youtube.featured_videos puts "number of featured videos: " + videos.size.to_s puts "title: " + videos[0].title puts "url: " + videos[0].url puts "embed url: " + videos[0].embed_url puts "embed html: \\n" + videos[0].embed_html details = youtube.video_details(videos[0]) puts "detailed description: " + details.description puts "thumbnail url: " + details.thumbnail_url</code>附件是这个lib包。更多信息请参考:RDOC : http://youtube.shanesbrain.net/", "created_at"=>2007-06-15 00:52:05 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    YouTube的快速窜红,得到很多人的喜爱,加上被google收购以后,直觉告诉我们,肯定会推出类似google其他产品的API,果不其然,马上就推出了YouTube REST API,然后在rubyforge看到支持这个API的Ruby库,试了下,很简单好用,如下:1.先要安装% gem install youtubeBulk updating Gem source index for: http://gems.rubyforge.orgInstall required dependency xml-simple? [Yn] ySuccessfully installed youtube-0.8.6Successfully installed xml-simple-1.0.11Installing ri documentation for youtube-0.8.6...Installing RDoc documentation for youtube-0.8.6...2.申请developer id到http://youtube.com/my_profile_devdeveloper申请一个 id。3.使用如下展示的是他的一个例子,很简单哈~<code> require 'rubygems' require 'youtube' youtube = YouTube::Client.new 'DEVELOPER_ID' profile = youtube.profile('br0wnpunk') puts "age: " + profile.age.to_s favorites = youtube.favorite_videos('br0wnpunk') puts "number of favorite videos: " + favorites.size.to_s friends = youtube.friends('paolodona') puts "number of friends: " + friends.size.to_s puts "friend name: " + friends[0].user videos = youtube.videos_by_tag('iron maiden') puts "number of videos by tag iron maiden: " + videos.size.to_s videos = youtube.videos_by_user('whytheluckystiff') puts "number of videos by why: " + videos.size.to_s puts "title: " + videos[0].title videos = youtube.featured_videos puts "number of featured videos: " + videos.size.to_s puts "title: " + videos[0].title puts "url: " + videos[0].url puts "embed url: " + videos[0].embed_url puts "embed html: \\n" + videos[0].embed_html details = youtube.video_details(videos[0]) puts "detailed description: " + details.description puts "thumbnail url: " + details.thumbnail_url</code>附件是这个lib包。更多信息请参考:RDOC : http://youtube.shanesbrain.net/

    \n", "_id"=>586}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.0发布啦!", "body"=>"很高兴的和大家说,做为*1sters.com*的第二个开源产品*1stlog*终于发布了,谢谢这么多朋友的关心和鼓励,谢谢你们大家的帮助,谢谢所有帮助、鼓励、支持我的朋友们!做为第一个对外发布版,从规划到实现,测试,到一步步的修正bug,一个来月的*“业余时间”*或许真的不算多(我白天是需要上班的,都是下班晚上写的代码),并且经常有其他的事情打扰,说真的,时间真的比较紧张。其实开源是需要勇气的,特别是对于我这样还没有多少经验和资本的时候,开源真的需要勇气,有的时候真的怕一个用户接二连三的抱怨或者漫骂,虽然做为开源的东西,做为作者的我并没有多少责任去满足每个用户的需求,但是从一个产品的开发者角度,我还是害怕大家用那种鄙视的目光,或者那种类似“就他也配开源”等等的话语,但是无所谓了,从开始规划1stlog我就打算开源了,我不能失约于关心我的朋友们。于是,狠狠心,咬咬牙,开源吧...或许还有很多的不足,还有很多的地方需要优化,很多地方需要调整和优化,等不及了,做为第一个版本,我想现在的功能已经足够丰富了。持续的改进,修复,优化将在后续版本继续吧。如果您使用或者借鉴了1stlog,如果有时间,可以发个mail什么的鼓励、感谢下我,也算对我心灵的犒劳;如果你有什么建议、意见,或者对1stlog有什么看法,也欢迎发Email给我。也可以到我的公司的网页上提建议:www.1sters.com..我的邮箱是:+iceskysl@gmail.com+马上就到6.14了,一个很特殊的日子,1stlog开源了...", "created_at"=>2007-06-13 07:59:51 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很高兴的和大家说,做为*1sters.com*的第二个开源产品*1stlog*终于发布了,谢谢这么多朋友的关心和鼓励,谢谢你们大家的帮助,谢谢所有帮助、鼓励、支持我的朋友们!做为第一个对外发布版,从规划到实现,测试,到一步步的修正bug,一个来月的*“业余时间”*或许真的不算多(我白天是需要上班的,都是下班晚上写的代码),并且经常有其他的事情打扰,说真的,时间真的比较紧张。其实开源是需要勇气的,特别是对于我这样还没有多少经验和资本的时候,开源真的需要勇气,有的时候真的怕一个用户接二连三的抱怨或者漫骂,虽然做为开源的东西,做为作者的我并没有多少责任去满足每个用户的需求,但是从一个产品的开发者角度,我还是害怕大家用那种鄙视的目光,或者那种类似“就他也配开源”等等的话语,但是无所谓了,从开始规划1stlog我就打算开源了,我不能失约于关心我的朋友们。于是,狠狠心,咬咬牙,开源吧...或许还有很多的不足,还有很多的地方需要优化,很多地方需要调整和优化,等不及了,做为第一个版本,我想现在的功能已经足够丰富了。持续的改进,修复,优化将在后续版本继续吧。如果您使用或者借鉴了1stlog,如果有时间,可以发个mail什么的鼓励、感谢下我,也算对我心灵的犒劳;如果你有什么建议、意见,或者对1stlog有什么看法,也欢迎发Email给我。也可以到我的公司的网页上提建议:www.1sters.com..我的邮箱是:+iceskysl@gmail.com+马上就到6.14了,一个很特殊的日子,1stlog开源了...

    \n", "_id"=>587}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog Version1.0.0安装部署文档", "body"=>"1stlog的安装部署文档,是基于51boo提供的空间做的演示,如果你是使用51boo的用户应该比较容易理解,如果你还没有ROR空间,建议你去51boo.com看看有没有合适你的产品,如果你有自己的服务器,那就不用我教了,部署方法和其他Rails部署基本上是一致的。需要提醒大家的是,搭建1stlog需要如下基本条件: mysql4.0及其以上版本数据库 rails1.2.3及其版本 ruby1.8.4及其以上版本 RedCloth RMagick详细的安装部署步骤在附件,请先自行下载查看,源文件将在晚上24点提供下载,请关注!", "created_at"=>2007-06-13 00:00:58 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    1stlog的安装部署文档,是基于51boo提供的空间做的演示,如果你是使用51boo的用户应该比较容易理解,如果你还没有ROR空间,建议你去51boo.com看看有没有合适你的产品,如果你有自己的服务器,那就不用我教了,部署方法和其他Rails部署基本上是一致的。需要提醒大家的是,搭建1stlog需要如下基本条件: mysql4.0及其以上版本数据库 rails1.2.3及其版本 ruby1.8.4及其以上版本 RedCloth RMagick详细的安装部署步骤在附件,请先自行下载查看,源文件将在晚上24点提供下载,请关注!

    \n", "_id"=>588}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) + String not valid UTF-8 +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"选取随机的记录的几个方法汇总", "body"=>"有的时候,我们可能想吧满足某个条件的记录随机的选几条出来,比如用户查看一篇文章的时候,我们想再旁边随机的列出与这个文章相关的几篇文章,我们就有如下几个方法:\n\n1.在Ruby中一次实现\n\nthings = Thing.find(:all)\nrandom_things = []\n3.times do\nrandom_things << things[rand(things.size)]\nend\n\n上面这个方法是可以的,但是有个缺点,它把整个表都查询出来,再随机的取三个,缺点很明显,如果数据库表太大,效率很差(内存等消耗很大);且可能取出两条相同的记录(尽管概率不大),第二个问题比较好修复,如下代码即可解决:\n\nthings = Thing.find(:all)\nrandom_things = []\nwhile random_things.size < 3\nrandom_things |= things[rand(things.size)]\nend\n\n2.Ruby查询两次\n\nthing_ids = Thing.find(:all, :select => 'id').map(&:id)\nrandom_ids = []\nwhile random_ids.size < 3 random_things |= things[rand(things.size)] end random_things = Thing.find(:all, :conditions => ['id IN (?)', random_ids])\n\n这个方法只是先随机取出ids较,然后再取ids对应的记录,比前面说的那个有个好处就是不会消耗太多的系统资源,比起第一种方法会快很多。\n\n3.在数据库层面上做\n\n<code>random_things = Thing.find(:all, :limit => 3, :order => 'random()')</code>\n\n是不是神奇呢,我们直接把:random(如果是MySQL则需要使用 rand()) 传给Find方法就可以了,这个方法看似比较好,其实不然,其构造出来的SQL比较变形,且对于不同的数据库不能通用。且类似与order by rand() limit 1这样的语句是很畸形的。并且这个sql效率奇低!!\n\n*4.使用offset进一步改进*\n\n<code>Thing.find :first, :offset => rand(Thing.count)</code>\n\n上面这个方法好多了,但是只能取一条,你可以按照第一种办法构造一个取多条的,页很简单,不是么?以上四个方法,请按照自己的实际情况使用,对于不同的需求,效率是不一样的,如果你有更好的方法,欢迎留言讨论。", "created_at"=>2007-06-10 21:09:11 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候,我们可能想吧满足某个条件的记录随机的选几条出来,比如用户查看一篇文章的时候,我们想再旁边随机的列出与这个文章相关的几篇文章,我们就有如下几个方法:

    \n\n

    1.在Ruby中一次实现

    \n\n

    things = Thing.find(:all)
    \nrandom_things = []
    \n3.times do
    \nrandom_things << things[rand(things.size)]
    \nend

    \n\n

    上面这个方法是可以的,但是有个缺点,它把整个表都查询出来,再随机的取三个,缺点很明显,如果数据库表太大,效率很差(内存等消耗很大);且可能取出两条相同的记录(尽管概率不大),第二个问题比较好修复,如下代码即可解决:

    \n\n

    things = Thing.find(:all)
    \nrandom_things = []
    \nwhile random_things.size < 3
    \nrandom_things |= things[rand(things.size)]
    \nend

    \n\n

    2.Ruby查询两次

    \n\n

    thing_ids = Thing.find(:all, :select => 'id').map(&:id)
    \nrandom_ids = []
    \nwhile random_ids.size < 3 random_things |= things[rand(things.size)] end random_things = Thing.find(:all, :conditions => ['id IN (?)', random_ids])

    \n\n

    这个方法只是先随机取出ids较,然后再取ids对应的记录,比前面说的那个有个好处就是不会消耗太多的系统资源,比起第一种方法会快很多。

    \n\n

    3.在数据库层面上做

    \n\n

    <code>random_things = Thing.find(:all, :limit => 3, :order => 'random()')</code>

    \n\n

    是不是神奇呢,我们直接把:random(如果是MySQL则需要使用 rand()) 传给Find方法就可以了,这个方法看似比较好,其实不然,其构造出来的SQL比较变形,且对于不同的数据库不能通用。且类似与order by rand() limit 1这样的语句是很畸形的。并且这个sql效率奇低!!

    \n\n

    4.使用offset进一步改进

    \n\n

    <code>Thing.find :first, :offset => rand(Thing.count)</code>

    \n\n

    上面这个方法好多了,但是只能取一条,你可以按照第一种办法构造一个取多条的,页很简单,不是么?以上四个方法,请按照自己的实际情况使用,对于不同的需求,效率是不一样的,如果你有更好的方法,欢迎留言讨论。

    \n", "_id"=>590}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails实现下载文件的小技巧", "body"=>"

    有的时候,如果你把需要下载的文件放在public目录或者其子目录下,是可以通过URL直接下载的,但是有的时候,你可能想把文件存放在别的目录以保证不会被爬虫或者其他恶意的人下载到(比如你写的电子书或者好的资料等等.),这个时候Rails的send_file函数就显得很好用,它每次发送4096byte,所以发送文件会很快,
    \n下面是个例子:

    \n
    send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
    \n
    \n


    \n这里只是一个例子,真实的使用中,你可以把一个文件的信息存放在数据库里面,然后下载的时候就可以根据每个文件来指定上述的值了,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def attachment  
    2. \n
    3. @attachment = Attachment.find(params[:id]) @attachment.update_attribute(:downloads,@attachment.downloads+1)  
    4. \n
    5. send_file @attachment.filepath, :type => @attachment.filetype, :disposition => 'inline'
      \n
    6. \n
    7. end 
      \n
    8. \n
    \n
    \n

    很棒,不是么~

    ", "created_at"=>2007-06-10 09:19:04 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候,如果你把需要下载的文件放在public目录或者其子目录下,是可以通过URL直接下载的,但是有的时候,你可能想把文件存放在别的目录以保证不会被爬虫或者其他恶意的人下载到(比如你写的电子书或者好的资料等等.),这个时候Rails的send_file函数就显得很好用,它每次发送4096byte,所以发送文件会很快,
    \n下面是个例子:
    \nsend_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
    \n
    \n
    \n这里只是一个例子,真实的使用中,你可以把一个文件的信息存放在数据库里面,然后下载的时候就可以根据每个文件来指定上述的值了,如下:
    \n
    \nRuby代码
    \n
    \n def attachment  
    \n @attachment = Attachment.find(params[:id]) @attachment.update_attribute(:downloads,@attachment.downloads+1)  
    \n send_file @attachment.filepath, :type => @attachment.filetype, :disposition => 'inline'
    \n
    \n end 
    \n
    \n
    \n
    \n很棒,不是么~

    \n", "_id"=>591}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails4Days中文翻译版", "body"=>"这个是我很早前开始接触ROR的时候翻译的,也有不少人看了,很是欣慰,今天1stlog加上了附件上传下载功能,顺便吧这个PDF发上来,需要的朋友可以在这里下载了。写在前面的话:自己正在学习ROR,鉴于关于ROR的中文资料比较少,虽然自己E语不怎么样,但是每次看到E文资料都尽力翻译过来。一来方便自己日后回头看这些资料比较方便;二是这样可以使自己看的比较认真,仔细揣摩原文的意思;还有一点就是尽量为后来的学习者提供一些关于ROR的中文资料。一边看一边翻译记录,没有仔细校核,如有不妥,还望海涵,如能指出,不甚感激!", "created_at"=>2007-06-10 09:01:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这个是我很早前开始接触ROR的时候翻译的,也有不少人看了,很是欣慰,今天1stlog加上了附件上传下载功能,顺便吧这个PDF发上来,需要的朋友可以在这里下载了。写在前面的话:自己正在学习ROR,鉴于关于ROR的中文资料比较少,虽然自己E语不怎么样,但是每次看到E文资料都尽力翻译过来。一来方便自己日后回头看这些资料比较方便;二是这样可以使自己看的比较认真,仔细揣摩原文的意思;还有一点就是尽量为后来的学习者提供一些关于ROR的中文资料。一边看一边翻译记录,没有仔细校核,如有不妥,还望海涵,如能指出,不甚感激!

    \n", "_id"=>592}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现验证码需要注意的地方", "body"=>"开始以为没有什么难得,参考了http://www.blogjava.net/killme2008/archive/2007/04/09/109456.html和JAVAEYE上的一些文章,其实大家说的都差不多的,都是说win下注意的事情,我在lunix上怎么就是跑不起来,一直报告Missing model noisy_image.rb这个错误,后来看到http://wiki.rubyonrails.com/rails/pages/HowtoSecureFormsWithNoisyImages这个文章,恍然大悟。<code>class NoisyImagerequire 'RMagick'include Magick</code>注意这个*require 'RMagick'*是放在class里面的,如果放在外面,就会报我上面说的那个错误。PS:刚刚给1stlog加上了验证码,也是最后一个功能点了。明天找时间整理下文档就可以开源了。真开心~", "created_at"=>2007-06-09 09:55:40 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    开始以为没有什么难得,参考了http://www.blogjava.net/killme2008/archive/2007/04/09/109456.html和JAVAEYE上的一些文章,其实大家说的都差不多的,都是说win下注意的事情,我在lunix上怎么就是跑不起来,一直报告Missing model noisy_image.rb这个错误,后来看到http://wiki.rubyonrails.com/rails/pages/HowtoSecureFormsWithNoisyImages这个文章,恍然大悟。<code>class NoisyImagerequire 'RMagick'include Magick</code>注意这个*require 'RMagick'*是放在class里面的,如果放在外面,就会报我上面说的那个错误。PS:刚刚给1stlog加上了验证码,也是最后一个功能点了。明天找时间整理下文档就可以开源了。真开心~

    \n", "_id"=>593}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"完善你的URL显示信息", "body"=>"当你允许用户评论的时候,可能需要他们输入主页等URL,你以为用户会很认真的写上*http://*,现实是用户很多时候懒得写,只写www.1ster.cn这样的,你可以在接收数据的时候或者JS处理一下,如果没有http://就加上,但有的时候,面对一些历史数据或者你不想在接收的时候处理,可以按照下面这个来处理。<code> def url=(addr) super (addr.blank? || addr.starts_with?('http')) ? addr : "http://\#{addr}" end</code>当然,你也可以按照这个思路在你接收数据的时候处理。", "created_at"=>2007-06-07 19:43:51 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    当你允许用户评论的时候,可能需要他们输入主页等URL,你以为用户会很认真的写上*http://*,现实是用户很多时候懒得写,只写www.1ster.cn这样的,你可以在接收数据的时候或者JS处理一下,如果没有http://就加上,但有的时候,面对一些历史数据或者你不想在接收的时候处理,可以按照下面这个来处理。<code> def url=(addr) super (addr.blank? || addr.starts_with?('http')) ? addr : "http://\#{addr}" end</code>当然,你也可以按照这个思路在你接收数据的时候处理。

    \n", "_id"=>594}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Layout in Rails(三种方法)", "body"=>"Rails里面的layout的主要思想是template的merge机制 — 即在布局中留下若干占位符。当HTTP请求过来,响应页面将具体内容插入到对应的占位符合并而成完成的内容,站在具体响应页面的角度看,当然“推”的处理方法项目可维护性更好。下面我们主要说说在Rails的controller中对layout的控制范围。*1. method级别的控制*。在某些特定的请求(对应rails controller里面一个method)需要特定的layout, 这时候可以<code> class ExampleController < AppplicationController def index render :layout => ‘my_layout’ end def list end end</code>*2. controller级别的控制*。很多情况下,需要对同一个controller中的所有或者大多数method应用一个layout。那么我们可以在controller级别上来定义layout<code> class ExampleController < AppplicationController layout 'my_layout', :except => rss # layout :my_def_layout # layout proc{|c| …} def index end def list end end</code>我们可以使用layout函数的三种方式来处理对应的情况。*3. application级别的控制*。因为所有的controller都是继承于ApplicationController, 所以要在application的级别控制layout, 我们只要把2中的layout定义上升到ApplicationController class。比如对于应用程序而言,XMLHttpRequest不需要layout, 那么<code> class ApplicationController < ActionController::Base layout proc{ |c| c.request.xhr? ? false : "application" } end</code>在以后我们将说说在layout中怎么插入多部分内容。", "created_at"=>2007-06-07 17:35:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Rails里面的layout的主要思想是template的merge机制 — 即在布局中留下若干占位符。当HTTP请求过来,响应页面将具体内容插入到对应的占位符合并而成完成的内容,站在具体响应页面的角度看,当然“推”的处理方法项目可维护性更好。下面我们主要说说在Rails的controller中对layout的控制范围。*1. method级别的控制*。在某些特定的请求(对应rails controller里面一个method)需要特定的layout, 这时候可以<code> class ExampleController < AppplicationController def index render :layout => ‘my_layout’ end def list end end</code>*2. controller级别的控制*。很多情况下,需要对同一个controller中的所有或者大多数method应用一个layout。那么我们可以在controller级别上来定义layout<code> class ExampleController < AppplicationController layout 'my_layout', :except => rss # layout :my_def_layout # layout proc{|c| …} def index end def list end end</code>我们可以使用layout函数的三种方式来处理对应的情况。*3. application级别的控制*。因为所有的controller都是继承于ApplicationController, 所以要在application的级别控制layout, 我们只要把2中的layout定义上升到ApplicationController class。比如对于应用程序而言,XMLHttpRequest不需要layout, 那么<code> class ApplicationController < ActionController::Base layout proc{ |c| c.request.xhr? ? false : "application" } end</code>在以后我们将说说在layout中怎么插入多部分内容。

    \n", "_id"=>595}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用check_box_tag时需要注意的", "body"=>"*check_box_tag*这个辅助方法,不晓得是rails自己的Bug还是其他的原因,按照道理来说,应该是和*check_box*这个辅助方法差不多的才对呀,但是在使用过程中发现有些问题,提醒各位下:check_box是可以自动生成*hidden_field*区域的代码的,这样选中或者不选中的时候,都可以正常工作;但是check_box_tag这个东西却没有那么好,它不会自动生成+hidden_field+的代码,所以使得你在不选该复选框的时候,其值是不会送到服务端的。必须手工添加以下代码:<%=hidden_field_tag item.name, 0 %>切忌切忌哈~", "created_at"=>2007-06-07 09:41:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    *check_box_tag*这个辅助方法,不晓得是rails自己的Bug还是其他的原因,按照道理来说,应该是和*check_box*这个辅助方法差不多的才对呀,但是在使用过程中发现有些问题,提醒各位下:check_box是可以自动生成*hidden_field*区域的代码的,这样选中或者不选中的时候,都可以正常工作;但是check_box_tag这个东西却没有那么好,它不会自动生成+hidden_field+的代码,所以使得你在不选该复选框的时候,其值是不会送到服务端的。必须手工添加以下代码:<%=hidden_field_tag item.name, 0 %>切忌切忌哈~

    \n", "_id"=>596}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dir.glob基本操作", "body"=>"使用*Dir.glob*可以方便的进行目录遍历,如下的例子是查找D:/gem的子目录中所有包含readme.txt文件的子目录。<code> themes_root = "D:/gem" glob = "\#{themes_root}/[a-zA-Z0-9]*" @theme_cache = Dir.glob(glob).select do |file| File.readable?("\#{file}/readme.txt") end.compact p @theme_cache</code>还有一系列的延伸,请参考ruby手册。", "created_at"=>2007-06-05 23:17:36 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    使用Dir.glob*可以方便的进行目录遍历,如下的例子是查找D:/gem的子目录中所有包含readme.txt文件的子目录。<code> themes_root = "D:/gem" glob = "\#{themes_root}/[a-zA-Z0-9]" @theme_cache = Dir.glob(glob).select do |file| File.readable?("\#{file}/readme.txt") end.compact p @theme_cache</code>还有一系列的延伸,请参考ruby手册。

    \n", "_id"=>597}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"自动备份数据库的脚本", "body"=>"一个WEB应用,基本上是不能保证其100%安全的,网络安全、系统的稳定性都可能在某个时间突然发生,您辛辛苦苦写的文章,收集的资料,很可能在瞬间消失,再也找不回来;数据真的是越来越重要了;另外,你可能想把一个WEB迁移到另外一台主机上等等,这个时候,数据库的备份就显得各位的重要。ROR应用中,使用的最多的是MYSQL数据库了,一直都没有找到比较好的、方便的方来来备份数据,上次自己写了一个备份到YMAL文件的,使用起来比较慢,导出来的格式也不是很好,所以也就没有发布出来,如果有人对这个比较感兴趣,可以mail我。今天说的是另外的一个备份的工具(*AutoMySQLBackup*),在COR上看到的链接,脚本是个老外写的,主要使用的是mysqldump来定时备份数据,下来简单的配置试了下,果然好用,你使用的时候,需要修改你需要备份的数据库名、连接用户、密码和主机地址,另外如果你是在虚拟主机上的,则需要修改备份目标文件夹,如+BACKUPDIR="./backups"+(需要加上*./*,否则你可能会得到目录拒绝写操作的提示);另外,还可以配置邮件,使得备份以后会把其压缩后的文件发送到你的邮箱(这个大小受到邮件附件大小的限制),可以定时(天、周、月)来备份。值得一提的是采用的是增量备份,非常方便。详细的介绍页面你可以参考:http://www.debianhelp.co.uk/mysqlscript.htm或者直接下载脚本程序(里面有说明的)", "created_at"=>2007-06-05 20:50:05 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    一个WEB应用,基本上是不能保证其100%安全的,网络安全、系统的稳定性都可能在某个时间突然发生,您辛辛苦苦写的文章,收集的资料,很可能在瞬间消失,再也找不回来;数据真的是越来越重要了;另外,你可能想把一个WEB迁移到另外一台主机上等等,这个时候,数据库的备份就显得各位的重要。ROR应用中,使用的最多的是MYSQL数据库了,一直都没有找到比较好的、方便的方来来备份数据,上次自己写了一个备份到YMAL文件的,使用起来比较慢,导出来的格式也不是很好,所以也就没有发布出来,如果有人对这个比较感兴趣,可以mail我。今天说的是另外的一个备份的工具(AutoMySQLBackup*),在COR上看到的链接,脚本是个老外写的,主要使用的是mysqldump来定时备份数据,下来简单的配置试了下,果然好用,你使用的时候,需要修改你需要备份的数据库名、连接用户、密码和主机地址,另外如果你是在虚拟主机上的,则需要修改备份目标文件夹,如+BACKUPDIR="./backups"+(需要加上./*,否则你可能会得到目录拒绝写操作的提示);另外,还可以配置邮件,使得备份以后会把其压缩后的文件发送到你的邮箱(这个大小受到邮件附件大小的限制),可以定时(天、周、月)来备份。值得一提的是采用的是增量备份,非常方便。详细的介绍页面你可以参考:http://www.debianhelp.co.uk/mysqlscript.htm或者直接下载脚本程序(里面有说明的)

    \n", "_id"=>598}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在windows上安装RMagick", "body"=>"看到网上很多人说再WIN下安装RMagick的方法都是这样的,gem install ImageMagick-6.3.0-7-Q8-windows-dll.exe,这样我感觉谁有问题的,至少我这样安装的时候是有错误的,如:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install ImageMagick-6.3.0-7-Q8-windows-dll.exeERROR: Error installing gem ImageMagick-6.3.0-7-Q8-windows-dll.exe[.gem]: string contains null byte所以正确的应该是用gem包来安装,如下:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install rmagick-1.14.1-win32.gemSuccessfully installed rmagick, version 1.14.1看看是不是安装上了:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem listrmagick (1.14.1) RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries.", "created_at"=>2007-06-04 22:06:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    看到网上很多人说再WIN下安装RMagick的方法都是这样的,gem install ImageMagick-6.3.0-7-Q8-windows-dll.exe,这样我感觉谁有问题的,至少我这样安装的时候是有错误的,如:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install ImageMagick-6.3.0-7-Q8-windows-dll.exeERROR: Error installing gem ImageMagick-6.3.0-7-Q8-windows-dll.exe[.gem]: string contains null byte所以正确的应该是用gem包来安装,如下:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install rmagick-1.14.1-win32.gemSuccessfully installed rmagick, version 1.14.1看看是不是安装上了:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem listrmagick (1.14.1) RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries.

    \n", "_id"=>599}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"mini_magick 1.2.2 Released", "body"=>"*mini_magick* version 1.2.2 has been released!RMagick是大家用的最多的图片处理类库,但是它台复杂了,消耗太多的内存,比如下面这段最简单的代码都会吃掉100M的内存:<code>Magick::read("image.jpg") do |f|f.write("manipulated.jpg")end</code>*mini_magick*是把ImageMagick进行的一次封装,使得可以很方便的使用MiniMagick的commandline,可以在http://www.imagemagick.org/script/mogrify.php 查看可耕多的ImageMagick has 信息。*mini_magick*1.2.2包含如下更新:# 1.) all image commands return the image object (The output of the last command is saved in @output)# 2.) identify doesn't trip over strangley named files# 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions)# 4.) identify commands escape output path correctly", "created_at"=>2007-06-03 00:01:12 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    mini_magick version 1.2.2 has been released!RMagick是大家用的最多的图片处理类库,但是它台复杂了,消耗太多的内存,比如下面这段最简单的代码都会吃掉100M的内存:<code>Magick::read("image.jpg") do |f|f.write("manipulated.jpg")end</code>*mini_magick*是把ImageMagick进行的一次封装,使得可以很方便的使用MiniMagick的commandline,可以在http://www.imagemagick.org/script/mogrify.php 查看可耕多的ImageMagick has 信息。*mini_magick*1.2.2包含如下更新:# 1.) all image commands return the image object (The output of the last command is saved in @output)# 2.) identify doesn't trip over strangley named files# 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions#) 4.) identify commands escape output path correctly

    \n", "_id"=>600}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"days_in_month函数介绍", "body"=>"days_in_month这个函数返回给定的年月的月的天数,对于写阴历什么的很有帮助,下面是英文的介绍。Descriptiondays_in_month(month, year=nil)Return the number of days in the given month. If a year is given, February will return the correct number of days for leap years. Otherwise, this method will always report February as having 28 days.<code> 1. >> Time.days_in_month(4) => 30 2. >> Time.days_in_month(4,2006) => 30 3. >> Time.days_in_month(2,2006) => 28 4. >> Time.days_in_month(2) => 28 5. >> Time.days_in_month(2,2008) => 29</code>", "created_at"=>2007-06-02 00:29:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    days_in_month这个函数返回给定的年月的月的天数,对于写阴历什么的很有帮助,下面是英文的介绍。Descriptiondays_in_month(month, year=nil)Return the number of days in the given month. If a year is given, February will return the correct number of days for leap years. Otherwise, this method will always report February as having 28 days.<code> 1. >> Time.days_in_month(4) => 30 2. >> Time.days_in_month(4,2006) => 30 3. >> Time.days_in_month(2,2006) => 28 4. >> Time.days_in_month(2) => 28 5. >> Time.days_in_month(2,2008) => 29</code>

    \n", "_id"=>601}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装SSH库的时候出现问题的修复", "body"=>"在使用SSH的时候,需要另外安装SSH的库,但是我按照官方上的方法无论是远程安装还是本地安装都出现错误,如下:D:\\>gem install net-ssh --include-dependenciesERROR: While executing gem ... (Zlib::BufError) buffer error查了下资料,貌似问题是出在Windows版本上的RUBY有点问题,可以按照下面的进行修复:1.修改ruby的安装目录下(c:\\ruby\\lib\\ruby\\site_ruby\\1.8\\rubygems\\package.rb)的package.rb文件,在 618 行,把1.2.1修改为 1.2.3。2) removed the linessh 22/tcp #SSHfrom file %systemroot%\\system32\\drivers\\etc\\services", "created_at"=>2007-06-01 23:57:42 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在使用SSH的时候,需要另外安装SSH的库,但是我按照官方上的方法无论是远程安装还是本地安装都出现错误,如下:D:&gt;gem install net-ssh --include-dependenciesERROR: While executing gem ... (Zlib::BufError) buffer error查了下资料,貌似问题是出在Windows版本上的RUBY有点问题,可以按照下面的进行修复:1.修改ruby的安装目录下(c:\\ruby\\lib\\ruby\\site_ruby\\1.8\\rubygems\\package.rb)的package.rb文件,在 618 行,把1.2.1修改为 1.2.3。2) removed the linessh 22/tcp #SSHfrom file %systemroot%\\system32\\drivers\\etc\\services

    \n", "_id"=>602}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Jsonifier在rails中生成json", "body"=>"

    由于一个系统需要对外提供数据,自然使用widget来实现,JS中自然是对json支持最好,也是就可以吧数据组装成json格式的,再用JS解析显示,于是就有了这个需求:在rails中生成JSON,尽管rails1.1版本就增加了对json的支持,但要想更加灵活,自然使用插件来实现了,而Jsonifier 正是我们需要的。
    \n看看Jsonifier的自我介绍:
    \nJsonifier is a Rails plugin that adds options to the ActiveRecord#to_json method similar to ActiveRecord#to_xml. It's time to treat the JSON encoding of AR objects with more respect ;)The :only, :except, :methods, and :include options are supported. Check out the examples below.
    \n
    \n*安装:*
    \n很简单,script/plugin install svn://svn.codefront.net/jsonifier/trunk
    \n
    \n*使用:*

    \n
    \n
    Ruby代码
    \n
      \n
    1. david = User.find(1)  
    2. \n
    3. david.to_json # {id: 1, name: "David", awesome: true, created_at: "07/01/2007"}  
    4. \n
    5. david.to_json(:only => :name# {name: "David"}  
    6. \n
    7. david.to_json(:only => [:id:name]) # {id: 1, name: "David"}  
    8. \n
    9. david.to_json(:except => :created_at# {id: 1, name: "David", awesome: true}  
    10. \n
    11. david.to_json(:except => [:id:created_at]) # {name: "David", awesome: true}  
    12. \n
    \n
    \n

    很简单吧~

    ", "created_at"=>2007-07-12 01:14:11 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    由于一个系统需要对外提供数据,自然使用widget来实现,JS中自然是对json支持最好,也是就可以吧数据组装成json格式的,再用JS解析显示,于是就有了这个需求:在rails中生成JSON,尽管rails1.1版本就增加了对json的支持,但要想更加灵活,自然使用插件来实现了,而Jsonifier 正是我们需要的。
    \n看看Jsonifier的自我介绍:
    \nJsonifier is a Rails plugin that adds options to the ActiveRecord#to_json method similar to ActiveRecord#to_xml. It's time to treat the JSON encoding of AR objects with more respect ;)The :only, :except, :methods, and :include options are supported. Check out the examples below.
    \n
    \n安装:
    \n很简单,script/plugin install svn://svn.codefront.net/jsonifier/trunk
    \n
    \n使用:
    \n
    \nRuby代码
    \n
    \n david = User.find(1)  
    \n david.to_json # {id: 1, name: "David", awesome: true, created_at: "07/01/2007"}  
    \n david.to_json(:only => :name) # {name: "David"}  
    \n david.to_json(:only => [:id, :name]) # {id: 1, name: "David"}  
    \n david.to_json(:except => :created_at) # {id: 1, name: "David", awesome: true}  
    \n david.to_json(:except => [:id, :created_at]) # {name: "David", awesome: true}  
    \n
    \n
    \n很简单吧~

    \n", "_id"=>603}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"敏捷软件开发宣言", "body"=>"觉得敏捷开发模式就是我们目前追寻的理想开发模式,配合RoR的灵活,足以使得更加敏捷~于是给这个blog重新添加了一个“敏捷开发”的分类,记录该类的读书感受等等,以下便是大名鼎鼎的敏捷宣言!*敏捷软件开发宣言*个体和交互 胜过 过程和工具可以工作的软件 胜过 面面俱到的文档客户合作 胜过 合同谈判响应变化 胜过 遵循计划虽然右项也有价值,但是我们认为左项具有更大的价值。PS:发现个37的那本Getting Real里面宣称的几乎完全一致!", "created_at"=>2007-07-11 17:44:44 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    觉得敏捷开发模式就是我们目前追寻的理想开发模式,配合RoR的灵活,足以使得更加敏捷~于是给这个blog重新添加了一个“敏捷开发”的分类,记录该类的读书感受等等,以下便是大名鼎鼎的敏捷宣言!*敏捷软件开发宣言*个体和交互 胜过 过程和工具可以工作的软件 胜过 面面俱到的文档客户合作 胜过 合同谈判响应变化 胜过 遵循计划虽然右项也有价值,但是我们认为左项具有更大的价值。PS:发现个37的那本Getting Real里面宣称的几乎完全一致!

    \n", "_id"=>604}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何快速统计RoR网站的访问量", "body"=>"本文来源JavaEye,由于没有提供单篇RSS,我就全部转过来了,版权所有规robbin所有。链接地址:http://robbin.javaeye.com/blog/97287统计网站的访问量有很多专业的第三方工具,例如Google Analytics,提供强大,而且详细的统计功能。当然,也许不是每个人都需要这么复杂而且操作麻烦的工具,如果你只是需要大概了解一下网站的访问量和访问URL的比例,那么让我们看看最简单最容易的统计工具:Unix Shell。一个RoR网站的访问纪录,Web Server(Apache or lighttpd)会记录所有的访问请求,包括动态请求和静态请求,但大量图片,JS,CSS的请求对我们没有太大的统计价值,因此web server的日志参考价值就不大。RoR会记录所有动态请求日志到log/production.log里面,我们要做的就是让RoR进行日志交换,每天产生一个新的日志文件。很简单,修改config/environment.rb RAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}.log", "daily") 那么每天就会产生一个诸如+production.log.20070702+这样的日志文件。*一、统计每日动态请求处理总数*cat production.log.20070702|grep "200 OK"|wc -l 打印日志文件,挑选正确处理的请求行,统计行数,一条shell命令就搞定了网站处理的动态请求数量。虽然动态请求数量不等于网站访问量,但是可以作为一个重要的参考指标。*二、统计URL的访问频度*网站管理员都很希望知道哪些频道受欢迎被访问的频繁,哪些URL格外受到关注,不必寻求专业的网站流量统计系统,一条shell命令就搞定了:cat production.log.20070702 |grep "200 OK" | awk '{print $17}'|sort|uniq -c | sort -r -n > stat.log 打印日志文件,挑选正确处理请求行,把第17列即URL那一列挑出来,排序,统计唯一URL出现的次数,按照URL次数倒序输出到stat.log文件里面,让我们看看stat.log是什么:10096 [http://www.javaeye.com/] 3590 [http://www.javaeye.com/forums/index] 3446 [http://www.javaeye.com/forums/board/Java] 3300 [http://www.javaeye.com/index/rss_index_topics] 2477 [http://www.javaeye.com/forums/board/Life] 1605 [http://www.javaeye.com/forums/board/AJAX] ......... 网站首页被访问了10096次,论坛频道首页被访问了3590次,......是不是很爽?我们用一条shell命令可以做简单的网站访问统计系统了。那么用Java做的系统,能不能这样统计呢?其实照样可以。你可以在tomcat的配置文件里面设置输出详细的日志信息,然后照样用shell命令搞定。", "created_at"=>2007-07-10 16:58:48 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    本文来源JavaEye,由于没有提供单篇RSS,我就全部转过来了,版权所有规robbin所有。链接地址:http://robbin.javaeye.com/blog/97287统计网站的访问量有很多专业的第三方工具,例如Google Analytics,提供强大,而且详细的统计功能。当然,也许不是每个人都需要这么复杂而且操作麻烦的工具,如果你只是需要大概了解一下网站的访问量和访问URL的比例,那么让我们看看最简单最容易的统计工具:Unix Shell。一个RoR网站的访问纪录,Web Server(Apache or lighttpd)会记录所有的访问请求,包括动态请求和静态请求,但大量图片,JS,CSS的请求对我们没有太大的统计价值,因此web server的日志参考价值就不大。RoR会记录所有动态请求日志到log/production.log里面,我们要做的就是让RoR进行日志交换,每天产生一个新的日志文件。很简单,修改config/environment.rb RAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}.log", "daily") 那么每天就会产生一个诸如+production.log.20070702+这样的日志文件。*一、统计每日动态请求处理总数*cat production.log.20070702|grep "200 OK"|wc -l 打印日志文件,挑选正确处理的请求行,统计行数,一条shell命令就搞定了网站处理的动态请求数量。虽然动态请求数量不等于网站访问量,但是可以作为一个重要的参考指标。*二、统计URL的访问频度*网站管理员都很希望知道哪些频道受欢迎被访问的频繁,哪些URL格外受到关注,不必寻求专业的网站流量统计系统,一条shell命令就搞定了:cat production.log.20070702 |grep "200 OK" | awk '{print $17}'|sort|uniq -c | sort -r -n > stat.log 打印日志文件,挑选正确处理请求行,把第17列即URL那一列挑出来,排序,统计唯一URL出现的次数,按照URL次数倒序输出到stat.log文件里面,让我们看看stat.log是什么:10096 [http://www.javaeye.com/] 3590 [http://www.javaeye.com/forums/index] 3446 [http://www.javaeye.com/forums/board/Java] 3300 [http://www.javaeye.com/index/rss_index_topics] 2477 [http://www.javaeye.com/forums/board/Life] 1605 [http://www.javaeye.com/forums/board/AJAX] ......... 网站首页被访问了10096次,论坛频道首页被访问了3590次,......是不是很爽?我们用一条shell命令可以做简单的网站访问统计系统了。那么用Java做的系统,能不能这样统计呢?其实照样可以。你可以在tomcat的配置文件里面设置输出详细的日志信息,然后照样用shell命令搞定。

    \n", "_id"=>605}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"话题广告测试~", "body"=>"feedsky的话题广告测试下1ef0baf2", "created_at"=>2007-07-04 00:52:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    feedsky的话题广告测试下1ef0baf2

    \n", "_id"=>606}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用图片代替link_to中的文字", "body"=>"link_to大家都会用吧,也有人用户把image_tag和link_to结合起来使用过吧,是不是觉得很长很不干净呢,不用怕,我们其实可以在link_to中直接使用图片来替代文字的,如下:<code><%= link_to image_tag("search.gif", :border=>0), :action => 'show', :id => user %></code>注意里面的:border=>0是为了去掉图片四周那个无聊的框框的,需要加上哦~", "created_at"=>2007-07-03 16:52:41 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    link_to大家都会用吧,也有人用户把image_tag和link_to结合起来使用过吧,是不是觉得很长很不干净呢,不用怕,我们其实可以在link_to中直接使用图片来替代文字的,如下:<code><%= link_to image_tag("search.gif", :border=>0), :action => 'show', :id => user %></code>注意里面的:border=>0是为了去掉图片四周那个无聊的框框的,需要加上哦~

    \n", "_id"=>607}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中实现跟踪记录每个用户的最近十条记录", "body"=>"有的时候,你可能想显示给每个用户他最近浏览的页面,这个时候的一个很自然的想法就是使用数据库来存放,但是这样如果你的用户足够的多,而且页面的读取数据库又很频繁的话,就会对性能造成很大的影响,换个思路,我们可以在session里面存取,示范代码如下:<code>class ApplicationController < ActionController::Base\tbefore_filter :add_to_history\tbefore_filter :page_title\t###def add_to_history session[:history] ||= []## if File.exists?("\#{RAILS_ROOT}/app/views/\#{self.controller_name}/\#{self.action_name}.rhtml") && session[:history].empty? || session[:history].first['uri'] != @request.request_uri session[:history].unshift({ 'uri' => @request.request_uri, 'name' => page_title }) session[:history].pop while session[:history].length > 11 endend######## This bit came from Peter Cooper's snippets source and was moved into the application controller:###\tdef page_title\t\tcase self.controller_name\t\t\twhen 'tag' \t\t\t\ttitle = "Tags &raquo; " + @params[:tags].join(" &gt; ")\t\t\twhen 'user'\t\t\t\ttitle = "Users &raquo; \#{@params[:user]}"\t \t\t\twhen 'features'\t\t\t\t\tcase self.action_name\t\t\t\t\t\twhen 'show' then title = "Feature &raquo; \#{Feature.find(@params[:id]).title}"\t\t\t\t\t\telse title = APP_CONFIG["default_title"]\t\t\t\t\tend\t\t\telse \t\t\t\ttitle = APP_CONFIG["default_title"] + self.controller_name + ":" + self.action_name\t\tend\tend\thelper_method :page_title###...end</code>然后在页面上就可以这样显示了:<code><h4>User History</h4><% for cur in session[:history][0..9] -%> <p><a href="<%= cur["url"] %>"><%= cur["name"] %></a></p><% end -%></code>", "created_at"=>2007-07-03 16:47:31 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候,你可能想显示给每个用户他最近浏览的页面,这个时候的一个很自然的想法就是使用数据库来存放,但是这样如果你的用户足够的多,而且页面的读取数据库又很频繁的话,就会对性能造成很大的影响,换个思路,我们可以在session里面存取,示范代码如下:<code>class ApplicationController < ActionController::Base before_filter :add_to_history before_filter :page_title ###def add_to_history session[:history] ||= []## if File.exists?("\#{RAILS_ROOT}/app/views/\#{self.controller_name}/\#{self.action_name}.rhtml") && session[:history].empty? || session[:history].first['uri'] != @request.request_uri session[:history].unshift({ 'uri' => @request.request_uri, 'name' => page_title }) session[:history].pop while session[:history].length > 11 endend######## This bit came from Peter Cooper's snippets source and was moved into the application controller:### def page_title case self.controller_name when 'tag' title = "Tags &raquo; " + @params[:tags].join(" &gt; ") when 'user' title = "Users &raquo; \#{@params[:user]}" when 'features' case self.action_name when 'show' then title = "Feature &raquo; \#{Feature.find(@params[:id]).title}" else title = APP_CONFIG["default_title"] end else title = APP_CONFIG["default_title"] + self.controller_name + ":" + self.action_name end end helper_method :page_title###...end</code>然后在页面上就可以这样显示了:<code><h4>User History</h4><% for cur in session[:history][0..9] -%> <p><a href="<%= cur["url"] %>"><%= cur["name"] %></a></p><% end -%></code>

    \n", "_id"=>608}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中一个方法返回多个结果的实例", "body"=>"

    大家知道,在一般的编程实现中,一个method只能返回一个结果,如果想实现返回多个结果,java中可以使用VO来实现,但是ruby借助其灵活的语法,我们可以一次返回多个结果,我记得前些时候还不晓得这么做,问了几个人貌似也没有提到,今天五一看到了这个实现,分享给大家:首先,按照这个需求,你可能会写出类似下面的这段代码来检验,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def a_method_to_insult_innocent_people   
    2. \n
    3.   error = compute_error   
    4. \n
    5.   if error == :stupid   
    6. \n
    7.     return false"You made a stupid error"   
    8. \n
    9.   elsif error == :ridiculous   
    10. \n
    11.     return false"You made a ridiculous error"   
    12. \n
    13.   elsif error == :worst_of_all_time   
    14. \n
    15.     return false"You made the most idiot error in history. Way to go…"   
    16. \n
    17.   else return true"You made no error, you are still an idiot"   
    18. \n
    19.   end   
    20. \n
    21. end   
    22. \n
    23.   
    24. \n
    25. success, msg = a_method_to_insult_innocent_people   
    26. \n
    27. do_something_with_success(success)   
    28. \n
    29. destroy_hateful_words!(msg) 
      \n
    30. \n
    \n
    \n

    但是这段代码还是只能返回一个结果,如何实现返回多个值呢,很简单,使用数组来实现,只要把上面这段代码中的- return false, "you made a stupid error"- 修改为 *return [false, "you made a stupid error"]*就可以了。记录记录以备不时之需。

    ", "created_at"=>2007-07-03 16:30:06 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    大家知道,在一般的编程实现中,一个method只能返回一个结果,如果想实现返回多个结果,java中可以使用VO来实现,但是ruby借助其灵活的语法,我们可以一次返回多个结果,我记得前些时候还不晓得这么做,问了几个人貌似也没有提到,今天五一看到了这个实现,分享给大家:首先,按照这个需求,你可能会写出类似下面的这段代码来检验,如下:
    \n
    \nRuby代码
    \n
    \n def a_method_to_insult_innocent_people   
    \n   error = compute_error   
    \n   if error == :stupid   
    \n     return false, "You made a stupid error"   
    \n   elsif error == :ridiculous   
    \n     return false, "You made a ridiculous error"   
    \n   elsif error == :worst_of_all_time   
    \n     return false, "You made the most idiot error in history. Way to go…"   
    \n   else return true, "You made no error, you are still an idiot"   
    \n   end   
    \n end   
    \n   
    \n success, msg = a_method_to_insult_innocent_people   
    \n do_something_with_success(success)   
    \n destroy_hateful_words!(msg) 
    \n
    \n
    \n
    \n但是这段代码还是只能返回一个结果,如何实现返回多个值呢,很简单,使用数组来实现,只要把上面这段代码中的- return false, "you made a stupid error"- 修改为 *return [false, "you made a stupid error"]*就可以了。记录记录以备不时之需。

    \n", "_id"=>609}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用POP3接收邮件", "body"=>"

    上次我们写了如何在rails中发送email,自然接收email也是常常需要的功能,今天给出一段代码实现在rails中接受并处理email,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. #!/usr/bin/env ruby  
    2. \n
    3. require 'net/pop'  
    4. \n
    5. require File.dirname(__FILE__) + '/../config/environment'  
    6. \n
    7. logger = RAILS_DEFAULT_LOGGER  
    8. \n
    9. logger.info "Running Mail Importer..."   
    10. \n
    11. Net::POP3.start("localhost"nil"username""password"do |pop|   
    12. \n
    13. if pop.mails.empty?   
    14. \n
    15.    logger.info "NO MAIL"   
    16. \n
    17. else   
    18. \n
    19.    pop.mails.each do |email|   
    20. \n
    21.    begin   
    22. \n
    23.     logger.info "receiving mail..."   
    24. \n
    25.     Notifier.receive(email.pop)   
    26. \n
    27.     email.delete   
    28. \n
    29.    rescue Exception => e   
    30. \n
    31.     logger.error "Error receiving email at " + Time.now.to_s + "::: " + e.message   
    32. \n
    33.    end   
    34. \n
    35.    end   
    36. \n
    37. end  
    38. \n
    39. end  
    40. \n
    41. logger.info "Finished Mail Importer."  
    42. \n
    \n
    \n


    \n做些说明:
    \n你需要在*Net::POP3.start*这行写上你要接收的邮箱的服务器地址以及你的用户名密码,如上配置好了,你就可以在cron中配置调度这个任务了,至于调度的频度你可以按照自己的需求来设定了。如何,还算简单吧。

    ", "created_at"=>2007-07-03 16:24:28 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    上次我们写了如何在rails中发送email,自然接收email也是常常需要的功能,今天给出一段代码实现在rails中接受并处理email,代码如下:
    \n
    \nRuby代码
    \n
    \n #!/usr/bin/env ruby  
    \n require 'net/pop'  
    \n require File.dirname(FILE) + '/../config/environment'  
    \n logger = RAILS_DEFAULT_LOGGER  
    \n logger.info "Running Mail Importer..."   
    \n Net::POP3.start("localhost", nil, "username", "password") do |pop|   
    \n if pop.mails.empty?   
    \n    logger.info "NO MAIL"   
    \n else   
    \n    pop.mails.each do |email|   
    \n    begin   
    \n     logger.info "receiving mail..."   
    \n     Notifier.receive(email.pop)   
    \n     email.delete   
    \n    rescue Exception => e   
    \n     logger.error "Error receiving email at " + Time.now.to_s + "::: " + e.message   
    \n    end   
    \n    end   
    \n end  
    \n end  
    \n logger.info "Finished Mail Importer."  
    \n
    \n
    \n
    \n做些说明:
    \n你需要在*Net::POP3.start*这行写上你要接收的邮箱的服务器地址以及你的用户名密码,如上配置好了,你就可以在cron中配置调度这个任务了,至于调度的频度你可以按照自己的需求来设定了。如何,还算简单吧。

    \n", "_id"=>610}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"本站可以订阅啦~", "body"=>"很多朋友说喜欢在googleReader里面看文章,希望我提供XML的订阅功能,其实这个feed早就有了,细心的朋友可能已经找到了,呵呵,在左下角的# RSS、# Comments RSS,是可以直接订阅的。有朋友推荐feedburner,说更加方便、也适合自己做统计,于是就添加了这个功能,在右边可以看到有个大大的订阅图标啦,其地址是http://feeds.feedburner.com/1stlog,大家可以使用这个来订阅啦。我会写出更多的Rails方面的文章,欢迎讨论~", "created_at"=>2007-07-01 09:24:21 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很多朋友说喜欢在googleReader里面看文章,希望我提供XML的订阅功能,其实这个feed早就有了,细心的朋友可能已经找到了,呵呵,在左下角的# RSS、# Comments RSS,是可以直接订阅的。有朋友推荐feedburner,说更加方便、也适合自己做统计,于是就添加了这个功能,在右边可以看到有个大大的订阅图标啦,其地址是http://feeds.feedburner.com/1stlog,大家可以使用这个来订阅啦。我会写出更多的Rails方面的文章,欢迎讨论~

    \n", "_id"=>611}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提交多个check_box的写法-check_box_tag.", "body"=>"有的时候可能需要有这样的需求,发一篇文章的时候,需要选择多个tag,我们把Tag取出来后就可以循环显示,但是注意应该是使用check_box_tag,如下是几个例子:<code><% Business.find(@know.business_id).know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>--------------<% @know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>---------------<% @tags.each do |tag|%><%= check_box_tag ("topic[tags_ids][]",tag.id)%><%= tag.name %><% end %></code>我想上面几个例子,大家应该明白了吧?", "created_at"=>2007-06-30 01:28:06 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有的时候可能需要有这样的需求,发一篇文章的时候,需要选择多个tag,我们把Tag取出来后就可以循环显示,但是注意应该是使用check_box_tag,如下是几个例子:<code><% Business.find(@know.business_id).know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>--------------<% @know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>---------------<% @tags.each do |tag|%><%= check_box_tag ("topic[tags_ids][]",tag.id)%><%= tag.name %><% end %></code>我想上面几个例子,大家应该明白了吧?

    \n", "_id"=>612}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用ActionMaile发送邮件实例", "body"=>"来源:http://www.javaeye.com/topic/40778更改config目录下的配置文件*environment.rb* 在最下面追加一段:<code>ActionMailer::Base.delivery_method = :smtp#以简单邮件传送协议发送邮件ActionMailer::Base.default_charset = "GBK"#设置邮件的默认编码为国标码否则发送的邮件主题可能会乱码ActionMailer::Base.server_settings = {:address => "192.168.1.110",:port => 25,:domain => "xxx.com",:authentication => :login,:user_name => "xxx",:password => "xxx",}</code>1、:address => and :port => 决定你将使用的SMTP的地址和端口。这些缺省值分别为localhost和25。2、:domain => 当识别自己是服务器时 mailer应该使用的域名。这是对HELO(因为HELO是命令客户端发送服务来启动一个连接)域的调用。你通常应该使用顶级域名机制来发送e-mail,但这依赖于你的SMTP服务的设置(some don’t check, and some check to try to reduce spam and socalled open-relay issues)3、:user_name => and :password => 如果:authentication被设置则要求有此。4、:authentication => :plain,:login,或:cram_md中的一个。你的服务器管理员将帮助选择正确的选项。当前没使用TLS(SSL)来从Rails连接邮件服务器的方式。这个参数应该被忽略,如果你的服务器不要求确认。 创建一个mailer的models<code>class OrderMailer < ActionMailer::Base def signup(domain, sent_at = Time.now) @subject = 'Welcome to Beast' @body = "hello world" @recipients = "yyy@yyy.com" @from = 'yyy@yyy.com' @sent_on = sent_at @headers = {} endend</code>@subject:邮件标题@body:邮件正文可以使用html标签但需要设置参考下面@recipients:收件人可以接收数组进行群发多人发送:@recipients = [ "1@a.com","2@b.com"]@from:发件人@sent_on:用于设置邮件 Date: header的Time 对象@headers:一个header name/value 对的哈希望表,用于添加任意header行给邮件 如:@headers["Organization"] = "Pragmatic Programmers, LLC"既要使用HTML格式发送邮件又要增加附件的话,需要在model里就对content-type进行设置 @content-type=”text/html” *创建一个controller 用于发送邮件*def send_maileremail = OrderMailer.deliver_signup(request.host_with_port)Puts email.encoded #邮件内容打印#email = OrderMailer.create_signup(request.host_with_port)#email.set_content_type("text/html") 可在模型中设置#OrderMailer.deliver(email)#发送HTML格式的邮件的设置end *发送HTML模板邮件*在views中创建一个模板:_mail_content.rhtml ……model中的mailer类改成如下:def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} endcontroller中更改发送方法: def send_mail content =render_to_string :partial=>" mail_content "email = OrderMailer.create_signup(request.host_with_port,content) email.set_content_type("text/html") OrderMailer.deliver(email) render :text=>"发送成功" end render_to_string方法返回的是String 与render不同的是它返回后不会发送给客户端。 *发送附件* 修改model中的mailer类,如下: def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} @data = "" File.open("D:\\\\Tools\\\\FastAIT.rar", "rb") { |fp| @data< } #参数的含义rb表示只读并且以二进制方式创建一个file对象 #不写r会出现丢失数据的问题,发送的附件也就被破坏了``r''\tRead-only, starts at beginning of file (default mode).只读,清除原有内容(默认方式)``r+''\tRead-write, starts at beginning of file.读写,清除原有内容``w''\tWrite-only, truncates existing file to zero length or creates a new file for writing.只写,创建一个新的文件覆盖旧的``w+''\tRead-write, truncates existing file to zero length or creates a new file for reading and writing.读写,创建一个新的文件覆盖旧的``a''\tWrite-only, starts at end of file if file exists, otherwise creates a new file for writing.只写,追加``a+''\tRead-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.读写,追加``b''\t(DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).*二进制模式* attachment :content_type => "application/rar", :filename => "FastAIT.rar" , :body => @data end邮件附件的content_type(内容类型表) ".asf" ContentType = "video/x-ms-asf" ".avi" ContentType = "video/avi" ".doc" ContentType = "application/msword" ".zip" ContentType = "application/zip" ".xls" ContentType = "application/vnd.ms-excel" ".gif" ContentType = "image/gif" ".jpg", "jpeg" ContentType = "image/jpeg" ".wav" ContentType = "audio/wav" ".mp3" ContentType = "audio/mpeg3" ".mpg", "mpeg" ContentType = "video/mpeg" ".rtf" ContentType = "application/rtf" ".htm", "html" ContentType = "text/html" ".txt" ContentType = "text/plain"".pdf" ContentType = "application/pdf" 其他 ContentType = "application/octet-stream"", "created_at"=>2007-06-29 16:12:18 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    来源:http://www.javaeye.com/topic/40778更改config目录下的配置文件environment.rb 在最下面追加一段:<code>ActionMailer::Base.delivery_method = :smtp#以简单邮件传送协议发送邮件ActionMailer::Base.default_charset = "GBK"#设置邮件的默认编码为国标码否则发送的邮件主题可能会乱码ActionMailer::Base.server_settings = {:address => "192.168.1.110",:port => 25,:domain => "xxx.com",:authentication => :login,:user_name => "xxx",:password => "xxx",}</code>1、:address => and :port => 决定你将使用的SMTP的地址和端口。这些缺省值分别为localhost和25。2、:domain => 当识别自己是服务器时 mailer应该使用的域名。这是对HELO(因为HELO是命令客户端发送服务来启动一个连接)域的调用。你通常应该使用顶级域名机制来发送e-mail,但这依赖于你的SMTP服务的设置(some don’t check, and some check to try to reduce spam and socalled open-relay issues)3、:user_name => and :password => 如果:authentication被设置则要求有此。4、:authentication => :plain,:login,或:cram_md中的一个。你的服务器管理员将帮助选择正确的选项。当前没使用TLS(SSL)来从Rails连接邮件服务器的方式。这个参数应该被忽略,如果你的服务器不要求确认。 创建一个mailer的models<code>class OrderMailer < ActionMailer::Base def signup(domain, sent_at = Time.now) @subject = 'Welcome to Beast' @body = "hello world" @recipients = "yyy@yyy.com" @from = 'yyy@yyy.com' @sent_on = sent_at @headers = {} endend</code>@subject:邮件标题@body:邮件正文可以使用html标签但需要设置参考下面@recipients:收件人可以接收数组进行群发多人发送:@recipients = [ "1@a.com","2@b.com"]@from:发件人@sent_on:用于设置邮件 Date: header的Time 对象@headers:一个header name/value 对的哈希望表,用于添加任意header行给邮件 如:@headers["Organization"] = "Pragmatic Programmers, LLC"既要使用HTML格式发送邮件又要增加附件的话,需要在model里就对content-type进行设置 @content-type=”text/html” 创建一个controller 用于发送邮件*def send_maileremail = OrderMailer.deliver_signup(request.host_with_port)Puts email.encoded #邮件内容打印#email = OrderMailer.create_signup(request.host_with_port)#email.set_content_type("text/html") 可在模型中设置#OrderMailer.deliver(email)#发送HTML格式的邮件的设置end *发送HTML模板邮件*在views中创建一个模板:_mail_content.rhtml ……model中的mailer类改成如下:def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} endcontroller中更改发送方法: def send_mail content =render_to_string :partial=>" mail_content "email = OrderMailer.create_signup(request.host_with_port,content) email.set_content_type("text/html") OrderMailer.deliver(email) render :text=>"发送成功" end render_to_string方法返回的是String 与render不同的是它返回后不会发送给客户端。 *发送附件 修改model中的mailer类,如下: def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} @data = "" File.open("D:\\Tools\\FastAIT.rar", "rb") { |fp| @data< } #参数的含义rb表示只读并且以二进制方式创建一个file对象 #不写r会出现丢失数据的问题,发送的附件也就被破坏了r'' Read-only, starts at beginning of file (default mode).只读,清除原有内容(默认方式)r+'' Read-write, starts at beginning of file.读写,清除原有内容w'' Write-only, truncates existing file to zero length or creates a new file for writing.只写,创建一个新的文件覆盖旧的w+'' Read-write, truncates existing file to zero length or creates a new file for reading and writing.读写,创建一个新的文件覆盖旧的a'' Write-only, starts at end of file if file exists, otherwise creates a new file for writing.只写,追加a+'' Read-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.读写,追加``b'' (DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).二进制模式 attachment :content_type => "application/rar", :filename => "FastAIT.rar" , :body => @data end邮件附件的content_type(内容类型表) ".asf" ContentType = "video/x-ms-asf" ".avi" ContentType = "video/avi" ".doc" ContentType = "application/msword" ".zip" ContentType = "application/zip" ".xls" ContentType = "application/vnd.ms-excel" ".gif" ContentType = "image/gif" ".jpg", "jpeg" ContentType = "image/jpeg" ".wav" ContentType = "audio/wav" ".mp3" ContentType = "audio/mpeg3" ".mpg", "mpeg" ContentType = "video/mpeg" ".rtf" ContentType = "application/rtf" ".htm", "html" ContentType = "text/html" ".txt" ContentType = "text/plain"".pdf" ContentType = "application/pdf" 其他 ContentType = "application/octet-stream"

    \n", "_id"=>613}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中的方法调用", "body"=>"引言:张雪同学blog上的这个文章很是不错,从一个侧面展示了Ruby的一些和别的不一样的特性,显出了其灵活和强大,很值得仔细看看~会使得你对ruby中的方法调用更加理解~<br/><br />*来源:*for each_day in life: ruby中的方法调用<br />*地址:*http://blog.snowonrails.com/articles/2007/05/15/ruby%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8<br />*标题:*ruby中的方法调用<br />*内容摘要:*<br />和我一样许多习惯了java的程序员在刚刚开始接触ruby的时候对ruby当中的方法声名以及调用的方式会感到非常的奇怪和别扭。比如我们在ruby当中经常可以看到类似的方法声名 method(arg1, *args), 又如这样的方法 method2(arg2, &block), 等等。相比于java那明确简单的方法声名方式,ruby中的方法声名要灵活许多,下面就ruby当中常见的几种方法声名的形式,以及方法调用的方式做一个简要的总结:1. 首先,不同于java的方法声名,ruby中的方法可以接收的参数是可变的,而不是像java那样必须和方法声名中的参数类型相等,个数相等。当你希望ruby方法接收一个或者多个参数的时候,可在普通的参数名前放置一个星号(*),比如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">def </span><span class="method">varargs</span><span class="punct">(</span><span class="ident">arg1</span><span class="punct">,</span> <span class="punct">*</span><span class="ident">rest</span><span class="punct">)</span> “<span class="constant">Received</span> <span class="comment">\#{arg1} and \#{rest.join(', ')}”</span><span class="keyword">end</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and &quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two&quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;,&quot;</span><span class="string">three</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two, three&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p80</span></notextile></code></pre></div>在这里,varargs方法的第二个形参前有一个星号,表示将方法中第二个以后的所有参数都装到一个数组当中,然后赋值给rest. 所以当方法声名的参数前边又一个*的时候,代表:将方法调用时传入的所有<b>除之前已匹配完毕的参数外的剩余参数</b>放入一个Array并将其赋值给*后边的形参。2. 我们也经常会见到在方法声名的参数当中有“&args”的形式,比如<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">class </span><span class="class">TaxCalculator</span> <span class="keyword">def </span><span class="method">initialize</span><span class="punct">(</span><span class="ident">name</span><span class="punct">,&amp;</span><span class="ident">block</span><span class="punct">)</span> <span class="attribute">@name</span><span class="punct">,</span><span class="attribute">@block</span> <span class="punct">=</span> <span class="ident">name</span><span class="punct">,</span> <span class="ident">block</span> <span class="keyword">end</span> <span class="keyword">def </span><span class="method">get_tax</span><span class="punct">(</span><span class="ident">amount</span><span class="punct">)</span> <span class="punct">&quot;</span><span class="string"><span class="expr">\#{@name}</span> on <span class="expr">\#{amount}</span> = <span class="expr">\#{@block.call(amount)}</span></span><span class="punct">&quot;</span> <span class="keyword">end</span><span class="keyword">end</span><span class="ident">tc</span> <span class="punct">=</span> <span class="constant">TaxCalculator</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(&quot;</span><span class="string">Sales tax</span><span class="punct">&quot;){|</span><span class="ident">amt</span><span class="punct">|</span> <span class="ident">amt</span> <span class="punct">*</span> <span class="number">0.075</span><span class="punct">}</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">100</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 100 = 7.5&quot;</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">200</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 250 = 18.75&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p81</span></notextile></code></pre></div>当方法的<b>最后一个参数</b>前缀为&,那么改方法调用的后边可以跟一个block,同时方法会将block转换为一个Proc对象,然后赋值给该参数。3. 我们经常可以在rails的文档中看到这种方法声名:<div class="typocode"><pre><code class="typocode_ruby "><\nno\ntextile><span class="keyword">def </span><span class="method">method</span><span class="punct">(</span><span class="ident">id</span><span class="punct">,</span><span class="ident">option</span><span class="punct">={})</span> <span class="punct">...</span><span class="keyword">end</span></notextile></code></pre></div>然后我们调用的时候可以以任意的顺序传入key=>value hash pair 如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="ident">method</span><span class="punct">(</span><span class="number">5</span><span class="punct">,</span><span class="ident">key1</span><span class="punct">=&gt;</span><span class="ident">value1</span><span class="punct">,</span><span class="ident">key2</span><span class="punct">=&gt;</span><span class="ident">value2</span><span class="punct">,...)</span></notextile></code></pre></div>在参数列表中,<b>当hash参数在正常参数之后,并且位于任何数组或block参数之前</b>,我们就可以直接用key=>value对,而不用加{}。所有的这些key=>value对会被集合到一个hash,然后赋值给形参,传入方法。", "created_at"=>2007-06-25 21:00:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    引言:张雪同学blog上的这个文章很是不错,从一个侧面展示了Ruby的一些和别的不一样的特性,显出了其灵活和强大,很值得仔细看看~会使得你对ruby中的方法调用更加理解~<br/><br />来源:*for each_day in life: ruby中的方法调用<br />*地址:*http://blog.snowonrails.com/articles/2007/05/15/ruby%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8<br; />*标题:*ruby中的方法调用<br />*内容摘要:<br />和我一样许多习惯了java的程序员在刚刚开始接触ruby的时候对ruby当中的方法声名以及调用的方式会感到非常的奇怪和别扭。比如我们在ruby当中经常可以看到类似的方法声名 method(arg1, args), 又如这样的方法 method2(arg2, &block), 等等。相比于java那明确简单的方法声名方式,ruby中的方法声名要灵活许多,下面就ruby当中常见的几种方法声名的形式,以及方法调用的方式做一个简要的总结:1. 首先,不同于java的方法声名,ruby中的方法可以接收的参数是可变的,而不是像java那样必须和方法声名中的参数类型相等,个数相等。当你希望ruby方法接收一个或者多个参数的时候,可在普通的参数名前放置一个星号(),比如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">def </span><span class="method">varargs</span><span class="punct">(</span><span class="ident">arg1</span><span class="punct">,</span> <span class="punct"></span><span class="ident">rest</span><span class="punct">)</span> “<span class="constant">Received</span> <span class="comment">\#{arg1} and \#{rest.join(', ')}”</span><span class="keyword">end</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and &quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two&quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;,&quot;</span><span class="string">three</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two, three&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p80</span></notextile></code></pre></div>在这里,varargs方法的第二个形参前有一个星号,表示将方法中第二个以后的所有参数都装到一个数组当中,然后赋值给rest. 所以当方法声名的参数前边又一个*的时候,代表:将方法调用时传入的所有<b>除之前已匹配完毕的参数外的剩余参数</b>放入一个Array并将其赋值给*后边的形参。2. 我们也经常会见到在方法声名的参数当中有“&args”的形式,比如<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">class </span><span class="class">TaxCalculator</span> <span class="keyword">def </span><span class="method">initialize</span><span class="punct">(</span><span class="ident">name</span><span class="punct">,&amp;</span><span class="ident">block</span><span class="punct">)</span> <span class="attribute">@name</span><span class="punct">,</span><span class="attribute">@block</span> <span class="punct">=</span> <span class="ident">name</span><span class="punct">,</span> <span class="ident">block</span> <span class="keyword">end</span> <span class="keyword">def </span><span class="method">get_tax</span><span class="punct">(</span><span class="ident">amount</span><span class="punct">)</span> <span class="punct">&quot;</span><span class="string"><span class="expr">\#{@name}</span> on <span class="expr">\#{amount}</span> = <span class="expr">\#{@block.call(amount)}</span></span><span class="punct">&quot;</span> <span class="keyword">end</span><span class="keyword">end</span><span class="ident">tc</span> <span class="punct">=</span> <span class="constant">TaxCalculator</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(&quot;</span><span class="string">Sales tax</span><span class="punct">&quot;){|</span><span class="ident">amt</span><span class="punct">|</span> <span class="ident">amt</span> <span class="punct"></span> <span class="number">0.075</span><span class="punct">}</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">100</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 100 = 7.5&quot;</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">200</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 250 = 18.75&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p81</span></notextile></code></pre></div>当方法的<b>最后一个参数</b>前缀为&,那么改方法调用的后边可以跟一个block,同时方法会将block转换为一个Proc对象,然后赋值给该参数。3. 我们经常可以在rails的文档中看到这种方法声名:<div class="typocode"><pre><code class="typocode_ruby "><
    \nno
    \ntextile><span class="keyword">def </span><span class="method">method</span><span class="punct">(</span><span class="ident">id</span><span class="punct">,</span><span class="ident">option</span><span class="punct">={})</span> <span class="punct">...</span><span class="keyword">end</span></notextile></code></pre></div>然后我们调用的时候可以以任意的顺序传入key=>value hash pair 如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="ident">method</span><span class="punct">(</span><span class="number">5</span><span class="punct">,</span><span class="ident">key1</span><span class="punct">=&gt;</span><span class="ident">value1</span><span class="punct">,</span><span class="ident">key2</span><span class="punct">=&gt;</span><span class="ident">value2</span><span class="punct">,...)</span></notextile></code></pre></div>在参数列表中,<b>当hash参数在正常参数之后,并且位于任何数组或block参数之前</b>,我们就可以直接用key=>value对,而不用加{}。所有的这些key=>value对会被集合到一个hash,然后赋值给形参,传入方法。

    \n", "_id"=>614}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"来,Rubyize你的代码~", "body"=>"了解Ruby语法的朋友应该对Ruby的语法和表达形式很惊叹,这都要归功与Ruby强大的表达能力,有的时候,把以前的写的不完善的代码Ruby化不仅能加深对Ruby的理解,还能提高代码质量,更加可读,或者说更加Ruby一些~好,下面举个例子来说明一下,希望有见解的朋友能分享你的写法。<code> def manage_ducks(ducks) if ducks == nil ducks = fetch_some_champions else unless ducks.won_stanley_cup? ducks = fetch_some_champions end end ducks.beat_random_opponent end</code>如果是刚刚解除Ruby的话,上面这段代码可能就是你写出来的,她虽然可行,但是一点都不符合ruby的风格,你将怎么改呢~请留言分享~", "created_at"=>2007-06-25 17:12:19 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    了解Ruby语法的朋友应该对Ruby的语法和表达形式很惊叹,这都要归功与Ruby强大的表达能力,有的时候,把以前的写的不完善的代码Ruby化不仅能加深对Ruby的理解,还能提高代码质量,更加可读,或者说更加Ruby一些~好,下面举个例子来说明一下,希望有见解的朋友能分享你的写法。<code> def manage_ducks(ducks) if ducks == nil ducks = fetch_some_champions else unless ducks.won_stanley_cup? ducks = fetch_some_champions end end ducks.beat_random_opponent end</code>如果是刚刚解除Ruby的话,上面这段代码可能就是你写出来的,她虽然可行,但是一点都不符合ruby的风格,你将怎么改呢~请留言分享~

    \n", "_id"=>615}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1可以下载了!", "body"=>"不好意思,今天出去有点事情,回来晚了点,结果就没能赶在0点之前发布,对不起了~现在可以下载了,为了保持1ster的ROR技术笔记氛围,不在这里提供下载了,将下载统一转到*1sters.com*站上,请大家前去下载,谢谢~为了再以后发布新版本的时候能迅速通知到大家,这次要求要下载的朋友提供邮箱,下次发布将第一时间通知各位,谢谢~下载页面:http://www.1sters.com/download谢谢大家支持~", "created_at"=>2007-06-24 08:50:02 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    不好意思,今天出去有点事情,回来晚了点,结果就没能赶在0点之前发布,对不起了~现在可以下载了,为了保持1ster的ROR技术笔记氛围,不在这里提供下载了,将下载统一转到*1sters.com*站上,请大家前去下载,谢谢~为了再以后发布新版本的时候能迅速通知到大家,这次要求要下载的朋友提供邮箱,下次发布将第一时间通知各位,谢谢~下载页面:http://www.1sters.com/download谢谢大家支持~

    \n", "_id"=>616}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1即将发布~", "body"=>"1stlog Version1.0.1即将发布~1、添加一些必须的数据库初始化脚本2、完善定制模板的实现原理3、修复文件拷贝在UNIX下不工作的4、后台界面修改为中文的5、添加了一个Youtube的组件6、修改了模板定制的规范7、增加初次安装注册管理员8、制定组件编写规范包和文档都整理好了,实在太困了,明天发布吧~", "created_at"=>2007-06-23 08:29:01 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    1stlog Version1.0.1即将发布~1、添加一些必须的数据库初始化脚本2、完善定制模板的实现原理3、修复文件拷贝在UNIX下不工作的4、后台界面修改为中文的5、添加了一个Youtube的组件6、修改了模板定制的规范7、增加初次安装注册管理员8、制定组件编写规范包和文档都整理好了,实在太困了,明天发布吧~

    \n", "_id"=>617}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很棒的Find方法!", "body"=>"今天CFC问我有没有用过find(:all, :select => )这个用法,别说,还真没有用过,直接告诉我应该是可以取指定的字段。果不其然,比如我要取Contact表的id和name两个字段,可以有兩種寫法,一個是find,一個是find_by_sql,如下:<code>Contact.find(:all, :select => "id, name")Contact.find_by_sql("SELECT id, name FROM `contacts`")</code>这两种写法效果是一样的,怎么样,是不是比较棒呀?可能你还要问这个写法有什么好处呀?写过rails的朋友应该对它的Find方法很熟悉,但是Find是一次吧所有字段都取出来,如果字段内容比较多,会耗费很多的内存的哦,这样的话,我们只取需要的字段就OK了。你还有什么想法,欢迎留言讨论~", "created_at"=>2007-06-22 04:47:16 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    今天CFC问我有没有用过find(:all, :select => )这个用法,别说,还真没有用过,直接告诉我应该是可以取指定的字段。果不其然,比如我要取Contact表的id和name两个字段,可以有兩種寫法,一個是find,一個是find_by_sql,如下:<code>Contact.find(:all, :select => "id, name")Contact.find_by_sql("SELECT id, name FROM contacts")</code>这两种写法效果是一样的,怎么样,是不是比较棒呀?可能你还要问这个写法有什么好处呀?写过rails的朋友应该对它的Find方法很熟悉,但是Find是一次吧所有字段都取出来,如果字段内容比较多,会耗费很多的内存的哦,这样的话,我们只取需要的字段就OK了。你还有什么想法,欢迎留言讨论~

    \n", "_id"=>618}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"乱码,警惕编辑器的编码~", "body"=>"今天没什么事情,写个小的问题分析系统,在数据库初始化的时候,用了<code> def self.up create_table :priorities do |t| t.column :name, :string, :default => "" t.column :desc, :string, :default => "" end Priority.new(:name=>"一级",:desc=>"很紧急,4-8小时完成").save Priority.new(:name=>"二级",:desc=>"紧急,8-24小时完成").save Priority.new(:name=>"三级",:desc=>"一般,24-48小时完成").save Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save Priority.new(:name=>"不详",:desc=>"不详").save end</code>遇到下列错误bq. ./db/migrate//003_create_priorities.rb:10: Invalid char `\\274' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\266' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\262' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\273' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\275' in expression./db/migrate//003_create_priorities.rb:10: syntax error, unexpected tIDENTIFIER, expecting kEND Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save真是ft,感觉是编码的问题,我数据库用的是UTF-8呀,我在environment.rb也加了$KCODE = 'u' require 'jcode'了呀,我在application.rb也写了:configure_charsets了下,我在数据库配置文件也加了encoding: utf8了呀。这个问题搞得我一肚子火,最后想到了,还有一处编码需要注意,那就是文件的编码,也就是把radrails的editor默认字符集改成utf-8。寒~真是ft,大家遇到类似问题千万记住呀,需要检查下面几个地方~ # 数据库编码 # application.rb # environment.rb # database.yml", "created_at"=>2007-06-22 02:37:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    今天没什么事情,写个小的问题分析系统,在数据库初始化的时候,用了<code> def self.up create_table :priorities do |t| t.column :name, :string, :default => "" t.column :desc, :string, :default => "" end Priority.new(:name=>"一级",:desc=>"很紧急,4-8小时完成").save Priority.new(:name=>"二级",:desc=>"紧急,8-24小时完成").save Priority.new(:name=>"三级",:desc=>"一般,24-48小时完成").save Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save Priority.new(:name=>"不详",:desc=>"不详").save end</code>遇到下列错误bq. ./db/migrate//003_create_priorities.rb:10: Invalid char \\274' in expression./db/migrate//003_create_priorities.rb:10: Invalid char\\266' in expression./db/migrate//003_create_priorities.rb:10: Invalid char \\262' in expression./db/migrate//003_create_priorities.rb:10: Invalid char\\273' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\275' in expression./db/migrate//003_create_priorities.rb:10: syntax error, unexpected tIDENTIFIER, expecting kEND Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save真是ft,感觉是编码的问题,我数据库用的是UTF-8呀,我在environment.rb也加了$KCODE = 'u' require 'jcode'了呀,我在application.rb也写了:configure_charsets了下,我在数据库配置文件也加了encoding: utf8了呀。这个问题搞得我一肚子火,最后想到了,还有一处编码需要注意,那就是文件的编码,也就是把radrails的editor默认字符集改成utf-8。寒~真是ft,大家遇到类似问题千万记住呀,需要检查下面几个地方~ # 数据库编码 # application.rb # environment.rb # database.yml

    \n", "_id"=>619}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"关于HAML的一点点想法~", "body"=>"大清早的,CFC就给我推荐HAML,说未来必将流行,这个东西以前我关注过,无非是使用一种规定的标记来替代RHTML,在显示的时候反向解析(这是我的理解),CFC给我看了他写的一篇文章(没有找到单篇的RSS,只能COPY过来啦=="),内容如下:---------------------------最近開始接觸HAML在Rails中,預設使用ERb來當作模板描述語言,可是這樣寫個人認為非常醜也非常累...而之前看到HAML時感覺到那東西似乎沒有太大的可用性,難道要Designer也學Ruby嗎?不過後來我想通了..架構這部分可以給Coder作,Designer乖乖設計CSS就夠了..來看看底下這個Sample吧:*這是rhtml*<code><div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p> <%= print_information %> </p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div></code>*這是HAML*<code> #content .left.column %h2 Welcome to our site! %p= print_information .right.column= render :partial => "sidebar"</code>看!少了多少行?可以讓開發速度變快耶= v =...最主要的是,看起來也比較美觀了!--------------------------说说偶的看法:(基本上是不推荐的)1、多了一次解析反解析,效果难道不受影响(除非是直接解析成html)2、难道要Designer也學Ruby嗎?同问?3、我把RHTML分成 局部模板,单个文件就不会很大,也很简单。4、美观么?ruby本来是不强制缩进的,这个东西还要求缩进~=_=~有谁再给出一些理由呢?", "created_at"=>2007-06-21 17:32:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    大清早的,CFC就给我推荐HAML,说未来必将流行,这个东西以前我关注过,无非是使用一种规定的标记来替代RHTML,在显示的时候反向解析(这是我的理解),CFC给我看了他写的一篇文章(没有找到单篇的RSS,只能COPY过来啦=="),内容如下:---------------------------最近開始接觸HAML在Rails中,預設使用ERb來當作模板描述語言,可是這樣寫個人認為非常醜也非常累...而之前看到HAML時感覺到那東西似乎沒有太大的可用性,難道要Designer也學Ruby嗎?不過後來我想通了..架構這部分可以給Coder作,Designer乖乖設計CSS就夠了..來看看底下這個Sample吧:這是rhtml<code><div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p> <%= printinformation %> </p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div></code>這是HAML<code> #content .left.column %h2 Welcome to our site! %p= print_information .right.column= render :partial => "sidebar"</code>看!少了多少行?可以讓開發速度變快耶= v =...最主要的是,看起來也比較美觀了!--------------------------说说偶的看法:(基本上是不推荐的)1、多了一次解析反解析,效果难道不受影响(除非是直接解析成html)2、难道要Designer也學Ruby嗎?同问?3、我把RHTML分成 局部模板,单个文件就不会很大,也很简单。4、美观么?ruby本来是不强制缩进的,这个东西还要求缩进~==~有谁再给出一些理由呢?

    \n", "_id"=>620}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于rails启动报500错误的可能问题点", "body"=>"当你启动rails的时候可能会遇到500错误“500- Premature end of script.”或者类似的错误,使得程序跑不起来~问题可能出在两个地方: 1、 The file permissions are not set to allow the dispatch.cgi to execute properly. Chmod the dispatch.cgi to +0755+. 2、The path to Ruby is is incorrect in the dispatch.cgi file. The first line of the file is called the shebang-- it sets the location of the intrepretor (in this case ruby). Change the shebang to the correct path to Ruby (/usr/bin/ruby). The first line of the dispatch.cgi file should look like this: #!/usr/bin/ruby", "created_at"=>2007-06-19 19:24:55 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    当你启动rails的时候可能会遇到500错误“500- Premature end of script.”或者类似的错误,使得程序跑不起来~问题可能出在两个地方: 1、 The file permissions are not set to allow the dispatch.cgi to execute properly. Chmod the dispatch.cgi to +0755+. 2、The path to Ruby is is incorrect in the dispatch.cgi file. The first line of the file is called the shebang-- it sets the location of the intrepretor (in this case ruby). Change the shebang to the correct path to Ruby (/usr/bin/ruby). The first line of the dispatch.cgi file should look like this: #!/usr/bin/ruby

    \n", "_id"=>621}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>622}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)二期功能收集整理", "body"=>"

    技能云(iTechTag)从策划到一期的实现,经历了不少的波折,现在终于稳定,就朋友们的反应来看还是比较认同的,都认为是个很好的Idea,也有很多人鼓励支持我,很是激动,于是再接再厉,收集整理第二期需求,并加快开发速度。
    \n
    \n目前已经有好几个朋友提到了几个不错的功能,记录于此,以免遗忘,我们会筛选优先级加以实现,谢谢这些给我建议的朋友,也希望更多的人能提一些建议和意见,您的关注将激励我不断前行。
    \n
    \n庄表伟:
    \n一个非常榜的主意!我曾经有另一个类似的设想,每个人都有一个地方记录自己的项目经验和教训。比如:多少人做了一个项目,在哪些方面是成功的,在哪些方面是失败的。
    \n
    \n冰云:
    \n我曾经也有类似的想法。不妨考虑把个人的经历组织起来,形成一个人的视图。这个视图可以看作是个人门户,包括做过的项目(可以查看做过这个项目的还有谁),写的blog(从个人blog来聚合),参与的论坛(例如JavaEye),发表过的文章,别人的评价等等。综合起来可以提供信息给其他网站,例如获取一个人的简历,或者别人对他的评价 。
    \n
    \nIceskYsl:

    \n

    维护公司的基本信息,比如可以修改该公司的地址,简介,等等。。考虑提供对其公司的评价,顶、踩等功能,以展示该公司在大家心目中的样子,而求职者一些游泳的参考。
    \n
    \nIceskYsl:
    \n生成简历, 个人简历生成。
    \n
    \nDavid:
    \n把个人技能做成论坛前面图片。
    \n
    \n霍泰稳:
    \n做项目肯定会遇到各种各样的问题
    \n而项目经理的问题差不多
    \n他们肯定想和有类似问题的人交流

    ", "created_at"=>2007-09-05 06:19:00 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    技能云(iTechTag)从策划到一期的实现,经历了不少的波折,现在终于稳定,就朋友们的反应来看还是比较认同的,都认为是个很好的Idea,也有很多人鼓励支持我,很是激动,于是再接再厉,收集整理第二期需求,并加快开发速度。
    \n
    \n目前已经有好几个朋友提到了几个不错的功能,记录于此,以免遗忘,我们会筛选优先级加以实现,谢谢这些给我建议的朋友,也希望更多的人能提一些建议和意见,您的关注将激励我不断前行。
    \n
    \n庄表伟:
    \n一个非常榜的主意!我曾经有另一个类似的设想,每个人都有一个地方记录自己的项目经验和教训。比如:多少人做了一个项目,在哪些方面是成功的,在哪些方面是失败的。
    \n
    \n冰云:
    \n我曾经也有类似的想法。不妨考虑把个人的经历组织起来,形成一个人的视图。这个视图可以看作是个人门户,包括做过的项目(可以查看做过这个项目的还有谁),写的blog(从个人blog来聚合),参与的论坛(例如JavaEye),发表过的文章,别人的评价等等。综合起来可以提供信息给其他网站,例如获取一个人的简历,或者别人对他的评价 。
    \n
    \nIceskYsl:
    \n维护公司的基本信息,比如可以修改该公司的地址,简介,等等。。考虑提供对其公司的评价,顶、踩等功能,以展示该公司在大家心目中的样子,而求职者一些游泳的参考。
    \n
    \nIceskYsl:
    \n生成简历, 个人简历生成。
    \n
    \nDavid:
    \n把个人技能做成论坛前面图片。
    \n
    \n霍泰稳:
    \n做项目肯定会遇到各种各样的问题
    \n而项目经理的问题差不多
    \n他们肯定想和有类似问题的人交流

    \n", "_id"=>623}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"为技能云的绽放贡献自己的力量!", "body"=>"

    技能云上线测试这么些天来,得到不少朋友的支持和鼓励,不少朋友甚至还特意写了文章介绍过,在此表示感谢,一下列举几篇我看到的推荐“技能云”的几篇文章,如果你曾写过关于“技能云”的文章,请通过回复让我们知晓,谢谢!
    \n
    \n个人品牌:程序同人,我们的声望被严重低估了。(小容)
    \niTechTag: 重建软件开发者的声望(透明思考)
    \niTechTag:声望创造价值(透明之眼)
    \niTechTag:声望创造价值(透明思考@CSDN)
    \niTechTag: 记录程序员的声望(敏捷中国)

    \n

    为了让这朵“技能云”更好的绽放,欢迎也感谢所有写过介绍、推荐、说明“技能云”的文章,如果你写了一篇关于“技能云”的文章,请让我们知道,一起见证它的绽放!

    ", "created_at"=>2007-09-05 07:08:32 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    技能云上线测试这么些天来,得到不少朋友的支持和鼓励,不少朋友甚至还特意写了文章介绍过,在此表示感谢,一下列举几篇我看到的推荐“技能云”的几篇文章,如果你曾写过关于“技能云”的文章,请通过回复让我们知晓,谢谢!
    \n
    \n个人品牌:程序同人,我们的声望被严重低估了。(小容)
    \niTechTag: 重建软件开发者的声望(透明思考)
    \niTechTag:声望创造价值(透明之眼)
    \niTechTag:声望创造价值(透明思考@CSDN)
    \niTechTag: 记录程序员的声望(敏捷中国)
    \n为了让这朵“技能云”更好的绽放,欢迎也感谢所有写过介绍、推荐、说明“技能云”的文章,如果你写了一篇关于“技能云”的文章,请让我们知道,一起见证它的绽放!

    \n", "_id"=>624}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没通宵了,偶尔来下还行!", "body"=>"

    上学那会经常通宵写程序、做设计、编稿子等,特别是那年暑假的时候几乎完全是颠倒的,太阳升起的时候我准时出门去“过早”,而后回宿舍睡觉到下午3点,吃点东西去球场,也挺不错的;

    \n

    工作后就没有怎么那么晚了,偶尔周末的时候晚一点,但是会在凌晨3点前睡觉,为了自己给某些人的承诺,也为了自己不那么快的衰老(谁说熬夜会衰老的),尽管每次都抓紧时间写代码,做设计,但是很久都不曾通宵了。

    \n

    今天项目组升级现网,做为项目开发组接口,需要留下来配合SS升级,从晚上7点开始一直干到早上8点多,几十台服务器,十几个子系统的升级,浩浩荡荡呀,虽然出现了一些问题,但是还好有惊无险,一切都还顺利。

    \n

    敲了24小时的键盘了,手指都不灵活了~好久不曾通宵~

    ", "created_at"=>2007-09-05 20:20:11 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    上学那会经常通宵写程序、做设计、编稿子等,特别是那年暑假的时候几乎完全是颠倒的,太阳升起的时候我准时出门去“过早”,而后回宿舍睡觉到下午3点,吃点东西去球场,也挺不错的;
    \n工作后就没有怎么那么晚了,偶尔周末的时候晚一点,但是会在凌晨3点前睡觉,为了自己给某些人的承诺,也为了自己不那么快的衰老(谁说熬夜会衰老的),尽管每次都抓紧时间写代码,做设计,但是很久都不曾通宵了。
    \n今天项目组升级现网,做为项目开发组接口,需要留下来配合SS升级,从晚上7点开始一直干到早上8点多,几十台服务器,十几个子系统的升级,浩浩荡荡呀,虽然出现了一些问题,但是还好有惊无险,一切都还顺利。
    \n敲了24小时的键盘了,手指都不灵活了~好久不曾通宵~

    \n", "_id"=>625}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新注册了一个NET域名~", "body"=>"

    偶以前创办的“天马行空技术组(1.S.T)”的域名到期了,几个朋友说天马需要革新了,于是大家决定从头再来,一个暂新的开始,于是我们打算改变,原来的域名1steam.cn不打算续费了,大家一致同意采用新的域名1sters.net,我们重新开始。

    \n

    正好装上芒果,立即申请下这个域名,然后做指向,再翻出N久N久前偶和另外一个朋友整的一个logo图片;再去阿里妈妈申请了个帐号,拿来一个广告,一起放在主页上,至于里面的东西,我们会按照讨论的模式重新开始。

    \n

    至于是什么杨的模式,不久后就可见分晓,不多言,有兴趣的朋友继续关注1sters.net的发展。

    \n

    附录:1.S.T简介

    \n

    天马行空(1.S.T),是一个纯技术型研究小组,如同天马自由自在、灵气十足。 主要致力于软件开发、Web设计、网络安全及其相关技术的学习和研究;纯小组成员个人爱好,无任何商业赢利成份.

    \n

    小组坚持原创,追求自由;小组成员平等互助,一起进步;诣在塑造一个和平轻松,自由快乐的环境,我们的梦想是有一天,我们都可以在个人喜好的领域扬眉吐气,天马行空...

    ", "created_at"=>2007-09-05 21:00:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    偶以前创办的“天马行空技术组(1.S.T)”的域名到期了,几个朋友说天马需要革新了,于是大家决定从头再来,一个暂新的开始,于是我们打算改变,原来的域名1steam.cn不打算续费了,大家一致同意采用新的域名1sters.net,我们重新开始。
    \n正好装上芒果,立即申请下这个域名,然后做指向,再翻出N久N久前偶和另外一个朋友整的一个logo图片;再去阿里妈妈申请了个帐号,拿来一个广告,一起放在主页上,至于里面的东西,我们会按照讨论的模式重新开始。
    \n至于是什么杨的模式,不久后就可见分晓,不多言,有兴趣的朋友继续关注1sters.net的发展。
    \n附录:1.S.T简介
    \n天马行空(1.S.T),是一个纯技术型研究小组,如同天马自由自在、灵气十足。 主要致力于软件开发、Web设计、网络安全及其相关技术的学习和研究;纯小组成员个人爱好,无任何商业赢利成份.
    \n小组坚持原创,追求自由;小组成员平等互助,一起进步;诣在塑造一个和平轻松,自由快乐的环境,我们的梦想是有一天,我们都可以在个人喜好的领域扬眉吐气,天马行空...

    \n", "_id"=>626}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"有惊无险,玩心跳~", "body"=>"

    昨天夜里通宵,今天回家睡觉,中午醒来的时候打开电脑突然发现“技能云”和“第一次”均无法打开,寒呀,急呀,怎么回事,一切来的都太突然了。

    \n

    我记得早上睡觉的时候还是好好的呢,抓紧解决中。。

    \n

    google一批资料均没有什么大的作用,应该不会是我配置的问题吧,先前可以跑的嘛,google到的资料一般说的就下面:

    \n

    修改plublic目录下的dispatch.*的三个文件中的头为服务器上ruby的路径,如bluehost是”/usr/bin/ruby”

    \n

    还是不行,真是见鬼了,后来直接rails mygod生成一个,把上面几个文件连同.htaccess搞下来看看,有点不一样,急忙替换上去后,重启后,技能云终于可以访问,比较下异同,最大的区别就是这句:

    \n

    RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

    \n

    原来使用的是dispatch.fcgi的,难道这个也。。奇怪中。。

    \n

    还发SMS给偶兄弟彭了呢,把他从半路上搞了回来,真囧~

    ", "created_at"=>2007-09-06 08:01:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    昨天夜里通宵,今天回家睡觉,中午醒来的时候打开电脑突然发现“技能云”和“第一次”均无法打开,寒呀,急呀,怎么回事,一切来的都太突然了。
    \n我记得早上睡觉的时候还是好好的呢,抓紧解决中。。
    \ngoogle一批资料均没有什么大的作用,应该不会是我配置的问题吧,先前可以跑的嘛,google到的资料一般说的就下面:
    \n修改plublic目录下的dispatch.的三个文件中的头为服务器上ruby的路径,如bluehost是”/usr/bin/ruby”
    \n还是不行,真是见鬼了,后来直接rails mygod生成一个,把上面几个文件连同.htaccess搞下来看看,有点不一样,急忙替换上去后,重启后,技能云终于可以访问,比较下异同,最大的区别就是这句:
    \nRewriteRule ^(.
    )$ dispatch.cgi [QSA,L]
    \n原来使用的是dispatch.fcgi的,难道这个也。。奇怪中。。
    \n还发SMS给偶兄弟彭了呢,把他从半路上搞了回来,真囧~

    \n", "_id"=>627}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"最近好多事情~", "body"=>"

    最近好多事情,业余的事情进展很缓慢~项目的事情好多,设计,编码,

    \n

    升级,部署,扩容,一大堆了,一个patch加上一个patch,一个版本接着一个版本,快顶不主了,都~ 觉得都是重复劳动,做这样的事情不是我的性格和风格,也不符合我追寻的风格。

    \n

    还记得有人说过:现实中可以稍微的低头,但是心目中的那个脑袋一定要是高昂着的。

    ", "created_at"=>2007-09-10 11:59:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    最近好多事情,业余的事情进展很缓慢~项目的事情好多,设计,编码,
    \n升级,部署,扩容,一大堆了,一个patch加上一个patch,一个版本接着一个版本,快顶不主了,都~ 觉得都是重复劳动,做这样的事情不是我的性格和风格,也不符合我追寻的风格。
    \n还记得有人说过:现实中可以稍微的低头,但是心目中的那个脑袋一定要是高昂着的。

    \n", "_id"=>628}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PS命令查看进程详细参数~", "body"=>"

    遇到一个问题需要查看下当前进程中执行到哪条命令了,于是

    \n

    使用ps -ef | grep java,无奈看不全参数,于是google,请教了下其他同学,得到:

    \n
    \n
    LUNIX代码
    \n
      \n
    1. ps -auxww | more  
    2. \n
    \n
    ", "created_at"=>2007-09-11 02:13:51 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    遇到一个问题需要查看下当前进程中执行到哪条命令了,于是
    \n使用ps -ef | grep java,无奈看不全参数,于是google,请教了下其他同学,得到:
    \n
    \nLUNIX代码
    \n
    \n ps -auxww | more  
    \n

    \n", "_id"=>629}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)下一步需要实现的功能!", "body"=>"

    恩,做互联网,尤其是做web2的人都知道beta是什么意思,技能云的理想模式也是web2的,所以也一直在beta阶段。

    \n

    也许透明同学说的对“可以说很快,大概两周就上线了;也可以说一直没有开发完,不断的在提高和改善。这也是web 2.0的特点,永远都在beta。"

    \n

    初步规划了下当前最需求的功能如下:

    \n

    1、简历生成 -本来打算导出PDF的,但是ruby中我采用了FPDF来生成,总体效果还不错,但是不能自动换行和英文字符的显示都存在一些问题,于是打算先生成HTNL格式的好了。

    \n

    2、通知功能  -当一个新功能上线的时候,可以给用户发送通知mail告诉他这个新功能,以及其使用,附带其他一些话语。

    \n

    3、邀请成员  --这个很重要,现在发完一个项目后,往往就提交项目后自己加入了,但是项目的 其他人并不知道,于是需要这个功能,使得可以针对项目发出邀请。输入对方的mail和你需要说的话,附带上项目URL已经注册,登录URL等发给被邀请者。

    \n

    4、用户自定义  --需要给用户提供定制功能,比如是否需要接收新功能通知等。

    \n

    先就规划这么多,快速实现之再规划下一步需要的功能~

    ", "created_at"=>2007-09-11 03:21:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    恩,做互联网,尤其是做web2的人都知道beta是什么意思,技能云的理想模式也是web2的,所以也一直在beta阶段。
    \n也许透明同学说的对“可以说很快,大概两周就上线了;也可以说一直没有开发完,不断的在提高和改善。这也是web 2.0的特点,永远都在beta。"
    \n初步规划了下当前最需求的功能如下:
    \n1、简历生成 -本来打算导出PDF的,但是ruby中我采用了FPDF来生成,总体效果还不错,但是不能自动换行和英文字符的显示都存在一些问题,于是打算先生成HTNL格式的好了。
    \n2、通知功能  -当一个新功能上线的时候,可以给用户发送通知mail告诉他这个新功能,以及其使用,附带其他一些话语。
    \n3、邀请成员  --这个很重要,现在发完一个项目后,往往就提交项目后自己加入了,但是项目的 其他人并不知道,于是需要这个功能,使得可以针对项目发出邀请。输入对方的mail和你需要说的话,附带上项目URL已经注册,登录URL等发给被邀请者。
    \n4、用户自定义  --需要给用户提供定制功能,比如是否需要接收新功能通知等。
    \n先就规划这么多,快速实现之再规划下一步需要的功能~

    \n", "_id"=>630}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)的简历功能已经完成.", "body"=>"

    今天在家休息,自然想到正好有时间把技能云的简历功能添加上,于是衣服都没来得及穿好就抱出本本干活,开点音乐,let's coding...\"\"

    \n

    按照和透明同学讨论的结果,生成简历属于紧急需求,于是经过简单的规划设计就开始了,在技能云的简历是按照技能云记载的你参与的项目自动生成的,辅助其他一些信息,比如你掌握的技能和扮演过的角色,生成一份能真实的展现自我实力的简历。

    \n

    目前还不允许个人编辑自己的简历,这个后期看情况可能会加入(还要看情况),目前看不到这个需求。针对这个功能,还请各位提提意见和建议,以更加符合大家的口味,谢谢。

    \n

    如想看看效果,可以看这里是我的简历,其他人的简历,你可以在他们的介绍页面看到,登录后在最上方可以看到自己简历的链接,希望大家喜欢这个功能。

    ", "created_at"=>2007-09-13 03:15:43 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    今天在家休息,自然想到正好有时间把技能云的简历功能添加上,于是衣服都没来得及穿好就抱出本本干活,开点音乐,let's coding...
    \n按照和透明同学讨论的结果,生成简历属于紧急需求,于是经过简单的规划设计就开始了,在技能云的简历是按照技能云记载的你参与的项目自动生成的,辅助其他一些信息,比如你掌握的技能和扮演过的角色,生成一份能真实的展现自我实力的简历。
    \n目前还不允许个人编辑自己的简历,这个后期看情况可能会加入(还要看情况),目前看不到这个需求。针对这个功能,还请各位提提意见和建议,以更加符合大家的口味,谢谢。
    \n如想看看效果,可以看这里是我的简历,其他人的简历,你可以在他们的介绍页面看到,登录后在最上方可以看到自己简历的链接,希望大家喜欢这个功能。

    \n", "_id"=>631}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(一):tar和gzip及其压缩相关~", "body"=>"

    老是忘记,干脆记下来好了~

    \n

    最简提示:
    \ntar zxvf XXXX.tar.gz
    \ntar jxvf XXXX tar.bz2
    \n1.压缩一组文件为tar.gz后缀。
    \n# tar cvf backup.tar /etc #gzip -q backup.tar
    \n或
    \n# tar cvfz backup.tar.gz /etc/
    \n
    \n2.释放一个后缀为tar.gz的文件。
    \n#gunzip backup.tar.gz #tar xvf backup.tar
    \n或
    \n# tar xvfz backup.tar.gz
    \n
    \n3.用一个命令完成压缩
    \n#tar cvf - /etc/ | gzip -qc > backup.tar.gz
    \n4.用一个命令完成释放
    \n# gunzip -c backup.tar.gz | tar xvf -
    \n
    \n5.如何解开tar.Z的文件?
    \n# tar xvfz backup.tar.Z 或 # uncompress backup.tar.Z #tar xvf backup.tar
    \n
    \n6.如何解开.tgz文件?
    \n#gunzip backup.tgz
    \n
    \n7.如何压缩和解压缩.bz2的包?
    \n#bzip2 /etc/smb.conf
    \n这将压缩文件smb.conf成smb.conf.bz2
    \n#bunzip2 /etc/smb.conf.bz2
    \n这将在当前目录下还原smb.conf.bz2为smb.conf
    \n
    \n(bzip2 -d也一样)
    \n注: .bz2压缩格式不是很常用,你可以man bzip2

    ", "created_at"=>2007-09-15 02:05:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    老是忘记,干脆记下来好了~
    \n最简提示:
    \ntar zxvf XXXX.tar.gz
    \ntar jxvf XXXX tar.bz2
    \n1.压缩一组文件为tar.gz后缀。

    \n\n

    tar cvf backup.tar /etc #gzip -q backup.tar

    \n\n

    \n\n

    tar cvfz backup.tar.gz /etc/

    \n\n

    2.释放一个后缀为tar.gz的文件。

    \n\n

    gunzip backup.tar.gz #tar xvf backup.tar

    \n\n

    \n\n

    tar xvfz backup.tar.gz

    \n\n

    3.用一个命令完成压缩

    \n\n

    tar cvf - /etc/ | gzip -qc > backup.tar.gz

    \n\n

    4.用一个命令完成释放

    \n\n

    gunzip -c backup.tar.gz | tar xvf -

    \n\n

    5.如何解开tar.Z的文件?

    \n\n

    tar xvfz backup.tar.Z 或 # uncompress backup.tar.Z #tar xvf backup.tar

    \n\n

    6.如何解开.tgz文件?

    \n\n

    gunzip backup.tgz

    \n\n

    7.如何压缩和解压缩.bz2的包?

    \n\n

    bzip2 /etc/smb.conf

    \n\n

    这将压缩文件smb.conf成smb.conf.bz2

    \n\n

    bunzip2 /etc/smb.conf.bz2

    \n\n

    这将在当前目录下还原smb.conf.bz2为smb.conf
    \n
    \n(bzip2 -d也一样)
    \n注: .bz2压缩格式不是很常用,你可以man bzip2

    \n", "_id"=>632}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决ubuntu下的rails开发时mysql的问题!", "body"=>"今天开电脑的时候没有注意选择,直接重启到前几天装的ubuntu下,于是懒得重新启动了,于是就在 ubuntu下继续开发好了,rails环境前几天就搭建好了,也测试过了,于是把源代码copy过来,重启后,初始化数据库,页面显示乱码,进数据库看看也是乱码,看来是有点问题。于是google了一把,抓住关键点,很快就解决了,以前在win下出现过乱码都解决了,所以这里针对ubuntu上的问题:1、配置sock地址另外还可能会出现一个错误No such file or directory - /tmp/mysql.sock这个是因为在ubuntu下默认的mysql是如上位置,于是在database.ym里面需要重新设置一下就ok了,如下:SQL代码 1. development: 2. adapter: mysql 3. database: sdroad_development 4. username: root 5. password: 6. host: localhost 7. socket: /var/run/mysqld/mysqld.sock 2、改变mysql编码,如下:1.) 修改mysql的配置文件 sudo gedit /etc/mysql/my.cnf在[client]下面增加 default-character=utf82. )在mysql shell下建立数据库.create database 1ster default character set utf8;*同时发表:*http://weblog.1ster.cn/?action=show&id=153", "created_at"=>2007-07-30 19:47:59 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    今天开电脑的时候没有注意选择,直接重启到前几天装的ubuntu下,于是懒得重新启动了,于是就在 ubuntu下继续开发好了,rails环境前几天就搭建好了,也测试过了,于是把源代码copy过来,重启后,初始化数据库,页面显示乱码,进数据库看看也是乱码,看来是有点问题。于是google了一把,抓住关键点,很快就解决了,以前在win下出现过乱码都解决了,所以这里针对ubuntu上的问题:1、配置sock地址另外还可能会出现一个错误No such file or directory - /tmp/mysql.sock这个是因为在ubuntu下默认的mysql是如上位置,于是在database.ym里面需要重新设置一下就ok了,如下:SQL代码 1. development: 2. adapter: mysql 3. database: sdroad_development 4. username: root 5. password: 6. host: localhost 7. socket: /var/run/mysqld/mysqld.sock 2、改变mysql编码,如下:1.) 修改mysql的配置文件 sudo gedit /etc/mysql/my.cnf在[client]下面增加 default-character=utf82. )在mysql shell下建立数据库.create database 1ster default character set utf8;*同时发表:*http://weblog.1ster.cn/?action=show&id=153;

    \n", "_id"=>633}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails笔记 active controller", "body"=>"别人写的一篇文章,推荐整理下,如下地址:http://weblog.1ster.cn/?action=show&id=150", "created_at"=>2007-07-30 19:45:51 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    别人写的一篇文章,推荐整理下,如下地址:http://weblog.1ster.cn/?action=show&id=150;

    \n", "_id"=>634}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Magick操作数据库blog字段的图像!", "body"=>"一直不是很喜欢用一些插件,一来觉得没有必要使用那么复杂的,一些特色功能我们完全可以写代码完成,比如用Magick操作图片等等,就很方便和简单;以前说过如何处理磁盘上的图片,今天看看如何用Magick操作数据库中blob字段的图片,看代码就明白咯,如果对你有用,记得谢谢我哈:)Ruby代码 1. #这个是用来生成用户图像的 2. def picture 3. @user = User.find(params[:id]) 4. image = Magick::Image::from_blob(@user.data).first 5. # clown = Magick::Image.read(.read).first 6. image.crop_resized!(60, 60, Magick::NorthGravity) 7. send_data(image.to_blob, 8. :filename => @user.nickname, 9. :type => @user.content_type, 10. :disposition => "inline") 11. end 有不明白的就留言问哈。同时发表于:http://weblog.1ster.cn/?action=show&id=145", "created_at"=>2007-07-30 19:43:53 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    一直不是很喜欢用一些插件,一来觉得没有必要使用那么复杂的,一些特色功能我们完全可以写代码完成,比如用Magick操作图片等等,就很方便和简单;以前说过如何处理磁盘上的图片,今天看看如何用Magick操作数据库中blob字段的图片,看代码就明白咯,如果对你有用,记得谢谢我哈:)Ruby代码 1. #这个是用来生成用户图像的 2. def picture 3. @user = User.find(params[:id]) 4. image = Magick::Image::from_blob(@user.data).first 5. # clown = Magick::Image.read(.read).first 6. image.crop_resized!(60, 60, Magick::NorthGravity) 7. send_data(image.to_blob, 8. :filename => @user.nickname, 9. :type => @user.content_type, 10. :disposition => "inline") 11. end 有不明白的就留言问哈。同时发表于:http://weblog.1ster.cn/?action=show&id=145;

    \n", "_id"=>635}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"10 Great New Ruby / Rails Screencasts from July 2007", "body"=>"这里列举了十个很不错的视频教程,但是都是老外的,打击可以看看,很不错的!http://www.rubyinside.com/12-great-new-ruby-rails-screencasts-from-july-2007-566.html", "created_at"=>2007-07-29 17:32:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这里列举了十个很不错的视频教程,但是都是老外的,打击可以看看,很不错的!http://www.rubyinside.com/12-great-new-ruby-rails-screencasts-from-july-2007-566.html

    \n", "_id"=>636}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"mongrel启动时报错的解决", "body"=>"记不得时候在本地机子上安装了mongrel,今天把1stlog用mongrel运行时,报告:-e:3:in `load': no such file to load -- mongrel_rails (LoadError)\tfrom -e:3看错误提示貌似mongrel_rails 这个加载不到,那么应该就是配置的问题了,问题解决如下:找到RadRails的 preferences > Rails > configuration ,在这里指定mongrel_rails的路径就可以了(注意不是bat也不是cmd,而是那个没有后缀的)ok,解决了,如果有谁遇到这个问题,也算帮忙了。呵呵。。。", "created_at"=>2007-07-20 16:55:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    记不得时候在本地机子上安装了mongrel,今天把1stlog用mongrel运行时,报告:-e:3:in `load': no such file to load -- mongrel_rails (LoadError) from -e:3看错误提示貌似mongrel_rails 这个加载不到,那么应该就是配置的问题了,问题解决如下:找到RadRails的 preferences > Rails > configuration ,在这里指定mongrel_rails的路径就可以了(注意不是bat也不是cmd,而是那个没有后缀的)ok,解决了,如果有谁遇到这个问题,也算帮忙了。呵呵。。。

    \n", "_id"=>637}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"警惕rails中的保留字带来的问题~", "body"=>"这个问题还真一直没有关注过,只是晓得rails和ruby中有些关键字、保留字,也没太注意,昨天开始遇到一个很奇怪的问题,我建立了一个用来存放友情链接的表links,里面有title,desc,*type*,created_at等字段,然后在controller中取记录的时候类似如下语句: @friend_links = Link.find(:all, :conditions => { :type => 1, :visible => 1 })貌似一切都很平常,却发生如下的错误:compile errorD:/soft/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1358: syntax errorObject::1一切都很平常呀,试着换个find的写法,还是一样出问题,真是够邪门的~!然后今天问了几个朋友,也说奇怪,没有遇到过,还好google还是找到了这个问题的根源:保留字。请注意,这里我使用了一个保留字*type*做为字段名,导致这个错误的发生,就像一个朋友这样解释的一样:Its because *type *is a reserved word, so you'll have to change that column's name (perhaps to kind or something). Otherwise you're code looks fine wink.大家以后一定要注意,这个小问题浪费了不少时间~", "created_at"=>2007-07-12 05:10:19 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这个问题还真一直没有关注过,只是晓得rails和ruby中有些关键字、保留字,也没太注意,昨天开始遇到一个很奇怪的问题,我建立了一个用来存放友情链接的表links,里面有title,desc,*type*,created_at等字段,然后在controller中取记录的时候类似如下语句: @friend_links = Link.find(:all, :conditions => { :type => 1, :visible => 1 })貌似一切都很平常,却发生如下的错误:compile errorD:/soft/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1358: syntax errorObject::1一切都很平常呀,试着换个find的写法,还是一样出问题,真是够邪门的~!然后今天问了几个朋友,也说奇怪,没有遇到过,还好google还是找到了这个问题的根源:保留字。请注意,这里我使用了一个保留字*type*做为字段名,导致这个错误的发生,就像一个朋友这样解释的一样:Its because *type *is a reserved word, so you'll have to change that column's name (perhaps to kind or something). Otherwise you're code looks fine wink.大家以后一定要注意,这个小问题浪费了不少时间~

    \n", "_id"=>638}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"服务器坏掉了~", "body"=>"

    真是闹心,坏了好几天了,还没有好~~

    \n

    可怜的技能云才上线两天就挂掉了,实在悲哀。。

    \n

    什么时间才能好呀~~

    ", "created_at"=>2007-08-23 16:31:17 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    真是闹心,坏了好几天了,还没有好~~
    \n可怜的技能云才上线两天就挂掉了,实在悲哀。。
    \n什么时间才能好呀~~

    \n", "_id"=>639}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)上线了~", "body"=>"

    服务器的事情总算差不多了,以前的数据还是导不出来(暗暗的郁闷一下,也对某些人BS一下),现在换了新的服务器;

    \n

    还请注册过的朋友重新注册,这次我们不会再丢失数据了(每天都有备份),谢谢各位大理支持~

    \n

    如果发现Bug或者有其他一些建议、意见,欢迎交流~

    ", "created_at"=>2007-08-28 01:25:49 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    服务器的事情总算差不多了,以前的数据还是导不出来(暗暗的郁闷一下,也对某些人BS一下),现在换了新的服务器;
    \n还请注册过的朋友重新注册,这次我们不会再丢失数据了(每天都有备份),谢谢各位大理支持~
    \n如果发现Bug或者有其他一些建议、意见,欢迎交流~

    \n", "_id"=>640}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Blog换服务器了!", "body"=>"

    在没有自己独立服务器器的日志里,我只能搬来搬去,原来是和技能云放在一个老外的空间里面的,但是觉得有点慢,且对PHP的二级目录支持不好,很多图片都看不到。

    \n

    于是联系了浪子兄弟暂时寄存在这里,数据随手备份,方便有自己服务器的时候可以迁移。

    \n

    感谢浪子。

    ", "created_at"=>2007-09-04 15:21:07 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在没有自己独立服务器器的日志里,我只能搬来搬去,原来是和技能云放在一个老外的空间里面的,但是觉得有点慢,且对PHP的二级目录支持不好,很多图片都看不到。
    \n于是联系了浪子兄弟暂时寄存在这里,数据随手备份,方便有自己服务器的时候可以迁移。
    \n感谢浪子。

    \n", "_id"=>641}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转透明:iTechTag:声望创造价值", "body"=>"
    \n

    本文是透明同学为“技能云”写的介绍,看完热血沸腾,转过来激励不断的完善技能云。

    \n

    以前在JavaEye的一个讨论里,有位同志说“简历嘛,大家都知道,肯定是有水分的”。于是我在另一个blog里说到,简历里唯一有意义的,就是工作经历。认真回想一下,我在看应聘者的简历时,也基本上不看基本信息、自我评价之类的,只看工作经历:做过什么项目,用过什么技术,比说什么“熟练”、“精通”要有意义得多。我的期望、我的评估、整个后续的面试过程都是围绕着工作经历来展开的。

    \n

    求职者的工作经历,这份信息对于潜在雇主有价值。但这份价值在求职者自己身上实现了多少?作为软件开发者,不妨问问自己:还有谁记得你几年前完成的那些“不可能的任务”?还有谁记得你通宵加班为项目做出的贡献?还有谁记得客户和领导曾给你的赞扬?有多少求贤若渴的潜在雇主想要知道你曾经那些了不起的成就,却无从获取这些信息?那么这份信息的价值去了哪里?我们把工作经历告诉了谁?是的,我们把工作经历写在简历里,把简历放在了招聘网站;而招聘网站把我们的简历锁起来,把我们的工作经历信息卖给潜在雇主。我们的工作经历,去给招聘网站创造价值了。

    \n

    并非所有行业都是这样的。就拿电影来说吧,除了导演和演员以外,一部好电影离不开无数的幕后英雄:灯光、音乐、武指、剪辑……不过这些幕后英雄并没有因为身处幕后而被埋没,他们的名字出现在影片的演职员表里,展现在所有观众的眼前。当大导演想要拍下一部大影片时,他立即就能想到自己喜欢哪部影片里的配乐,然后立即就能找出这个配乐的人。幕后英雄们的每一段工作经历不仅给自己带来收入,还积累成为自己的声望,为自己打开了未来的门。

    \n

    iTechTag的目标就是让软件开发者的工作经历真正成为自己的声望,让声望给我们自己创造价值。我们希望记录下自己辛勤工作的成果,并与他人分享我们的骄傲。我们希望让别人知道我们掌握什么技能、参与过什么项目、帮助过什么客户、做出过什么贡献。我们希望让自己、让同事、让朋友、让所有关注我们的人有机会了解:我们是多么优秀的软件开发者。
    \n把这样一朵“技能云”贴在自己的blog旁边,向所有人炫耀自己的强大技能和丰富经验,让自己的声望开始发挥价值。这就是iTechTag想要给你的。

    \n
    ", "created_at"=>2007-09-04 15:45:01 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    本文是透明同学为“技能云”写的介绍,看完热血沸腾,转过来激励不断的完善技能云。
    \n以前在JavaEye的一个讨论里,有位同志说“简历嘛,大家都知道,肯定是有水分的”。于是我在另一个blog里说到,简历里唯一有意义的,就是工作经历。认真回想一下,我在看应聘者的简历时,也基本上不看基本信息、自我评价之类的,只看工作经历:做过什么项目,用过什么技术,比说什么“熟练”、“精通”要有意义得多。我的期望、我的评估、整个后续的面试过程都是围绕着工作经历来展开的。
    \n求职者的工作经历,这份信息对于潜在雇主有价值。但这份价值在求职者自己身上实现了多少?作为软件开发者,不妨问问自己:还有谁记得你几年前完成的那些“不可能的任务”?还有谁记得你通宵加班为项目做出的贡献?还有谁记得客户和领导曾给你的赞扬?有多少求贤若渴的潜在雇主想要知道你曾经那些了不起的成就,却无从获取这些信息?那么这份信息的价值去了哪里?我们把工作经历告诉了谁?是的,我们把工作经历写在简历里,把简历放在了招聘网站;而招聘网站把我们的简历锁起来,把我们的工作经历信息卖给潜在雇主。我们的工作经历,去给招聘网站创造价值了。
    \n并非所有行业都是这样的。就拿电影来说吧,除了导演和演员以外,一部好电影离不开无数的幕后英雄:灯光、音乐、武指、剪辑……不过这些幕后英雄并没有因为身处幕后而被埋没,他们的名字出现在影片的演职员表里,展现在所有观众的眼前。当大导演想要拍下一部大影片时,他立即就能想到自己喜欢哪部影片里的配乐,然后立即就能找出这个配乐的人。幕后英雄们的每一段工作经历不仅给自己带来收入,还积累成为自己的声望,为自己打开了未来的门。
    \niTechTag的目标就是让软件开发者的工作经历真正成为自己的声望,让声望给我们自己创造价值。我们希望记录下自己辛勤工作的成果,并与他人分享我们的骄傲。我们希望让别人知道我们掌握什么技能、参与过什么项目、帮助过什么客户、做出过什么贡献。我们希望让自己、让同事、让朋友、让所有关注我们的人有机会了解:我们是多么优秀的软件开发者。
    \n把这样一朵“技能云”贴在自己的blog旁边,向所有人炫耀自己的强大技能和丰富经验,让自己的声望开始发挥价值。这就是iTechTag想要给你的。

    \n", "_id"=>642}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails上使用ruby来发Jabber消息~", "body"=>"

    近日考虑一个新的需求,希望在技能云上加上一种IM的支持,可以直接对Gtalk之类的发消息,自然是用ruby实现,于是google到一些资料,如下:
    \n
    \n参考:
    \nxmpp4r文档:
    \nhttp://home.gna.org/xmpp4r/rdoc/
    \n
    \n一个老外写了三篇文章:
    \nhttp://devblog.famundo.com/articles/category/xmpp4r-jabber
    \n
    \njavaeye上的一个例子:
    \nhttp://danoyang.javaeye.com/blog/67884
    \n
    \n一个日本人写的例子:
    \nhttp://d.hatena.ne.jp/technohippy/20070803#1186104969
    \n
    \n另外还可以使用xmpp4r-simple:
    \nhttp://romeda.org/blog/2006/11/announcing-jabbersimple.html

    ", "created_at"=>2007-09-15 08:05:20 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    近日考虑一个新的需求,希望在技能云上加上一种IM的支持,可以直接对Gtalk之类的发消息,自然是用ruby实现,于是google到一些资料,如下:
    \n
    \n参考:
    \nxmpp4r文档:
    \nhttp://home.gna.org/xmpp4r/rdoc/
    \n
    \n一个老外写了三篇文章:
    \nhttp://devblog.famundo.com/articles/category/xmpp4r-jabber
    \n
    \njavaeye上的一个例子:
    \nhttp://danoyang.javaeye.com/blog/67884
    \n
    \n一个日本人写的例子:
    \nhttp://d.hatena.ne.jp/technohippy/20070803#1186104969
    \n
    \n另外还可以使用xmpp4r-simple:
    \nhttp://romeda.org/blog/2006/11/announcing-jabbersimple.html

    \n", "_id"=>643}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"How do I install my own Gems?", "body"=>"

    BH 上缺少了一些我需要的gem,于是需要自己安装,BH允许把Gems安装到自己的目录下,于是找了些资料,操作步骤如下:

    \n

    The easiest and fastest way to install Ruby gems is to install them in your local directory, you will need shell access. To install your own gems use the following steps:
    \n
    \n1) Using File Manager in your cPanel make a copy of the .bashrc file in your root directory, name it .bashrc.bak.
    \n2) Now edit the .bashrc file and add the following to the end of the file:

    \n
    \n
    lunix代码
    \n
      \n
    1. export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin"  
    2. \n
    3. export GEM_HOME="$HOME/.gems"  
    4. \n
    5. export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"  
    6. \n
    7.   
    8. \n
    9. export GEM_CACHE=”$GEM_HOME/cache” 
      \n
    10. \n
    \n
    \n

    3) Using your favorite SSH client connect to your site.
    \n
    \n4) at the prompt type:
    \n
    \ncp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ./
    \ngem install sources-0.0.1.gem
    \ngem update -y
    \n
    \nThis will update rails to the latest version and install it to your local gem directory.
    \n
    \n5) When using a rails application, make sure you add the following to your ./config/environment.rb:
    \n
    \nENV['GEM_PATH'] = '/path/to/your/home/.gems:/usr/lib/ruby/gems/1.8'
    \n
    \n这里还有一个帖子,可以参考下:
    \nhttp://www.bluehostforum.com/showthread.php?t=1064

    \n

     

    \n

    另外:还可以把在本地安装好gem后把其copy到Vendor目录下,但是这个方法我不喜欢,不晓得能不能直接把gem包copy到Vendor目录下?试过的告诉下下,多谢!

    ", "created_at"=>2007-09-17 07:39:53 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    BH 上缺少了一些我需要的gem,于是需要自己安装,BH允许把Gems安装到自己的目录下,于是找了些资料,操作步骤如下:
    \nThe easiest and fastest way to install Ruby gems is to install them in your local directory, you will need shell access. To install your own gems use the following steps:
    \n
    \n1) Using File Manager in your cPanel make a copy of the .bashrc file in your root directory, name it .bashrc.bak.
    \n2) Now edit the .bashrc file and add the following to the end of the file:
    \n
    \nlunix代码
    \n
    \n export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin"  
    \n export GEM_HOME="$HOME/.gems"  
    \n export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"  
    \n   
    \n export GEM_CACHE=”$GEM_HOME/cache” 
    \n
    \n
    \n
    \n3) Using your favorite SSH client connect to your site.
    \n
    \n4) at the prompt type:
    \n
    \ncp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ./
    \ngem install sources-0.0.1.gem
    \ngem update -y
    \n
    \nThis will update rails to the latest version and install it to your local gem directory.
    \n
    \n5) When using a rails application, make sure you add the following to your ./config/environment.rb:
    \n
    \nENV['GEM_PATH'] = '/path/to/your/home/.gems:/usr/lib/ruby/gems/1.8'
    \n
    \n这里还有一个帖子,可以参考下:
    \nhttp://www.bluehostforum.com/showthread.php?t=1064
    \n 
    \n另外:还可以把在本地安装好gem后把其copy到Vendor目录下,但是这个方法我不喜欢,不晓得能不能直接把gem包copy到Vendor目录下?试过的告诉下下,多谢!

    \n", "_id"=>644}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"郁闷的事情,Blue上的XMPP4R竟然连不出来..", "body"=>"

    本来已经突破最后一个难题以为搞定了这个XMOO4R的使用,在本地测试很顺利,无奈的是在bluehost上就是不成功,开始因为上面没有安装XMPP4R,后来突破了这个后,还是不行,错误如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. Processing PeopleController#notify_in_gtalk (for 121.35.109.40 at 2007-09-17 09:02:42) [GET]  
    2. \n
    3.   Session ID: 192fbe2f031b846cbcba5fad37f32228  
    4. \n
    5.   Parameters: {"action"=>"notify_in_gtalk""controller"=>"people"}  
    6. \n
    7.   SQL (0.000151)   SET NAMES 'utf8'  
    8. \n
    9.   SQL (0.000047)   SET SQL_AUTO_IS_NULL=0  
    10. \n
    11.   SQL (0.000000)   Mysql::Error: Query was empty:   
    12. \n
    13.   
    14. \n
    15.   
    16. \n
    17. Errno::ETIMEDOUT (Connection timed out - connect(2)):  
    18. \n
    19.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `initialize' 
    20. \n
    21.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `new'  
    22. \n
    23.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `connect' 
    24. \n
    25.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:73:in `connect'  
    26. \n
    27.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:60:in `connect' 
    28. \n
    29.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in `each'  
    30. \n
    31.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in `connect' 
    32. \n
    33.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:390:in `connect!'  
    34. \n
    35.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:322:in `client' 
    36. \n
    37.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:331:in `send!'  
    38. \n
    39.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:147:in `status' 
    40. \n
    41.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:90:in `initialize'  
    42. \n
    43.     /app/controllers/people_controller.rb:122:in `new' 
    44. \n
    45.     /app/controllers/people_controller.rb:122:in `notify_in_gtalk'  
    46. \n
    47.     /usr/lib/ruby/gems/1.8/gems  
    48. \n
    \n
    \n真是郁闷,我估计是BH上的限制,明天发个mail问问,但愿可以搞定,好想有一台自己的服务器哦。。

    ", "created_at"=>2007-09-17 15:46:17 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    本来已经突破最后一个难题以为搞定了这个XMOO4R的使用,在本地测试很顺利,无奈的是在bluehost上就是不成功,开始因为上面没有安装XMPP4R,后来突破了这个后,还是不行,错误如下:
    \n
    \n
    \nRuby代码
    \n
    \n Processing PeopleController#notify_in_gtalk (for 121.35.109.40 at 2007-09-17 09:02:42) [GET]  
    \n   Session ID: 192fbe2f031b846cbcba5fad37f32228  
    \n   Parameters: {"action"=>"notify_in_gtalk", "controller"=>"people"}  
    \n   SQL (0.000151)   SET NAMES 'utf8'  
    \n   SQL (0.000047)   SET SQL_AUTO_IS_NULL=0  
    \n   SQL (0.000000)   Mysql::Error: Query was empty:   
    \n   
    \n   
    \n Errno::ETIMEDOUT (Connection timed out - connect(2)):  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in initialize</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in&nbsp;
    new'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:73:in&nbsp;
    connect'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:60:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in&nbsp;
    each'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:390:in&nbsp;
    connect!'  
    \n     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:322:in client</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:331:in&nbsp;
    send!'  
    \n     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:147:in status</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:90:in&nbsp;
    initialize'  
    \n     /app/controllers/people_controller.rb:122:in </span><span class="keyword">new</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/app/controllers/people_controller.rb:122:in&nbsp;
    notify_in_gtalk'  
    \n     /usr/lib/ruby/gems/1.8/gems  
    \n
    \n
    \n真是郁闷,我估计是BH上的限制,明天发个mail问问,但愿可以搞定,好想有一台自己的服务器哦。。

    \n", "_id"=>645}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"weblogic性能调优", "body"=>"

    注:在下面做的介绍都是以Weblogic8.1为例的,其它版本的Weblogic可能会有些许不同。
    \n
    \n1) 设置JAVA参数;
    \na) 编辑Weblogic Server启动脚本文件;
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startWebLogic.cmd(startWebLogic.sh on Unix) 
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startManagedWebLogic.cmd(startManagedWebLogic.sh on Unix) --这个是做集群的时候用的
    \nb) 编辑set JAVA_OPTIONS命令,如:set JAVA_OPTIONS=-Xms256m –Xmx256m;
    \n(在UNIX下把MEM_ARGS="-Xms1024m -Xmx1024m -Xmn128m"加到上述两个.sh文件中即可)
    \nc) 保存,重启即可。
    \n注:在WebLogic中,为了获得更好的性能,BEA公司推荐最小Java堆等于最大Java堆。
    \n(这个偶们的设置都是1024M的,反正偶们内存大大的4G呢)
    \n
    \n2) 开发模式 vs. 产品模式;
    \n开发模式和产品模式的一些参数的默认值不同,可能会对性能造成影响,下面是对性能有影响的参数列表:

    \n

    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    参数开发模式默认值产品模式默认值
    Execute Queue: Thread Count15 threads25 threads
    JDBC Connection Pool: MaxCapacity15 connnections25 connections
    \n
    \n通过启动管理控制台,在域(如:mydomain)> 配置 > 常规选择产品模式。
    \n(这个在创建weblogic的domain的时候是有选择的,选择“产品”模式就可以了,如果后期需要修改,可以按照上面的方法修改)
    \n
    \n3) 尽量开启本地I/O;

    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 配置 > 调整选择启用本地I/O。
    \n注:此值也可通过手动的修改config.xml配置文件。
    \n(这个没有试验过,不晓得有什么效果和好处,知道的告诉偶下下。)
    \n
    \n4) 调优执行队列线程;
    \na) 修改默认执行线程数
    \n在这里,执行队列的线程数表示执行队列能够同时执行的操作的数量。但此值不是设的越大越好,应该恰到好处的去设置它,太小了,执行队列中将会积累很多待处理的任务,太大了,则会消耗大量的系统资源从而影响整体的性能。在产品模式下默认为25个执行线程。
    \n(点:一般来说,其上限是每个CPU对应50个线程,其按照CPU个数线性增长.)
    \n
    \n为了设置理想的执行队列的线程数,我们可以启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 监视 > 性能中监控最大负载时执行队列的吞吐量和队列中的等待请求数,据此确定理想的数值。
    \n理想的默认执行线程数是由多方面的因素决定的,比如机器CPU性能、总体体系架构、I/O、操作系统的进程调度机制、JVM的线程调度机制。随着CPU个数的增加,WebLogic可以近乎线性地提高线程数。线程数越多,花费在线程切换的时间也就越多;线程数越小,CPU可能无法得到充分的利用。为获取一个理想的线程数,需要经过反复的测试。在测试中,可以以25*CPU个数为基准进行调整。当空闲线程较少,CPU利用率较低时,可以适当增加线程数的大小(每五个递增)。对于PC Server和Windows 2000,则最好每个CPU小于50个线程,以CPU利用率为90%左右为最佳。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置中修改线程计数。
    \n
    \nb) 设定执行队列的溢出条件;
    \n    Weblogic Server提供给默认的执行队列或用户自定义的执行队列自定义溢出条件的功能,当满足此溢出条件时,服务器改变其状态为“警告”状态,并且额外的再分配一些线程去处理在队列中的请求,而达到降低队列长度的目的。
    \n    通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置下面几项:
    \n●队列长度:此值表示执行队列中可容纳的最大请求数,默认值是65536,最后不要手动改变此值。
    \n●队列长度阈值百分比:此值表示溢出条件,在此服务器指出队列溢出之前可以达到的队列长度大小的百分比。
    \n●线程数增加:当检测到溢出条件时,将增加到执行队列中的线程数量。如果CPU和内存不是足够的高,尽量不要改变默认值“0”。因为Weblogic一旦增加后不会自动缩减,虽然最终可能确实起到了降低请求的作用,但在将来的运行中将影响程序的性能。
    \n●最大线程数:为了防止创建过多的线程数量,可以通过设定最大的线程数进行控制。
    \n在实际的应用场景中,应根据具体情况适当的调整以上参数。
    \n
    \nc) 设定执行队列监测行为
    \nWeblogic Server能够自动监测到当一个执行线程变为“阻塞”。变为“阻塞”状态的执行线程将无法完成当前的工作,也无法再执行新请求。如果执行队列中的所有执行线程都变为“阻塞”状态,Weblogic server可能改变状态为“警告”或“严重”状态。如果Weblogic server变为“严重”状态,可以通过Node Manager来自动关闭此服务器并重新启动它。具体请参考:Node Manager Capabilities文档。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置下面几项:
    \n●阻塞线程最长时间:在此服务器将线程诊断为阻塞线程之前,线程必须连续工作的时间长度(秒)。默认情况下,WebLogic Server 认为线程在连续工作 600 秒后成为阻塞线程。
    \n●阻塞线程计时器间隔:WebLogic Server 定期扫描线程以查看它们是否已经连续工作了 "阻塞线程最长时间" 字段中指定的时间长度的间隔时间(秒)。默认情况下,WebLogic Server 将此时间间隔设置为 600 秒。
    \n
    \n5) 调优TCP连接缓存数;
    \nWebLogic Server用Accept Backlog参数规定服务器向操作系统请求的队列大小,默认值为50。当系统重载负荷时,这个值可能过小,日志中报Connection Refused,导致有效连接请求遭到拒绝,此时可以提高Accept Backlog 25%直到连接拒绝错误消失。对于Portal类型的应用,默认值往往是不够的。
    \nLogin Timeout和SSL Login Timeout参数表示普通连接和SSL连接的超时时间,如果客户连接被服务器中断或者SSL容量大,可以尝试增加该值。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置“接受预备连接”。
    \n
    \n6) 改变Java编译器;
    \n标准的Java编译器是javac,但编译JSP servlets速度太慢,为了提高编译速度,可以使用sj或jikes编译器取代javac编译器。下面说说更改Java编译器:
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 常规下改变Java 编译器,默认为javac。输入完整路径,如:c:\\visualcafe31\\bin\\sj.exe。然后打开高级选项,在预规划到类路径填写编译 Java 代码时为 Java 编译器类路径预规划的选项,如:BEA_HOME\\jdk141_02\\jre\\lib\\rt.jar。
    \n
    \n7) 使用Webogic Server集群提高性能;
    \n具体关于如何配置Weblogic集群,我就不细说了。详情可参考:Introduction to WebLogic Server Clustering。
    \n
    \n8) Weblogic EJB调优
    \n由于EJB2.0已经很少项目在用了,EJB3.0再成熟一点,我再补充这一部分吧!
    \n
    \n9) JDBC应用调优
    \nJDBC Connection Pool的调优受制于WebLogic Server线程数的设置和数据库进程数,游标的大小。通常我们在一个线程中使用一个连接,所以连接数并不是越多越好,为避免两边的资源消耗,建议设置连接池的最大值等于或者略小于线程数。同时为了减少新建连接的开销,将最小值和最大值设为一致。
    \n增加Statement Cache Size对于大量使用PreparedStatement对象的应用程序很有帮助,WebLogic能够为每一个连接缓存这些对象,此值默认为10。在保证数据库游标大小足够的前提下,可以根据需要提高Statement Cache Size。比如当你设置连接数为25,Cache Size为10时,数据库可能需要打开25*10=250个游标。不幸的是,当遇到与PreparedStatement Cache有关的应用程序错误时,你需要将Cache Size设置为0。
    \n尽管JDBC Connection Pool提供了很多高级参数,在开发模式下比较有用,但大部分在生产环境下不需调整。这里建议最好不要设置测试表, 同时Test Reserved Connections和Test Released Connections也无需勾上。 当然如果你的数据库不稳定,时断时续,你就可能需要上述的参数打开。
    \n最后提一下驱动程序类型的选择,以Oracle为例,Oracle提供thin驱动和oci驱动,从性能上来讲,oci驱动强于thin驱动,特别是大数据量的操作。但在简单的数据库操作中,性能相差不大,随着thin驱动的不断改进,这一弱势将得到弥补。而thin驱动的移植性明显强于oci驱动。所以在通常情况下建议使用thin驱动。而最新驱动器由于WebLogic server/bin目录下的类包可能不是最新的,请以Oracle网站为准: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html。
    \n
    \n10) JSP调优
    \n设置jsp-param pageCheckSeconds=-1;
    \n设置serlet-reload-check=-1或ServletReloadCheckSecs=-1;
    \n设置jsp-param precompile=true,关闭JSP预编译选项。

    ", "created_at"=>2007-09-18 02:58:44 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    注:在下面做的介绍都是以Weblogic8.1为例的,其它版本的Weblogic可能会有些许不同。
    \n
    \n1) 设置JAVA参数;
    \na) 编辑Weblogic Server启动脚本文件;
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startWebLogic.cmd(startWebLogic.sh on Unix) 
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startManagedWebLogic.cmd(startManagedWebLogic.sh on Unix) --这个是做集群的时候用的
    \nb) 编辑set JAVA_OPTIONS命令,如:set JAVA_OPTIONS=-Xms256m –Xmx256m;
    \n(在UNIX下把MEM_ARGS="-Xms1024m -Xmx1024m -Xmn128m"加到上述两个.sh文件中即可)
    \nc) 保存,重启即可。
    \n注:在WebLogic中,为了获得更好的性能,BEA公司推荐最小Java堆等于最大Java堆。
    \n(这个偶们的设置都是1024M的,反正偶们内存大大的4G呢)
    \n
    \n2) 开发模式 vs. 产品模式;
    \n开发模式和产品模式的一些参数的默认值不同,可能会对性能造成影响,下面是对性能有影响的参数列表:
    \n
    \n
    \n
    \n
    \n 参数
    \n 开发模式默认值
    \n 产品模式默认值
    \n
    \n
    \n Execute Queue: Thread Count
    \n 15 threads
    \n 25 threads
    \n
    \n
    \n JDBC Connection Pool: MaxCapacity
    \n 15 connnections
    \n 25 connections
    \n
    \n
    \n
    \n
    \n通过启动管理控制台,在域(如:mydomain)> 配置 > 常规选择产品模式。
    \n(这个在创建weblogic的domain的时候是有选择的,选择“产品”模式就可以了,如果后期需要修改,可以按照上面的方法修改)
    \n
    \n3) 尽量开启本地I/O;
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 配置 > 调整选择启用本地I/O。
    \n注:此值也可通过手动的修改config.xml配置文件。
    \n(这个没有试验过,不晓得有什么效果和好处,知道的告诉偶下下。)
    \n
    \n4) 调优执行队列线程;
    \na) 修改默认执行线程数
    \n在这里,执行队列的线程数表示执行队列能够同时执行的操作的数量。但此值不是设的越大越好,应该恰到好处的去设置它,太小了,执行队列中将会积累很多待处理的任务,太大了,则会消耗大量的系统资源从而影响整体的性能。在产品模式下默认为25个执行线程。
    \n(点:一般来说,其上限是每个CPU对应50个线程,其按照CPU个数线性增长.)
    \n
    \n为了设置理想的执行队列的线程数,我们可以启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 监视 > 性能中监控最大负载时执行队列的吞吐量和队列中的等待请求数,据此确定理想的数值。
    \n理想的默认执行线程数是由多方面的因素决定的,比如机器CPU性能、总体体系架构、I/O、操作系统的进程调度机制、JVM的线程调度机制。随着CPU个数的增加,WebLogic可以近乎线性地提高线程数。线程数越多,花费在线程切换的时间也就越多;线程数越小,CPU可能无法得到充分的利用。为获取一个理想的线程数,需要经过反复的测试。在测试中,可以以25*CPU个数为基准进行调整。当空闲线程较少,CPU利用率较低时,可以适当增加线程数的大小(每五个递增)。对于PC Server和Windows 2000,则最好每个CPU小于50个线程,以CPU利用率为90%左右为最佳。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置中修改线程计数。
    \n
    \nb) 设定执行队列的溢出条件;
    \n    Weblogic Server提供给默认的执行队列或用户自定义的执行队列自定义溢出条件的功能,当满足此溢出条件时,服务器改变其状态为“警告”状态,并且额外的再分配一些线程去处理在队列中的请求,而达到降低队列长度的目的。
    \n    通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置下面几项:
    \n●队列长度:此值表示执行队列中可容纳的最大请求数,默认值是65536,最后不要手动改变此值。
    \n●队列长度阈值百分比:此值表示溢出条件,在此服务器指出队列溢出之前可以达到的队列长度大小的百分比。
    \n●线程数增加:当检测到溢出条件时,将增加到执行队列中的线程数量。如果CPU和内存不是足够的高,尽量不要改变默认值“0”。因为Weblogic一旦增加后不会自动缩减,虽然最终可能确实起到了降低请求的作用,但在将来的运行中将影响程序的性能。
    \n●最大线程数:为了防止创建过多的线程数量,可以通过设定最大的线程数进行控制。
    \n在实际的应用场景中,应根据具体情况适当的调整以上参数。
    \n
    \nc) 设定执行队列监测行为
    \nWeblogic Server能够自动监测到当一个执行线程变为“阻塞”。变为“阻塞”状态的执行线程将无法完成当前的工作,也无法再执行新请求。如果执行队列中的所有执行线程都变为“阻塞”状态,Weblogic server可能改变状态为“警告”或“严重”状态。如果Weblogic server变为“严重”状态,可以通过Node Manager来自动关闭此服务器并重新启动它。具体请参考:Node Manager Capabilities文档。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置下面几项:
    \n●阻塞线程最长时间:在此服务器将线程诊断为阻塞线程之前,线程必须连续工作的时间长度(秒)。默认情况下,WebLogic Server 认为线程在连续工作 600 秒后成为阻塞线程。
    \n●阻塞线程计时器间隔:WebLogic Server 定期扫描线程以查看它们是否已经连续工作了 "阻塞线程最长时间" 字段中指定的时间长度的间隔时间(秒)。默认情况下,WebLogic Server 将此时间间隔设置为 600 秒。
    \n
    \n5) 调优TCP连接缓存数;
    \nWebLogic Server用Accept Backlog参数规定服务器向操作系统请求的队列大小,默认值为50。当系统重载负荷时,这个值可能过小,日志中报Connection Refused,导致有效连接请求遭到拒绝,此时可以提高Accept Backlog 25%直到连接拒绝错误消失。对于Portal类型的应用,默认值往往是不够的。
    \nLogin Timeout和SSL Login Timeout参数表示普通连接和SSL连接的超时时间,如果客户连接被服务器中断或者SSL容量大,可以尝试增加该值。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置“接受预备连接”。
    \n
    \n6) 改变Java编译器;
    \n标准的Java编译器是javac,但编译JSP servlets速度太慢,为了提高编译速度,可以使用sj或jikes编译器取代javac编译器。下面说说更改Java编译器:
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 常规下改变Java 编译器,默认为javac。输入完整路径,如:c:\\visualcafe31\\bin\\sj.exe。然后打开高级选项,在预规划到类路径填写编译 Java 代码时为 Java 编译器类路径预规划的选项,如:BEA_HOME\\jdk141_02\\jre\\lib\\rt.jar。
    \n
    \n7) 使用Webogic Server集群提高性能;
    \n具体关于如何配置Weblogic集群,我就不细说了。详情可参考:Introduction to WebLogic Server Clustering。
    \n
    \n8) Weblogic EJB调优
    \n由于EJB2.0已经很少项目在用了,EJB3.0再成熟一点,我再补充这一部分吧!
    \n
    \n9) JDBC应用调优
    \nJDBC Connection Pool的调优受制于WebLogic Server线程数的设置和数据库进程数,游标的大小。通常我们在一个线程中使用一个连接,所以连接数并不是越多越好,为避免两边的资源消耗,建议设置连接池的最大值等于或者略小于线程数。同时为了减少新建连接的开销,将最小值和最大值设为一致。
    \n增加Statement Cache Size对于大量使用PreparedStatement对象的应用程序很有帮助,WebLogic能够为每一个连接缓存这些对象,此值默认为10。在保证数据库游标大小足够的前提下,可以根据需要提高Statement Cache Size。比如当你设置连接数为25,Cache Size为10时,数据库可能需要打开25*10=250个游标。不幸的是,当遇到与PreparedStatement Cache有关的应用程序错误时,你需要将Cache Size设置为0。
    \n尽管JDBC Connection Pool提供了很多高级参数,在开发模式下比较有用,但大部分在生产环境下不需调整。这里建议最好不要设置测试表, 同时Test Reserved Connections和Test Released Connections也无需勾上。 当然如果你的数据库不稳定,时断时续,你就可能需要上述的参数打开。
    \n最后提一下驱动程序类型的选择,以Oracle为例,Oracle提供thin驱动和oci驱动,从性能上来讲,oci驱动强于thin驱动,特别是大数据量的操作。但在简单的数据库操作中,性能相差不大,随着thin驱动的不断改进,这一弱势将得到弥补。而thin驱动的移植性明显强于oci驱动。所以在通常情况下建议使用thin驱动。而最新驱动器由于WebLogic server/bin目录下的类包可能不是最新的,请以Oracle网站为准: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
    \n
    \n10) JSP调优
    \n设置jsp-param pageCheckSeconds=-1;
    \n设置serlet-reload-check=-1或ServletReloadCheckSecs=-1;
    \n设置jsp-param precompile=true,关闭JSP预编译选项。

    \n", "_id"=>646}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"*UNIX学习之系统调优篇", "body"=>"

    本文用来总结UNIX系统参数的理解和调优实践、理论等,不断补充,不断更新,

    ", "created_at"=>2007-09-18 06:28:05 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    本文用来总结UNIX系统参数的理解和调优实践、理论等,不断补充,不断更新,

    \n", "_id"=>647}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"gtalk表情符号,纯粹吹水~", "body"=>"

    发现自己发明的表情符号还挺有趣,Gt的桌面客户端是不支持表情的,于是大家都用只发明的表情符号,还挺好玩的。。。

    \n

    大比拼开始啦~~

    ", "created_at"=>2007-09-20 11:51:30 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    发现自己发明的表情符号还挺有趣,Gt的桌面客户端是不支持表情的,于是大家都用只发明的表情符号,还挺好玩的。。。
    \n大比拼开始啦~~

    \n", "_id"=>648}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转:To技能云:还请耐住寂寞 ——送给IceskYsl的“困惑”", "body"=>"

    一个在技能云注册的用户对技能云的关注,以及送我的困惑,其中很多部分正是前期考虑到的,也有尚未考虑成熟的,针对这个文章,我想到很多,也倍受鼓舞,也对“寂寞”做好了心理准备,但是我一定会坚持,突破,把技能云绽放在每个程序员的心目中。。
    \n
    \n得原作者“过河卒”的允许,特意把这篇文章娶回来,一来鼓励我自己,二来思考更多的东西,谢谢“过河卒”,希望你一路向前,永不退缩,早日绽放自己的那块“蘑菇云”。。

    \n
    \n
    -----以下是转来的文章--------------
    \n
      \n
    1. 在互联网里面让一个东西火起来,聚集更多的人气并不是一件想得到做不到的事情,只要去做了效果是立杆见影的。但是我觉得一个互联网上的东西吸引人的东西只有两种:内容和服务。有些网站靠内容,如javaeye,有些网站靠服务,如自称要转向服务的IBM。而技能云,我觉得是偏向内容的,当然一个好的网站内容和服务都是不可或缺的。  
    2. \n
    3.   
    4. \n
    5.         技能云的初衷是好的,但是最终能不能作出预期的模样,还看当事人是否奈得住寂寞。在我看来,技能云提倡的保持程序员的一种骨子里面的骄傲,勇敢的 show,勇敢的show出真实的自己。技能云中技能的来源的基础来自于从事过的项目,而项目本身的状态是公开的,面向所有人的,受到所有人监督的,这样会起到一定的约束力。进而想通过这种约束力,形成一种公正诚信的氛围,在这种氛围中提取有价值的信息作为网站的自养之道。诚然,社会舆论和监督是一种巨大的力量。但是这对于技能云是个双刃剑,正面维护了网站内容的公正和诚信,负面隔绝了那些还需要通过通过一纸简历来养家糊口,给孩子卖奶粉的从业者。基于这点技能云不可能有太大的规模,毕竟程序员数量有限,能坦诚的交代自己的程序员就更有限了。记得几天前上技能云发现上面注册的用户的大多是些大牛,还有很大一部分是些只留下了ID,其他什么也没有留下的人。我觉得这些人也是值得我们尊敬,他们或基于现实的考虑,或受困于自身的经历,没有能在技能云上面留下什么,但是一个简单的ID表明了作为一个程序员的骄傲。  
    6. \n
    7.   
    8. \n
    9.             维护技能云信息的公正诚信很大一方面靠的的技能云本身提供的监督机制,而另外程序员本身的诚信。这种诚信最为可贵。古语云:诚信是金,而且在当前这种现实环境中这句话太惨白。据闻某彩票点把500W归还某代买彩票的人,一般听众的反应是:彩票点的人傻了。这就是现实。但是我想说的是技能云做的不错,在那个小的环境里面,我个人愿意相信所有的信息都是真实的。这可能就是技能云想要的氛围。而我个人的感觉也就是这种氛围影响了我。留下一个ID后就悄悄的离开的,回到自己的地方小声的吼了一下。话说,打江山不易,守江山更难。形成一种氛围固然不容易,但是要巩固它,加深它的影响自然是难上加难。虽然上面说的都很难,但是容易的事情也很容易,就是吹散这种氛围。  
    10. \n
    11.   
    12. \n
    13.             如何维护这种氛围,我本无发言权。但是我觉得javaeye做的很不错。一件小事情可以看出来,前不久javaeye更改了论坛的积分规则,把只要回帖就有的两分给取消了。自然,这样少了论坛的人气,但是同时也少了论坛里面的无意义内容。这符合javaeye的口号:做最棒的软件开发交流社区。正是这样的手段,隔离了那些看似的热闹,才有了javaeye上面的激烈的讨论和质量颇高的原创文章。这方面的问题,你自可以和robbin交流去,看上去他是个相当热心的人。  
    14. \n
    15.   
    16. \n
    17.     (BWT:我以前也在javaeye上面写Blog,可是感觉力不从心,任何一个问题似乎都没有人看的明白和透彻,看着一山又比一山高,压力实在太大,所以我就到这里来了。这里自由,写写自己看的,听的,想的,挺好。当然,我还是时不时的回去看看,毕竟那很吸引人。)  
    18. \n
    19.   
    20. \n
    21.         看看现在的javaeye,每天是3WIP,15W左右的PV。而技能云要做到这个现在似乎很难,但是javaeye可能很难复制了,不可能再有一个 rubyeye,perleye了。但是技能云还有这个潜力,不仅仅是程序员会对自己的工作产生自豪感,任何一个行业对有一群人狂热的爱着自己的工作。古语云:360行,行行出状元。只要技能云能够把握好自己,耐住了寂寞,维护建站的初衷和理想。可以想见:总有一天技能云会看起来像核弹引爆后的蘑菇云的。  
    22. \n
    23.   
    24. \n
    25.         副标题里面说这是“困惑”,这只是应景的一个说法。或许在IceskYsl心里面另有高谋。说的不好,还请IceskYsl自酌。  
    26. \n
    \n
    \n

     

    ", "created_at"=>2007-09-21 04:16:32 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    一个在技能云注册的用户对技能云的关注,以及送我的困惑,其中很多部分正是前期考虑到的,也有尚未考虑成熟的,针对这个文章,我想到很多,也倍受鼓舞,也对“寂寞”做好了心理准备,但是我一定会坚持,突破,把技能云绽放在每个程序员的心目中。。
    \n
    \n得原作者“过河卒”的允许,特意把这篇文章娶回来,一来鼓励我自己,二来思考更多的东西,谢谢“过河卒”,希望你一路向前,永不退缩,早日绽放自己的那块“蘑菇云”。。
    \n
    \n-----以下是转来的文章--------------
    \n
    \n 在互联网里面让一个东西火起来,聚集更多的人气并不是一件想得到做不到的事情,只要去做了效果是立杆见影的。但是我觉得一个互联网上的东西吸引人的东西只有两种:内容和服务。有些网站靠内容,如javaeye,有些网站靠服务,如自称要转向服务的IBM。而技能云,我觉得是偏向内容的,当然一个好的网站内容和服务都是不可或缺的。  
    \n   
    \n         技能云的初衷是好的,但是最终能不能作出预期的模样,还看当事人是否奈得住寂寞。在我看来,技能云提倡的保持程序员的一种骨子里面的骄傲,勇敢的 show,勇敢的show出真实的自己。技能云中技能的来源的基础来自于从事过的项目,而项目本身的状态是公开的,面向所有人的,受到所有人监督的,这样会起到一定的约束力。进而想通过这种约束力,形成一种公正诚信的氛围,在这种氛围中提取有价值的信息作为网站的自养之道。诚然,社会舆论和监督是一种巨大的力量。但是这对于技能云是个双刃剑,正面维护了网站内容的公正和诚信,负面隔绝了那些还需要通过通过一纸简历来养家糊口,给孩子卖奶粉的从业者。基于这点技能云不可能有太大的规模,毕竟程序员数量有限,能坦诚的交代自己的程序员就更有限了。记得几天前上技能云发现上面注册的用户的大多是些大牛,还有很大一部分是些只留下了ID,其他什么也没有留下的人。我觉得这些人也是值得我们尊敬,他们或基于现实的考虑,或受困于自身的经历,没有能在技能云上面留下什么,但是一个简单的ID表明了作为一个程序员的骄傲。  
    \n   
    \n             维护技能云信息的公正诚信很大一方面靠的的技能云本身提供的监督机制,而另外程序员本身的诚信。这种诚信最为可贵。古语云:诚信是金,而且在当前这种现实环境中这句话太惨白。据闻某彩票点把500W归还某代买彩票的人,一般听众的反应是:彩票点的人傻了。这就是现实。但是我想说的是技能云做的不错,在那个小的环境里面,我个人愿意相信所有的信息都是真实的。这可能就是技能云想要的氛围。而我个人的感觉也就是这种氛围影响了我。留下一个ID后就悄悄的离开的,回到自己的地方小声的吼了一下。话说,打江山不易,守江山更难。形成一种氛围固然不容易,但是要巩固它,加深它的影响自然是难上加难。虽然上面说的都很难,但是容易的事情也很容易,就是吹散这种氛围。  
    \n   
    \n             如何维护这种氛围,我本无发言权。但是我觉得javaeye做的很不错。一件小事情可以看出来,前不久javaeye更改了论坛的积分规则,把只要回帖就有的两分给取消了。自然,这样少了论坛的人气,但是同时也少了论坛里面的无意义内容。这符合javaeye的口号:做最棒的软件开发交流社区。正是这样的手段,隔离了那些看似的热闹,才有了javaeye上面的激烈的讨论和质量颇高的原创文章。这方面的问题,你自可以和robbin交流去,看上去他是个相当热心的人。  
    \n   
    \n     (BWT:我以前也在javaeye上面写Blog,可是感觉力不从心,任何一个问题似乎都没有人看的明白和透彻,看着一山又比一山高,压力实在太大,所以我就到这里来了。这里自由,写写自己看的,听的,想的,挺好。当然,我还是时不时的回去看看,毕竟那很吸引人。)  
    \n   
    \n         看看现在的javaeye,每天是3WIP,15W左右的PV。而技能云要做到这个现在似乎很难,但是javaeye可能很难复制了,不可能再有一个 rubyeye,perleye了。但是技能云还有这个潜力,不仅仅是程序员会对自己的工作产生自豪感,任何一个行业对有一群人狂热的爱着自己的工作。古语云:360行,行行出状元。只要技能云能够把握好自己,耐住了寂寞,维护建站的初衷和理想。可以想见:总有一天技能云会看起来像核弹引爆后的蘑菇云的。  
    \n   
    \n         副标题里面说这是“困惑”,这只是应景的一个说法。或许在IceskYsl心里面另有高谋。说的不好,还请IceskYsl自酌。  
    \n
    \n
    \n 

    \n", "_id"=>649}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"

    透明同学说需要给技能云一个”自动登录“的功能,于是下午睡觉起来google了些资料,也大概问了下几个朋友,思路就有了,思路很多种,这里采取的是这篇文章介绍的方式。

    \n

    基本步骤如下:

    \n

    1、首先创建一个用来保存用户信息的表modle(PersistentLogin),代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class CreatePersistentLogins < ActiveRecord::Migration  
    2. \n
    3.   def self.up  
    4. \n
    5.     
    6. \n
    7.     create_table :persistent_logins do |t|  
    8. \n
    9.       t.column :uid:string:null => false  
    10. \n
    11.       t.column :user_id:integer:null => false  
    12. \n
    13.       t.column :created_on:datetime:null => false  
    14. \n
    15.     end  
    16. \n
    17.           
    18. \n
    19.     add_index :persistent_logins:uid:name => "uid"  
    20. \n
    21.     add_index :persistent_logins:created_on:name => "created_on"      
    22. \n
    23.       
    24. \n
    25.   end  
    26. \n
    27.   
    28. \n
    29.   def self.down  
    30. \n
    31.     drop_table :persistent_logins  
    32. \n
    33.   end  
    34. \n
    35. end  
    36. \n
    \n
    \n

    2、然后写这个modle,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class PersistentLogin < ActiveRecord::Base  
    2. \n
    3.     
    4. \n
    5.   belongs_to :user  
    6. \n
    7.   before_create :assign_uid  
    8. \n
    9.     
    10. \n
    11.   private  
    12. \n
    13.     
    14. \n
    15.   def assign_uid  
    16. \n
    17.     self.uid = UUID.random_create.to_s  
    18. \n
    19.   end  
    20. \n
    21. end  
    22. \n
    \n
    \n

    3、紧接着在登录的页面加一个chechk_box用来供用户选择是否保存自己的信息以实现自动登录,代码如下:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <%=check_box_tag("persist", value = "1"checked = trueoptions = {})%>    记住我吧.  
    2. \n
    \n
    \n

    4、接着在你原来的验证登录的地方,添加如下代码:

    \n
    \n
    Ruby代码
    \n
      \n
    1. # inside your 'login' code after you have validated the credentials  
    2. \n
    3. if params[:persist]  
    4. \n
    5.   p = PersistentLogin.create(:user=>u)  
    6. \n
    7.   cookies[:p_session_id] = {:value => p.uid, :expires => Time.now + 7.days}  
    8. \n
    9. end  
    10. \n
    \n
    \n

    5、写一个前置过滤器,判断用户是否存在cookie,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def get_current_user  
    2. \n
    3.   if session[:user].nil?  
    4. \n
    5.     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    6. \n
    7.       session[:user] = c_user.id  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end  
    14. \n
    \n
    \n

    6、最后用户点了退出登录以后,删除cookie和表中记录,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def logout  
    2. \n
    3.   session[:user] = nil  
    4. \n
    5.     
    6. \n
    7.   if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    8. \n
    9.     p.destroy  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   cookies.delete :p_session_id   
    16. \n
    17. end  
    18. \n
    \n
    \n

    备注:需要安装一个UUID用来产生随机数,自然你也可以自己写,对时间MD5一下肯定重复不了,呵呵。

    \n

    代码偶给的已经相当详细了,就不具体解释了。

    \n

    另外还可以参考:

    \n

    http://lightyror.thegiive.net/2007/04/persistent-login-on-rails.html

    \n

    http://livsey.org/2006/6/30/persistent-logins-in-rails

    ", "created_at"=>2007-09-21 07:15:38 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    透明同学说需要给技能云一个”自动登录“的功能,于是下午睡觉起来google了些资料,也大概问了下几个朋友,思路就有了,思路很多种,这里采取的是这篇文章介绍的方式。
    \n基本步骤如下:
    \n1、首先创建一个用来保存用户信息的表modle(PersistentLogin),代码如下:
    \n
    \nRuby代码
    \n
    \n class CreatePersistentLogins < ActiveRecord::Migration  
    \n   def self.up  
    \n     
    \n     create_table :persistent_logins do |t|  
    \n       t.column :uid, :string, :null => false  
    \n       t.column :user_id, :integer, :null => false  
    \n       t.column :created_on, :datetime, :null => false  
    \n     end  
    \n           
    \n     add_index :persistent_logins, :uid, :name => "uid"  
    \n     add_index :persistent_logins, :created_on, :name => "created_on"      
    \n       
    \n   end  
    \n   
    \n   def self.down  
    \n     drop_table :persistent_logins  
    \n   end  
    \n end  
    \n
    \n
    \n2、然后写这个modle,代码如下:
    \n
    \nRuby代码
    \n
    \n class PersistentLogin < ActiveRecord::Base  
    \n     
    \n   belongs_to :user  
    \n   before_create :assign_uid  
    \n     
    \n   private  
    \n     
    \n   def assign_uid  
    \n     self.uid = UUID.random_create.to_s  
    \n   end  
    \n end  
    \n
    \n
    \n3、紧接着在登录的页面加一个chechk_box用来供用户选择是否保存自己的信息以实现自动登录,代码如下:
    \n
    \nXML/HTML代码
    \n
    \n <%=check_box_tag("persist", value = "1", checked = true, options = {})%>    记住我吧.  
    \n
    \n
    \n4、接着在你原来的验证登录的地方,添加如下代码:
    \n
    \nRuby代码
    \n
    \n # inside your 'login' code after you have validated the credentials  
    \n if params[:persist]  
    \n   p = PersistentLogin.create(:user=>u)  
    \n   cookies[:p_session_id] = {:value => p.uid, :expires => Time.now + 7.days}  
    \n end  
    \n
    \n
    \n5、写一个前置过滤器,判断用户是否存在cookie,如下:
    \n
    \nRuby代码
    \n
    \n def get_current_user  
    \n   if session[:user].nil?  
    \n     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    \n       session[:user] = c_user.id  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n6、最后用户点了退出登录以后,删除cookie和表中记录,代码如下:
    \n
    \nRuby代码
    \n
    \n def logout  
    \n   session[:user] = nil  
    \n     
    \n   if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    \n     p.destroy  
    \n   end  
    \n   
    \n   cookies.delete :p_session_id   
    \n end  
    \n
    \n
    \n备注:需要安装一个UUID用来产生随机数,自然你也可以自己写,对时间MD5一下肯定重复不了,呵呵。
    \n代码偶给的已经相当详细了,就不具体解释了。
    \n另外还可以参考:
    \nhttp://lightyror.thegiive.net/2007/04/persistent-login-on-rails.html
    \nhttp://livsey.org/2006/6/30/persistent-logins-in-rails

    \n", "_id"=>650}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"

    做WEB开发的都知道log的重要性,开发过java的肯定知道log4j等日志记录工具,使用起来非常方便的;RoR下发开发自然也少不了日志的应用,刚刚开始的那会把日志都写到一个文件里,很恐怖的说,后来查了些资料,可以看到ROR默认的log是可以分级别的,记录如下:
    \n
    \n日志级别(Log Level)
    \nRails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever有:debug, :info, :warn,:error, :fatal.
    \n:debug level提供最详细的log, 可以将每一条sql都记录下来。
    \n:info  level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录下每封信的内容,Log文件内容就是快速增长。
    \n为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn level等log level, 只记录重要的信息.
    \n
    \n设置方法:
    \n在/config/environment.rb文件中可以设置以下选项
    \nconfig.log_level = :debug
    \n如果只希望在production环境下,输入少量的log,
    \n则只需要在config/environments/production.rb中增加一项(我就是这样设置的)
    \nconfig.log_level = :warn

    ", "created_at"=>2007-09-23 06:19:40 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    做WEB开发的都知道log的重要性,开发过java的肯定知道log4j等日志记录工具,使用起来非常方便的;RoR下发开发自然也少不了日志的应用,刚刚开始的那会把日志都写到一个文件里,很恐怖的说,后来查了些资料,可以看到ROR默认的log是可以分级别的,记录如下:
    \n
    \n日志级别(Log Level)
    \nRails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever有:debug, :info, :warn,:error, :fatal.
    \n:debug level提供最详细的log, 可以将每一条sql都记录下来。
    \n:info  level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录下每封信的内容,Log文件内容就是快速增长。
    \n为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn level等log level, 只记录重要的信息.
    \n
    \n设置方法:
    \n在/config/environment.rb文件中可以设置以下选项
    \nconfig.log_level = :debug
    \n如果只希望在production环境下,输入少量的log,
    \n则只需要在config/environments/production.rb中增加一项(我就是这样设置的)
    \nconfig.log_level = :warn

    \n", "_id"=>651}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails Security Guide", "body"=>"

     

    \n

    好久没去ROR官方站点了,今天google到他上面的一个wiki,看完后随手到其blog里面看看,看到一篇好文章,是介绍Rails中安全控制的,于是跟着那个链接过去,看了一部分,没时间看完,特转回来记录着有时间再看~

    \n

    Ruby on Rails does a decent job in handling security concerns in the background. You will have to configure your application to avoid few security attacks while plugins would be required for many security concerns which are not at all or poorly managed by rails.

    \n

    In this article I have described the security issues related to a ruby on rails web application. I have followed DRY by linking to articles with good explanation and solutions to security concerns wherever required. This guide can also be used as a quick security check for your current web application.

    \n

    原文地址:http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide

    \n

    ", "created_at"=>2007-09-24 08:06:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

     
    \n好久没去ROR官方站点了,今天google到他上面的一个wiki,看完后随手到其blog里面看看,看到一篇好文章,是介绍Rails中安全控制的,于是跟着那个链接过去,看了一部分,没时间看完,特转回来记录着有时间再看~
    \nRuby on Rails does a decent job in handling security concerns in the background. You will have to configure your application to avoid few security attacks while plugins would be required for many security concerns which are not at all or poorly managed by rails.
    \nIn this article I have described the security issues related to a ruby on rails web application. I have followed DRY by linking to articles with good explanation and solutions to security concerns wherever required. This guide can also be used as a quick security check for your current web application.
    \n原文地址:http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide

    \n", "_id"=>652}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中两种\"多对多\"关系的建立的方法 !", "body"=>"

    以前的时候只知道在Rails中建立多对多的关系可以把两个表的复数做表名,并去掉其主键ID,后来使用的过程中遇到不少问题,虽然当时也可以 hack过去了,但是心理一直觉得不爽,上次看《敏捷开发第二版》的时候,看到还有另外一个方法,刚好刚才在railscasts上也看到了,现在归纳记 录如下:

    \n

     

    \n
    \n
    第一种方法: has_and_belongs_to_many
    \n
      \n
    1. # in migration  
    2. \n
    3. def self.up  
    4. \n
    5.   create_table 'categories_products':id => false do |t|  
    6. \n
    7.     t.column :category_id:integer  
    8. \n
    9.     t.column :product_id:integer  
    10. \n
    11.   end  
    12. \n
    13. end  
    14. \n
    15.   
    16. \n
    17. # models/product.rb  
    18. \n
    19. has_and_belongs_to_many :categories  
    20. \n
    21.   
    22. \n
    23. # models/category.rb  
    24. \n
    25. has_and_belongs_to_many :products  
    26. \n
    \n
    \n
    \n
    第二种方法:has_many :through
    \n
      \n
    1. # models/categorization.rb  
    2. \n
    3. belongs_to :product  
    4. \n
    5. belongs_to :category  
    6. \n
    7.   
    8. \n
    9. # models/product.rb  
    10. \n
    11. has_many :categorizations  
    12. \n
    13. has_many :categories:through => :categorizations  
    14. \n
    15.   
    16. \n
    17. # models/category.rb  
    18. \n
    19. has_many :categorizations  
    20. \n
    21. has_many :products:through => :categorizations  
    22. \n
    \n
    \n

    很显然,使用第二种会更加明了和便捷,且那个联系表可以随意命名,更加优雅!

    \n

     

    ", "created_at"=>2007-09-24 08:27:13 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    以前的时候只知道在Rails中建立多对多的关系可以把两个表的复数做表名,并去掉其主键ID,后来使用的过程中遇到不少问题,虽然当时也可以 hack过去了,但是心理一直觉得不爽,上次看《敏捷开发第二版》的时候,看到还有另外一个方法,刚好刚才在railscasts上也看到了,现在归纳记 录如下:
    \n 
    \n
    \n第一种方法: has_and_belongs_to_many
    \n
    \n # in migration  
    \n def self.up  
    \n   create_table 'categories_products', :id => false do |t|  
    \n     t.column :category_id, :integer  
    \n     t.column :product_id, :integer  
    \n   end  
    \n end  
    \n   
    \n # models/product.rb  
    \n has_and_belongs_to_many :categories  
    \n   
    \n # models/category.rb  
    \n has_and_belongs_to_many :products  
    \n
    \n
    \n
    \n第二种方法:has_many :through
    \n
    \n # models/categorization.rb  
    \n belongs_to :product  
    \n belongs_to :category  
    \n   
    \n # models/product.rb  
    \n has_many :categorizations  
    \n has_many :categories, :through => :categorizations  
    \n   
    \n # models/category.rb  
    \n has_many :categorizations  
    \n has_many :products, :through => :categorizations  
    \n
    \n
    \n很显然,使用第二种会更加明了和便捷,且那个联系表可以随意命名,更加优雅!
    \n 

    \n", "_id"=>653}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails项目管理之SubVersion(SVN)", "body"=>"

    多人协作的时候版本控制是很重要的,我以前公司使用的VSS或者CC&CQ,这些都是比较重量级的,做大项目的控制比较合适,但是做一些 rails的比较小的项目的时候就没有这个必要,也没有这个必要;

    \n

    相反,SVN和CVS可能更适合一点,因为CVS比较老,现在SVN比较主流,使用起来 也很方便,于是做Rails项目自然选择SVN,以前使用不多,虽然也会用,但是做了不少无用功,今天看到一篇介绍的文章,改吧改吧记录下。

    \n

    \n

    \n
    第一步,创建Rails应用并做基础设置
    \n
      \n
    1. mkdir project //创建工程目录,在此目录下设置基础的导入数据  
    2. \n
    3. cd project    //进入project目录  
    4. \n
    5. rails test    //生成rails应用,名字为test  
    6. \n
    7. cd test       //进入rails应用目录  
    8. \n
    9. mv config/database.yml config/database_example.yml //修改数据库配置文件的名字,因为这个配置文件可能每个开发人员的都不一样  
    10. \n
    11. rm -r log/*   //删除log目录下的所有文件,这个目录下的文件不需要加入到版本控制  
    12. \n
    13. rm -r tmp/*   //同上,临时目录也不要加入版本控制  
    14. \n
    15. cd ..         //回到project目录  
    16. \n
    17. mv test trunk //修改rails应用test目录的名字为trunk,这是svn的惯例,相当与CVS的HEAD,是开发主目录  
    18. \n
    19. mkdir tags    //惯例,保存tag  
    20. \n
    21. mkdir branches//惯例,保存分支第二步,生成将项目文件导入SVN   
    22. \n
    \n
    \n没个项目的SVN库所使用的协议可能个不相同,这里假设你已经创建好了SVN库并可以使用了 。

    \n

    \n

    \n
    第二步:导入
    \n
      \n
    1. cd project 在project目录下执行  
    2. \n
    3. svn import . http://your_domain/svn/test -m "初始化导入" --username your_name  
    4. \n
    \n
    \n如果没有错误,项目就导入成功了,现在我们到自己的rails项目工作目录checkout刚刚创建的项目
    \n

    \n

    \n

    \n
    第三步:签出
    \n
      \n
    1. cd /rails //进入你的rails工作目录  
    2. \n
    3. svn co http://your_domain/svn/test/trunk test //checkout代码到test  
    4. \n
    5. cd test  
    6. \n
    7. cp config/database_example.yml config/database.yml //创建自己的数据库配置文件  
    8. \n
    9. svn propset svn:ignore database.yml config/        //忽略database.yml文件,也就是不将此文件纳入版本控制  
    10. \n
    11. svn propset svn:ignore "*" log/                    //忽略log下的所有文件  
    12. \n
    13. svn propset svn:ignore "*" tmp/                    //忽略tmp目录下的所有文件  
    14. \n
    15. svn commit -m "忽略文件"                           //提交配置好了,到现在基本的项目初始化 
      \n
    16. \n
    \n
    \n工作即可告一段落了,以后的工作基本就是更新,编码,提交了,属于svn基本使用问题,我们就不详述了。
    \n

    \n

    参考其他类似文章:

    \n

    http://www.javaeye.com/article/107799

    \n

    http://railscasts.com/episodes/36
    \n

    ", "created_at"=>2007-09-24 09:09:39 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    多人协作的时候版本控制是很重要的,我以前公司使用的VSS或者CC&CQ,这些都是比较重量级的,做大项目的控制比较合适,但是做一些 rails的比较小的项目的时候就没有这个必要,也没有这个必要;
    \n相反,SVN和CVS可能更适合一点,因为CVS比较老,现在SVN比较主流,使用起来 也很方便,于是做Rails项目自然选择SVN,以前使用不多,虽然也会用,但是做了不少无用功,今天看到一篇介绍的文章,改吧改吧记录下。
    \n
    \n
    \n第一步,创建Rails应用并做基础设置
    \n
    \n mkdir project //创建工程目录,在此目录下设置基础的导入数据  
    \n cd project    //进入project目录  
    \n rails test    //生成rails应用,名字为test  
    \n cd test       //进入rails应用目录  
    \n mv config/database.yml config/database_example.yml //修改数据库配置文件的名字,因为这个配置文件可能每个开发人员的都不一样  
    \n rm -r log/   //删除log目录下的所有文件,这个目录下的文件不需要加入到版本控制  
    \n rm -r tmp/
       //同上,临时目录也不要加入版本控制  
    \n cd ..         //回到project目录  
    \n mv test trunk //修改rails应用test目录的名字为trunk,这是svn的惯例,相当与CVS的HEAD,是开发主目录  
    \n mkdir tags    //惯例,保存tag  
    \n mkdir branches//惯例,保存分支第二步,生成将项目文件导入SVN   
    \n
    \n
    \n没个项目的SVN库所使用的协议可能个不相同,这里假设你已经创建好了SVN库并可以使用了 。
    \n
    \n
    \n第二步:导入
    \n
    \n cd project 在project目录下执行  
    \n svn import . http://your_domain/svn/test -m "初始化导入" --username your_name  
    \n
    \n
    \n如果没有错误,项目就导入成功了,现在我们到自己的rails项目工作目录checkout刚刚创建的项目
    \n
    \n
    \n
    \n第三步:签出
    \n
    \n cd /rails //进入你的rails工作目录  
    \n svn co http://your_domain/svn/test/trunk test //checkout代码到test  
    \n cd test  
    \n cp config/database_example.yml config/database.yml //创建自己的数据库配置文件  
    \n svn propset svn:ignore database.yml config/        //忽略database.yml文件,也就是不将此文件纳入版本控制  
    \n svn propset svn:ignore "" log/                    //忽略log下的所有文件  
    \n svn propset svn:ignore "
    " tmp/                    //忽略tmp目录下的所有文件  
    \n svn commit -m "忽略文件"                           //提交配置好了,到现在基本的项目初始化 
    \n
    \n
    \n
    \n工作即可告一段落了,以后的工作基本就是更新,编码,提交了,属于svn基本使用问题,我们就不详述了。
    \n
    \n参考其他类似文章:
    \nhttp://www.javaeye.com/article/107799
    \nhttp://railscasts.com/episodes/36

    \n", "_id"=>654}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"让你的Rails远离SQL Injection", "body"=>"

    做为一名安全爱好者,我自然知道现在在动态语言写的web系统中可能存在的安全隐患的,例如大名鼎鼎的SQL Injection,CSS/XSS,文件包含,暴路径,泄露源代码等等,其中目前最杀手级的应该是SQL注射了,在PHP和ASP的世界了,辅助 union查询可以恩容易的暴出敏感数据,例如管理员用户名、密码等,就算你的密码MD5加密了,也有诸如XMD5这样的站点在线查询破解,如果存在漏 洞,自然非常危险。

    \n

    Rails出生于真实的WEB应用,自然考虑到这些问题,例如如下代码即可杜绝Rails的SQL Injection:

    \n

    \n

    \n
    示范代码
    \n
      \n
    1. # tasks_controller.rb  
    2. \n
    3. def index  
    4. \n
    5.   @tasks = Task.find(:all:conditions => ["name LIKE ?""%\#{params[:query]}%"])  
    6. \n
    7. end  
    8. \n
    \n
    \n如上代码在PHP或者ASP中的处理逻辑是先取得params[:query],再对这个进行检查、过滤,才能放进去查询的,在Rails中,只要使用? 替代符,然后就可以实现这个效果。如果你写成下面这个样子,肯定是危险的:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # tasks_controller.rb        
    2. \n
    3. def index        
    4. \n
    5.    @tasks = Task.find(:all:conditions => ["name LIKE \#{params[:query]}"])        
    6. \n
    7. end     
    8. \n
    \n
    \n以一个业余hacker的口气告诫您,一定要注意!
    \n

    ", "created_at"=>2007-09-24 09:26:08 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    做为一名安全爱好者,我自然知道现在在动态语言写的web系统中可能存在的安全隐患的,例如大名鼎鼎的SQL Injection,CSS/XSS,文件包含,暴路径,泄露源代码等等,其中目前最杀手级的应该是SQL注射了,在PHP和ASP的世界了,辅助 union查询可以恩容易的暴出敏感数据,例如管理员用户名、密码等,就算你的密码MD5加密了,也有诸如XMD5这样的站点在线查询破解,如果存在漏 洞,自然非常危险。
    \nRails出生于真实的WEB应用,自然考虑到这些问题,例如如下代码即可杜绝Rails的SQL Injection:
    \n
    \n
    \n示范代码
    \n
    \n # tasks_controller.rb  
    \n def index  
    \n   @tasks = Task.find(:all, :conditions => ["name LIKE ?", "%\#{params[:query]}%"])  
    \n end  
    \n
    \n
    \n如上代码在PHP或者ASP中的处理逻辑是先取得params[:query],再对这个进行检查、过滤,才能放进去查询的,在Rails中,只要使用? 替代符,然后就可以实现这个效果。如果你写成下面这个样子,肯定是危险的:
    \n
    \n
    \nRuby代码
    \n
    \n # tasks_controller.rb        
    \n def index        
    \n    @tasks = Task.find(:all, :conditions => ["name LIKE \#{params[:query]}"])        
    \n end     
    \n
    \n
    \n以一个业余hacker的口气告诫您,一定要注意!

    \n", "_id"=>655}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随意指定Layouts~", "body"=>"

    很多时候,我们会使用global layouts, controller layouts, shared layouts, dynamic layouts and action layouts.另外,我们还可以用如下方法的layouts,看例子:

    \n

    \n

    \n
    layouts示例代码
    \n
      \n
    1. # projects_controller.rb  
    2. \n
    3. layout :user_layout  
    4. \n
    5.   
    6. \n
    7. def index  
    8. \n
    9.   @projects = Project.find(:all)  
    10. \n
    11.   render :layout => 'projects'  
    12. \n
    13. end  
    14. \n
    15.   
    16. \n
    17. protected  
    18. \n
    19.   
    20. \n
    21. def user_layout  
    22. \n
    23.   if current_user.admin?  
    24. \n
    25.     "admin"  
    26. \n
    27.   else  
    28. \n
    29.     "application"  
    30. \n
    31.   end  
    32. \n
    33. end 
      \n
    34. \n
    \n
    \n

    ", "created_at"=>2007-09-25 02:18:33 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很多时候,我们会使用global layouts, controller layouts, shared layouts, dynamic layouts and action layouts.另外,我们还可以用如下方法的layouts,看例子:
    \n
    \n
    \nlayouts示例代码
    \n
    \n # projects_controller.rb  
    \n layout :user_layout  
    \n   
    \n def index  
    \n   @projects = Project.find(:all)  
    \n   render :layout => 'projects'  
    \n end  
    \n   
    \n protected  
    \n   
    \n def user_layout  
    \n   if current_user.admin?  
    \n     "admin"  
    \n   else  
    \n     "application"  
    \n   end  
    \n end 
    \n
    \n
    \n

    \n", "_id"=>656}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"content_for:动态改变您的Layouts", "body"=>"

    content_for这个方法竟然一直没看到过,今天也是无意中看到的,看到对此介绍为:
    \nIf you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.
    \n也就是说,如果你想动态的改变你原来layout中的东西,你可以使用content_for这个方法,结合代码就很好理解了,如下:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. <!-- projects/index.rhtml -->  
    2. \n
    3. <% content_for :head do %>  
    4. \n
    5.   <%= stylesheet_link_tag 'projects' %>  
    6. \n
    7. <% end %>  
    8. \n
    9.   
    10. \n
    11. <!-- layouts/application.rhtml -->  
    12. \n
    13. <head>  
    14. \n
    15.   <title>Todo List</title>  
    16. \n
    17.   <%= stylesheet_link_tag 'application' %>  
    18. \n
    19.   <%= yield :head %>  
    20. \n
    21. </head>  
    22. \n
    \n
    \n先用content_for申明一个变量,接着可以在你需要的地方使用<%= yield :name %> 来调用,参考如上代码应该不难理解。

    \n

    另外,对于其详细用法,

    \n

    请参考API:http://api.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html
    \n

    ", "created_at"=>2007-09-25 03:19:53 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    content_for这个方法竟然一直没看到过,今天也是无意中看到的,看到对此介绍为:
    \nIf you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.
    \n也就是说,如果你想动态的改变你原来layout中的东西,你可以使用content_for这个方法,结合代码就很好理解了,如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n <!-- projects/index.rhtml -->  
    \n <% content_for :head do %>  
    \n   <%= stylesheet_link_tag 'projects' %>  
    \n <% end %>  
    \n   
    \n <!-- layouts/application.rhtml -->  
    \n <head>  
    \n   <title>Todo List</title>  
    \n   <%= stylesheet_link_tag 'application' %>  
    \n   <%= yield :head %>  
    \n </head>  
    \n
    \n
    \n先用content_for申明一个变量,接着可以在你需要的地方使用<%= yield :name %> 来调用,参考如上代码应该不难理解。
    \n另外,对于其详细用法,
    \n请参考API:http://api.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html

    \n", "_id"=>657}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏你log中的敏感信息~", "body"=>"

    写过rails的肯定看过它的日志文件,在登录的时候,你肯定看过类型下面的内容:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. Processing UsersController#create (for 127.0.0.1 at 2007-02-23 19:11:20) [POST]    
    2. \n
    3. Session ID: 4047778b64af62d387f7e860e51cce20    
    4. \n
    5. <span style="color:red;">Parameters</span>: {"user" => {"name" => "name", "password_confirmation" => "123456", "password" => "123456"}, "commit" =>     
    6. \n
    7. "Register", "action" => "create", "controller" => "users"}    
    8. \n
    9. SQL (0.000108) BEGIN    
    10. \n
    11. <span style="color:red;">SQL</span> (0.000238) INSERT INTO users ('name', 'password') VALUES('name', '123456')    
    12. \n
    13. SQL (0.000395) COMMIT    
    14. \n
    15. Redirected to http://localhost:3000/users/5    
    16. \n
    17. ...   
      \n
    18. \n
    \n
    \n

    做为一个安全爱好者,我可以负责任的告诉你,这些东西非常危险,恶意的人总是能想办法(这个办法很多,比如旁注等)拿到你的日志文件,而这个日志文件比起加密的数据库文件还要危险,于是肯定是需要做一些工作的。

    \n

    ActionController#filter_parameter_logging 就是我们需要的东西,它可以用来过滤那些你不想保存在日志中的数据,它可以阻止一些敏感数据赤裸裸的暴露在日志文件中,比如密码,或者信用卡帐号。也可以防止一些大块的数据占用日志文件,等等。
    \n如果你的应用用到passwords,复制下面这行到你的ApplicaitonController  Class:

    \n
    \n
    Ruby代码
    \n
      \n
    1. filter_parameter_logging "password" 
      \n
    2. \n
    \n
    \n

    这样就可以阻止任何匹配/password/i模式的数据被写入日志,诸如:[user][password] 或 [user][password_confirmation]
    \n
    \n另外,如果想在开发环境下显示POST logging,但是在产品环境下完全不显示,如何做呢?

    \n
    \n
    Ruby代码
    \n
      \n
    1. filter_parameter_logging("password"if RAILS_ENV == "production" 
      \n
    2. \n
    \n
    \n

    如果想完全禁止POST logging,则可以在production.rb中修改:config.log_level = :warn
    \n
    \n其他类似文章,请参考:

    \n

    http://blackanger.blog.51cto.com/140924/35735
    \nhttp://hideto.javaeye.com/blog/106956
    \nhttp://api.rubyonrails.com/classes/ActionController/Base.html#M000260

    ", "created_at"=>2007-09-25 05:20:22 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    写过rails的肯定看过它的日志文件,在登录的时候,你肯定看过类型下面的内容:
    \n
    \nXML/HTML代码
    \n
    \n Processing UsersController#create (for 127.0.0.1 at 2007-02-23 19:11:20) [POST]    
    \n Session ID: 4047778b64af62d387f7e860e51cce20    
    \n <span style="color:red;">Parameters</span>: {"user" => {"name" => "name", "password_confirmation" => "123456", "password" => "123456"}, "commit" =>     
    \n "Register", "action" => "create", "controller" => "users"}    
    \n SQL (0.000108) BEGIN    
    \n <span style="color:red;">SQL</span> (0.000238) INSERT INTO users ('name', 'password') VALUES('name', '123456')    
    \n SQL (0.000395) COMMIT    
    \n Redirected to http://localhost:3000/users/5    
    \n ...   
    \n
    \n
    \n
    \n做为一个安全爱好者,我可以负责任的告诉你,这些东西非常危险,恶意的人总是能想办法(这个办法很多,比如旁注等)拿到你的日志文件,而这个日志文件比起加密的数据库文件还要危险,于是肯定是需要做一些工作的。
    \nActionController#filter_parameter_logging 就是我们需要的东西,它可以用来过滤那些你不想保存在日志中的数据,它可以阻止一些敏感数据赤裸裸的暴露在日志文件中,比如密码,或者信用卡帐号。也可以防止一些大块的数据占用日志文件,等等。
    \n如果你的应用用到passwords,复制下面这行到你的ApplicaitonController  Class:
    \n
    \nRuby代码
    \n
    \n filter_parameter_logging "password" 
    \n
    \n
    \n
    \n这样就可以阻止任何匹配/password/i模式的数据被写入日志,诸如:[user][password] 或 [user][password_confirmation]
    \n
    \n另外,如果想在开发环境下显示POST logging,但是在产品环境下完全不显示,如何做呢?
    \n
    \nRuby代码
    \n
    \n filter_parameter_logging("password") if RAILS_ENV == "production" 
    \n
    \n
    \n
    \n如果想完全禁止POST logging,则可以在production.rb中修改:config.log_level = :warn
    \n
    \n其他类似文章,请参考:
    \nhttp://blackanger.blog.51cto.com/140924/35735
    \nhttp://hideto.javaeye.com/blog/106956
    \nhttp://api.rubyonrails.com/classes/ActionController/Base.html#M000260

    \n", "_id"=>658}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中取得REFERER!", "body"=>"``需要取打开技能云tag的页面地址,于是需要取得referer的值,记录如下:
    Try:

    request.env['HTTP_REFERER']
    或者
    request.referer
    参考:http://www.ruby-forum.com/topic/79405```", "created_at"=>2007-09-26 09:22:48 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    需要取打开技能云tag的页面地址,于是需要取得<strong>referer</strong>的值,记录如下:<strong><br />Try: </strong><br />request.env['HTTP_REFERER']<br />或者<br />request.referer<br />参考:http://www.ruby-forum.com/topic/79405`

    \n", "_id"=>659}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"warning: already initialized constant OPTIONS", "body"=>"

    着手开发1stlog Ver 1.1版本,把代码整理了一下,带到公司跑不起来,看了下Ruby版本,是1.8.4的,难道是版本太老,卸掉重新装个1.8.6的版本,接着装rails,mongrel和mongrel_service等。

    \n

    \n

    \n
    安装套件
    \n
      \n
    1. gem install rails –y  
    2. \n
    3. gem install mongrel –y  
    4. \n
    5. gem install mongrel_service -y  
    6. \n
    \n
    \n可是ruby ./script/server启动后,还是报错,如下:

    \n
    \n
    \n
    XML/HTML代码
    \n
      \n
    1. => Booting Mongrel (use 'script/server webrick' to force WEBrick)  
    2. \n
    3. => Rails application starting on http://0.0.0.0:3000  
    4. \n
    5. => Call with -d to detach  
    6. \n
    7. => Ctrl-C to shutdown server  
    8. \n
    9. ** Starting Mongrel listening at 0.0.0.0:3000  
    10. \n
    11. ** Starting Rails with development environment...  
    12. \n
    13. Exiting  
    14. \n
    15. /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS  
    16. \n
    17. /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method `options' for []:Array (NoMethodError)  
    18. \n
    19.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'  
    20. \n
    21.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in `require'  
    22. \n
    23.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    24. \n
    25.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'  
    26. \n
    27.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    28. \n
    29.         from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39  
    30. \n
    31.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'  
    32. \n
    33.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'  
    34. \n
    35.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    36. \n
    37.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'  
    38. \n
    39.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    40. \n
    41.         from script/server:3  
    42. \n
    \n
    \n 十分之不解,于是卸掉
    mongrel,重新安装下,还是不行,google到这篇文章:情况几乎差不多,他说是缺少app中使用的gem,恩,很有可能,打开我的environment.rb,看到require 'redcloth',哦,原来如此。
    \n 装上这个gem后一切正常,接着看到一个修复方法,如下:
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. “require ‘nonexistingfile’”. 
      \n
    2. \n
    \n
    \n 但是加上这句保证可启动,但是其中遇到需要使用gem的时候,肯定还是不行的。
    ", "created_at"=>2007-09-27 03:52:41 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    着手开发1stlog Ver 1.1版本,把代码整理了一下,带到公司跑不起来,看了下Ruby版本,是1.8.4的,难道是版本太老,卸掉重新装个1.8.6的版本,接着装rails,mongrel和mongrel_service等。
    \n
    \n
    \n安装套件
    \n
    \n gem install rails –y  
    \n gem install mongrel –y  
    \n gem install mongrel_service -y  
    \n
    \n
    \n可是ruby ./script/server启动后,还是报错,如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n => Booting Mongrel (use 'script/server webrick' to force WEBrick)  
    \n => Rails application starting on http://0.0.0.0:3000  
    \n => Call with -d to detach  
    \n => Ctrl-C to shutdown server  
    \n  Starting Mongrel listening at 0.0.0.0:3000  
    \n
     Starting Rails with development environment...  
    \n Exiting  
    \n /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS  
    \n /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method options'&nbsp;for&nbsp;[]:Array&nbsp;(NoMethodError)&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in&nbsp;
    gem_original_require'  
    \n         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in require'&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in new_constants_in'&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39  
    \n         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in require'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in&nbsp;
    new_constants_in'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    \n         from script/server:3  
    \n
    \n
    \n 十分之不解,于是卸掉mongrel,重新安装下,还是不行,google到这篇文章:情况几乎差不多,他说是缺少app中使用的gem,恩,很有可能,打开我的environment.rb,看到require 'redcloth',哦,原来如此。
    \n 装上这个gem后一切正常,接着看到一个修复方法,如下:
    \n
    \n
    \n Ruby代码
    \n
    \n “require ‘nonexistingfile’”. 
    \n
    \n
    \n
    \n 但是加上这句保证可启动,但是其中遇到需要使用gem的时候,肯定还是不行的。

    \n", "_id"=>660}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)最新功能及其来源~", "body"=>"

    最新的两个功能,完成后将进行一次宣传推广,抓紧时间实现,记录:
    \n 1、要求战友功能 --自动的给项目成员(提交者)发送提醒Email,让其邀请自己的战友加入项目成员;

    \n

    2、智能抓取  --按照展示“技能云”的地址,智能抓取其对于的BLOG内容(按照RSS抓取),解析后入库,显示在其个人的页面上。

    ", "created_at"=>2007-09-29 08:52:24 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    最新的两个功能,完成后将进行一次宣传推广,抓紧时间实现,记录:
    \n 1、要求战友功能 --自动的给项目成员(提交者)发送提醒Email,让其邀请自己的战友加入项目成员;
    \n2、智能抓取  --按照展示“技能云”的地址,智能抓取其对于的BLOG内容(按照RSS抓取),解析后入库,显示在其个人的页面上。

    \n", "_id"=>661}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取到了展示“技能云”的页面URL了", "body"=>"

    和前面说的那个文章中的道理,今天晚上测试了下,可以顺利抓取到展示“技能云”的页面URL了,并且做了一些处理,比如记录次数,就可以帮忙用户统计其页 面被欢迎程度了,呵呵,感觉和站点统计有点相像,下一步是抓取用户页面上的RSS地址,并抓取解析其内容,截个图片,如下:

    ", "created_at"=>2007-09-29 15:15:13 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    和前面说的那个文章中的道理,今天晚上测试了下,可以顺利抓取到展示“技能云”的页面URL了,并且做了一些处理,比如记录次数,就可以帮忙用户统计其页 面被欢迎程度了,呵呵,感觉和站点统计有点相像,下一步是抓取用户页面上的RSS地址,并抓取解析其内容,截个图片,如下:

    \n", "_id"=>662}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"(x)HTML解析利器:Hpricot", "body"=>"

    由于需要在技能云(iTechTag) 上智能抓取展示“技能云”的页面的URL对于的RSS进行解析,所以需要写取RSS已经解析的代码,先贴一个一般的例子,如下:

    \n

     

    \n
    \n
    首先给一段XML代码(my.xml)
    \n
      \n
    1. <Export>  
    2. \n
    3.   <Product>  
    4. \n
    5.     <SKU>403276</SKU>  
    6. \n
    7.     <ItemName>Trivet</ItemName>  
    8. \n
    9.     <CollectionNo>0</CollectionNo>  
    10. \n
    11.     <Pages>0</Pages>  
    12. \n
    13.   </Product>  
    14. \n
    15. </Export>  
    16. \n
    \n
    \n

    紧接着,我们用来解析并入库:

    \n

     

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. FIELDS = %w[SKU ItemName CollectionNo Pages]  
    2. \n
    3.   
    4. \n
    5. doc = Hpricot.parse(File.read("my.xml"))  
    6. \n
    7. (doc/:product).each do |xml_product|  
    8. \n
    9.   product = Product.new  
    10. \n
    11.   for field in FIELDS  
    12. \n
    13.     product[field] = (xml_product/field.intern).first.innerHTML  
    14. \n
    15.   end  
    16. \n
    17.   product.save  
    18. \n
    19. end  
    20. \n
    \n
    \n

    遗留问题:

    \n

     

    \n

    1、对于中文,可能会出现乱码

    \n

    2、另外,有人说不是线程安全的,多线程的话可能有问题。

    \n

    再附录一段我写的:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require "open-uri"  
    2. \n
    3. require "hpricot"  
    4. \n
    5. doc = open("http://blog.1sters.com") { |f| Hpricot(f) }  
    6. \n
    7. rel = doc.search("//link[@rel='alternate']").first[:href]  
    8. \n
    9.   
    10. \n
    11. print rel.to_s  
    12. \n
    13.   
    14. \n
    15. #xmldoc = Hpricot.XML(open("http://blog.1sters.com/"+rel))  
    16. \n
    17. xmldoc = open("http://blog.1sters.com/"+rel) do |fi|  
    18. \n
    19.    Hpricot.XML(fi)  
    20. \n
    21.  end  
    22. \n
    23.  (xmldoc/:item).each do |item|  
    24. \n
    25.    title = (item/:title).inner_html  
    26. \n
    27.    link = (item/:link).inner_html  
    28. \n
    29.    date = (item/'dc:date').inner_html  
    30. \n
    31.    puts "\#{title}: \#{link}"   
    32. \n
    33.  end  
    34. \n
    35. #print xmldoc.to_s 
      \n
    36. \n
    \n
    \n

    \n

    参考:

    \n

    1、http://www.ave7.net/forum/showthread.php?t=5919
    \n2、http://club.phpe.net/index.php?act=ST&f=19&t=15267&s=04a67d90deb7607c0907d28dafba10f5

    ", "created_at"=>2007-09-30 03:20:33 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    由于需要在技能云(iTechTag) 上智能抓取展示“技能云”的页面的URL对于的RSS进行解析,所以需要写取RSS已经解析的代码,先贴一个一般的例子,如下:
    \n 
    \n
    \n首先给一段XML代码(my.xml)
    \n
    \n <Export>  
    \n   <Product>  
    \n     <SKU>403276</SKU>  
    \n     <ItemName>Trivet</ItemName>  
    \n     <CollectionNo>0</CollectionNo>  
    \n     <Pages>0</Pages>  
    \n   </Product>  
    \n </Export>  
    \n
    \n
    \n紧接着,我们用来解析并入库:
    \n 
    \n 
    \n
    \nRuby代码
    \n
    \n FIELDS = %w[SKU ItemName CollectionNo Pages]  
    \n   
    \n doc = Hpricot.parse(File.read("my.xml"))  
    \n (doc/:product).each do |xml_product|  
    \n   product = Product.new  
    \n   for field in FIELDS  
    \n     product[field] = (xml_product/field.intern).first.innerHTML  
    \n   end  
    \n   product.save  
    \n end  
    \n
    \n
    \n 遗留问题:
    \n 
    \n1、对于中文,可能会出现乱码
    \n2、另外,有人说不是线程安全的,多线程的话可能有问题。
    \n再附录一段我写的:
    \n
    \n
    \nRuby代码
    \n
    \n require "open-uri"  
    \n require "hpricot"  
    \n doc = open("http://blog.1sters.com") { |f| Hpricot(f) }  
    \n rel = doc.search("//link[@rel='alternate']").first[:href]  
    \n   
    \n print rel.to_s  
    \n   
    \n #xmldoc = Hpricot.XML(open("http://blog.1sters.com/"+rel);)  
    \n xmldoc = open("http://blog.1sters.com/"+rel) do |fi|  
    \n    Hpricot.XML(fi)  
    \n  end  
    \n  (xmldoc/:item).each do |item|  
    \n    title = (item/:title).inner_html  
    \n    link = (item/:link).inner_html  
    \n    date = (item/'dc:date').inner_html  
    \n    puts "\#{title}: \#{link}"   
    \n  end  
    \n #print xmldoc.to_s 
    \n
    \n
    \n
    \n
    \n参考:
    \n1、http://www.ave7.net/forum/showthread.php?t=5919
    \n2、http://club.phpe.net/index.php?act=ST&f=19&t=15267&s=04a67d90deb7607c0907d28dafba10f5;

    \n", "_id"=>663}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云上又一个令人兴奋的功能:智能抓取", "body"=>"

    实现了对展示“技能云”的用户的博客内容的智能抓取,效果相当不错,呵呵,为以后的发展提供了不错的思路,大家可以看这个地址上的右下角,显示的即是该用户的blog上的最新内容:
    \n
    \n http://www.itechtag.com/people/view/16

    \n

    http://www.itechtag.com/people/view/1

    \n

    其他的,只有用户在自己的页面上展示了自己的“技能云”,我们就可以智能的抓取到其最新的博客内容,相当方便。

    ", "created_at"=>2007-09-30 12:13:32 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    实现了对展示“技能云”的用户的博客内容的智能抓取,效果相当不错,呵呵,为以后的发展提供了不错的思路,大家可以看这个地址上的右下角,显示的即是该用户的blog上的最新内容:
    \n
    \n http://www.itechtag.com/people/view/16
    \nhttp://www.itechtag.com/people/view/1
    \n其他的,只有用户在自己的页面上展示了自己的“技能云”,我们就可以智能的抓取到其最新的博客内容,相当方便。

    \n", "_id"=>664}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Win下安装Rmagick!", "body"=>"

    说来惭愧,写了这么久的Ruby,做了那么多的网站,也写过不少使用Rmagick来处理图片的代码,但是自己的机子上始终安装不成功,折腾了好几 次,我记得都没有最终完全搞定。本来准备使用Ubuntu上,但是很多东西在Win下使用惯了,所以还是安心的在WIN下做开发吧。

    \n

    言归正传,说说怎么在Win下安装Rmagick,其他的部分可以参考http://www.javaeye.com/post/167758和 http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html这两文章,我大概说下步骤和可能会出现的问 题,记录一下:

    \n
    1、首先到这个地方去下载RMagick的最新Windows版本,到目前为止的最新版本是rmagick-win32-1.13.0_IM-6.2.9-3.zip
    \n
    2、先解压,然后输入命令安装:gem install rmagick-1.13.0-win32.gem
    \n
    3、然后再点ImageMagick-6.2.9-3-Q8-windows-dll.exe安装,并且把这个的安装路径放到path环境变量里面去,否则会出现CORE_RL_magick_.dll找不到的错误(需要注意,加入后CMD需要重新打开下,否则不行)。
    \n然后试试这段代码,如下:
    \n
    \n
    示例代码
    \n
      \n
    1. require 'RMagick'  
    2. \n
    3. include Magick  
    4. \n
    5. pic = ImageList.new("vd2.jpg")  
    6. \n
    7. l = pic.columns > pic.rows ? pic.columns : pic.rows  
    8. \n
    9. f = 128.0/l;  
    10. \n
    11. thumb = pic.thumbnail(f)  
    12. \n
    13. thumb.write("vd2_tb.jpg")  
    14. \n
    \n
    \n其他的就不写的,互联网的资源是无限的,参考以下:
    \n1、http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html
    \n2、http://www.javaeye.com/post/167758
    \n3、http://rmagick.rubyforge.org/portfolio.html
    ", "created_at"=>2007-10-01 12:29:15 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    说来惭愧,写了这么久的Ruby,做了那么多的网站,也写过不少使用Rmagick来处理图片的代码,但是自己的机子上始终安装不成功,折腾了好几 次,我记得都没有最终完全搞定。本来准备使用Ubuntu上,但是很多东西在Win下使用惯了,所以还是安心的在WIN下做开发吧。
    \n言归正传,说说怎么在Win下安装Rmagick,其他的部分可以参考http://www.javaeye.com/post/167758和 http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html这两文章,我大概说下步骤和可能会出现的问 题,记录一下:
    \n1、首先到这个地方去下载RMagick的最新Windows版本,到目前为止的最新版本是rmagick-win32-1.13.0IM-6.2.9-3.zip。
    \n2、先解压,然后输入命令安装:gem install rmagick-1.13.0-win32.gem
    \n3、然后再点ImageMagick-6.2.9-3-Q8-windows-dll.exe安装,并且把这个的安装路径放到path环境变量里面去,否则会出现CORE_RL_magick
    .dll找不到的错误(需要注意,加入后CMD需要重新打开下,否则不行)。
    \n然后试试这段代码,如下:
    \n
    \n示例代码
    \n
    \n require 'RMagick'  
    \n include Magick  
    \n pic = ImageList.new("vd2.jpg")  
    \n l = pic.columns > pic.rows ? pic.columns : pic.rows  
    \n f = 128.0/l;  
    \n thumb = pic.thumbnail(f)  
    \n thumb.write("vd2_tb.jpg")  
    \n
    \n
    \n其他的就不写的,互联网的资源是无限的,参考以下:
    \n1、http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html
    \n2、http://www.javaeye.com/post/167758
    \n3、http://rmagick.rubyforge.org/portfolio.html

    \n", "_id"=>665}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复一个关于自动登录的BUG!", "body"=>"

    前几天给“技能云”加上了自动登录的功能,并写了一篇手记文章(参考这里:在Rails中实现自动登录功能!),但是前几天wangdi.cd提了一个问题如下:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. 我前几天用了一下itechtag,并且注册了一个hobitton的用户名,,但是现在,,我还没登  
    2. \n
    3. 录,就自己给我用trail的用户名登录了,,还能修改他的信息,,怎么回事呢?  
    4. \n
    \n
    \n开始还没有引起重视,昨天晚上另外一个用户dbd也说存在这个问题,详细问了下,他说上次登录的时候选择了“记住我”,今天再次登录的时候就出现该问题了,而后google时无意看到JAVAEYE的抛出异常的爱说:

    \n

    \n

    \n
    抛出异常的爱:
    \n
      \n
    1. 刚刚在  
    2. \n
    3. 技能云http://www.itechtag.com/about  
    4. \n
    5. 遇到了。。。  
    6. \n
    7. 用的是温柔一刀的账号。。。。。  
    8. \n
    \n
    \n看来是有问题了,立即检查代码,看到取当前用户是否自动登录的代码如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def get_current_user    
    2. \n
    3.   if session[:user].nil?    
    4. \n
    5.     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])    
    6. \n
    7.       session[:user] = c_user.id    
    8. \n
    9.     end    
    10. \n
    11.   end    
    12. \n
    13. end   
    14. \n
    \n
    \n再看看PersistentLogin这个表的结构,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. class CreatePersistentLogins < ActiveRecord::Migration  
    2. \n
    3.   def self.up  
    4. \n
    5.     create_table :persistent_logins do |t|  
    6. \n
    7.       t.column :uid:string:null => false  
    8. \n
    9.       t.column :user_id:integer:null => false  
    10. \n
    11.       t.column :created_on:datetime:null => false  
    12. \n
    13.     end  
    14. \n
    15.       
    16. \n
    17.    add_index :persistent_logins:uid:name => "uid"  
    18. \n
    19.    add_index :persistent_logins:created_on:name => "created_on"      
    20. \n
    21.   end  
    22. \n
    23.   
    24. \n
    25.   def self.down  
    26. \n
    27.     drop_table :persistent_logins  
    28. \n
    29.   end  
    30. \n
    31. end  
    32. \n
    \n
    \n一眼看出问题所在,user_id这个字段保存的才是用户的ID,而前面那段代码取成了id 字段,真是疏忽呀~

    \n

    找到问题,自然好解决了,不在废话~
    \n

    ", "created_at"=>2007-10-02 05:13:40 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    前几天给“技能云”加上了自动登录的功能,并写了一篇手记文章(参考这里:在Rails中实现自动登录功能!),但是前几天wangdi.cd提了一个问题如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n 我前几天用了一下itechtag,并且注册了一个hobitton的用户名,,但是现在,,我还没登  
    \n 录,就自己给我用trail的用户名登录了,,还能修改他的信息,,怎么回事呢?  
    \n
    \n
    \n开始还没有引起重视,昨天晚上另外一个用户dbd也说存在这个问题,详细问了下,他说上次登录的时候选择了“记住我”,今天再次登录的时候就出现该问题了,而后google时无意看到JAVAEYE的抛出异常的爱说:
    \n
    \n
    \n抛出异常的爱:
    \n
    \n 刚刚在  
    \n 技能云http://www.itechtag.com/about  
    \n 遇到了。。。  
    \n 用的是温柔一刀的账号。。。。。  
    \n
    \n
    \n看来是有问题了,立即检查代码,看到取当前用户是否自动登录的代码如下:
    \n
    \n
    \nRuby代码
    \n
    \n def get_current_user    
    \n   if session[:user].nil?    
    \n     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])    
    \n       session[:user] = c_user.id    
    \n     end    
    \n   end    
    \n end   
    \n
    \n
    \n再看看PersistentLogin这个表的结构,如下:
    \n
    \n
    \nRuby代码
    \n
    \n class CreatePersistentLogins < ActiveRecord::Migration  
    \n   def self.up  
    \n     create_table :persistent_logins do |t|  
    \n       t.column :uid, :string, :null => false  
    \n       t.column :user_id, :integer, :null => false  
    \n       t.column :created_on, :datetime, :null => false  
    \n     end  
    \n       
    \n    add_index :persistent_logins, :uid, :name => "uid"  
    \n    add_index :persistent_logins, :created_on, :name => "created_on"      
    \n   end  
    \n   
    \n   def self.down  
    \n     drop_table :persistent_logins  
    \n   end  
    \n end  
    \n
    \n
    \n一眼看出问题所在,user_id这个字段保存的才是用户的ID,而前面那段代码取成了id 字段,真是疏忽呀~
    \n找到问题,自然好解决了,不在废话~

    \n", "_id"=>666}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的音乐DNA测评报告~", "body"=>"

    朋友发了一个URL,说在FF下太震撼了,随手打开,是个音乐的网站,首页最显著的地方有个很好玩的心理测试flash,按照自己的性格,做了下,按照其 生成的报告,还真挺准的,真的很准的。比如我喜欢的摇滚和朋克等,以及其推荐的linkpark等歌曲,这个网站貌似有点前途~

    \n

    报告如下:

    \n

    你的音乐DNA测评报告

    \n
    \n
    \n
    \n
    (S)沉思的萨克斯25%
    \n
    (G)激烈的电吉他44%
    \n
    (P)动听的钢琴16%
    \n
    (D)动感的电子鼓15%
    \n
     
    \n
    \n
    \n
    \n
    \n
    显性音乐DNA为:(G)激烈的电吉他
    \n
    隐性音乐DNA为:(S)沉思的萨克斯
    \n
    \n
    \n
    \n\n\n\n
    \n\n
    \n
    \n
    \n
    \n### 你是:典型的“(G)激烈的电吉他”类型\n

    G类型(反叛型)音乐DNA呈显性的人,认为音乐是情绪表达的最好出口。音乐于你来讲就如同一项刺激的探险旅行,你期待在音乐中获得异于他人的新鲜体验。

    \n
      \n
    • 速度偏爱
    • \n

      在大多数情况下,偏爱节拍速度较快的音乐(BPM ”Beat per Minute”>80)。在歌曲节奏性与旋律性的对比上,你更倾向于节奏性较强的音乐表达和充满能量的速度感体验。

      \n
    • 歌词偏爱
    • \n

      简单直接,甚至带有一些无所谓何般抵抗的词汇才是脑中所想,反叛性的歌词亦是这类听者的最爱“我不愿相信真的有魔鬼,也不愿与任何人作对”,“噢姐 姐,我想回家,牵着我的手,我有些困了……”。“你会看见雾、看见云、看见太阳,纪念和大地重复着悲伤……”你完全不喜欢千篇一律的情感描述词句。

      \n
    • 歌曲情绪体现
    • \n

      在你看来,情绪表达是一首歌的重要内容之一。你会十分在意一首歌的情绪是否与你心情合拍,并倾向于较为直接和激烈的情绪表达。

      \n
    • 人声体现
    • \n

      喜欢不一样的声音,喜欢嗓子里像粘上碎玻璃的声音;喜欢人声随着乐器越来越猛烈的嘶喊,混乱、躁动,不安现状的声音会得到青睐;不喜欢做作和感情扭捏造作的口水式演唱。

      \n
    • 曲风偏好
    • \n

      在纷繁的音乐类型中,这种类型的爱好者会偏爱硬摇滚、另类、朋克(PUNK)、重金属Heavy metal、流行金属等能量较高的音乐。

      \n
    • 乐器偏好
    • \n

      偏爱电声乐器(什么是?):如失真电吉他、电贝司、架子鼓、饱满的木吉他扫弦或是一段精彩的乐器SOLO(什么是?)中那充满延伸的电子合成器;喜欢原始却不失热情的配器,

      \n
    • 能量消耗
    • \n

      无论从演奏者还是演唱者,都会有极度消耗能量的倾向,而这样的倾向,会获得典型此类型人的极大共鸣

      \n
    • 音乐人偏好
    • \n

      Beyond、F.I.R、蔡健雅、信乐团、孙燕姿、崔健、莫文蔚、谢天啸、Metallica 、Nirvana、Korn、Green Day、Coldplay、X-Japan

      \n
    \n
    \n
    \n
    \n
    \n
    \n

    注:关于测评结果,你需要了解,

    \n
      \n
    • YOBO 根据人们对音乐偏好的差异,将每个人的音乐DNA分为4种倾向性。你的音乐DNA可能在其中一类上尤为突出,也有可能同时倾向于2-3类不同的音乐偏好。 YOBO的前期调查显示,每个人都具有其最明显的显性倾向和相对较为隐蔽的隐性倾向,然而,没有会对4类音乐偏好都同时具有明显倾向性的人—当然,你也有 可能是最例外的一位
    • \n
    • 在音乐心理测评报告中,我们描述你的音乐喜好所举的实例,包括歌词、歌曲、人名等等,有可能因为一些不可预计的因素而存在个体差异,请你更关注整体描述
    • \n
    • 除了针对音乐元素的心理分析报告,我们还将分析你的性格特征和情感体现
    • \n
    \n
    \n
    \n
    \n
     
    \n
    ", "created_at"=>2007-10-02 06:52:02 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    朋友发了一个URL,说在FF下太震撼了,随手打开,是个音乐的网站,首页最显著的地方有个很好玩的心理测试flash,按照自己的性格,做了下,按照其 生成的报告,还真挺准的,真的很准的。比如我喜欢的摇滚和朋克等,以及其推荐的linkpark等歌曲,这个网站貌似有点前途~
    \n报告如下:
    \n你的音乐DNA测评报告
    \n
    \n
    \n
    \n(S)沉思的萨克斯25%
    \n(G)激烈的电吉他44%
    \n(P)动听的钢琴16%
    \n(D)动感的电子鼓15%
    \n 
    \n
    \n
    \n
    \n
    \n显性音乐DNA为:(G)激烈的电吉他
    \n隐性音乐DNA为:(S)沉思的萨克斯
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \nvar js_564=new yobo_SWF("/flash/t/102/YoboPsyTest.swf", "finalPlayer", "8", "GW=engine.yobo.com&U=825856&L=0&S=d71d8677cddb40469bcaf749a80a0a0ed0c9d1c5&P=0&V=-1&D=0&cID=0&VER=0.30", "591", "206", "#ffffff");js_564.write("swf_564_finalPlayer");
    \n
    \n
    \n

    \n\n

    你是:典型的“(G)激烈的电吉他”类型

    \n\n

    G类型(反叛型)音乐DNA呈显性的人,认为音乐是情绪表达的最好出口。音乐于你来讲就如同一项刺激的探险旅行,你期待在音乐中获得异于他人的新鲜体验。
    \n
    \n 速度偏爱
    \n 在大多数情况下,偏爱节拍速度较快的音乐(BPM ”Beat per Minute”>80)。在歌曲节奏性与旋律性的对比上,你更倾向于节奏性较强的音乐表达和充满能量的速度感体验。
    \n 歌词偏爱
    \n 简单直接,甚至带有一些无所谓何般抵抗的词汇才是脑中所想,反叛性的歌词亦是这类听者的最爱“我不愿相信真的有魔鬼,也不愿与任何人作对”,“噢姐 姐,我想回家,牵着我的手,我有些困了……”。“你会看见雾、看见云、看见太阳,纪念和大地重复着悲伤……”你完全不喜欢千篇一律的情感描述词句。
    \n 歌曲情绪体现
    \n 在你看来,情绪表达是一首歌的重要内容之一。你会十分在意一首歌的情绪是否与你心情合拍,并倾向于较为直接和激烈的情绪表达。
    \n 人声体现
    \n 喜欢不一样的声音,喜欢嗓子里像粘上碎玻璃的声音;喜欢人声随着乐器越来越猛烈的嘶喊,混乱、躁动,不安现状的声音会得到青睐;不喜欢做作和感情扭捏造作的口水式演唱。
    \n 曲风偏好
    \n 在纷繁的音乐类型中,这种类型的爱好者会偏爱硬摇滚、另类、朋克(PUNK)、重金属Heavy metal、流行金属等能量较高的音乐。
    \n 乐器偏好
    \n 偏爱电声乐器(什么是?):如失真电吉他、电贝司、架子鼓、饱满的木吉他扫弦或是一段精彩的乐器SOLO(什么是?)中那充满延伸的电子合成器;喜欢原始却不失热情的配器,
    \n 能量消耗
    \n 无论从演奏者还是演唱者,都会有极度消耗能量的倾向,而这样的倾向,会获得典型此类型人的极大共鸣
    \n 音乐人偏好
    \n Beyond、F.I.R、蔡健雅、信乐团、孙燕姿、崔健、莫文蔚、谢天啸、Metallica 、Nirvana、Korn、Green Day、Coldplay、X-Japan
    \n
    \n
    \n
    \n
    \n
    \n
    \n注:关于测评结果,你需要了解,
    \n
    \n YOBO 根据人们对音乐偏好的差异,将每个人的音乐DNA分为4种倾向性。你的音乐DNA可能在其中一类上尤为突出,也有可能同时倾向于2-3类不同的音乐偏好。 YOBO的前期调查显示,每个人都具有其最明显的显性倾向和相对较为隐蔽的隐性倾向,然而,没有会对4类音乐偏好都同时具有明显倾向性的人—当然,你也有 可能是最例外的一位
    \n 在音乐心理测评报告中,我们描述你的音乐喜好所举的实例,包括歌词、歌曲、人名等等,有可能因为一些不可预计的因素而存在个体差异,请你更关注整体描述
    \n 除了针对音乐元素的心理分析报告,我们还将分析你的性格特征和情感体现
    \n
    \n
    \n
    \n
    \n 

    \n", "_id"=>667}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Migration把 MySQL的表引擎修改为InnoDB", "body"=>"

    尽管现在还没有这个需求,但是还是有必要了解一下,也是对Migration掌握的必须掌握的东西,代码不是我写的,来自与http://snippets.dzone.com/posts/show/4601,我怕时间按久了在那里找不到,所以干脆贴过来。

    \n
    \n
    Migration的Ruby代码
    \n
      \n
    1. class ChangeTableTypes < ActiveRecord::Migration  
    2. \n
    3.     
    4. \n
    5.   def self.up  
    6. \n
    7.     ActiveRecord::Migration::say 'Setting all tables to InnoDB engine (excluding schema_info table)...'  
    8. \n
    9.     result = ActiveRecord::Migration::execute 'show tables'  
    10. \n
    11.     while table = result.fetch_row  
    12. \n
    13.       execute("ALTER TABLE \#{table.to_s} TYPE = InnoDB"unless table.to_s == 'schema_info'  
    14. \n
    15.     end  
    16. \n
    17.   end  
    18. \n
    19.   
    20. \n
    21.   def self.down  
    22. \n
    23.     raise ActiveRecord::IrreversibleMigration  
    24. \n
    25.   end  
    26. \n
    27. end  
    28. \n
    \n
    ", "created_at"=>2007-10-02 07:26:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    尽管现在还没有这个需求,但是还是有必要了解一下,也是对Migration掌握的必须掌握的东西,代码不是我写的,来自与http://snippets.dzone.com/posts/show/4601,我怕时间按久了在那里找不到,所以干脆贴过来。
    \n
    \nMigration的Ruby代码
    \n
    \n class ChangeTableTypes < ActiveRecord::Migration  
    \n     
    \n   def self.up  
    \n     ActiveRecord::Migration::say 'Setting all tables to InnoDB engine (excluding schema_info table)...'  
    \n     result = ActiveRecord::Migration::execute 'show tables'  
    \n     while table = result.fetch_row  
    \n       execute("ALTER TABLE \#{table.to_s} TYPE = InnoDB") unless table.to_s == 'schema_info'  
    \n     end  
    \n   end  
    \n   
    \n   def self.down  
    \n     raise ActiveRecord::IrreversibleMigration  
    \n   end  
    \n end  
    \n

    \n", "_id"=>668}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正在筹备给技能云进行一次大改版~", "body"=>"

    有些地方使用起来不是很顺,需要大改一下,目前可能会修改的地方有:

    \n

    角色的规则(可能改成和技能一样的处理方式,可以随便用户自动添加,就像技能一样)

    \n

    显示方式(可能会使用tab的方式,进行显示)

    \n

    其他的部分正在一步步的想。

    ", "created_at"=>2007-10-08 04:18:03 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    有些地方使用起来不是很顺,需要大改一下,目前可能会修改的地方有:
    \n角色的规则(可能改成和技能一样的处理方式,可以随便用户自动添加,就像技能一样)
    \n显示方式(可能会使用tab的方式,进行显示)
    \n其他的部分正在一步步的想。

    \n", "_id"=>669}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate :分页不可或缺的插件", "body"=>"

    Rails以前的版本中包含了一个分页的方法,我使用的使用做了一些扩充,一直用到现在,看到很多人介绍Will Paginate,偶也不感兴趣,后来发现一个消息说Rails2.0将祛除内置的Paginate,于是就看看这个Will Paginate。

    \n

    参考资料:

    \n\n

    附录:基本步骤和过程

    \n

    \n

    \n
    安装will_paginate
    \n
      \n
    1. ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate  
      \n
    2. \n
    \n
    \n

    \n\n
    \n
    \n
    在Model中使用will_paginate
    \n
      \n
    1. # models/product.rb    
    2. \n
    3. def self.search(search, page)    
    4. \n
    5.   paginate :per_page => 5, :page => page,    
    6. \n
    7.            :conditions => ['name like ?'"%\#{search}%"],    
    8. \n
    9.            : order => 'name'    
    10. \n
    11. nd   
      \n
    12. \n
    \n
    \n
    \n\n
    \n
    \n
    在controller中使用search
    \n
      \n
    1. # products_controller.rb    
    2. \n
    3. def index    
    4. \n
    5.   @products = Product.search(params[:search], params[:page])    
    6. \n
    7. end   
      \n
    8. \n
    \n
    \n
    \n
    在页面中使用will_paginate
    \n
      \n
    1. <!-- products/index.rhtml -->    
    2. \n
    3.  <%= will_paginate @products %>    
    4. \n
    \n
    \n
    \n", "created_at"=>2007-10-10 07:08:55 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Rails以前的版本中包含了一个分页的方法,我使用的使用做了一些扩充,一直用到现在,看到很多人介绍Will Paginate,偶也不感兴趣,后来发现一个消息说Rails2.0将祛除内置的Paginate,于是就看看这个Will Paginate。
    \n参考资料:
    \n
    \n http://dev.rubyonrails.org/changeset/6993
    \n http://errtheblog.com/post/4791
    \n http://agilewebdevelopment.com/plugins/will_paginate
    \n http://mattrobinson.net/2007/6/26/rails-plugins-scope_out-and-will_paginate
    \n http://www.dcmanges.com/blog/21
    \n http://www.lycom.de/past/2007/7/12/rails_will_paginate20070712_200741/
    \n http://www.javaeye.com/topic/108118
    \n http://railscasts.com/episodes/51
    \n
    \n附录:基本步骤和过程
    \n
    \n
    \n安装will_paginate
    \n
    \n ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate  
    \n
    \n
    \n
    \n
    \nrender_code();
    \n
    \n
    \n在Model中使用will_paginate
    \n
    \n # models/product.rb    
    \n def self.search(search, page)    
    \n   paginate :per_page => 5, :page => page,    
    \n            :conditions => ['name like ?', "%\#{search}%"],    
    \n            : order => 'name'    
    \n nd   
    \n
    \n
    \n
    \n
    \nrender_code();
    \n
    \n
    \n在controller中使用search
    \n
    \n # products_controller.rb    
    \n def index    
    \n   @products = Product.search(params[:search], params[:page])    
    \n end   
    \n
    \n
    \n
    \n
    \n在页面中使用will_paginate
    \n
    \n # <!-- products/index.rhtml -->    
    \n  <%= will_paginate @products %>    
    \n
    \n
    \n
    \nrender_code();

    \n", "_id"=>670}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取在线网页图像的方法~", "body"=>"

    在考虑给技能云添加一个特色的功能,就是给动态抓取提交项目的页面图片,google了一些方法,记录如下:

    \n

    1、http://thumbnailspro.com/网站

    \n
    \n
    Website Thumbnails - Screenshots captured in seconds - Over 1000 sizes!
    \n
      \n
    1. <a href="http://thumbnailspro.com" title="website thumbnails">  
    2. \n
    3. <img src="http://thumbnailspro.com/thumb.php?url=http://www.itechtag.com&S=150" border="0" alt="website thumbnails">  
    4. \n
    5. </a>  
    6. \n
    \n
    \n

    这个网站号称Screenshots captured in seconds,我在本地测试了几个,感觉速度还不错,我们可以直接使用,或者第一次把这个图片保存到本地即可。

    \n

    2、http://webthumb.bluga.net/home.php
    \n按照http://snippets.dzone.com/posts/show/3621上面的代码,抓取,采用ruby代码,用webservice连接到做snap的网站获得jpg文件,但是需要注册,申请API的key,免费有限制每月250次。

    \n

    3、www.artviper.net

    \n

    第3种比较简单和第一种web service相似
    \n不过不用ruby而是纯html img的tag, 有点慢
    \n

    \n
    XML/HTML代码
    \n
      \n
    1. <img src="http://www.artviper.net/screenshots/screener.php?&url=www.meinedomain.com&q=xx&h=hh&w=ww&sdx=xxx&sdy=xxx" alt="artViper designstudio website thumbnail "/>  
    2. \n
    \n
    \nThe parameters as following:
    \n    * q = quality level ( 30-70% )
    \n    * h = output height
    \n    * w = output width
    \n    * sdx = crop area horizontally
    \n    * sdy = crop area vertically
    \n
    \nIf you omit the sdx & sdy values, the whole page gets snapped.
    \nDon't forget to add a backlink to www.artviper.net or www.artviper.de ( textlink is enough ) but please place the link good visible.
    \nhttp://www.artviper.net/screenshots/screener.php?&url=http://www.itechtag.com&q=70&h=180&w=360

    \n

    \"\"

    ", "created_at"=>2007-10-12 09:39:04 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在考虑给技能云添加一个特色的功能,就是给动态抓取提交项目的页面图片,google了一些方法,记录如下:
    \n1、http://thumbnailspro.com/网站
    \n
    \nWebsite Thumbnails - Screenshots captured in seconds - Over 1000 sizes!
    \n
    \n <a href="http://thumbnailspro.com" title="website thumbnails">  
    \n <img src="http://thumbnailspro.com/thumb.php?url=http://www.itechtag.com&S=150;" border="0" alt="website thumbnails">  
    \n </a>  
    \n
    \n
    \n这个网站号称Screenshots captured in seconds,我在本地测试了几个,感觉速度还不错,我们可以直接使用,或者第一次把这个图片保存到本地即可。
    \n2、http://webthumb.bluga.net/home.php
    \n按照http://snippets.dzone.com/posts/show/3621上面的代码,抓取,采用ruby代码,用webservice连接到做snap的网站获得jpg文件,但是需要注册,申请API的key,免费有限制每月250次。
    \n3、www.artviper.net
    \n第3种比较简单和第一种web service相似
    \n不过不用ruby而是纯html img的tag, 有点慢
    \n
    \nXML/HTML代码
    \n
    \n <img src="http://www.artviper.net/screenshots/screener.php?&url=www.meinedomain.com&q=xx&h=hh&w=ww&sdx=xxx&sdy=xxx;" alt="artViper designstudio website thumbnail "/>  
    \n
    \n
    \nThe parameters as following:
    \n    * q = quality level ( 30-70% )
    \n    * h = output height
    \n    * w = output width
    \n    * sdx = crop area horizontally
    \n    * sdy = crop area vertically
    \n
    \nIf you omit the sdx & sdy values, the whole page gets snapped.
    \nDon't forget to add a backlink to www.artviper.net or www.artviper.de ( textlink is enough ) but please place the link good visible.
    \nhttp://www.artviper.net/screenshots/screener.php?&url=http://www.itechtag.com&q=70&h=180&w=360;

    \n", "_id"=>671}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)功能需求归纳", "body"=>"

    1、修改角色云的添加方式
    \n说明:按照技能云的模式修改角色云,可以让用户自己随意添加角色;

    \n

    2、添加项目的时候的检查

    \n

    说明:检查项目名称、项目简介等信息,如果以上两个为空,则不能添加;

    \n

    3、添加项目时对公司、行业等的添加方式~

    \n

    说明:这个需要更改下添加方式,现在的方式在公司多了的时候那个下拉列表会很长;

    \n

    4、界面优化

    \n

    说明:需要对界面进行一些优化,现在的界面有的地方看上去很丑~

    \n

    5、重构

    \n

    说明:有些地方很不合理,需要重构下代码。

    \n

    6、评价的时候有个bug

    \n

    说明:我第一次评价时,明明评价了一次,却显示评价了2次。

    \n

    7、后台管理功能

    \n

    说明:后台现在还缺少很多的管理功能,需要加上部分管理功能。

    \n

    8、评价的显示

    \n

    说明:修改为按照tab的模式进行显示,不再把项目成员的信息显示在侧边栏,侧边栏可以放诸如类似性质的项目或者同一个行业的项目;或者同一个公司的项目;

    \n

    9、展示最新消息

    \n

    说明:为了使得网站看上去是持续的改进,需要把最新的动态告诉大家, 后台发布信息的已经有了,但是需要在前台找个地方展示出来。

    \n

    10、抓取网页图片

    \n

    说明:按照提交项目的地址抓取用户的页面图片。

    ", "created_at"=>2007-10-12 09:44:22 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    1、修改角色云的添加方式
    \n说明:按照技能云的模式修改角色云,可以让用户自己随意添加角色;
    \n2、添加项目的时候的检查
    \n说明:检查项目名称、项目简介等信息,如果以上两个为空,则不能添加;
    \n3、添加项目时对公司、行业等的添加方式~
    \n说明:这个需要更改下添加方式,现在的方式在公司多了的时候那个下拉列表会很长;
    \n4、界面优化
    \n说明:需要对界面进行一些优化,现在的界面有的地方看上去很丑~
    \n5、重构
    \n说明:有些地方很不合理,需要重构下代码。
    \n6、评价的时候有个bug
    \n说明:我第一次评价时,明明评价了一次,却显示评价了2次。
    \n7、后台管理功能
    \n说明:后台现在还缺少很多的管理功能,需要加上部分管理功能。
    \n8、评价的显示
    \n说明:修改为按照tab的模式进行显示,不再把项目成员的信息显示在侧边栏,侧边栏可以放诸如类似性质的项目或者同一个行业的项目;或者同一个公司的项目;
    \n9、展示最新消息
    \n说明:为了使得网站看上去是持续的改进,需要把最新的动态告诉大家, 后台发布信息的已经有了,但是需要在前台找个地方展示出来。
    \n10、抓取网页图片
    \n说明:按照提交项目的地址抓取用户的页面图片。

    \n", "_id"=>672}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate的扩充使用~", "body"=>"

    Will Paginate真的很容易使用,看他自带的readme就能明白,但是其他的一些东西可以看看代码就明白了,比如你想显示一共多少页?当前是第几页?已经一共多少个item,都是可以做到的,看一个我在技能云上用的例子,代码如下:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <!--分页导航 -->  
    2. \n
    3. <table>  
    4. \n
    5.   <tr>  
    6. \n
    7.     <td><%= will_paginate @projects %></td>  
    8. \n
    9.       <td>  
    10. \n
    11.       <div class="pagination">  
    12. \n
    13.         <span class="lable">  
    14. \n
    15.           <b>页面信息: </b><%=@projects.total_entries %></b>个, 共<b><%=@projects.page_count %></b>页,  当前第<b><%= @projects.current_page%></b>页.  
    16. \n
    17.         </span>  
    18. \n
    19.       </div>  
    20. \n
    21.       
    22. \n
    23.   </tr>  
    24. \n
    25. </table> 
      \n
    26. \n
    \n
    \n

    其他的用法,比如显示的页数什么的,以及是否支持ajax等都是可以找到相关资料的,我就不多说了,参考如下资料:

    \n

    http://errtheblog.com/post/929

    ", "created_at"=>2007-10-13 02:04:17 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Will Paginate真的很容易使用,看他自带的readme就能明白,但是其他的一些东西可以看看代码就明白了,比如你想显示一共多少页?当前是第几页?已经一共多少个item,都是可以做到的,看一个我在技能云上用的例子,代码如下:
    \n
    \nXML/HTML代码
    \n
    \n <!--分页导航 -->  
    \n <table>  
    \n   <tr>  
    \n     <td><%= will_paginate @projects %></td>  
    \n       <td>  
    \n       <div class="pagination">  
    \n         <span class="lable">  
    \n           <b>页面信息: </b>总<%=@projects.total_entries %></b>个, 共<b><%=@projects.page_count %></b>页,  当前第<b><%= @projects.current_page%></b>页.  
    \n         </span>  
    \n       </div>  
    \n       
    \n   </tr>  
    \n </table> 
    \n
    \n
    \n
    \n其他的用法,比如显示的页数什么的,以及是否支持ajax等都是可以找到相关资料的,我就不多说了,参考如下资料:
    \nhttp://errtheblog.com/post/929

    \n", "_id"=>673}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>" 这篇文章是我很早前写的,放在原来的blog上的,无奈那个blog坏掉了,幸好还有”百度快照 “(http://cache.baidu.com/c?word=feedcontrol&url=http%3A//weblog% 2E1ster%2Ecn/%3Faction%3Dshow%26id%3D112&p=98769a45dcd011a05be7d3284c0096& user=baidu),找回来了,呵呵。以下是原文。\r\n\r\nGoogle放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:\r\n其API都很简单,详细的可以看这个页面上的介绍:\r\nhttp://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl\r\n只有一个构造器:FeedControl\r\n四个函数:\r\n1.addFeed(url, label) //添加需要显示的FEED的URL\r\n2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:\r\n\r\nfeedControl.draw(\r\ndocument.getElementById(\"feedControl\"),\r\n{\r\ndrawMode : google.feeds.FeedControl.DRAW_MODE_TABBED\r\n});\r\n\r\nfeedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.\r\n\r\n3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)\r\n4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下:\r\n\r\n* google.feeds.LINK_TARGET_BLANK - links will open in a new window\r\n* google.feeds.LINK_TARGET_SELF - links will open in the current window\r\n* google.feeds.LINK_TARGET_TOP - links will open in the topmost frame\r\n* google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame.\r\n* anything-else - the value of target in the resulting anchor element is set to linkTarget\r\n\r\n附录其网站上的说明:\r\n---------------\r\nThis morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:\r\n\r\nvar feedControl = new google.feeds.FeedControl();\r\nfeedControl.addFeed(\"http://www.digg.com/rss/index.xml\", \"Digg\");\r\nfeedControl.addFeed(\"http://feeds.feedburner.com/Techcrunch\", \"TechCrunch\");\r\nfeedControl.draw(document.getElementById(\"feedControl\"));\r\n\r\nIn addition to the formal documentation, we have put together a few samples to help you quickly come up to speed.\r\n\r\n另外,补充一点东西,如果你需要定制他的CSS样式表,可以按照这个模式定制,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <!-- The Feed Control Class (Note: Linear Mode is Shown) -->  
    2. \r\n\t
    3. <div class=\"gfc-control\">  
    4. \r\n\t
    5.   
    6. \r\n\t
    7.   <!-- Per Feed Container -->  
    8. \r\n\t
    9.   <div class=\"gfc-resultsRoot\">  
    10. \r\n\t
    11.   
    12. \r\n\t
    13.     <!-- Per Feed Header -->  
    14. \r\n\t
    15.     <!-- .gfc-title holds Feed's Label -->  
    16. \r\n\t
    17.     <div class=\"gfc-resultsHeader\">  
    18. \r\n\t
    19.       <div class=\"gfc-title\"></div>  
    20. \r\n\t
    21.     </div>  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.     <!-- Collection of Entries -->  
    26. \r\n\t
    27.     <div class=\"gfc-results\">  
    28. \r\n\t
    29.   
    30. \r\n\t
    31.       <!-- One .gfc-result per entry -->  
    32. \r\n\t
    33.       <div class=\"gfc-result\">  
    34. \r\n\t
    35.   
    36. \r\n\t
    37.         <!-- One .gf-result per entry -->  
    38. \r\n\t
    39.         <div class=\"gf-result\">  
    40. \r\n\t
    41.   
    42. \r\n\t
    43.           <!-- Hyperlinked Entry Title -->  
    44. \r\n\t
    45.           <div class=\"gf-title\">  
    46. \r\n\t
    47.             <a class=\"gf-title\"></a>  
    48. \r\n\t
    49.           </div>  
    50. \r\n\t
    51.   
    52. \r\n\t
    53.           <!-- Author (Only if entry.author is present -->  
    54. \r\n\t
    55.           <div class=\"gf-author\"></div>  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.           <!-- Published Date (Only if entry.publishedDate is present -->  
    60. \r\n\t
    61.           <div class=\"gf-relativePublishedDate\"></div>  
    62. \r\n\t
    63.   
    64. \r\n\t
    65.           <!-- Snippet entry.contentSnippet -->  
    66. \r\n\t
    67.           <div class=\"gf-snippet\"></div>  
    68. \r\n\t
    69.   
    70. \r\n\t
    71.         </div>  
    72. \r\n\t
    73.       </div>  
    74. \r\n\t
    75.       ...  
    76. \r\n\t
    77.       <div class=\"gfc-result\"></div>  
    78. \r\n\t
    79.     </div>  
    80. \r\n\t
    81.   </div>  
    82. \r\n\t
    83.   ...  
    84. \r\n\t
    85.   <div class=\"gfc-resultsRoot\"></div>  
    86. \r\n\t
    87.   
    88. \r\n\t
    89. </div>  
    90. \r\n
    \r\n
    \r\n参考Google文档:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl", "created_at"=>2007-10-14 02:55:28 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

     这篇文章是我很早前写的,放在原来的blog上的,无奈那个blog坏掉了,幸好还有”百度快照 “(http://cache.baidu.com/c?word=feedcontrol&url=http%3A//weblog%; 2E1ster%2Ecn/%3Faction%3Dshow%26id%3D112&p=98769a45dcd011a05be7d3284c0096& user=baidu),找回来了,呵呵。以下是原文。

    \n\n

    Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:
    \n其API都很简单,详细的可以看这个页面上的介绍:
    \nhttp://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl
    \n只有一个构造器:FeedControl
    \n四个函数:
    \n1.addFeed(url, label) //添加需要显示的FEED的URL
    \n2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:

    \n\n

    feedControl.draw(
    \ndocument.getElementById("feedControl"),
    \n{
    \ndrawMode : google.feeds.FeedControl.DRAW_MODE_TABBED
    \n});

    \n\n

    feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.

    \n\n

    3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)
    \n4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下:

    \n\n
      \n
    • google.feeds.LINK_TARGET_BLANK - links will open in a new window
    • \n
    • google.feeds.LINK_TARGET_SELF - links will open in the current window
    • \n
    • google.feeds.LINK_TARGET_TOP - links will open in the topmost frame
    • \n
    • google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame.
    • \n
    • anything-else - the value of target in the resulting anchor element is set to linkTarget
    • \n
    \n\n

    附录其网站上的说明:

    \n\n

    This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:

    \n\n

    var feedControl = new google.feeds.FeedControl();
    \nfeedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");
    \nfeedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");
    \nfeedControl.draw(document.getElementById("feedControl"));

    \n\n

    In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed.
    \n
    \n Basic FeedControl - feedcontrol.html
    \n Tabbed FeedControl - tabbed.html
    \n Sidebar Style FeedControl - sidebar.html
    \n AJAX Feed API Playground Blog
    \n
    \n另外,补充一点东西,如果你需要定制他的CSS样式表,可以按照这个模式定制,如下:
    \n
    \nXML/HTML代码
    \n
    \n <!-- The Feed Control Class (Note: Linear Mode is Shown) -->  
    \n <div class="gfc-control">  
    \n   
    \n   <!-- Per Feed Container -->  
    \n   <div class="gfc-resultsRoot">  
    \n   
    \n     <!-- Per Feed Header -->  
    \n     <!-- .gfc-title holds Feed's Label -->  
    \n     <div class="gfc-resultsHeader">  
    \n       <div class="gfc-title"></div>  
    \n     </div>  
    \n   
    \n     <!-- Collection of Entries -->  
    \n     <div class="gfc-results">  
    \n   
    \n       <!-- One .gfc-result per entry -->  
    \n       <div class="gfc-result">  
    \n   
    \n         <!-- One .gf-result per entry -->  
    \n         <div class="gf-result">  
    \n   
    \n           <!-- Hyperlinked Entry Title -->  
    \n           <div class="gf-title">  
    \n             <a class="gf-title"></a>  
    \n           </div>  
    \n   
    \n           <!-- Author (Only if entry.author is present -->  
    \n           <div class="gf-author"></div>  
    \n   
    \n           <!-- Published Date (Only if entry.publishedDate is present -->  
    \n           <div class="gf-relativePublishedDate"></div>  
    \n   
    \n           <!-- Snippet entry.contentSnippet -->  
    \n           <div class="gf-snippet"></div>  
    \n   
    \n         </div>  
    \n       </div>  
    \n       ...  
    \n       <div class="gfc-result"></div>  
    \n     </div>  
    \n   </div>  
    \n   ...  
    \n   <div class="gfc-resultsRoot"></div>  
    \n   
    \n </div>  
    \n
    \n
    \n参考Google文档:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl

    \n", "_id"=>674}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随笔有用的Ruby的函数~", "body"=>"

     

    \n

    经常查一些比较有用的Ruby函数,时间久了就忘记了,随手记录下,以备忘,如果你有不错的函数,欢迎分享,如果顺便附带上一些实例代码就更好了。

    \n

    \n

    \n
    ActiveSupport::CoreExtensions::String::StartsEndsWith
    \n
      \n
    1. starts_with?  
    2. \n
    3.   
    4. \n
    5. Description  
    6. \n
    7. starts_with?(prefix)   
    8. \n
    9. Does the string start with the specified prefix?   
    10. \n
    \n
    \n例如如下代码检测上传的文件是否是图片:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. ( params[:asset][:uploaded_data].content_type.to_s.starts_with?  "image" )  
    2. \n
    \n
    \n

    ", "created_at"=>2007-10-14 15:28:36 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

     
    \n经常查一些比较有用的Ruby函数,时间久了就忘记了,随手记录下,以备忘,如果你有不错的函数,欢迎分享,如果顺便附带上一些实例代码就更好了。
    \n
    \n
    \nActiveSupport::CoreExtensions::String::StartsEndsWith
    \n
    \n starts_with?  
    \n   
    \n Description  
    \n starts_with?(prefix)   
    \n Does the string start with the specified prefix?   
    \n
    \n
    \n例如如下代码检测上传的文件是否是图片:
    \n
    \n
    \nRuby代码
    \n
    \n ( params[:asset][:uploaded_data].content_type.to_s.starts_with?  "image" )  
    \n
    \n

    \n", "_id"=>675}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 1.2.5: Security and maintenance release", "body"=>"

    This release closes a JSON XSS vulnerability, fixes a couple of minor regressions introduced in 1.2.4, and backports a handful of features and fixes from the 2.0 preview release.

    \n

    All users of Rails 1.2.4 or earlier are advised to upgrade to 1.2.5, though it isn’t strictly necessary if you aren’t working with JSON. For more information the JSON vulnerability, see CVE-2007-3227.

    \n

    Summary of changes:

    \n
      \n
    • acts_as_list: fixed an edge case where removing an item from the list then destroying the item leads to incorrect item positioning
    • \n
    • deprecated calling .create on has_many associations with an unsaved owner (like post = Post.new; post.comments.create)
    • \n
    • backport array and hash query parameters
    • \n
    • fix in place editor’s setter action with non-string fields
    • \n
    • updated config/boot.rb to correctly recognize RAILS_GEM_VERSION
    • \n
    \n

    To upgrade, `gem install rails`, set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and `rake rails:update:configs`.

    ", "created_at"=>2007-10-15 03:23:17 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    This release closes a JSON XSS vulnerability, fixes a couple of minor regressions introduced in 1.2.4, and backports a handful of features and fixes from the 2.0 preview release.
    \nAll users of Rails 1.2.4 or earlier are advised to upgrade to 1.2.5, though it isn’t strictly necessary if you aren’t working with JSON. For more information the JSON vulnerability, see CVE-2007-3227.
    \nSummary of changes:
    \n
    \n acts_as_list: fixed an edge case where removing an item from the list then destroying the item leads to incorrect item positioning
    \n deprecated calling .create on has_many associations with an unsaved owner (like post = Post.new; post.comments.create)
    \n backport array and hash query parameters
    \n fix in place editor’s setter action with non-string fields
    \n updated config/boot.rb to correctly recognize RAILS_GEM_VERSION
    \n
    \nTo upgrade, gem install rails, set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and rake rails:update:configs.

    \n", "_id"=>676}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails URL Validation", "body"=>"

    从上看到的,随手记录如下,可能需要用到。

    \n
    \n
    Rails URL Validation
    \n
      \n
    1. validates_each :href:on => :create do |record, attr, value|  
    2. \n
    3.   begin  
    4. \n
    5.     uri = URI.parse(value)  
    6. \n
    7.     if uri.class != URI::HTTP  
    8. \n
    9.       record.errors.add(attr, 'Only HTTP protocol addresses can be used')  
    10. \n
    11.     end  
    12. \n
    13.   rescue URI::InvalidURIError  
    14. \n
    15.     record.errors.add(attr, 'The format of the url is not valid.')  
    16. \n
    17.   end  
    18. \n
    19. end  
    20. \n
    \n
    \n

    以前我判断的时候都是按照是不是http://开头等做的判断,感觉好傻,这样的判断才更加专业和准确。

    ", "created_at"=>2007-10-16 05:31:31 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    从上看到的,随手记录如下,可能需要用到。
    \n
    \nRails URL Validation
    \n
    \n validates_each :href, :on => :create do |record, attr, value|  
    \n   begin  
    \n     uri = URI.parse(value)  
    \n     if uri.class != URI::HTTP  
    \n       record.errors.add(attr, 'Only HTTP protocol addresses can be used')  
    \n     end  
    \n   rescue URI::InvalidURIError  
    \n     record.errors.add(attr, 'The format of the url is not valid.')  
    \n   end  
    \n end  
    \n
    \n
    \n以前我判断的时候都是按照是不是http://开头等做的判断,感觉好傻,这样的判断才更加专业和准确。

    \n", "_id"=>677}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"

    firefox不能显示alt指定的文字,只能显示title 指定的,以前的做法是每个地方都写两个,真是够麻烦的,在rails中可以扩充下这个helper,使用起来方便多了,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. module ApplicationHelper  
    2. \n
    3.   def image_tag(location, options)  
    4. \n
    5.     options[:title] ||= options[:alt]  
    6. \n
    7.     super(location, options)  
    8. \n
    9.   end  
    10. \n
    11. end  
    12. \n
    \n
    \n感谢互联网~

    ", "created_at"=>2007-10-16 05:39:50 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    firefox不能显示alt指定的文字,只能显示title 指定的,以前的做法是每个地方都写两个,真是够麻烦的,在rails中可以扩充下这个helper,使用起来方便多了,如下:
    \n
    \n
    \nRuby代码
    \n
    \n module ApplicationHelper  
    \n   def image_tag(location, options)  
    \n     options[:title] ||= options[:alt]  
    \n     super(location, options)  
    \n   end  
    \n end  
    \n
    \n
    \n感谢互联网~

    \n", "_id"=>678}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"软件架构的十大错误", "body"=>"

    在infoQ上看到一篇关于软件构架的文章,说了一个软件构架中可能存在的一些错误,有些错误在现有的软件,项目构架中是普遍存在的问题,转载记录一二。

    \n

    虽然我不是构架师,但是在做RoR项目的时候,这些角色都是混杂起来的,必须是全部了解,因为没有那么多的空闲资源,所以了解还是很有必要的。

    \n

    原文开始:

    \n

    IASA成员Eoin Woods发表了一篇文章讲述他所认为的十大软件架构错误——常常要碰得头破血流才会得到的一些教训。这十大错误简要总结如下:

    \n
      \n
    1. 不能界定项目范围。“在这种情况发生时,一个简单的出差登记系统结果变成内建了完整的花费报销管理系统,项目费用、时间跨度和质量都留下不可避免的烂摊子……除了简单的登录真的不需要安全措施了?用户登录系统后真的不能够执行任何系统操作吗?”
    2. \n
    3. 网撒得不够宽。“我们都曾经犯过的一个错误是,只关注系统所有利益相关者中的一两方——通常受让人(为系统出钱的人)和最终用户得到了全部的关注。”
    4. \n
    5. 只关注功能。“……除非系统表现出了全面的高质量(诸如性能、安全、可维护性等等),否则不太可能成功。”
    6. \n
    7. 用方框和线条来描述。“[一个无所不包的]巨大的Visio图无法成为有效的架构描述,有两个原因:第一,它试图在单一表示中呈现太多信息;第二,没人真正清楚地知道你画的各种符号到底表示什么意思。”
    8. \n
    9. 忘了需要培养的过程。“在建造系统的时候常常需要小心的事物包括:开发者和测试者没法真正理解设计,他们不热衷或者没时间学习技术,以及还没有很好的工具支持的新技术,或者新技术会强迫人们以新的不熟悉的方式工作。”
    10. \n
    11. 平台定义不精确。“光用‘需要Unix和Oracle’来描述你的平台是不足够的。你需要精确地说明每一部分具体的版本和配置,才能保证得到你所需的平台。不然如果有人好心为平台的某一部分升级了一个库,就可能导致某些东西停止运作。精确定义平台你才能在部署中避免这样的情形。”
    12. \n
    13. 对性能和伸缩能力想当然。“及早开始考虑性能和伸缩性,构建性能模型尝试预测关键的性能指标并定位瓶颈,在设计逐渐成型的同时投入到一些实际的验证性工作中去。这会帮助你提高对设计中不存在严重性能和伸缩性缺陷的信心。”
    14. \n
    15. 自己发明安全技术。“多 年来许多系统所犯的一个错误是试图加入自己发明的安全技术来提高系统安全性。比如定制的加密算法,开发者自己编写的审核系统,甚至完全DIY的访问控制系 统。自家开发的安全方案基本上都是不明智的。虽然很多人都以为自己可以马上搞出一些聪明的安全技术,但通常都只是自作聪明。”
    16. \n
    17. 没有灾难恢复。“要想得到资源来实现系统的灾难恢复机制,其关键在于在若干真实的场景中,具体衡量系统不可用所导致的损失。如果你还能估算这些场景发生的概率,你就可以用这两组数据去说服人们灾难恢复的重要性,并获得合理的预算去实现它。”
    18. \n
    19. 没有撤退计划。“确保无论在系统部署或升级的过程中发生任何事,你都有一份书面的、经过审查的、一致同意的撤退计划,允许你将整个环境恢复到部署之前的状态。”
    20. \n
    \n

    Eoin Woods是UBS Investment Bank的软件及企业架构师。

    \n

    查看英文原文:Top Ten Software Architecture Mistakes

    ", "created_at"=>2007-10-19 01:22:23 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    在infoQ上看到一篇关于软件构架的文章,说了一个软件构架中可能存在的一些错误,有些错误在现有的软件,项目构架中是普遍存在的问题,转载记录一二。
    \n虽然我不是构架师,但是在做RoR项目的时候,这些角色都是混杂起来的,必须是全部了解,因为没有那么多的空闲资源,所以了解还是很有必要的。
    \n原文开始:
    \nIASA成员Eoin Woods发表了一篇文章讲述他所认为的十大软件架构错误——常常要碰得头破血流才会得到的一些教训。这十大错误简要总结如下:
    \n
    \n 不能界定项目范围。“在这种情况发生时,一个简单的出差登记系统结果变成内建了完整的花费报销管理系统,项目费用、时间跨度和质量都留下不可避免的烂摊子……除了简单的登录真的不需要安全措施了?用户登录系统后真的不能够执行任何系统操作吗?”
    \n 网撒得不够宽。“我们都曾经犯过的一个错误是,只关注系统所有利益相关者中的一两方——通常受让人(为系统出钱的人)和最终用户得到了全部的关注。”
    \n 只关注功能。“……除非系统表现出了全面的高质量(诸如性能、安全、可维护性等等),否则不太可能成功。”
    \n 用方框和线条来描述。“[一个无所不包的]巨大的Visio图无法成为有效的架构描述,有两个原因:第一,它试图在单一表示中呈现太多信息;第二,没人真正清楚地知道你画的各种符号到底表示什么意思。”
    \n 忘了需要培养的过程。“在建造系统的时候常常需要小心的事物包括:开发者和测试者没法真正理解设计,他们不热衷或者没时间学习技术,以及还没有很好的工具支持的新技术,或者新技术会强迫人们以新的不熟悉的方式工作。”
    \n 平台定义不精确。“光用‘需要Unix和Oracle’来描述你的平台是不足够的。你需要精确地说明每一部分具体的版本和配置,才能保证得到你所需的平台。不然如果有人好心为平台的某一部分升级了一个库,就可能导致某些东西停止运作。精确定义平台你才能在部署中避免这样的情形。”
    \n 对性能和伸缩能力想当然。“及早开始考虑性能和伸缩性,构建性能模型尝试预测关键的性能指标并定位瓶颈,在设计逐渐成型的同时投入到一些实际的验证性工作中去。这会帮助你提高对设计中不存在严重性能和伸缩性缺陷的信心。”
    \n 自己发明安全技术。“多 年来许多系统所犯的一个错误是试图加入自己发明的安全技术来提高系统安全性。比如定制的加密算法,开发者自己编写的审核系统,甚至完全DIY的访问控制系 统。自家开发的安全方案基本上都是不明智的。虽然很多人都以为自己可以马上搞出一些聪明的安全技术,但通常都只是自作聪明。”
    \n 没有灾难恢复。“要想得到资源来实现系统的灾难恢复机制,其关键在于在若干真实的场景中,具体衡量系统不可用所导致的损失。如果你还能估算这些场景发生的概率,你就可以用这两组数据去说服人们灾难恢复的重要性,并获得合理的预算去实现它。”
    \n 没有撤退计划。“确保无论在系统部署或升级的过程中发生任何事,你都有一份书面的、经过审查的、一致同意的撤退计划,允许你将整个环境恢复到部署之前的状态。”
    \n
    \nEoin Woods是UBS Investment Bank的软件及企业架构师。
    \n查看英文原文:Top Ten Software Architecture Mistakes

    \n", "_id"=>679}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云:两人两周的Web 2.0网站", "body"=>"

    本文是infoQ中文站的采访帖,版权归infoQ所有,如需要查看原文,请到这里

    \n

    作者 \t\t\t霍泰稳 \t\t\t发布于 \t\t\t2007年10月17日 上午3时7分

    \n
    社区Architecture,Ruby
    主题Web 2.0,Ruby on Rails
    \n

    编者按:因 为Ruby on Rails的出现,借用互联网创业的人越来越多,虽然不能说全是RoR的功劳,但至少说明技术门槛的降低加速了互联网的发展。从前从一个点子的产生到实现 可能要耗费少则几个月,多则几年的时间,而现在,只要你的点子够新,有实践的可能,几天几周就可以看到原型。而后面的维护也比较方便,几乎可以说是实时进 行。本文通过采访技能云网站的策划人熊节和主设计师Iceskysl就是想证明前文所述,据两人介绍,这两个到现在还没有见过面的年轻人通过网络,在不到两周的时间里,将一个创意点子变成了现实。

    \n

    InfoQ中文站:这个项目发布后,你被人问到的最多的三个问题是什么?

    \n

    InfoQ中文站:介绍一下你自己和你的团队?

    \n

    IceskYsl:我是IceskYsl,目前还是靠Java吃饭,ROR是暂时还是业余活动,很享受这种方 式;1sters!暂时还是个虚拟的、我自己心中理想中的团队模式,也正一步步的走向成熟。我接触RoR有一段时间了,期间被它的灵活吸引,有事没事的就 会写写代码,时间不多,写了好几个像模像样的系统如:

    \n
      \n
    1. byeloo.cn(毕业咯):一个开源的多班级同学录系统,趴在床上用笔画出大概的模块以及基本的数据结构后;利用一个通宵写完了整个框架,而后就上线使用,根据同学们的要求,主键完善。目前功能都很实用;
    2. \n
    3. 然后是1stlog,一个针对国内用户的基于ROR的blog程序,功能强大可定制,方便扩展,已经发布两个版本,马上即将发布第三个版本;
    4. \n
    5. 1sters.com:一个集新闻,产品展示,官方blog,已经产品缺陷跟踪管理于一体的CMS系统;
    6. \n
    7. 1stimes:第一次是一个分享你我第一次经历的Web 2.0的系统;
    8. \n
    9. itechtag:技能云。
    10. \n
    \n

    熊节:我是熊节,网名叫"透明"的。先后干过媒体、程序员、咨询师三种职业,所以有一堆Web 2.0的点子。可惜每天忙忙叨叨的,这些点子落地的很少。

    \n

    InfoQ中文站:技能云的创意是从何而来?

    \n

    IceskYsl:项目的创意随着时间逐步演化,起初只是为程序员及其相关的人提供一个展现自我的平台,为国内的程序员赢得更多的他曾被无形剥夺的东西;进而发展为项目展示、交流、经验分享及其人脉的一个平台。

    \n

    熊节:这个东西的想法很简单:我要有一个widget挂 在我的blog上,告诉别人我有些什么技能,譬如说我Ruby很不错、Java很不错、JavaScript也有经验,等等。为什么我想给别人show这 些呢?因为我觉得骄傲,为自己骄傲。我在过去的8年里一直在编程,我掌握了那么多的技能,我觉得很骄傲。说白了就是,我要向别人炫耀自己的技能。

    \n

    东西很简单,但背后可以有引申。这个炫耀的widget一展开,就引出了别的东西,那就是从哪里得到这些技能的信息。当然了,只有从项目经验里来。 只有真正在项目里做过,用过一种技术,你才能说你掌握了这种技能。而且一般来说,技能掌握的熟练程度还是和使用的时间成正比的。所以iTechTag是以 项目为基础的。你不能说自己"精通"、"熟练掌握"什么技能,你必须证明,证据就是真实的项目经验。

    \n

    那么有了一个炫耀的widget,有了一堆项目经验,就可以很方便的导出简历了。(这是我们下一步的重点功能。)技能-经验-简历,这个三位一体就 构成了一个程序员的声望(reputation)。谁对这些声望感兴趣呢?当然是正在招人的潜在雇主。换句话说iTechTag的注册用户在炫耀的同时顺 手得到了直接面对潜在雇主的机会。这就是我一开始说的,“释放程序员声望的价值”。如果说开源软件是把源代码的价值还给程序员(和用户),那么 iTechTag这个模式就像是人才招聘领域的开源,把程序员的价值还给程序员(和潜在雇主)。

    \n

    InfoQ中文站:为什么会采用 RoR实现,用RoR开发你们体味到什么特殊之处?
    \nInfoQ中文站:这个项目的开发过程是怎么样子的,比如时间、人力等?
    \nInfoQ中文站:敏捷开发方法在你们的开发过程中有没有得到什么实践?
    \nInfoQ中文站:类似于用RoR开发技能云这样的项目,有什么经验和教训和大家分享?

    \n

    IceskYsl:Idea一定要足够的好,且你自己对这个Idea有充分的兴趣,自己必须是这个Idea的超级拥护者和使用者。必须脱离传统的类似外包项目的模式,否则其中的乐趣你肯定体会不到。

    ", "created_at"=>2007-10-19 02:06:21 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    本文是infoQ中文站的采访帖,版权归infoQ所有,如需要查看原文,请到这里:
    \n作者 霍泰稳 发布于 2007年10月17日 上午3时7分
    \n社区Architecture,Ruby主题Web 2.0,Ruby on Rails
    \n编者按:因 为Ruby on Rails的出现,借用互联网创业的人越来越多,虽然不能说全是RoR的功劳,但至少说明技术门槛的降低加速了互联网的发展。从前从一个点子的产生到实现 可能要耗费少则几个月,多则几年的时间,而现在,只要你的点子够新,有实践的可能,几天几周就可以看到原型。而后面的维护也比较方便,几乎可以说是实时进 行。本文通过采访技能云网站的策划人熊节和主设计师Iceskysl就是想证明前文所述,据两人介绍,这两个到现在还没有见过面的年轻人通过网络,在不到两周的时间里,将一个创意点子变成了现实。
    \nInfoQ中文站:这个项目发布后,你被人问到的最多的三个问题是什么?
    \nInfoQ中文站:介绍一下你自己和你的团队?
    \nIceskYsl:我是IceskYsl,目前还是靠Java吃饭,ROR是暂时还是业余活动,很享受这种方 式;1sters!暂时还是个虚拟的、我自己心中理想中的团队模式,也正一步步的走向成熟。我接触RoR有一段时间了,期间被它的灵活吸引,有事没事的就 会写写代码,时间不多,写了好几个像模像样的系统如:
    \n
    \n byeloo.cn(毕业咯):一个开源的多班级同学录系统,趴在床上用笔画出大概的模块以及基本的数据结构后;利用一个通宵写完了整个框架,而后就上线使用,根据同学们的要求,主键完善。目前功能都很实用;
    \n 然后是1stlog,一个针对国内用户的基于ROR的blog程序,功能强大可定制,方便扩展,已经发布两个版本,马上即将发布第三个版本;
    \n 1sters.com:一个集新闻,产品展示,官方blog,已经产品缺陷跟踪管理于一体的CMS系统;
    \n 1stimes:第一次是一个分享你我第一次经历的Web 2.0的系统;
    \n itechtag:技能云。
    \n
    \n熊节:我是熊节,网名叫"透明"的。先后干过媒体、程序员、咨询师三种职业,所以有一堆Web 2.0的点子。可惜每天忙忙叨叨的,这些点子落地的很少。
    \nInfoQ中文站:技能云的创意是从何而来?
    \nIceskYsl:项目的创意随着时间逐步演化,起初只是为程序员及其相关的人提供一个展现自我的平台,为国内的程序员赢得更多的他曾被无形剥夺的东西;进而发展为项目展示、交流、经验分享及其人脉的一个平台。
    \n熊节:这个东西的想法很简单:我要有一个widget挂 在我的blog上,告诉别人我有些什么技能,譬如说我Ruby很不错、Java很不错、JavaScript也有经验,等等。为什么我想给别人show这 些呢?因为我觉得骄傲,为自己骄傲。我在过去的8年里一直在编程,我掌握了那么多的技能,我觉得很骄傲。说白了就是,我要向别人炫耀自己的技能。
    \n东西很简单,但背后可以有引申。这个炫耀的widget一展开,就引出了别的东西,那就是从哪里得到这些技能的信息。当然了,只有从项目经验里来。 只有真正在项目里做过,用过一种技术,你才能说你掌握了这种技能。而且一般来说,技能掌握的熟练程度还是和使用的时间成正比的。所以iTechTag是以 项目为基础的。你不能说自己"精通"、"熟练掌握"什么技能,你必须证明,证据就是真实的项目经验。
    \n那么有了一个炫耀的widget,有了一堆项目经验,就可以很方便的导出简历了。(这是我们下一步的重点功能。)技能-经验-简历,这个三位一体就 构成了一个程序员的声望(reputation)。谁对这些声望感兴趣呢?当然是正在招人的潜在雇主。换句话说iTechTag的注册用户在炫耀的同时顺 手得到了直接面对潜在雇主的机会。这就是我一开始说的,“释放程序员声望的价值”。如果说开源软件是把源代码的价值还给程序员(和用户),那么 iTechTag这个模式就像是人才招聘领域的开源,把程序员的价值还给程序员(和潜在雇主)。
    \nInfoQ中文站:为什么会采用 RoR实现,用RoR开发你们体味到什么特殊之处?
    \nInfoQ中文站:这个项目的开发过程是怎么样子的,比如时间、人力等?
    \nInfoQ中文站:敏捷开发方法在你们的开发过程中有没有得到什么实践?
    \nInfoQ中文站:类似于用RoR开发技能云这样的项目,有什么经验和教训和大家分享?
    \nIceskYsl:Idea一定要足够的好,且你自己对这个Idea有充分的兴趣,自己必须是这个Idea的超级拥护者和使用者。必须脱离传统的类似外包项目的模式,否则其中的乐趣你肯定体会不到。

    \n", "_id"=>680}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu下出现缺少openssl的解决", "body"=>"

    MissingSourceFile in PeopleController#invite

    \n

    no such file to load -- openssl

    \n``解决:
    $ sudo apt-get install libopenssl-ruby1.8```", "created_at"=>2007-10-21 13:11:55 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    MissingSourceFile in PeopleController#invite
    \nno such file to load -- openssl
    \n<font size="3"><strong>解决:</strong><br /></font>$ sudo apt-get install libopenssl-ruby1.8`

    \n", "_id"=>681}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"请freeze你的Rails!", "body"=>"

    早上起了一个大早,打开电脑,打开技能云,寒~出错了,信息如下:

    \n

    Rails application failed to start properly"RewriteCond %{HTTP_REFERER} !^http://1stimes.liquidchinaware.com/.*$ [NC]

    \n

    看来有点问题,赶紧打开log看看,没有任何错误,看来还没到这步,奇怪,感觉应该是.htaccess的问题,但是我没改过呀,copy一个好的过去,还是不行,郁闷!

    \n

    赶紧./script/server 试试,提示找不到1.2.3版本的rails,接着rails -v 看下,我靠,咋成1.2.5了,看来是Bl自己升级了,也不通知下,囧~

    \n

    找到问题就好办了,修改配置文件environment.rb,把rails版本改成1.2.5即可!

    \n

    引出另外一个话题,需要freeze你的Rails么?答案是肯定的,转另外一个老外写的一段话,如下:

    \n

    "Freezing Rails is recommended if you are using a Rails application for a business site or another production environment where stability is the most important concern (if you don't freeze your application, there is a small possibility that your application might stop working due to compatibility problems when a new version of Rails is installed on our servers)."

    \n

    方法很简单:rake rails:freeze:gems等几个命令就ok,会把rails单独拷贝到你的 vender下,而rails启动的时候先看这个目录,如果有就加载,没有的话再加载系统的。

    \n

    至于为什么这么做,你可以参考他写的文章:http://support.tigertech.net/freeze-rails

    \n

    参考命令:

    \n``rake rails:freeze:gems
    rake rails:freeze:edge
    rake rails:freeze:edge TAG=rel_1-1-6
    rake rails:unfreeze```\n

     

    ", "created_at"=>2007-10-22 03:31:32 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    早上起了一个大早,打开电脑,打开技能云,寒~出错了,信息如下:
    \nRails application failed to start properly"RewriteCond %{HTTP_REFERER} !^http://1stimes.liquidchinaware.com/.*$ [NC]
    \n看来有点问题,赶紧打开log看看,没有任何错误,看来还没到这步,奇怪,感觉应该是.htaccess的问题,但是我没改过呀,copy一个好的过去,还是不行,郁闷!
    \n赶紧./script/server 试试,提示找不到1.2.3版本的rails,接着rails -v 看下,我靠,咋成1.2.5了,看来是Bl自己升级了,也不通知下,囧~
    \n找到问题就好办了,修改配置文件environment.rb,把rails版本改成1.2.5即可!
    \n引出另外一个话题,需要freeze你的Rails么?答案是肯定的,转另外一个老外写的一段话,如下:
    \n"Freezing Rails is recommended if you are using a Rails application for a business site or another production environment where stability is the most important concern (if you don't freeze your application, there is a small possibility that your application might stop working due to compatibility problems when a new version of Rails is installed on our servers)."
    \n方法很简单:rake rails:freeze:gems等几个命令就ok,会把rails单独拷贝到你的 vender下,而rails启动的时候先看这个目录,如果有就加载,没有的话再加载系统的。
    \n至于为什么这么做,你可以参考他写的文章:http://support.tigertech.net/freeze-rails
    \n参考命令:
    \n<a name="freezing-to-a-different">rake rails:freeze:gems<br />rake rails:freeze:edge<br /></a><a name="freezing-to-a-different">rake rails:freeze:edge TAG=rel_1-1-6<br /></a><a name="unfreezing-thawing-rails">rake rails:unfreeze</a>`
    \n 

    \n", "_id"=>682}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留神你的session文件~", "body"=>"

    早上6点半起床,打开电脑,打开技能云,一切正常,开始写Gtalk的发送消息的ruby代码,很顺利,全部搞定,准备关机的时候,刷新了下技能云,显示启动错误!

    \n

    晕,哪里出问题了呢?我刚才没有更新代码上去呀,看来是系统的问题,SSH上去,看日志没有任何有用的信息,调试一把,可以启动,难道是 sessions的问题(我的session还是保存在文件系统里面的),转到tmp/sessions下wc -l 了一下,寒,7W多个文件,恐怖,貌似我忘记清理了,直接rm * (保存密码的人别骂我哈),显示参数过长,郁闷,看来文件数太多了,文件貌似也没有什么规律,总不能一个一个删吧(傻瓜才这个干),于是寻找解决办法。

    \n

    Google到这段代码,试了下可以正常工作,共享给大家:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'find'   
    2. \n
    3. namespace :tmp do    
    4. \n
    5.     namespace :sessions do    
    6. \n
    7.         desc 'Clear expired sessions'    
    8. \n
    9.         task :clear_expired => :environment do    
    10. \n
    11.             ctime = (ENV['ctime'] || 120).to_i    
    12. \n
    13.             atime = (ENV['atime'] || 20).to_i    
    14. \n
    15.             Find.find(RAILS_ROOT + "/tmp/sessions/"do |path|   
    16. \n
    17.                 if FileTest.directory?(path)    
    18. \n
    19.                     if File.basename(path)[0] == ?.    
    20. \n
    21.                         Find.prune    
    22. \n
    23.                     else    
    24. \n
    25.                         next   
    26. \n
    27.                     end    
    28. \n
    29.                 else    
    30. \n
    31.                 File.delete(path) if File.ctime(path) < ctime.minutes.ago or File.atime(path) < atime.minutes.ago    
    32. \n
    33.                 end    
    34. \n
    35.             end    
    36. \n
    37.         end    
    38. \n
    39.     end   
    40. \n
    41. end   
    42. \n
    \n
    \n按照作者给出的用法,如下:

    \n

    It can be run with 2 optional parameters: “atime”, which defines the time in minutes that will be compared against the last access time of a session file and “ctime” which defines the time in minutes that will be compared against the creation time of a session file. The default values are: ctime = 120 (minutes) and atime = 20 (miuntes) which means that the session files not accessed in the last 20 minutes and created earlier than 2 hours ago will be removed when the script runs.

    \n

    保存到你的lib/tasks目录下,然后用rake -T就可以看到这个rake命令,可以接受两个参数,举个例子,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. rake tmp:sessions:clear_expired atime=15 ctime=60  
    2. \n
    \n
    \n另外,还google到一段直接配置的脚本,如下:

    \n

    Here's a cron-only one liner which, every 30 min, removes all session files that haven't been accessed in 4 hours. 10,40 * * * * /usr/bin/find /u/apps/*/current/tmp/sessions -name "ruby_sess*" -amin +240 -exec rm {} \\;

    \n

    如果你有更优雅的方法,请分享给我,谢谢~

    \n

    参考地址:
    \nhttp://www.taknado.com/2007/7/25/rake-task-to-clear-expired-session-files

    ", "created_at"=>2007-10-25 01:59:53 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    早上6点半起床,打开电脑,打开技能云,一切正常,开始写Gtalk的发送消息的ruby代码,很顺利,全部搞定,准备关机的时候,刷新了下技能云,显示启动错误!
    \n晕,哪里出问题了呢?我刚才没有更新代码上去呀,看来是系统的问题,SSH上去,看日志没有任何有用的信息,调试一把,可以启动,难道是 sessions的问题(我的session还是保存在文件系统里面的),转到tmp/sessions下wc -l 了一下,寒,7W多个文件,恐怖,貌似我忘记清理了,直接rm * (保存密码的人别骂我哈),显示参数过长,郁闷,看来文件数太多了,文件貌似也没有什么规律,总不能一个一个删吧(傻瓜才这个干),于是寻找解决办法。
    \nGoogle到这段代码,试了下可以正常工作,共享给大家:
    \n
    \nRuby代码
    \n
    \n require 'find'   
    \n namespace :tmp do    
    \n     namespace :sessions do    
    \n         desc 'Clear expired sessions'    
    \n         task :clear_expired => :environment do    
    \n             ctime = (ENV['ctime'] || 120).to_i    
    \n             atime = (ENV['atime'] || 20).to_i    
    \n             Find.find(RAILS_ROOT + "/tmp/sessions/") do |path|   
    \n                 if FileTest.directory?(path)    
    \n                     if File.basename(path)[0] == ?.    
    \n                         Find.prune    
    \n                     else    
    \n                         next   
    \n                     end    
    \n                 else    
    \n                 File.delete(path) if File.ctime(path) < ctime.minutes.ago or File.atime(path) < atime.minutes.ago    
    \n                 end    
    \n             end    
    \n         end    
    \n     end   
    \n end   
    \n
    \n
    \n按照作者给出的用法,如下:
    \nIt can be run with 2 optional parameters: “atime”, which defines the time in minutes that will be compared against the last access time of a session file and “ctime” which defines the time in minutes that will be compared against the creation time of a session file. The default values are: ctime = 120 (minutes) and atime = 20 (miuntes) which means that the session files not accessed in the last 20 minutes and created earlier than 2 hours ago will be removed when the script runs.
    \n保存到你的lib/tasks目录下,然后用rake -T就可以看到这个rake命令,可以接受两个参数,举个例子,如下:
    \n
    \n
    \nRuby代码
    \n
    \n rake tmp:sessions:clear_expired atime=15 ctime=60  
    \n
    \n
    \n另外,还google到一段直接配置的脚本,如下:
    \nHere's a cron-only one liner which, every 30 min, removes all session files that haven't been accessed in 4 hours. 10,40 * * * * /usr/bin/find /u/apps//current/tmp/sessions -name "ruby_sess" -amin +240 -exec rm {} \\;
    \n如果你有更优雅的方法,请分享给我,谢谢~
    \n参考地址:
    \nhttp://www.taknado.com/2007/7/25/rake-task-to-clear-expired-session-files

    \n", "_id"=>683}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的一个域名丢了", "body"=>"

    去年买的一个我比较喜欢的域名,前几天到期了,找原来的代理找不到了,于是没有办法续费,还抱着侥幸的心理准备等他重新投入注册的时候再次注册,但是让人郁闷的事情发生了。

    \n

    今天早上起来,发现被人抢注了,真TMD郁闷,真有这些鸟公司专门敢这样的事情,丫的把我郁闷的不行。

    \n

    但是没有办法,忘记他吧。把手上的域名保护好。这个无论如何也不能再丢了。最后还鄙视下那个抢我域名的鸟公司。

    ", "created_at"=>2007-10-29 14:04:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    去年买的一个我比较喜欢的域名,前几天到期了,找原来的代理找不到了,于是没有办法续费,还抱着侥幸的心理准备等他重新投入注册的时候再次注册,但是让人郁闷的事情发生了。
    \n今天早上起来,发现被人抢注了,真TMD郁闷,真有这些鸟公司专门敢这样的事情,丫的把我郁闷的不行。
    \n但是没有办法,忘记他吧。把手上的域名保护好。这个无论如何也不能再丢了。最后还鄙视下那个抢我域名的鸟公司。

    \n", "_id"=>684}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby GB2312和UTF-8编码转换", "body"=>"

    今天CFC测试技能云的时候,在导出简历的时候,报错,跟了下log发现,错误如下:

    \n

    Iconv::IllegalSequence ("閫欐槸涓€鍊嬪皣\\345"...):

    \n

    就是代码转换老是报错,原来CFC的输入的是繁体中文的,原来如此,一定要加上IGNORE参数,就好了。记录一下。\n

    \n
    Ruby代码
    \n
      \n
    1. Iconv.iconv("UTF-8//IGNORE","GB2312//IGNORE",text)  
    2. \n
    \n
    \n

    \n

    最后感谢写CFC同学~

    ", "created_at"=>2007-10-30 02:33:37 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    今天CFC测试技能云的时候,在导出简历的时候,报错,跟了下log发现,错误如下:
    \nIconv::IllegalSequence ("閫欐槸涓€鍊嬪皣\\345"...):
    \n就是代码转换老是报错,原来CFC的输入的是繁体中文的,原来如此,一定要加上IGNORE参数,就好了。记录一下。
    \n
    \nRuby代码
    \n
    \n Iconv.iconv("UTF-8//IGNORE","GB2312//IGNORE",text)  
    \n
    \n
    \n
    \n最后感谢写CFC同学~

    \n", "_id"=>685}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"导回以前的blog内容~", "body"=>"

    很早前在51boo的时候,在1ster.cn上的一个专题博客,由于51boo的最后down机,最后没办法恢复就一直放在那里了;前段时间51boo恢复了一阵子,我正好上去把这个内容做了下备份,当时图省事,直接备份了RSS,也就是XML格式的内容;

    \n

    昨天正好试试sablog后台的一个导入数据功能,说可以导入RSS文件,于是试着导入了一下以前备份下来的数据,比较幸运的是,很顺利,你现在可以看到很多我以前的写的、记录的文章了,虽然文字格式还有点问题,不过不影响阅读,就先这样吧。

    \n

    值得高兴一下,这次资料终于没有丢失。

    \n

    PS:1ster.cn被人抢注了,不是我的了,大家不用去那里看了:(

    ", "created_at"=>2007-10-30 05:00:48 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很早前在51boo的时候,在1ster.cn上的一个专题博客,由于51boo的最后down机,最后没办法恢复就一直放在那里了;前段时间51boo恢复了一阵子,我正好上去把这个内容做了下备份,当时图省事,直接备份了RSS,也就是XML格式的内容;
    \n昨天正好试试sablog后台的一个导入数据功能,说可以导入RSS文件,于是试着导入了一下以前备份下来的数据,比较幸运的是,很顺利,你现在可以看到很多我以前的写的、记录的文章了,虽然文字格式还有点问题,不过不影响阅读,就先这样吧。
    \n值得高兴一下,这次资料终于没有丢失。
    \nPS:1ster.cn被人抢注了,不是我的了,大家不用去那里看了:(

    \n", "_id"=>686}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用oracle", "body"=>"

    1.安装驱动
    \nhttp://rubyforge.org/projects/ruby-oci8/
    \n下载并运行(双击)ruby-oci8-mswin里面的*.rb
    \n
    \n2.更改database.yml

    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \nor
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: 192.168.0.50/examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \n没有用到database字段;exampleuser可以用tns来代替;
    \n
    \n我的oracle装在另外一台机器上,所以配置如下
    \ndevelopment:
    \n  adapter: oci
    \n  host: MyTnsName
    \n  username: system
    \n  password: manager

    \n

    参考地址:http://www.oracle.com/technology/global/cn/pub/articles/haefel-oracle-ruby.html

    ", "created_at"=>2007-11-07 01:26:17 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    1.安装驱动
    \nhttp://rubyforge.org/projects/ruby-oci8/
    \n下载并运行(双击)ruby-oci8-mswin里面的*.rb
    \n
    \n2.更改database.yml
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \nor
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: 192.168.0.50/examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \n没有用到database字段;exampleuser可以用tns来代替;
    \n
    \n我的oracle装在另外一台机器上,所以配置如下
    \ndevelopment:
    \n  adapter: oci
    \n  host: MyTnsName
    \n  username: system
    \n  password: manager
    \n参考地址:http://www.oracle.com/technology/global/cn/pub/articles/haefel-oracle-ruby.html

    \n", "_id"=>687}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"准备搬迁技能云,麻烦各地的朋友测试下速度~", "body"=>"

    首先感谢http://www.duxoo.com/的慷慨和大度,给技能云提供服务器,非常感谢。

    \n

    前几天做了搬迁预演,可以实现完全搬迁,不会遗失资料或者其他的什么,请各地的朋友帮忙测试下您所在位置的速度差异。

    \n

    请比较:
    \nhttp://www.itechtag.com/

    \n

    http://itechtag.i410.cn/

    \n

    这两个地址的响应速度,直接贴在下面即可,我好参考着看速度是否满意,谢谢各位参与者~

    ", "created_at"=>2007-11-08 02:56:38 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    首先感谢http://www.duxoo.com/的慷慨和大度,给技能云提供服务器,非常感谢。
    \n前几天做了搬迁预演,可以实现完全搬迁,不会遗失资料或者其他的什么,请各地的朋友帮忙测试下您所在位置的速度差异。
    \n请比较:
    \nhttp://www.itechtag.com/
    \nhttp://itechtag.i410.cn/
    \n这两个地址的响应速度,直接贴在下面即可,我好参考着看速度是否满意,谢谢各位参与者~

    \n", "_id"=>688}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(二):系统负载情况估算相关", "body"=>"

    --显示Linux内核版本号
    \n[root@CentOS4 ~]# uname -a
    \nLinux CentOS4.5 2.6.9-55.ELsmp #1 SMP Wed May 2 14:28:44 EDT 2007 i686 i686 i386 GNU/Linux
    \n语  法:uname [-amnrsv][--help][--version]
    \n补充说明:uname可显示电脑以及操作系统的相关信息。
    \n参  数:
    \n-a或--all  显示全部的信息。
    \n-m或--machine  显示电脑类型。
    \n-n或-nodename  显示在网络上的主机名称。
    \n-r或--release  显示操作系统的发行编号。
    \n-s或--sysname  显示操作系统名称。
    \n-V  显示操作系统的版本。
    \n--help  显示帮助。
    \n--version  显示版本信息。

    \n

    --查看Linux内存使用情况
    \n[root@CentOS4 ~]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       1034584      71752     962832          0       3740      35260
    \n-/+ buffers/cache:      32752    1001832
    \nSwap:      1052248          0    1052248
    \n
    \n
    \n语  法: free [-bkmotV][-s <间隔秒数>]
    \n free指令会显示内存的使用情况,包括实体内存,虚拟的交换文件内存,共享内存区段,以及系统核心使用的缓冲区等。
    \n参  数:
    \n-b  以Byte为单位显示内存使用情况。
    \n-k  以KB为单位显示内存使用情况。
    \n-m  以MB为单位显示内存使用情况。
    \n-o  不显示缓冲区调节列。
    \n-s<间隔秒数>  持续观察内存使用状况。
    \n-t  显示内存总和列。
    \n-V  显示版本信息。
    \n如MB为单位显示内存使用情况:
    \n[root@CentOS4 ~]# free -m
    \n             total       used       free     shared    buffers     cached
    \nMem:          1010         70        940          0          3         34
    \n-/+ buffers/cache:         31        978
    \nSwap:         1027          0       1027

    \n

    附录:free的详细解释:

    \n

    [root@Linux /tmp]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       4149156    4130412      18744          0      13220    2720160
    \n-/+ buffers/cache:    1397032    2752124
    \nSwap:      6289408        144    6289264第1行
    \ntotal 内存总数: 4149156
    \nused 已经使用的内存数: 4130412
    \nfree 空闲的内存数: 18744
    \nshared 当前已经废弃不用,总是0
    \nbuffers Buffer Cache内存数: 13220
    \ncached Page Cache内存数: 2720160
    \n
    \n关系:total = used + free
    \n
    \n第2行:
    \n-/+ buffers/cache的意思相当于:
    \n-buffers/cache 的内存数:1397032 (等于第1行的 used - buffers - cached)
    \n+buffers/cache 的内存数: 2752124 (等于第1行的 free + buffers + cached)
    \n
    \n可见-buffers/cache反映的是被程序实实在在吃掉的内存,而+buffers/cache反映的是可以挪用的内存总数。
    \n
    \n第三行单独针对交换分区, 就不用再说了.
    \n
    \n为了提高磁盘存取效率, Linux做了一些精心的设计, 除了对dentry进行缓存(用于VFS,加速文件路径名到inode的转换), 还采取了两种主要Cache方式:Buffer Cache和Page Cache。前者针对磁盘块的读写,后者针对文件inode的读写。这些Cache有效缩短了 I/O系统调用(比如read,write,getdents)的时间。
    \n
    \n如果感兴趣可以进一步参考文件/proc/meminfo,free命令就是根据它的信息生成的。free命令的源码可从procps-xxx-.src.rpm获取,xxx为版本号,比如procps-3.2.3-5.3.src.rpm。
    \n
    \n参考内核代码:
    \n
    \narch/i386/mm/init.c
    \nfs/proc/proc_misc.c
    \ninclude/linux/swap.h
    \nmm/filemap.c
    \nfs/buffer.c
    \n
    \n另外还可以参考O'REILLY的书《Understanding the LINUX KERNEL》。

    ", "created_at"=>2007-11-09 07:13:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    --显示Linux内核版本号
    \n[root@CentOS4 ~]# uname -a
    \nLinux CentOS4.5 2.6.9-55.ELsmp #1 SMP Wed May 2 14:28:44 EDT 2007 i686 i686 i386 GNU/Linux
    \n语  法:uname [-amnrsv][--help][--version]
    \n补充说明:uname可显示电脑以及操作系统的相关信息。
    \n参  数:
    \n-a或--all  显示全部的信息。
    \n-m或--machine  显示电脑类型。
    \n-n或-nodename  显示在网络上的主机名称。
    \n-r或--release  显示操作系统的发行编号。
    \n-s或--sysname  显示操作系统名称。
    \n-V  显示操作系统的版本。
    \n--help  显示帮助。
    \n--version  显示版本信息。
    \n--查看Linux内存使用情况
    \n[root@CentOS4 ~]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       1034584      71752     962832          0       3740      35260
    \n-/+ buffers/cache:      32752    1001832
    \nSwap:      1052248          0    1052248
    \n
    \n
    \n语  法: free [-bkmotV][-s <间隔秒数>]
    \n free指令会显示内存的使用情况,包括实体内存,虚拟的交换文件内存,共享内存区段,以及系统核心使用的缓冲区等。
    \n参  数:
    \n-b  以Byte为单位显示内存使用情况。
    \n-k  以KB为单位显示内存使用情况。
    \n-m  以MB为单位显示内存使用情况。
    \n-o  不显示缓冲区调节列。
    \n-s<间隔秒数>  持续观察内存使用状况。
    \n-t  显示内存总和列。
    \n-V  显示版本信息。
    \n如MB为单位显示内存使用情况:
    \n[root@CentOS4 ~]# free -m
    \n             total       used       free     shared    buffers     cached
    \nMem:          1010         70        940          0          3         34
    \n-/+ buffers/cache:         31        978
    \nSwap:         1027          0       1027
    \n附录:free的详细解释:
    \n[root@Linux /tmp]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       4149156    4130412      18744          0      13220    2720160
    \n-/+ buffers/cache:    1397032    2752124
    \nSwap:      6289408        144    6289264第1行
    \ntotal 内存总数: 4149156
    \nused 已经使用的内存数: 4130412
    \nfree 空闲的内存数: 18744
    \nshared 当前已经废弃不用,总是0
    \nbuffers Buffer Cache内存数: 13220
    \ncached Page Cache内存数: 2720160
    \n
    \n关系:total = used + free
    \n
    \n第2行:
    \n-/+ buffers/cache的意思相当于:
    \n-buffers/cache 的内存数:1397032 (等于第1行的 used - buffers - cached)
    \n+buffers/cache 的内存数: 2752124 (等于第1行的 free + buffers + cached)
    \n
    \n可见-buffers/cache反映的是被程序实实在在吃掉的内存,而+buffers/cache反映的是可以挪用的内存总数。
    \n
    \n第三行单独针对交换分区, 就不用再说了.
    \n
    \n为了提高磁盘存取效率, Linux做了一些精心的设计, 除了对dentry进行缓存(用于VFS,加速文件路径名到inode的转换), 还采取了两种主要Cache方式:Buffer Cache和Page Cache。前者针对磁盘块的读写,后者针对文件inode的读写。这些Cache有效缩短了 I/O系统调用(比如read,write,getdents)的时间。
    \n
    \n如果感兴趣可以进一步参考文件/proc/meminfo,free命令就是根据它的信息生成的。free命令的源码可从procps-xxx-.src.rpm获取,xxx为版本号,比如procps-3.2.3-5.3.src.rpm。
    \n
    \n参考内核代码:
    \n
    \narch/i386/mm/init.c
    \nfs/proc/proc_misc.c
    \ninclude/linux/swap.h
    \nmm/filemap.c
    \nfs/buffer.c
    \n
    \n另外还可以参考O'REILLY的书《Understanding the LINUX KERNEL》。

    \n", "_id"=>689}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云迁移时遇到一点意外", "body"=>"

    迁移过程比较顺利,最后解析域名的时候出现一些问题,导致现在域名解析不了,只能等到明天早上才能恢复了,这段时间请大家使用 http://itechtag.i410.cn/ 访问技能云,谢谢。

    \n

    我们将尽快恢复,给大家带来的不便,还请海涵》。

    ", "created_at"=>2007-11-09 17:43:48 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    迁移过程比较顺利,最后解析域名的时候出现一些问题,导致现在域名解析不了,只能等到明天早上才能恢复了,这段时间请大家使用 http://itechtag.i410.cn/ 访问技能云,谢谢。
    \n我们将尽快恢复,给大家带来的不便,还请海涵》。

    \n", "_id"=>690}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)服务器迁移顺利完成", "body"=>"

    各位朋友,很高兴的告诉大家,技能云迁移工作顺利完成,期间遇到一些意外(域名迁移比较诡异,域名解析时间比我们预期的时间要长),不过还好,总算顺利迁移完成。

    \n

    经过很多热心朋友的测试,我们确定新服务器比起原来的服务器速度方面更加令人满意,各方限制(包括带宽、内存等)基本上都不存在了。

    \n

    以后我们会逐渐完善很多用户反馈的问题,力求这朵“技能云”开的更加艳丽\"\"

    \n

    各位朋友如果发现什么问题,请联系我们解决,谢谢~

    \n

    联系方式:iceskysl@1sers.com

    ", "created_at"=>2007-11-11 09:29:56 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    各位朋友,很高兴的告诉大家,技能云迁移工作顺利完成,期间遇到一些意外(域名迁移比较诡异,域名解析时间比我们预期的时间要长),不过还好,总算顺利迁移完成。
    \n经过很多热心朋友的测试,我们确定新服务器比起原来的服务器速度方面更加令人满意,各方限制(包括带宽、内存等)基本上都不存在了。
    \n以后我们会逐渐完善很多用户反馈的问题,力求这朵“技能云”开的更加艳丽。
    \n各位朋友如果发现什么问题,请联系我们解决,谢谢~
    \n联系方式:iceskysl@1sers.com

    \n", "_id"=>691}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"unix定时JOB随笔", "body"=>"

    0 0 * * * /home/iceskysl/itechtag/backup/automysqlbackup.sh
    \n(每天凌晨0点执行automysqlbackup.sh进行数据备份)

    ", "created_at"=>2007-11-11 10:56:38 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    0 0 * * * /home/iceskysl/itechtag/backup/automysqlbackup.sh
    \n(每天凌晨0点执行automysqlbackup.sh进行数据备份)

    \n", "_id"=>692}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby的Hash和Array的遍历", "body"=>"

    Hach遍历:
    \n   h = { "我" =>" 谁呀" , "b" => 200 }
    \n   h.each {|key, value| puts "\#{key} is \#{value}" }

    \n

    数组遍历:

    \n

       b = [ "a", "b", "c" ]
    \n   b.each_with_index{|value, index| puts index.to_s + " - " + value.to_s}
    \n  
    \n   for i in 0...b.size
    \n   puts i.to_s + '---'  + b[i].to_s
    \n   end

    ", "created_at"=>2007-11-12 08:25:59 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    Hach遍历:
    \n   h = { "我" =>" 谁呀" , "b" => 200 }
    \n   h.each {|key, value| puts "\#{key} is \#{value}" }
    \n数组遍历:
    \n   b = [ "a", "b", "c" ]
    \n   b.each_with_index{|value, index| puts index.to_s + " - " + value.to_s}
    \n  
    \n   for i in 0...b.size
    \n   puts i.to_s + '---'  + b[i].to_s
    \n   end

    \n", "_id"=>693}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Hpricot解析XML示例~", "body"=>"

    来源:http://errtheblog.com/post/8
    \nGiven a piece of XML:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <Export>  
    2. \n
    3.   <Product>  
    4. \n
    5.     <SKU>403276</SKU>  
    6. \n
    7.     <ItemName>Trivet</ItemName>  
    8. \n
    9.     <CollectionNo>0</CollectionNo>  
    10. \n
    11.     <Pages>0</Pages>  
    12. \n
    13.   </Product>  
    14. \n
    15. </Export>  
    16. \n
    \n
    \n

    One might assume that REXML is the way to parse it, but we all know how slow it is.
    \n
    \nEnter _why’s HTML parser, Hpricot. It’s written in C and since XHTML is a subset of XML, there’s no reason it shouldn’t be able to parse my file.
    \n
    \nTurns out it does, it’s really fast, and the code is dead simple.

    \n
    \n
    Ruby代码
    \n
      \n
    1. FIELDS = %w[SKU ItemName CollectionNo Pages]  
    2. \n
    3.   
    4. \n
    5. doc = Hpricot.parse(File.read("my.xml"))  
    6. \n
    7. (doc/:product).each do |xml_product|  
    8. \n
    9.   product = Product.new  
    10. \n
    11.   for field in FIELDS  
    12. \n
    13.     product[field] = (xml_product/field.intern).first.innerHTML  
    14. \n
    15.   end  
    16. \n
    17.   product.save  
    18. \n
    19. end  
    20. \n
    \n
    \n

    Update: Slight refactoring of the code above. Chris figured out last night that you can use innerHTML which eliminated the only ugly part of the code.

    ", "created_at"=>2007-11-13 05:53:29 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    来源:http://errtheblog.com/post/8
    \nGiven a piece of XML:
    \n
    \nXML/HTML代码
    \n
    \n <Export>  
    \n   <Product>  
    \n     <SKU>403276</SKU>  
    \n     <ItemName>Trivet</ItemName>  
    \n     <CollectionNo>0</CollectionNo>  
    \n     <Pages>0</Pages>  
    \n   </Product>  
    \n </Export>  
    \n
    \n
    \nOne might assume that REXML is the way to parse it, but we all know how slow it is.
    \n
    \nEnter _why’s HTML parser, Hpricot. It’s written in C and since XHTML is a subset of XML, there’s no reason it shouldn’t be able to parse my file.
    \n
    \nTurns out it does, it’s really fast, and the code is dead simple.
    \n
    \nRuby代码
    \n
    \n FIELDS = %w[SKU ItemName CollectionNo Pages]  
    \n   
    \n doc = Hpricot.parse(File.read("my.xml"))  
    \n (doc/:product).each do |xml_product|  
    \n   product = Product.new  
    \n   for field in FIELDS  
    \n     product[field] = (xml_product/field.intern).first.innerHTML  
    \n   end  
    \n   product.save  
    \n end  
    \n
    \n
    \nUpdate: Slight refactoring of the code above. Chris figured out last night that you can use innerHTML which eliminated the only ugly part of the code.

    \n", "_id"=>694}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"统计本星期~", "body"=>"

    raecoo问有没有办法统计一个星期中最受欢迎的文章,我问是’标准星期?还是最近7天‘,他说要的是标准星期,于是感觉这么杨貌似可以,

    \n

    where scores.updated_at beteen Time.now.moday ... Time.now.sunday order by score

    \n

    上面只是一个思路示意,开始翻API找相应的函数,无奈的是翻遍API也没找到合适的函数,最后raecoo从MYSQL的函数库中找到几个,给了我一段代码:
    \nwhere TO_DAYS(NOW()) - TO_DAYS(updated_at) <= 7

    \n

    MYSQL的TO_DAYS(DATE)函数是这样说明的: 传回DATE到公元0年的总日数

    \n

    貌似不满足需要嘛~这个取出来的还是最近几天的呀,再想想~
    \n

    ", "created_at"=>2007-11-14 05:09:06 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    raecoo问有没有办法统计一个星期中最受欢迎的文章,我问是’标准星期?还是最近7天‘,他说要的是标准星期,于是感觉这么杨貌似可以,
    \nwhere scores.updated_at beteen Time.now.moday ... Time.now.sunday order by score
    \n上面只是一个思路示意,开始翻API找相应的函数,无奈的是翻遍API也没找到合适的函数,最后raecoo从MYSQL的函数库中找到几个,给了我一段代码:
    \nwhere TO_DAYS(NOW()) - TO_DAYS(updated_at) <= 7
    \nMYSQL的TO_DAYS(DATE)函数是这样说明的: 传回DATE到公元0年的总日数
    \n貌似不满足需要嘛~这个取出来的还是最近几天的呀,再想想~

    \n", "_id"=>695}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"查看Linux版本命令", "body"=>"

    时间久了以后,想找出Linux 版本信息来看看,有2个文件里面有保存。
    \n
    \ncat /etc/redhat-release
    \nFedora Core release 5 (Bordeaux)
    \n
    \ncat /etc/issue
    \nFedora Core release 5 (Bordeaux)
    \nKernel \\r on an \\m
    \n
    \n还有内核的版本信息在这里:
    \ncat /proc/version
    \n
    \nLinux version 2.6.17-1.2145_FC5smp (brewbuilder@hs20-bc2-2.build.redhat.com) (gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)) #1 SMP Sat Jul 1 13:19:14 EDT 2006

    ", "created_at"=>2007-11-14 09:29:08 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    时间久了以后,想找出Linux 版本信息来看看,有2个文件里面有保存。
    \n
    \ncat /etc/redhat-release
    \nFedora Core release 5 (Bordeaux)
    \n
    \ncat /etc/issue
    \nFedora Core release 5 (Bordeaux)
    \nKernel \\r on an \\m
    \n
    \n还有内核的版本信息在这里:
    \ncat /proc/version
    \n
    \nLinux version 2.6.17-1.2145_FC5smp (brewbuilder@hs20-bc2-2.build.redhat.com) (gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)) #1 SMP Sat Jul 1 13:19:14 EDT 2006

    \n", "_id"=>696}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RoR中操作时间和日期", "body"=>"

    time = Date.today
    \n
    \nputs "Date.today:" + time.to_s
    \n
    \nputs "----"*20
    \nputs   "time.cwday():" + time.cwday().to_s  
    \nputs   "time.cweek():" + time.cweek().to_s  
    \nputs   "time.cwyear():" + time.cwyear().to_s  
    \nputs   "time.mon() :" + time.mon().to_s  
    \nputs   "time.day():" + time.day().to_s  
    \nputs "----"*20
    \n
    \n===
    \nselected_mon = params[:mon].to_date.mon()
    \n@tasks = Task.find(:all, :conditions =>[ "MONTH(created_at) = ?",selected_mon]) 

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File src/rails-1.2.3/activesupport/lib/active_support/core_ext/string/conversions.rb, line 13  
    2. \n
    3.         def to_date  
    4. \n
    5.           ::Date.new(*ParseDate.parsedate(self)[0..2])  
    6. \n
    7.         end 
      \n
    8. \n
    \n
    \n

    \n

     参考:http://fanqiang.chinaunix.net/a2/b1/20010705/150000802.html

    ", "created_at"=>2007-11-16 07:34:21 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    time = Date.today
    \n
    \nputs "Date.today:" + time.to_s
    \n
    \nputs "----"*20
    \nputs   "time.cwday():" + time.cwday().to_s  
    \nputs   "time.cweek():" + time.cweek().to_s  
    \nputs   "time.cwyear():" + time.cwyear().to_s  
    \nputs   "time.mon() :" + time.mon().to_s  
    \nputs   "time.day():" + time.day().to_s  
    \nputs "----"*20
    \n
    \n===
    \nselected_mon = params[:mon].to_date.mon()
    \n@tasks = Task.find(:all, :conditions =>[ "MONTH(created_at) = ?",selected_mon]) 
    \n
    \n
    \nRuby代码
    \n
    \n # File src/rails-1.2.3/activesupport/lib/active_support/core_ext/string/conversions.rb, line 13  
    \n         def to_date  
    \n           ::Date.new(*ParseDate.parsedate(self)[0..2])  
    \n         end 
    \n
    \n
    \n
    \n
    \n 参考:http://fanqiang.chinaunix.net/a2/b1/20010705/150000802.html

    \n", "_id"=>697}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"理解.bash_profile和.bashrc", "body"=>"

    .bash_profile和.bashrc的什么区别
    \n /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.
    \n并从/etc/profile.d目录的配置文件中搜集shell的设置.
    \n/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
    \n~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.
    \n~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该
    \n该文件被读取.
    \n~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
    \n另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.
    \n~/.bash_profile 是交互式、login 方式进入 bash 运行的
    \n~/.bashrc 是交互式 non-login 方式进入 bash 运行的
    \n通常二者设置大致相同,所以通常前者会调用后者。

    \n

    编辑.bash_profile
    \n编辑你主目录下的.bash_profile文件@"
    \n加上:
    \nalias ls='ls -laF'
    \n保存退出
    \n最后source .bash_profile 使变动生效

    ", "created_at"=>2007-11-22 06:26:29 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    .bash_profile和.bashrc的什么区别
    \n /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.
    \n并从/etc/profile.d目录的配置文件中搜集shell的设置.
    \n/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
    \n~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.
    \n~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该
    \n该文件被读取.
    \n~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
    \n另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.
    \n~/.bash_profile 是交互式、login 方式进入 bash 运行的
    \n~/.bashrc 是交互式 non-login 方式进入 bash 运行的
    \n通常二者设置大致相同,所以通常前者会调用后者。
    \n编辑.bash_profile
    \n编辑你主目录下的.bash_profile文件@"
    \n加上:
    \nalias ls='ls -laF'
    \n保存退出
    \n最后source .bash_profile 使变动生效

    \n", "_id"=>698}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"自动FTP下载多个文件", "body"=>"

    \n

    \n
    SHELL代码
    \n
      \n
    1. ftp -i -n 10.1.1.1 <<YSL  
    2. \n
    3. user username password  
    4. \n
    5. bin  
    6. \n
    7. hash  
    8. \n
    9. cd some/path/here/datas/  
    10. \n
    11. #prompt  
    12. \n
    13. mget *$1*  
    14. \n
    15. quit  
    16. \n
    17. YSL  
    18. \n
    \n
    \n

    ", "created_at"=>2007-11-22 09:41:10 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    SHELL代码
    \n
    \n ftp -i -n 10.1.1.1 <<YSL  
    \n user username password  
    \n bin  
    \n hash  
    \n cd some/path/here/datas/  
    \n #prompt  
    \n mget $1  
    \n quit  
    \n YSL  
    \n
    \n

    \n", "_id"=>699}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"删除所有.svn目录", "body"=>"

    当使用了svn版本控制系统后每个目录下都会有一个.svn目录存在,开发完当交付产品或者上传到服务器时一般要把这些目录删除,这里总结了一下在linux和win下的办法。

    \n

    一、在linux下

    \n

    删除这些目录是很简单的,命令如下
    \n
    \nfind . -type d -name ".svn"|xargs rm -rf

    \n

    或者

    \n

    find . -type d -iname ".svn" -exec rm -rf {} \\;  

    \n

    全部搞定。(http://tech.techweb.com.cn/redirect.php?fid=26&tid=205673&goto=nextnewset)

    \n

     

    \n

    二、在windows下用以下法子:

    \n
    1、在项目平级的目录,执行dos命令:
    \nxcopy project_dir project_dir_1 /s /i
    \n

     

    \n
    2、或者在项目根目录执行以下dos命令
    \nfor /r . %%a in (.) do @if exist "%%a\\.svn" rd /s /q "%%a\\.svn"
    \n

    其实第二种方法可以用来干很多事的,比如把代码中的.svn替换为任意其他文件名并在硬盘根目录下执行,就可以从硬盘上删除所有的这个文件啦。

    \n

    3、加注册表

    \n

    Jon Galloway提供了一段注册表代码,可以将”Delete SVN Folders”命名增加到资源管理器的右键上,这样,鼠标点两下就能把选中目录下的所有.svn目录干掉了。Works just great!

    \n

    代码为:

    \n``Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN]@=”Delete SVN Folders

    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN\\command]@=”cmd.exe /c \\”TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \\”%1\\” %%f IN (.svn) DO RD /s /q \\”%%f\\” \\”“```\n

    将这段代码保存为一个.reg文件,双击确认导入注册表即可。

    ", "created_at"=>2007-11-27 13:19:59 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    当使用了svn版本控制系统后每个目录下都会有一个.svn目录存在,开发完当交付产品或者上传到服务器时一般要把这些目录删除,这里总结了一下在linux和win下的办法。
    \n一、在linux下
    \n删除这些目录是很简单的,命令如下
    \n
    \nfind . -type d -name ".svn"|xargs rm -rf
    \n或者
    \nfind . -type d -iname ".svn" -exec rm -rf {} \\;  
    \n全部搞定。(http://tech.techweb.com.cn/redirect.php?fid=26&tid=205673&goto=nextnewset;)
    \n 
    \n二、在windows下用以下法子:
    \n1、在项目平级的目录,执行dos命令:
    \nxcopy project_dir project_dir_1 /s /i
    \n 
    \n2、或者在项目根目录执行以下dos命令
    \nfor /r . %%a in (.) do @if exist "%%a.svn" rd /s /q "%%a.svn"
    \n其实第二种方法可以用来干很多事的,比如把代码中的.svn替换为任意其他文件名并在硬盘根目录下执行,就可以从硬盘上删除所有的这个文件啦。
    \n3、加注册表
    \nJon Galloway提供了一段注册表代码,可以将”Delete SVN Folders”命名增加到资源管理器的右键上,这样,鼠标点两下就能把选中目录下的所有.svn目录干掉了。Works just great!
    \n代码为:
    \nWindows Registry Editor Version 5.00<br /><br />[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN]@=&rdquo;<span style="color: rgb(139, 0, 0);">Delete SVN Folders</span>&ldquo;<br /><br />[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN\\command]@=&rdquo;<span style="color: rgb(139, 0, 0);">cmd.exe /c \\&rdquo;TITLE Removing SVN Folders in %1 &amp;&amp; COLOR 9A &amp;&amp; FOR /r \\&rdquo;%1\\&rdquo; %%f IN (.svn) DO RD /s /q \\&rdquo;%%f\\&rdquo; \\&rdquo;</span>&ldquo;`
    \n将这段代码保存为一个.reg文件,双击确认导入注册表即可。

    \n", "_id"=>700}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加Feeds抓起功能", "body"=>"

    为了让大家了解我们的成员都在干什么,也为了反应成员的动态,我们为1sters.com开发了Feeds抓取、展示的功能,会定时刷新,取每个成员的blog内容,详细的大家可以到1sters.com站的,点击上面的“Feeds”标签。
    \n也就是如下这个地址:http://www.1sters.com/feeds
    \n有什么建议啥的,情告诉我。
    \n我们正准备给技能云(iTechTag)加上这个功能,用来展示每个用户写的blog、文章等。。

    ", "created_at"=>2007-12-04 15:58:36 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    为了让大家了解我们的成员都在干什么,也为了反应成员的动态,我们为1sters.com开发了Feeds抓取、展示的功能,会定时刷新,取每个成员的blog内容,详细的大家可以到1sters.com站的,点击上面的“Feeds”标签。
    \n也就是如下这个地址:http://www.1sters.com/feeds
    \n有什么建议啥的,情告诉我。
    \n我们正准备给技能云(iTechTag)加上这个功能,用来展示每个用户写的blog、文章等。。

    \n", "_id"=>701}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RSS和ATOM的版本和规范", "body"=>"

    由于需要在技能云(iTechTag.com)添加mash-up用户写过的文章(blog),于是写了一个自动探测用户提供的地址的RSS地址以及其附带的一些属性和其下的blog内容,由于之前只看了RSS2.0的规范,所以写的都是兼容RSS2.0的,测试了一把也相当顺利;

    \n

    然后再测试透明的blog内容,无奈的是什么都检测不到,后来看了下他的塬,发现是ATOM的,以前倒是晓得RSS和ATOM,也晓得其不是很兼容,但不晓得差别这么大,看来还需要写一份解析ATOM的了。

    \n

    附录几个问题:

    \n

    1、怎么判断RSS是RSS2.0规范还是微软的SSE,还是Atom的XML格式?

    \n

    文件头部 
    \nRSS   2.0 判断<rss   version="2.0"> 
    \natom  判断<feed   xmlns="http://www.w3.org/2005/Atom">

    \n

    2、几个有用的文章

    \n

    RSS 简介:http://www.ibm.com/developerworks/cn/xml/x-rssintro/

    \n

    Atom 规范及中文翻译 附:ATOM规范英文原版  http://hi.baidu.com/liberty88/blog/item/f5dd1db3decde1a7d8335a12.html

    ", "created_at"=>2007-12-06 01:37:54 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    由于需要在技能云(iTechTag.com)添加mash-up用户写过的文章(blog),于是写了一个自动探测用户提供的地址的RSS地址以及其附带的一些属性和其下的blog内容,由于之前只看了RSS2.0的规范,所以写的都是兼容RSS2.0的,测试了一把也相当顺利;
    \n然后再测试透明的blog内容,无奈的是什么都检测不到,后来看了下他的塬,发现是ATOM的,以前倒是晓得RSS和ATOM,也晓得其不是很兼容,但不晓得差别这么大,看来还需要写一份解析ATOM的了。
    \n附录几个问题:
    \n1、怎么判断RSS是RSS2.0规范还是微软的SSE,还是Atom的XML格式?
    \n文件头部 
    \nRSS   2.0 判断<rss   version="2.0"> 
    \natom  判断<feed   xmlns="http://www.w3.org/2005/Atom">
    \n2、几个有用的文章
    \nRSS 简介:http://www.ibm.com/developerworks/cn/xml/x-rssintro/
    \nAtom 规范及中文翻译 附:ATOM规范英文原版  http://hi.baidu.com/liberty88/blog/item/f5dd1db3decde1a7d8335a12.html

    \n", "_id"=>702}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Ruby实现抓取ATOM格式的feed~", "body"=>"

    前几天写完了技能云上抓取用户RSS2.0的feed的功能,紧接着需要实现抓取ATOM格式的,如下是随手做的几个小测试,代码如下:

    \n

     require 'hpricot'
    \n require 'open-uri'
    \n 
    \ndoc = open("http://gigix.thoughtworkers.org/feed/atom.xml") do |f|
    \n   Hpricot.XML(f)
    \n end
    \n 
    \nputs rel = doc.search("//feed").first[:xmlns].downcase
    \n 
    \n puts root = doc.root.name
    \n 
    \nputs feed_title = (doc/:feed/:title).first.inner_html
    \nputs feed_id = (doc/:feed/:id).first.inner_html
    \nputs rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \nputs rel = doc.search("//link[@rel='self']").first[:href].downcase
    \nputs feed_generator = (doc/:feed/:generator).first.inner_html
    \nputs feed_rights = (doc/:feed/:rights).first.inner_html
    \n
    \nputs feed_updated = (doc/:feed/:updated).first.inner_html
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \n 
    \n
    \n (doc/:entry).each do |item|
    \n #puts author = (item/:author/:name).inner_html
    \n   #puts title = (item/:title).inner_html
    \n   #puts link = (item/:link).first[:href].downcase
    \n  # rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \n   #puts id = (item/:id).inner_html
    \n   #puts date = (item/:published).inner_html
    \n   #puts updated = (item/:updated).inner_html
    \n   #puts content = (item/:content).inner_html
    \n end

    ", "created_at"=>2007-12-07 05:47:12 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    前几天写完了技能云上抓取用户RSS2.0的feed的功能,紧接着需要实现抓取ATOM格式的,如下是随手做的几个小测试,代码如下:
    \n require 'hpricot'
    \n require 'open-uri'
    \n 
    \ndoc = open("http://gigix.thoughtworkers.org/feed/atom.xml";) do |f|
    \n   Hpricot.XML(f)
    \n end
    \n 
    \nputs rel = doc.search("//feed").first[:xmlns].downcase
    \n 
    \n puts root = doc.root.name
    \n 
    \nputs feed_title = (doc/:feed/:title).first.inner_html
    \nputs feed_id = (doc/:feed/:id).first.inner_html
    \nputs rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \nputs rel = doc.search("//link[@rel='self']").first[:href].downcase
    \nputs feed_generator = (doc/:feed/:generator).first.inner_html
    \nputs feed_rights = (doc/:feed/:rights).first.inner_html
    \n
    \nputs feed_updated = (doc/:feed/:updated).first.inner_html
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \n 
    \n
    \n (doc/:entry).each do |item|
    \n #puts author = (item/:author/:name).inner_html
    \n   #puts title = (item/:title).inner_html
    \n   #puts link = (item/:link).first[:href].downcase
    \n  # rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \n   #puts id = (item/:id).inner_html
    \n   #puts date = (item/:published).inner_html
    \n   #puts updated = (item/:updated).inner_html
    \n   #puts content = (item/:content).inner_html
    \n end

    \n", "_id"=>703}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定期清理垃圾数据", "body"=>"

    linux上用来清除长时不用的session的cron命令:
    \n$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")
    \n
    \n参考:
    \nhttp://rubyasylum.com/articles/2006/06/04/cron-job-tips-for-rails
    \nhttp://www.cslog.cn/articles/search?q=sessions

    ", "created_at"=>2007-12-08 15:54:19 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    linux上用来清除长时不用的session的cron命令:
    \n$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")
    \n
    \n参考:
    \nhttp://rubyasylum.com/articles/2006/06/04/cron-job-tips-for-rails
    \nhttp://www.cslog.cn/articles/search?q=sessions

    \n", "_id"=>704}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中的定期JOB的实现方式。", "body"=>"

    大概总结一下,有如下几种方式:

    \n

    1、Thread based scheduler(sleep)

    \n

    2、Flexible scheduling in Ruby(OpenWFEru

    \n

    3、BackgrounDRB

    \n

    参考:

    \n

    http://www.igvita.com/blog/2007/03/29/scheduling-tasks-in-ruby-rails/

    ", "created_at"=>2007-12-08 15:57:56 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    大概总结一下,有如下几种方式:
    \n1、Thread based scheduler(sleep)
    \n2、Flexible scheduling in Ruby(OpenWFEru )
    \n3、BackgrounDRB
    \n参考:
    \nhttp://www.igvita.com/blog/2007/03/29/scheduling-tasks-in-ruby-rails/

    \n", "_id"=>705}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将会试试FeedTools的功能", "body"=>"

    由于需要抽时间重新1st的站点,按照我设想的模式,会抓取指定的RSS功能,以前都是自己写的,前些日志看到ruby有个gem,可以找时间试试,

    \n

    FeedTools is a simple Ruby library for handling rss, atom, and cdf parsing, generation, and translation as well as caching. It attempts to adhere to Postel’s law—i.e. a liberal parsing and conservative generation policy.

    \n

    参考如下2篇文章:

    \n

    http://sporkmonger.com/projects/feedtools/

    \n

    http://sporkmonger.com/2005/08/11/tutorial

    ", "created_at"=>2007-12-12 05:03:29 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    由于需要抽时间重新1st的站点,按照我设想的模式,会抓取指定的RSS功能,以前都是自己写的,前些日志看到ruby有个gem,可以找时间试试,
    \nFeedTools is a simple Ruby library for handling rss, atom, and cdf parsing, generation, and translation as well as caching. It attempts to adhere to Postel’s law—i.e. a liberal parsing and conservative generation policy.
    \n参考如下2篇文章:
    \nhttp://sporkmonger.com/projects/feedtools/
    \nhttp://sporkmonger.com/2005/08/11/tutorial

    \n", "_id"=>706}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scrot -- ubuntu/Linux 下一个很好用抓屏截图工具", "body"=>"

    ubuntu 下 gnome 自带的截图工具其实也还不错,有快捷键,可以在命令行下用 --window 的方式指定对某窗进行截图,也可以使用 --border 来指定是否包含窗体边框,甚至可以有阴影。但我还是不满意,因为我经常需要用鼠标划定一个范围来截图,GNOME自带的就没法做到了。
    \n
    \n      Scrot,也是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
    \n
    \n      * 其他非 ubuntu 系统,你可以在 [这里] 下载到这款截图工具。
    \n
    \n      安装:
    \n      可以打开新立得搜索 scrot 并安装,也可以在终端:
    \n      sudo apt-get install scrot
    \n      来进行安装。
    \n
    \n Scrot 使用:
    \n-----------------------------------------------------------------------------------------------------------------------
    \n概要
    \nscrot [options] [file]
    \n
    \n描述
    \nscrot 是一个使用 imlib2 库截取屏幕和保存图像的的工具。
    \n选项 [file] 指定截图保存的文件名。 如果 [file] 没有指定,
    \n截图就会以当前的日期和时间为文件名保存在当前目录中。
    \n
    \n选项
    \n-h, --help
    \n显示帮助并且退出
    \n-v, --version
    \n显示版本信息并且退出
    \n-b, --border
    \n当选择一个窗口时,同时包含窗口边框。
    \n-c, --count
    \n延时时的显示倒计时
    \n-d, --delay NUM
    \n延时 NUM 秒
    \n-e, --exec APP
    \n对保存的图像执行程序 APP
    \n-q, --quality NUM
    \n图像质量 (1-100) 值大意味着文件大, 压缩率低。
    \n-m, --multidisp
    \n对多个显示设备分别截图并且连接在一起。
    \n-s, --select
    \n用鼠标交互式的选择一个窗口或者区域。
    \n-t, --thumb NUM
    \n同时生成缩略图。 NUM 是缩略图的百分比。
    \n
    \n说明符
    \n--exec 和 文件名可以使用可以被 scrot 扩充的格式说明符。有两种类型的
    \n说明符。 '%' 前导的说明符由 strfile(2) 来解释。例程可以查看 strftile
    \n手册。这些选项用来引用当前的日期。第二种说明符由 scort 内部解释并且
    \n使用前缀 '$'. 可以识别的说明符如下:
    \n$f 图像的路径/文件名 (如果在文件名中就会忽略)
    \n$n 图像文件名 (如果在文件名中会被忽略)
    \n$s 图像大小(字节数) (如果在文件名会被忽略)
    \n$p 图像像素大小
    \n$w 图像宽度
    \n$h 图像高度
    \n$t 图像格式
    \n$$ 打印字符 '$'
    \nn 打印新行 (如果在文件名中会被忽略)

    \n-----------------------------------------------------------------------------------------------------------------------
    \n
    \n     例子(~ 用户主目录):
    \n1、对全屏截图并保存文件名:
    \n      scrot ~/abc.png
    \n
    \n2、抓取窗口,b 参数表示带边框窗体,s 用户可以指定窗口:
    \n      scrot -bs ~/abc.png
    \n
    \n3、抓取鼠标选定区域:
    \n
          scrot -s ~/abc.png
    \n
    \n4、延时抓取,d 表示延时,c 倒计时,10 是秒,抓菜单等其他东西时很好用:
    \n
          scrot -cd 10 ~/abc.png
    \n
    \n5、生成缩略图,t 表示要生成缩略图, 20% 表示缩略图的比例, s 表示截取用户划定区域:
    \n
          scrot -t 20% -s ~/abc.png
    \n
    \n6、启用某项操作 s 划定截图,-e 采用某项行为,这里用 gimp 打开截图图片,
    \n      scrot -s ~/abc.png -e 'gimp $f'

    ", "created_at"=>2007-12-15 15:54:42 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    ubuntu 下 gnome 自带的截图工具其实也还不错,有快捷键,可以在命令行下用 --window 的方式指定对某窗进行截图,也可以使用 --border 来指定是否包含窗体边框,甚至可以有阴影。但我还是不满意,因为我经常需要用鼠标划定一个范围来截图,GNOME自带的就没法做到了。
    \n
    \n      Scrot,也是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
    \n
    \n      * 其他非 ubuntu 系统,你可以在 [这里] 下载到这款截图工具。
    \n
    \n      安装:
    \n      可以打开新立得搜索 scrot 并安装,也可以在终端:
    \n      sudo apt-get install scrot
    \n      来进行安装。
    \n
    \n Scrot 使用:
    \n-----------------------------------------------------------------------------------------------------------------------
    \n概要
    \nscrot [options] [file]
    \n
    \n描述
    \nscrot 是一个使用 imlib2 库截取屏幕和保存图像的的工具。
    \n选项 [file] 指定截图保存的文件名。 如果 [file] 没有指定,
    \n截图就会以当前的日期和时间为文件名保存在当前目录中。
    \n
    \n选项
    \n-h, --help
    \n显示帮助并且退出
    \n-v, --version
    \n显示版本信息并且退出
    \n-b, --border
    \n当选择一个窗口时,同时包含窗口边框。
    \n-c, --count
    \n延时时的显示倒计时
    \n-d, --delay NUM
    \n延时 NUM 秒
    \n-e, --exec APP
    \n对保存的图像执行程序 APP
    \n-q, --quality NUM
    \n图像质量 (1-100) 值大意味着文件大, 压缩率低。
    \n-m, --multidisp
    \n对多个显示设备分别截图并且连接在一起。
    \n-s, --select
    \n用鼠标交互式的选择一个窗口或者区域。
    \n-t, --thumb NUM
    \n同时生成缩略图。 NUM 是缩略图的百分比。
    \n
    \n说明符
    \n--exec 和 文件名可以使用可以被 scrot 扩充的格式说明符。有两种类型的
    \n说明符。 '%' 前导的说明符由 strfile(2) 来解释。例程可以查看 strftile
    \n手册。这些选项用来引用当前的日期。第二种说明符由 scort 内部解释并且
    \n使用前缀 '$'. 可以识别的说明符如下:
    \n$f 图像的路径/文件名 (如果在文件名中就会忽略)
    \n$n 图像文件名 (如果在文件名中会被忽略)
    \n$s 图像大小(字节数) (如果在文件名会被忽略)
    \n$p 图像像素大小
    \n$w 图像宽度
    \n$h 图像高度
    \n$t 图像格式
    \n$$ 打印字符 '$'
    \nn 打印新行 (如果在文件名中会被忽略)
    \n-----------------------------------------------------------------------------------------------------------------------
    \n
    \n     例子(~ 用户主目录):
    \n1、对全屏截图并保存文件名:
    \n      scrot ~/abc.png
    \n
    \n2、抓取窗口,b 参数表示带边框窗体,s 用户可以指定窗口:
    \n      scrot -bs ~/abc.png
    \n
    \n3、抓取鼠标选定区域:
    \n      scrot -s ~/abc.png
    \n
    \n4、延时抓取,d 表示延时,c 倒计时,10 是秒,抓菜单等其他东西时很好用:
    \n      scrot -cd 10 ~/abc.png
    \n
    \n5、生成缩略图,t 表示要生成缩略图, 20% 表示缩略图的比例, s 表示截取用户划定区域:
    \n      scrot -t 20% -s ~/abc.png
    \n
    \n6、启用某项操作 s 划定截图,-e 采用某项行为,这里用 gimp 打开截图图片,
    \n      scrot -s ~/abc.png -e 'gimp $f'

    \n", "_id"=>707}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)完成重大升级", "body"=>"

    这个周末是个疯狂的周末,我自己都不记得给技能云增加了多少新功能;完善了多少个不如意的地方,让我大概的回想一下吧:
    \n1、增加站内导航条的设计和实现(这个方法实在太棒了,重用了页面的一块区域,相当不错)
    \n2、增加了feed内容查看功能,也就是说,可以在技能云直接查看您提交的feed上的blos内容了,完成定时同步功能,相当漂亮。
    \n3、完善了用户界面的展示内容,现在展示的内容更加丰富合理了。
    \n4、添加公司(企业)信息维护,展示页面,社区话题等,可以维护企业的信息,和大家讨论的话题了,更清晰的认识这个企业。
    \n5、还有什么?想不起来了,貌似还有不少,这就是这个周末的劳动成果,真的,相当不错。
    \n现在的技能云,内容更加丰富,从多个方面展示一个软件开发者和企业、技能、角色等方面。目前来看,正在一步步的影响着软件开发者社区,希望有一天,技能云可以成长为参天大树。
    \n一个软件开发者的展示个人技能,其他相关信息分享的大平台。。

    ", "created_at"=>2007-12-16 14:42:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这个周末是个疯狂的周末,我自己都不记得给技能云增加了多少新功能;完善了多少个不如意的地方,让我大概的回想一下吧:
    \n1、增加站内导航条的设计和实现(这个方法实在太棒了,重用了页面的一块区域,相当不错)
    \n2、增加了feed内容查看功能,也就是说,可以在技能云直接查看您提交的feed上的blos内容了,完成定时同步功能,相当漂亮。
    \n3、完善了用户界面的展示内容,现在展示的内容更加丰富合理了。
    \n4、添加公司(企业)信息维护,展示页面,社区话题等,可以维护企业的信息,和大家讨论的话题了,更清晰的认识这个企业。
    \n5、还有什么?想不起来了,貌似还有不少,这就是这个周末的劳动成果,真的,相当不错。
    \n现在的技能云,内容更加丰富,从多个方面展示一个软件开发者和企业、技能、角色等方面。目前来看,正在一步步的影响着软件开发者社区,希望有一天,技能云可以成长为参天大树。
    \n一个软件开发者的展示个人技能,其他相关信息分享的大平台。。

    \n", "_id"=>708}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ubuntu下配置使用nginx+mogrel跑Rails集群.", "body"=>"

    很早前就曾经关注过nginx(一个俄罗斯人开发的HTTP服务器),看过一些中文和英文文档,觉得相当棒的一个服务器,但是一直没亲自试试其威力如何,这个周末写了不少代码,自己也都很满意,于是周日晚上准备休息下,顺便亲自试试nginx。

    \n

    按照我对rails服务构架部署的理解,在我本本上是ubuntu系统,由于一直订阅了mogrel的邮件列表,所以对其相当看好和喜欢,于是这次就把这两个接合起来。

    \n

    大概的架构是nginx在前面充当HTTP代理,同时处理一些静态的资源文件(比如图片,JS,CSS等),WEB请求直接到nginx后,将ruby的内容转到后端的mogrel处理;而mogrel采取集群的方式,可以自己设定需要启动的进程数(虽然以前说mogrel是非多线程的,但是从我现在跑的技能云的效果来看,一个实例都可以支撑相当的请求了),这样就形成一个前端nginx,后端mogrel的部署构架。

    \n

    其他不在多说,网上资源相当丰富,从我试验的效果看,虽然没有刻意调优的等操作,但是其配置等都相当简介明了,用起来也相当放心。

    \n

    如果以后有了自己的服务器,我肯定选择这个方式跑Rails应用。

    \n

    如下是我在这个过程中google到的参考资料,各有侧重,请需要的朋友自己筛选需要的信息:

    \n

    1、http://blackanger.blog.51cto.com/140924/40089

    \n

    2、nginx官方:http://nginx.net/

    \n

    3、英文wiki:http://wiki.codemongers.com/NginxGettingStarted

    \n

    4、javaeye上有一篇:http://yangzx.javaeye.com/blog/105869

    \n

    5、有部分中文wiki:http://wiki.codemongers.com/NginxChsWhyUseIt

    \n

    如果您对nginx、rails、mogrel等有自己的见解,欢迎分享。

    ", "created_at"=>2007-12-16 14:57:52 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    很早前就曾经关注过nginx(一个俄罗斯人开发的HTTP服务器),看过一些中文和英文文档,觉得相当棒的一个服务器,但是一直没亲自试试其威力如何,这个周末写了不少代码,自己也都很满意,于是周日晚上准备休息下,顺便亲自试试nginx。
    \n按照我对rails服务构架部署的理解,在我本本上是ubuntu系统,由于一直订阅了mogrel的邮件列表,所以对其相当看好和喜欢,于是这次就把这两个接合起来。
    \n大概的架构是nginx在前面充当HTTP代理,同时处理一些静态的资源文件(比如图片,JS,CSS等),WEB请求直接到nginx后,将ruby的内容转到后端的mogrel处理;而mogrel采取集群的方式,可以自己设定需要启动的进程数(虽然以前说mogrel是非多线程的,但是从我现在跑的技能云的效果来看,一个实例都可以支撑相当的请求了),这样就形成一个前端nginx,后端mogrel的部署构架。
    \n其他不在多说,网上资源相当丰富,从我试验的效果看,虽然没有刻意调优的等操作,但是其配置等都相当简介明了,用起来也相当放心。
    \n如果以后有了自己的服务器,我肯定选择这个方式跑Rails应用。
    \n如下是我在这个过程中google到的参考资料,各有侧重,请需要的朋友自己筛选需要的信息:
    \n1、http://blackanger.blog.51cto.com/140924/40089
    \n2、nginx官方:http://nginx.net/
    \n3、英文wiki:http://wiki.codemongers.com/NginxGettingStarted
    \n4、javaeye上有一篇:http://yangzx.javaeye.com/blog/105869
    \n5、有部分中文wiki:http://wiki.codemongers.com/NginxChsWhyUseIt
    \n如果您对nginx、rails、mogrel等有自己的见解,欢迎分享。

    \n", "_id"=>709}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"DH要升级Rails了。", "body"=>"

    早上看RSS订阅的时候,发现DH有一则公告,仔细看了下,原来其准备升级到Rails2.0.2版本了,看来Rails2的时代以及来临了,引起原话如下:

    \n
    \n
    \n
    \n

    Just when I thought it was safe to upgrade, another version appears!

    \n

    I’m going to start upgrading our servers to Rails 2.0.2. This involves packaging, testing, and then slowly rolling it out. The jump is to a 2.x version from 1.2.6, so I’m going to take my time with this one to make sure nothing goes horribly wrong, so it might be right after the new year when it’s all done, just to be safe.

    \n

    For your new year’s resolution, you will freeze your rails! Login via shell, and in your rails directory, run “rake freeze_gems” - that should do the trick!

    \n

    Please contact support if you have any questions or concerns.

    \n
    \n
    \n
    \n

     

    ", "created_at"=>2007-12-18 01:18:51 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    早上看RSS订阅的时候,发现DH有一则公告,仔细看了下,原来其准备升级到Rails2.0.2版本了,看来Rails2的时代以及来临了,引起原话如下:
    \n
    \n
    \n
    \n“Just when I thought it was safe to upgrade, another version appears!
    \nI’m going to start upgrading our servers to Rails 2.0.2. This involves packaging, testing, and then slowly rolling it out. The jump is to a 2.x version from 1.2.6, so I’m going to take my time with this one to make sure nothing goes horribly wrong, so it might be right after the new year when it’s all done, just to be safe.
    \nFor your new year’s resolution, you will freeze your rails! Login via shell, and in your rails directory, run “rake freeze_gems” - that should do the trick!
    \nPlease contact support if you have any questions or concerns.”
    \n
    \n
    \n
    \n 

    \n", "_id"=>710}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart Gem", "body"=>"

    ruby的世界真的很活跃,前不久,在infoQ上看到有人介绍了google的chart功能,自己也花了点点时间,给技能云加上这个功能,可以 在这里(http://www.itechtag.com/widget/index)看到效果,也在想,可以把这个包装成一个gem,由于最近技能云进 行不少功能的开发,就暂时搁浅了;

    \n

    中午看RSS发现,已经有人做了这个事情,而且做的相当棒,和我当初想法一样,而且有2个,呵呵,大家可以参考:

    \n

    http://railsontherun.com/2007/12/10/google-chart-gem

    \n

    http://code.google.com/p/gchartrb/

    \n

    这个小功能真的相当好用,极力推荐~

    ", "created_at"=>2007-12-21 05:24:01 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    ruby的世界真的很活跃,前不久,在infoQ上看到有人介绍了google的chart功能,自己也花了点点时间,给技能云加上这个功能,可以 在这里(http://www.itechtag.com/widget/index)看到效果,也在想,可以把这个包装成一个gem,由于最近技能云进 行不少功能的开发,就暂时搁浅了;
    \n中午看RSS发现,已经有人做了这个事情,而且做的相当棒,和我当初想法一样,而且有2个,呵呵,大家可以参考:
    \nhttp://railsontherun.com/2007/12/10/google-chart-gem
    \nhttp://code.google.com/p/gchartrb/
    \n这个小功能真的相当好用,极力推荐~

    \n", "_id"=>711}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定制logger", "body"=>"

    需要定制一些log格式等,都说rails的log比较简单,但是其基本功能还是满足了的,例如如下技巧等。

    \n

    控制日志文件大小,保留10个历史文件,文件大小最大为1024000字节:

    \n
    \n
      \n
    1. logger = Logger.new('foo.log', 10, 1024000) 
      \n
    2. \n
    \n每日/星期/月一个日志文件
    \n
      \n
    1. logger = Logger.new('foo.log', 'daily')  
    2. \n
    3. logger = Logger.new('foo.log', 'weekly')  
    4. \n
    5. logger = Logger.new('foo.log', 'monthly') 
      \n
    6. \n
    \n而后就可以这么用了。
    \n
    \n
      \n
    1. logger.fatal { "Argument 'foo' not given." }  
    2. \n
    3. logger.error "Argument \#{ @foo } mismatch."  
    4. \n
    5. logger.info('initialize') { "Initializing..." }  
    6. \n
    7. logger.add(Logger::FATAL) { 'Fatal error!' }
      \n
    8. \n
    \n其他:按日期来分开存储web日志文件和sql日志
    \n
    \n

    1、简单做法
    \n首先,在log/目录下新建sql文件夹,sql文件夹用来保存sql日志
    \n接着,修改config\\environment.rb代码,需注意代码顺序。

    \n

    #web访问日志
    \nRAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}_\#{Date.today.to_s}.log", "daily")

    \n

    #rails的初始化
    \nRails::Initializer.run do |config|
    \n#...
    \nend

    \n

    #sql日志
    \nActiveRecord::Base.logger = Logger.new("\#{RAILS_ROOT}/log/sql/\#{RAILS_ENV}_\#{Date.today.to_s}.log", "daily")

    \n

    2、使用unix的cron做定时转存。

    \n
    ", "created_at"=>2007-12-23 17:41:09 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    需要定制一些log格式等,都说rails的log比较简单,但是其基本功能还是满足了的,例如如下技巧等。
    \n控制日志文件大小,保留10个历史文件,文件大小最大为1024000字节:
    \n
    \n
    \n logger = Logger.new('foo.log', 10, 1024000) 
    \n
    \n
    \n每日/星期/月一个日志文件
    \n
    \n logger = Logger.new('foo.log', 'daily')  
    \n logger = Logger.new('foo.log', 'weekly')  
    \n logger = Logger.new('foo.log', 'monthly') 
    \n
    \n
    \n而后就可以这么用了。
    \n
    \n
    \n logger.fatal { "Argument 'foo' not given." }  
    \n logger.error "Argument \#{ @foo } mismatch."  
    \n logger.info('initialize') { "Initializing..." }  
    \n logger.add(Logger::FATAL) { 'Fatal error!' }
    \n
    \n
    \n其他:按日期来分开存储web日志文件和sql日志
    \n
    \n1、简单做法
    \n首先,在log/目录下新建sql文件夹,sql文件夹用来保存sql日志
    \n接着,修改config\\environment.rb代码,需注意代码顺序。
    \n#web访问日志
    \nRAILSDEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}\#{Date.today.to_s}.log", "daily")
    \n#rails的初始化
    \nRails::Initializer.run do |config|

    \n\n

    ...

    \n\n

    end
    \n#sql日志
    \nActiveRecord::Base.logger = Logger.new("\#{RAILSROOT}/log/sql/\#{RAILS_ENV}\#{Date.today.to_s}.log", "daily")
    \n2、使用unix的cron做定时转存。

    \n", "_id"=>712}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"YAML Configuration File", "body"=>"

     

    \n

    Application configuration shouldn't be spread throughout your code base. Instead a much better place to put it is an external YAML file. See how to do that in this episode.

    \n
    \n
    \n``[code]
    # config/initializers/load_config.rb

    APP_CONFIG = YAML.load_file("\#{RAILS_ROOT}/config/config.yml")[RAILS_ENV]

    # application.rb
    def authenticate
    if APP_CONFIG['perform_authentication']
    authenticate_or_request_with_http_basic do |username, password|
    username == APP_CONFIG['username'] && password == APP_CONFIG['password']
    end
    end
    end
    [/code]
    ---
    [code]
    # config/config.yml
    development:
    perform_authentication: false

    test:
    perform_authentication: false

    production:
    perform_authentication: true
    username: admin
    password: secret
    [/code]
    来源:http://railscasts.com/episodes/85```\n
    \n
    ", "created_at"=>2007-12-28 04:44:04 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

     
    \nApplication configuration shouldn't be spread throughout your code base. Instead a much better place to put it is an external YAML file. See how to do that in this episode.
    \n
    \n
    \n<span class="c">[code]<br /># config/initializers/load_config.rb</span><br /><span class="co">APP_CONFIG</span> = <span class="co">YAML</span>.load_file(<span class="s"><span class="dl">&quot;</span><span class="il"><span class="idl">\#{</span><span class="co">RAILS_ROOT</span><span class="idl">}</span></span><span class="k">/config/config.yml</span><span class="dl">&quot;</span></span>)[<span class="co">RAILS_ENV</span>]<br /><br /><span class="c"># application.rb</span><br /><span class="r">def</span> <span class="fu">authenticate</span><br /> <span class="r">if</span> <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">perform_authentication</span><span class="dl">'</span></span>]<br /> authenticate_or_request_with_http_basic <span class="r">do</span> |username, password|<br /> username == <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">username</span><span class="dl">'</span></span>] &amp;&amp; password == <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">password</span><span class="dl">'</span></span>]<br /> <span class="r">end</span><br /> <span class="r">end</span><br /><span class="r">end<br /></span><span class="c">[/code]</span><br /><span class="r">---<br /></span><span class="c">[code]</span><br /># config/config.yml<br />development:<br /> perform_authentication: false<br /><br />test:<br /> perform_authentication: false<br /><br />production:<br /> perform_authentication: true<br /> username: admin<br /> password: secret<br /><span class="c">[/code]</span><br />来源:http://railscasts.com/episodes/85`
    \n

    \n", "_id"=>713}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Web 2.0 ,有文化的网站做不大", "body"=>"

    这个文章从一个层面上讲述了这个现象。
    \n原文:http://china.digitalwall.com/scripts/display.asp?UID=403
    \n摘要:

    \n

    为什么会造成这种市场局面?笔者以前说过,Web 2.0 的发展基础是 社会学,因此一个Web 2.0 网站的用户数多寡,完全看它占领了那个 社会阶层(或者文化阶层)而定,那个阶层直接决定了用户数的上限。

    \n

    因为Web 2.0 网站几乎是靠著人拉人发展起来。每个用户会拉动的人 都是他生活上熟悉的圈子,不管陌生人或熟人。当同一种阶层的人在 这个网站越积越多的时候,其他阶层的人也越难以加入到这里。

    \n

    等到网站有第一批用户,为了牢牢抓住他们,及利用他们带更多用户 进来,必须更加揣摩他们的心思甚或社交习惯。结果更深化了这样的 发展,更加走向某一种文化氛围或者社会阶层,再也无法回头。

    \n

     

    ", "created_at"=>2007-12-28 04:47:04 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    这个文章从一个层面上讲述了这个现象。
    \n原文:http://china.digitalwall.com/scripts/display.asp?UID=403
    \n摘要:
    \n为什么会造成这种市场局面?笔者以前说过,Web 2.0 的发展基础是 社会学,因此一个Web 2.0 网站的用户数多寡,完全看它占领了那个 社会阶层(或者文化阶层)而定,那个阶层直接决定了用户数的上限。
    \n因为Web 2.0 网站几乎是靠著人拉人发展起来。每个用户会拉动的人 都是他生活上熟悉的圈子,不管陌生人或熟人。当同一种阶层的人在 这个网站越积越多的时候,其他阶层的人也越难以加入到这里。
    \n等到网站有第一批用户,为了牢牢抓住他们,及利用他们带更多用户 进来,必须更加揣摩他们的心思甚或社交习惯。结果更深化了这样的 发展,更加走向某一种文化氛围或者社会阶层,再也无法回头。
    \n 

    \n", "_id"=>714}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Oracle中的截取字符更新", "body"=>"

    update bizobj_extend_value t
    \nset t.extend_value = substr(t.extend_value,1,10)
    \nwhere extend_key = 'BOSSID'  and  lengthb(trim(t.extend_value) )> 20  

    ", "created_at"=>2007-12-29 03:57:41 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    update bizobj_extend_value t
    \nset t.extend_value = substr(t.extend_value,1,10)
    \nwhere extend_key = 'BOSSID'  and  lengthb(trim(t.extend_value) )> 20  

    \n", "_id"=>715}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"见到了传说中的透明同学", "body"=>"

    透明(http://gigix.thoughtworkers.org/)同学也算是界内大名鼎鼎的了哈,虽然一起完成了伟大的‘技能云’网站,但是一直没有见过真人,实在遗憾;碰巧他来深圳做项目,赶在元旦节终于见到一面。

    \n

    做为一个技术人员,我本人不是很喜欢社交活动,但是偶然见见几个朋友,还是很不错的:)

    \n

    说到技能云,我们觉得还是大有前途的。

    ", "created_at"=>2008-01-02 13:25:57 UTC, "updated_at"=>2012-06-24 15:47:01 UTC, "body_html"=>"

    透明(http://gigix.thoughtworkers.org/)同学也算是界内大名鼎鼎的了哈,虽然一起完成了伟大的‘技能云’网站,但是一直没有见过真人,实在遗憾;碰巧他来深圳做项目,赶在元旦节终于见到一面。
    \n做为一个技术人员,我本人不是很喜欢社交活动,但是偶然见见几个朋友,还是很不错的:)
    \n说到技能云,我们觉得还是大有前途的。

    \n", "_id"=>716}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"2008年都来了,该盘点下去年的历程了", "body"=>"

    好像真的好快,转眼间,我毕业都快2年了,2007年又悄悄的过完了,回首看看,我貌似也干了不少‘看上去’了不起的事情,该坐下来稍微盘点下下拉。

    \n

    本职工作,公司的项目我貌似完成的相当不错,开发和运维做的都不错的,电信级的产品让自己也学到了不少东西,虽然都是点点滴滴的,但每每需要用到什么东西的时候,我都可以搞定的差不多。有些机会,没有真正抓住,但是也促使了其他的一些新的机会,貌似很不错。

    \n

    课余活动,貌似真的很丰富,我能用Rails实现了很多自己以前想到却无法实现的东西,做了一批我心目中的网站,虽然没有取得巨大的成功,但是看看技能云(iTechTag)、1.s.t,以及byeloo1stlog第一次等等,我自己都不敢相信,这些都是我做的。构建自己理想的团队模式和氛围1sters.com,做为国内第一批专业的ROR技术团队,虽然我们不曾实际运转,但其让我积累足够的经验。

    \n

    晓得了什么是敏捷开发,什么是rails,什么是mogrel,ngnix等等等。。晓得了代码还可以这么优雅和舒服。

    \n

    继续了天马行空的梦想,虽然遇到了不少困难和挫折,但是我们挺过来了,还是有那么多的安全爱好者兄弟,浪子,小A,丰初,心雨以及其他几个朋友,让我保持了对安全领域兴趣和爱好。

    \n

    协助Tudou编辑nohack杂志,nohack中我还算是元老吧,从创办到现在,风风雨雨,虽然我不曾尽全力,但是始终关注,尽自己的一份绵薄之力,虽然还不成见过那群很神秘的TUdou、裤子,LCX等等。对nohack的热爱,使得自己也对网络安全保存自己的特有视觉。

    \n

    另外认识了一些创业界的朋友,看着朋友的网站“圈内”,“公益街”,“recity”,“善学”,“菜盘子”等等,看着他们为自己的理想工作,实在不错;接触到ROR世界中的一些活跃者,看到未来的趋势。认识了一起扯蛋、讨论的reacoo,公益街那个心怀梦想的monty,上海recity的创者,透明、infoQ的老霍(泰稳)、不曾见面却提供很多帮助的fengbo,给我很多建议cash.zhao,一起讨论问题的tails, 在我故乡的创建自己善学的jouy、来自德国的maxime、在家过着我向往的节奏生活的snowzhang,javaeye的robbin前辈,国内ROR实践的先行者dongbing、rails的布道者caiwangqin、道喜以及程序员杂志社的朋友们。

    \n

    还有伴着我已经5年风雨的shine,虽然没有多少惊喜,但是我们一起走过,琐碎的生活,让我们学会更多,虽然也曾惹你生气、流泪,但请相信,我们的未来肯定是美好的,相伴一生。

    \n

    一年时间不算太长,我忙忙碌碌的没有停歇,回首过去,点点滴滴。

    \n

    已经到来的2008,是充满希望的一年,虽然说不上雄伟的计划,但是2008中还是心怀梦想的,希望2008年,我们的’技能云‘能爆发全面的威力;希望朋友们的梦想都能成真,还有诸多暂时不能说的秘密。

    \n

    期待我们完美的2008..还没有盘点的XDJM该盘点下再前行啦。。

    \n

     

    \n

     

    ", "created_at"=>2008-01-02 13:54:57 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    好像真的好快,转眼间,我毕业都快2年了,2007年又悄悄的过完了,回首看看,我貌似也干了不少‘看上去’了不起的事情,该坐下来稍微盘点下下拉。
    \n本职工作,公司的项目我貌似完成的相当不错,开发和运维做的都不错的,电信级的产品让自己也学到了不少东西,虽然都是点点滴滴的,但每每需要用到什么东西的时候,我都可以搞定的差不多。有些机会,没有真正抓住,但是也促使了其他的一些新的机会,貌似很不错。
    \n课余活动,貌似真的很丰富,我能用Rails实现了很多自己以前想到却无法实现的东西,做了一批我心目中的网站,虽然没有取得巨大的成功,但是看看技能云(iTechTag)、1.s.t,以及byeloo,1stlog,第一次等等,我自己都不敢相信,这些都是我做的。构建自己理想的团队模式和氛围1sters.com,做为国内第一批专业的ROR技术团队,虽然我们不曾实际运转,但其让我积累足够的经验。
    \n晓得了什么是敏捷开发,什么是rails,什么是mogrel,ngnix等等等。。晓得了代码还可以这么优雅和舒服。
    \n继续了天马行空的梦想,虽然遇到了不少困难和挫折,但是我们挺过来了,还是有那么多的安全爱好者兄弟,浪子,小A,丰初,心雨以及其他几个朋友,让我保持了对安全领域兴趣和爱好。
    \n协助Tudou编辑nohack杂志,nohack中我还算是元老吧,从创办到现在,风风雨雨,虽然我不曾尽全力,但是始终关注,尽自己的一份绵薄之力,虽然还不成见过那群很神秘的TUdou、裤子,LCX等等。对nohack的热爱,使得自己也对网络安全保存自己的特有视觉。
    \n另外认识了一些创业界的朋友,看着朋友的网站“圈内”,“公益街”,“recity”,“善学”,“菜盘子”等等,看着他们为自己的理想工作,实在不错;接触到ROR世界中的一些活跃者,看到未来的趋势。认识了一起扯蛋、讨论的reacoo,公益街那个心怀梦想的monty,上海recity的创者,透明、infoQ的老霍(泰稳)、不曾见面却提供很多帮助的fengbo,给我很多建议cash.zhao,一起讨论问题的tails, 在我故乡的创建自己善学的jouy、来自德国的maxime、在家过着我向往的节奏生活的snowzhang,javaeye的robbin前辈,国内ROR实践的先行者dongbing、rails的布道者caiwangqin、道喜以及程序员杂志社的朋友们。
    \n还有伴着我已经5年风雨的shine,虽然没有多少惊喜,但是我们一起走过,琐碎的生活,让我们学会更多,虽然也曾惹你生气、流泪,但请相信,我们的未来肯定是美好的,相伴一生。
    \n一年时间不算太长,我忙忙碌碌的没有停歇,回首过去,点点滴滴。
    \n已经到来的2008,是充满希望的一年,虽然说不上雄伟的计划,但是2008中还是心怀梦想的,希望2008年,我们的’技能云‘能爆发全面的威力;希望朋友们的梦想都能成真,还有诸多暂时不能说的秘密。
    \n期待我们完美的2008..还没有盘点的XDJM该盘点下再前行啦。。
    \n 
    \n 

    \n", "_id"=>717}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Nano简单就是美的基础指南", "body"=>"

    使用的DH上的crontab的默认编辑器是nano,我以前在家里的电脑上貌似也看到过,但是当时觉得不会有,也懒得看DOCs,于是就按照google到的文档将其设定为vim了,今天在DH上配置crontab的时候,再次发现这个东西,决定好好看看到底是什么东西。

    \n

    google到2篇文章,稍微看了下,在结合实例试了下,果然简洁好用,相当不错,使用起来也很简单,摘抄点放下面:

    \n

    NANO中有这么几种特殊的输入方式,当你按下Ctrl键(用^表示)的同时再按其它键,或者连续按两下ESC键再按其它键,你就可以使用NANO的特殊功能。比如:
    \n^Y 向前翻一页
    \n^V 向后翻一页
    \n^X 退出编辑器
    \n^G 获得在线帮助 这是最重要的功能,请大家一定时常使用
    \n^O 存储文件
    \n^W 搜索
    \n^C 获得当前鼠标位置
    \n^K 删掉光标所在行
    \n还有好多好多特殊功能,大家可以^G通过在线帮助来学习,这里就不详述了。

    \n

    其他的请参考我google到的2篇文章:

    \n

    Nano基础指南:http://www.gentoo.org/doc/zh_cn/nano-basics-guide.xml

    \n

    NANO,简单就是美:http://www.linuxer.cn/?uid-2-action-viewspace-itemid-9

    \n

    Nano官方:http://www.nano-editor.org

    ", "created_at"=>2008-01-03 07:04:31 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    使用的DH上的crontab的默认编辑器是nano,我以前在家里的电脑上貌似也看到过,但是当时觉得不会有,也懒得看DOCs,于是就按照google到的文档将其设定为vim了,今天在DH上配置crontab的时候,再次发现这个东西,决定好好看看到底是什么东西。
    \ngoogle到2篇文章,稍微看了下,在结合实例试了下,果然简洁好用,相当不错,使用起来也很简单,摘抄点放下面:
    \nNANO中有这么几种特殊的输入方式,当你按下Ctrl键(用^表示)的同时再按其它键,或者连续按两下ESC键再按其它键,你就可以使用NANO的特殊功能。比如:
    \n^Y 向前翻一页
    \n^V 向后翻一页
    \n^X 退出编辑器
    \n^G 获得在线帮助 这是最重要的功能,请大家一定时常使用
    \n^O 存储文件
    \n^W 搜索
    \n^C 获得当前鼠标位置
    \n^K 删掉光标所在行
    \n还有好多好多特殊功能,大家可以^G通过在线帮助来学习,这里就不详述了。
    \n其他的请参考我google到的2篇文章:
    \nNano基础指南:http://www.gentoo.org/doc/zh_cn/nano-basics-guide.xml
    \nNANO,简单就是美:http://www.linuxer.cn/?uid-2-action-viewspace-itemid-9
    \nNano官方:http://www.nano-editor.org

    \n", "_id"=>718}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google SOAP Search API不在提供服务", "body"=>"

    其实很早前我就用过这个,貌似还是在读书的时候吧,现在技能云上我突然感觉这个相当不错的一个功能,可惜的是,在其站上发现,已经不在提供了,看到其公告如下:
    \n
    \nf December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.
    \n

    \n

    Depending on your application, the AJAX Search API may be a better choice for you instead. It tends to be better suited for search-based web applications and supports additional features like Video, News, Maps, and Blog search results.

    \n

    For developers who are already using the SOAP Search API, we've kept the documentation live on this site.

    \n

    \n

    唉,按照其意思是推荐大家使用更强大的AJAX Search API,但是我不觉得其好用,也不符合我的需要,可惜了哦。
    \n还是贴一段代码吧,如下:
    \nrequire 'soap/wsdlDriver'
    \n$KCODE = "UTF8"
    \nkey = 'LVJnAm5QFHblahblahblah your key here'
    \n
    \n#create driver
    \nwsdl = "http://api.google.com/GoogleSearch.wsdl"
    \ndriver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    \nquery = "your query string here"
    \nstart = 0
    \nmax = 10
    \n 
    \n# see http://dev.ctor.org/soap4r/browser/trunk/sample/wsdl/googleSearch/wsdlDriver.rb
    \n@results = driver.doGoogleSearch( key, query, start, max, true, "", true, 'lang_en', '','')
    \nsnippets = @results.resultElements.collect { |r| r.snippet } # you can get all kinds'a' info here
    \nself.update_attribute(:html, snippets.join("\\n")) # or whatever
    \n
    \n===================================
    \ndef search
    \n require 'soap/wsdlDriver'
    \n @title = 'Search Results'
    \n key = 'YOUR GOOGLE API KEY HERE'
    \n yoursite = 'YOUR SITE ADDRESS HERE'
    \n driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl").createDriver
    \n @results = driver.doGoogleSearch(key, @params['term']+" site:\#{yoursite}", 0, 10, true, " ", false, " ", " ", " ")
    \nend
    \n
    \n
    \n<% for result in @results.resultElements %>
    \n <h2><%= result.title %></h2>
    \n <p><%= result.snippet %></p>
    \n <p><a href="<%= result.URL %>"><%= result.URL %></a></p>
    \n<% end %>

    ", "created_at"=>2008-01-03 15:58:04 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    其实很早前我就用过这个,貌似还是在读书的时候吧,现在技能云上我突然感觉这个相当不错的一个功能,可惜的是,在其站上发现,已经不在提供了,看到其公告如下:
    \n“
    \nf December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.
    \n
    \nDepending on your application, the AJAX Search API may be a better choice for you instead. It tends to be better suited for search-based web applications and supports additional features like Video, News, Maps, and Blog search results.
    \nFor developers who are already using the SOAP Search API, we've kept the documentation live on this site.
    \n”
    \n唉,按照其意思是推荐大家使用更强大的AJAX Search API,但是我不觉得其好用,也不符合我的需要,可惜了哦。
    \n还是贴一段代码吧,如下:
    \nrequire 'soap/wsdlDriver'
    \n$KCODE = "UTF8"
    \nkey = 'LVJnAm5QFHblahblahblah your key here'

    \n\n

    create driver

    \n\n

    wsdl = "http://api.google.com/GoogleSearch.wsdl"
    \ndriver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    \nquery = "your query string here"
    \nstart = 0
    \nmax = 10
    \n 

    \n\n

    see http://dev.ctor.org/soap4r/browser/trunk/sample/wsdl/googleSearch/wsdlDriver.rb

    \n\n

    @results = driver.doGoogleSearch( key, query, start, max, true, "", true, 'lang_en', '','')
    \nsnippets = @results.resultElements.collect { |r| r.snippet } # you can get all kinds'a' info here
    \nself.update_attribute(:html, snippets.join("\\n")) # or whatever
    \n
    \n===================================
    \ndef search
    \n require 'soap/wsdlDriver'
    \n @title = 'Search Results'
    \n key = 'YOUR GOOGLE API KEY HERE'
    \n yoursite = 'YOUR SITE ADDRESS HERE'
    \n driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl".createDriver;)
    \n @results = driver.doGoogleSearch(key, @params['term']+" site:\#{yoursite}", 0, 10, true, " ", false, " ", " ", " ")
    \nend
    \n
    \n
    \n<% for result in @results.resultElements %>
    \n <h2><%= result.title %></h2>
    \n <p><%= result.snippet %></p>
    \n <p><a href="<%= result.URL %>"><%= result.URL %></a></p>
    \n<% end %>

    \n", "_id"=>719}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"测试ruby中的gsub和scan等找到需要的字符串", "body"=>"

    测试一些ruby中的字符匹配方法,如下是源代码。

    \n

    <code class=java>

    \n

     

    \n

    puts "----1、 使用gsub找到需要的字符串 存在$1中-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.*)"/,"---")}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.*)"/,"---")
    \nputs $1
    \n
    \nputs "---------------------------"
    \n
    \nputs "----2、在gsub里面可以使用区块?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.*)")/){|c| c.upcase}}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.*)")/){|c| c.upcase}
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \n
    \nputs "----3、看看匹配到的是什么?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.*)")/,'\\2')}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.*)")/,'\\2')
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \nputs "----4、使用scan来扫描符合正则的字符串-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.*)"/).first.first}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.*)"/).first.first
    \nputs $1
    \n</code>

    \n


    \n输出结果:
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.*)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n----3、看看匹配到的是什么?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.*)")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk
    \n
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n----1、 使用gsub找到需要的字符串 存在$1中-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(encoding="(.*)"/,"---")
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.*)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----3、看看匹配到的是什么?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.*)")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk

    ", "created_at"=>2008-01-07 02:38:25 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    测试一些ruby中的字符匹配方法,如下是源代码。
    \n<code class=java>
    \n 
    \nputs "----1、 使用gsub找到需要的字符串 存在$1中-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.)"/,"---")}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.
    )"/,"---")
    \nputs $1
    \n
    \nputs "---------------------------"
    \n
    \nputs "----2、在gsub里面可以使用区块?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.)")/){|c| c.upcase}}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.
    )")/){|c| c.upcase}
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \n
    \nputs "----3、看看匹配到的是什么?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.)")/,'\\2')}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.
    )")/,'\\2')
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \nputs "----4、使用scan来扫描符合正则的字符串-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.)"/).first.first}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.
    )"/).first.first
    \nputs $1
    \n</code>
    \n
    \n输出结果:
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n----3、看看匹配到的是什么?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.
    )")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.)"/).first.first
    \ngbk
    \ngbk
    \n
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n----1、 使用gsub找到需要的字符串 存在$1中-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(encoding="(.
    )"/,"---")
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----3、看看匹配到的是什么?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.
    )")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk

    \n", "_id"=>720}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何完成非utf8格式的RSS转换", "body"=>"

    技能云的开发过程中,由于提供了抓取用户提交的Feed上的文章的功能,于是乎,遭受到编码问题的困扰,按照一般的规范,RSS或者ATOM都应该使用UTF-8的编码吧,无奈的是总有些人不遵守,比较baid空间的RSS就是gb2312编码的。
    \n
    \n没办法,竟然用户提出来,我也只能想办法搞定它了。其实原理也很简单,读取该feed的编码,然后在入库前先做此编码转换。
    \n至于如何取得该feed的编码,可以参考我前面写的这篇文章(http://iceskysl.1sters.com/?action=show&id=184)。

    \n

    PS:新版本的firefox3b2对我这个blog的编辑器支持不是很好,无法弹出加链接等等的框,比较不爽。。

    ", "created_at"=>2008-01-07 02:46:35 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在技能云的开发过程中,由于提供了抓取用户提交的Feed上的文章的功能,于是乎,遭受到编码问题的困扰,按照一般的规范,RSS或者ATOM都应该使用UTF-8的编码吧,无奈的是总有些人不遵守,比较baid空间的RSS就是gb2312编码的。
    \n
    \n没办法,竟然用户提出来,我也只能想办法搞定它了。其实原理也很简单,读取该feed的编码,然后在入库前先做此编码转换。
    \n至于如何取得该feed的编码,可以参考我前面写的这篇文章(http://iceskysl.1sters.com/?action=show&id=184)。;
    \nPS:新版本的firefox3b2对我这个blog的编辑器支持不是很好,无法弹出加链接等等的框,比较不爽。。

    \n", "_id"=>721}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag增加圈子编辑和其分类添加编辑功能", "body"=>"

    技能云 添加新功能 和完善以前的功能,已经成为习惯了,每天每天没事的时候就想想哪些地方需要改进?哪些地方还需要加强等.

    \n

    现在是凌晨0:30分,我把刚才完成的新功能升级上去了,虽然是轻车熟路,不免还是心潮澎湃,看着技能云 一天天的成长,是我最欣慰的事情。

    \n

    今天添加功能有:

    \n
      \n
    1. 圈子 的编辑功能,开通圈子的人默认为其管理者,可以修改完善圈子的名字、描述和规则;
    2. \n
    3. 另外,还可以针对自己的圈子添加适当的分类以更好的将话题分类,以方便浏览。
    4. \n
    5. 按照分类来浏览其Group中的话题。
    6. \n
    \n

    以上功能你在浏览社区的时候应该都可以看到,我就不截图了。。

    \n

    如有建议和意见,欢迎联系我。

    ", "created_at"=>2008-01-08 16:42:21 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    给技能云 添加新功能 和完善以前的功能,已经成为习惯了,每天每天没事的时候就想想哪些地方需要改进?哪些地方还需要加强等.
    \n现在是凌晨0:30分,我把刚才完成的新功能升级上去了,虽然是轻车熟路,不免还是心潮澎湃,看着技能云 一天天的成长,是我最欣慰的事情。
    \n今天添加功能有:
    \n
    \n 圈子 的编辑功能,开通圈子的人默认为其管理者,可以修改完善圈子的名字、描述和规则;
    \n 另外,还可以针对自己的圈子添加适当的分类以更好的将话题分类,以方便浏览。
    \n 按照分类来浏览其Group中的话题。
    \n
    \n以上功能你在浏览社区的时候应该都可以看到,我就不截图了。。
    \n如有建议和意见,欢迎联系我。

    \n", "_id"=>722}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Proc.new vs Lambda in Ruby", "body"=>"

    一直都不是很能把ruby的Proc运用自由,今天看一个gem的时候,又发现另外一个比较让我迷惑的东西Lambda ,好读书不求甚解,先找到一篇相关的文章,如下:

    \n

    http://samdanielson.com/2007/3/19/proc-new-vs-lambda-in-ruby

    \n

    原作者是这么说的:

    \n
    \n

    I found the following lines of code on Wikipedia today. It’s a very succinct description of one important difference between a lambda and a Proc. Try printing the return value of f.call for more insight.

    \n
    \n

    摘录部分内容如下:

    \n``
    def foo
    f = Proc.new { return "return from foo from inside proc" }
    f.call # control leaves foo here
    return "return from foo"
    end

    def bar
    f = lambda { return "return from lambda" }
    f.call # control does not leave bar here
    return "return from bar"
    end

    puts foo # prints "return from foo from inside proc"
    puts bar # prints "return from bar"

    在wiki上也有,地址如下:http://en.wikipedia.org/wiki/Closure_(computer_science)``````", "created_at"=>2008-01-09 04:37:23 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一直都不是很能把ruby的Proc运用自由,今天看一个gem的时候,又发现另外一个比较让我迷惑的东西Lambda ,好读书不求甚解,先找到一篇相关的文章,如下:
    \nhttp://samdanielson.com/2007/3/19/proc-new-vs-lambda-in-ruby
    \n原作者是这么说的:
    \n
    \nI found the following lines of code on Wikipedia today. It’s a very succinct description of one important difference between a lambda and a Proc. Try printing the return value of f.call for more insight.
    \n
    \n摘录部分内容如下:
    \n<code class="ruby"><br /><span class="keywords">def</span> foo<br /> f = <span class="constants">Proc</span><span class="method">.new</span> <span class="brackets">{</span> return <span class="string">&quot;return from foo from inside proc&quot;</span> <span class="brackets">}</span><br /> f<span class="method">.call</span> <span class="comment"># control leaves foo here</span><br /> return <span class="string">&quot;return from foo&quot;</span> <br /><span class="keywords">end</span><br /><br /><span class="keywords">def</span> bar<br /> f = lambda <span class="brackets">{</span> return <span class="string">&quot;return from lambda&quot;</span> <span class="brackets">}</span><br /> f<span class="method">.call</span> <span class="comment"># control does not leave bar here</span><br /> return <span class="string">&quot;return from bar&quot;</span> <br /><span class="keywords">end</span><br /><br />puts foo <span class="comment"># prints &quot;return from foo from inside proc&quot; </span><br />puts bar <span class="comment"># prints &quot;return from bar&quot; </span><br /><br />在wiki上也有,地址如下:http://en.wikipedia.org/wiki/Closure_(computer_science)````

    \n", "_id"=>723}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RubyOnRails + S3 + EC2 = ?", "body"=>"

    最近关注了下Amazon S3EC2,加上一直比较看好的Rails,联系在一起想想,真是前景无限呀。
    \nS3提供了海量存储和安全备份,我们再不需要为机器故障、硬盘坏道等担忧了,我也也不需要去买服务器,定时备份了,因为使用S3的海量存储,数据是安全的,容量是无限的,而且价格也是低廉的;
    \nok?相当好,不是么?
    \n别急,还有更好的,EC2这种解决方案更加让人兴奋,看其名字````Elastic Computer Cloud ```就可以就让人无限联想了,不是么?Cloud。。。
    \nEC2是一种基于Xen的虚拟单元,可以自己按照需要购买适当的配置,支持无限扩展,而且价格也比较合理,其他的自己去Amazon 看,我就不罗嗦了。
    \n加上一直很火的RubyOnRails,真的很难想象,以后的互联网会是怎么样的,有时间我写篇文章,幻想一下。
    \n
    \n但是在EC2上跑Rails,操作起来,不是很方便,所以有些插件就出来了。如下收集一些比较不错的资源,有兴趣的朋友自行研究。
    \n体验Amazon EC2:(目前为止看到的唯一一篇中文介绍)
    \nhttp://cookoo.javaeye.com/blog/105510
    \nEC2 on Rails:(插件)
    \nhttp://ec2onrails.rubyforge.org/
    \nDeploying Rails App On Ec2:(slideshare上的一个PPT,写的相当好)
    \nhttp://static.slideshare.net/bansalakhil/deploying-rails-app-on-ec2/
    \nAmazon S3 Firefox Organizer(S3Fox)(火狐的一个用于S3传输的插件,cool)
    \nhttps://addons.mozilla.org/en-US/firefox/addon/3247
    \nUtilizing Amazon S3 and EC2 in Rails(说了常见的几个问题)
    \nhttp://blog.centopeia.com/railsconf-europe-2007-notes/utilizing-amazon-s3-and-ec2-in-rails/
    \nDeploying Rails on EC2
    \nhttp://railspikes.com/2007/4/5/rails-on-ec2
    \n
    \n我已经使用S3了,有机会试试EC2...

    ", "created_at"=>2008-01-10 08:58:56 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近关注了下Amazon 的S3和EC2,加上一直比较看好的Rails,联系在一起想想,真是前景无限呀。
    \nS3提供了海量存储和安全备份,我们再不需要为机器故障、硬盘坏道等担忧了,我也也不需要去买服务器,定时备份了,因为使用S3的海量存储,数据是安全的,容量是无限的,而且价格也是低廉的;
    \nok?相当好,不是么?
    \n别急,还有更好的,EC2这种解决方案更加让人兴奋,看其名字`Elastic Computer Cloud就可以就让人无限联想了,不是么?Cloud。。。
    \nEC2是一种基于Xen的虚拟单元,可以自己按照需要购买适当的配置,支持无限扩展,而且价格也比较合理,其他的自己去Amazon 看,我就不罗嗦了。
    \n加上一直很火的RubyOnRails,真的很难想象,以后的互联网会是怎么样的,有时间我写篇文章,幻想一下。
    \n
    \n但是在EC2上跑Rails,操作起来,不是很方便,所以有些插件就出来了。如下收集一些比较不错的资源,有兴趣的朋友自行研究。
    \n体验Amazon EC2:(目前为止看到的唯一一篇中文介绍)
    \nhttp://cookoo.javaeye.com/blog/105510
    \nEC2 on Rails:(插件)
    \nhttp://ec2onrails.rubyforge.org/
    \nDeploying Rails App On Ec2:(slideshare上的一个PPT,写的相当好)
    \nhttp://static.slideshare.net/bansalakhil/deploying-rails-app-on-ec2/
    \nAmazon S3 Firefox Organizer(S3Fox)(火狐的一个用于S3传输的插件,cool)
    \nhttps://addons.mozilla.org/en-US/firefox/addon/3247
    \nUtilizing Amazon S3 and EC2 in Rails(说了常见的几个问题)
    \nhttp://blog.centopeia.com/railsconf-europe-2007-notes/utilizing-amazon-s3-and-ec2-in-rails/
    \nDeploying Rails on EC2
    \nhttp://railspikes.com/2007/4/5/rails-on-ec2
    \n
    \n我已经使用S3了,有机会试试EC2...

    \n", "_id"=>724}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"刚刚注册完域名OriginalCopyright.com", "body"=>"

    经过一番的思考和推敲,最终选定了http://www.originalcopyright.com/ 这个域名; 尽管长了点,但是容易记,且意思很丰富,不是么?

    \n

    刚刚开始这个Idea,希望大家多多支持..

    ", "created_at"=>2008-01-10 16:31:04 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    经过一番的思考和推敲,最终选定了http://www.originalcopyright.com/ 这个域名; 尽管长了点,但是容易记,且意思很丰富,不是么?
    \n刚刚开始这个Idea,希望大家多多支持..

    \n", "_id"=>725}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很不错的在线分析网站Clicky", "body"=>"

    \"Clicky
    \n一个很不错的在线分析网站,

    \n

    功能相当强大,需要的朋友可以试试看,比我以前是的GA要好很多。。比51.la和51yes都好用。。

    ", "created_at"=>2008-01-10 16:37:24 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一个很不错的在线分析网站,
    \n功能相当强大,需要的朋友可以试试看,比我以前是的GA要好很多。。比51.la和51yes都好用。。

    \n", "_id"=>726}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"vsftpd下显示的时间与系统时间不一致问题", "body"=>"

    最近老是遇到FTP上去看到的文件时间和实际登录上去查看得到的文件生成时间不一致的现象,找了下原因,是因为默认情况下,vsftpd 是用gmt做为它的时间的,所以和系统的时间可能会不一致,修改也很简单:
    \n
    \nvi /etc/vsftpd/vsftpd.conf

    \n

    在最后加入一行:

    \n

    use_localtime=yes

    \n

    存盘后,重启vsftpd即可:

    \n

    service vsftpd restart

    ", "created_at"=>2008-01-15 04:35:19 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近老是遇到FTP上去看到的文件时间和实际登录上去查看得到的文件生成时间不一致的现象,找了下原因,是因为默认情况下,vsftpd 是用gmt做为它的时间的,所以和系统的时间可能会不一致,修改也很简单:
    \n
    \nvi /etc/vsftpd/vsftpd.conf
    \n在最后加入一行:
    \nuse_localtime=yes
    \n存盘后,重启vsftpd即可:
    \nservice vsftpd restart

    \n", "_id"=>727}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Mysql的连接数问题始末", "body"=>"

    看到“海阳”在chinaonrails上问一个关于在Rails的线程中使用mysql链接的问题(http://chinaonrails.com/topic/view/1201/1.html#replyForm),老是出现异常:

    \n

    ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:

    \n

    我以前在写技能云的时候,在后台定时跑的一个并发job的时候,也遇到过类似的问题,个人感觉是线程数的问题,找到几篇资料,证明我的猜测,如下:

    \n

    MySQL最大连接数设置:http://spaces.huash.com/86932/viewspace-223435.html

    \n

    MySQL服务维护笔记 :http://www.chedong.com/tech/mysql.html

    \n

    加大mysql的最大连接数:http://www.21ds.net/article/56/547

    ", "created_at"=>2008-01-15 04:40:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    看到“海阳”在chinaonrails上问一个关于在Rails的线程中使用mysql链接的问题(http://chinaonrails.com/topic/view/1201/1.html#replyForm),老是出现异常:
    \nActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:
    \n我以前在写技能云的时候,在后台定时跑的一个并发job的时候,也遇到过类似的问题,个人感觉是线程数的问题,找到几篇资料,证明我的猜测,如下:
    \nMySQL最大连接数设置:http://spaces.huash.com/86932/viewspace-223435.html
    \nMySQL服务维护笔记 :http://www.chedong.com/tech/mysql.html
    \n加大mysql的最大连接数:http://www.21ds.net/article/56/547

    \n", "_id"=>728}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用消息队列的策略", "body"=>"

    开始的时候,有人说Rails没有队列机制,无法达到企业级的需求,时间没多久,现在再来看看Rails有没有队列机制吧。

    \n

    \"\"

    \n

    别看一组可行的列表,如下:

    \n

    beanstalkd

    \n

    Fast, simple, designed to mirror the style of memcached. Rails plugin available, or usable with a simple Ruby-based API. Server written in C, but is very easy to install. Memory only…jobs are not persistent. New, so the internal protocol may change. Workers may be difficult to manage.

    \n

    bj

    \n

    Rails plugin. Self-spawning. Can only send shell commands. Jobs start a full copy of your Rails app on every execution.

    \n

    BackgroundRB

    \n

    Ruby-based. Can be polled for incremental feedback on the progress of a job. Recently rewritten.

    \n

    Amazon SQS

    \n

    Runs on Amazon’s cluster, so it can handle a ton of traffic. Operated by Amazon, so it doesn’t run locally. Not open source.

    \n

    Apache ActiveMQ

    \n

    Well-known. Persistent. Requires several installation steps and database tables.

    \n

    ActiveMessaging

    \n

    Rails plugin. Works with ActiveMQ and others. Requires external job server.

    \n

    BBQ

    \n

    Nothing to install…involves only a single line of code! Doesn’t work on Windows NT4.

    \n

    如下是几篇介绍的文章:

    \n

    http://www.thewebfellas.com/blog/2008/1/17/queues

    \n

    http://nubyonrails.com/articles/about-this-blog-beanstalk-messaging-queue

    ", "created_at"=>2008-01-18 06:48:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    开始的时候,有人说Rails没有队列机制,无法达到企业级的需求,时间没多久,现在再来看看Rails有没有队列机制吧。
    \n
    \n别看一组可行的列表,如下:
    \nbeanstalkd
    \nFast, simple, designed to mirror the style of memcached. Rails plugin available, or usable with a simple Ruby-based API. Server written in C, but is very easy to install. Memory only…jobs are not persistent. New, so the internal protocol may change. Workers may be difficult to manage.
    \nbj
    \nRails plugin. Self-spawning. Can only send shell commands. Jobs start a full copy of your Rails app on every execution.
    \nBackgroundRB
    \nRuby-based. Can be polled for incremental feedback on the progress of a job. Recently rewritten.
    \nAmazon SQS
    \nRuns on Amazon’s cluster, so it can handle a ton of traffic. Operated by Amazon, so it doesn’t run locally. Not open source.
    \nApache ActiveMQ
    \nWell-known. Persistent. Requires several installation steps and database tables.
    \nActiveMessaging
    \nRails plugin. Works with ActiveMQ and others. Requires external job server.
    \nBBQ
    \nNothing to install…involves only a single line of code! Doesn’t work on Windows NT4.
    \n如下是几篇介绍的文章:
    \nhttp://www.thewebfellas.com/blog/2008/1/17/queues
    \nhttp://nubyonrails.com/articles/about-this-blog-beanstalk-messaging-queue

    \n", "_id"=>729}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用backgroundrb任务队列", "body"=>"

    svn co      http://svn.devjavu.com/backgroundrb/trunk      backgroundrb
    \nrake backgroundrb:setup
    \n或者:script/plugin install svn://rubyforge.org//var/svn/backgroundrb

    \n

    可用资源:
    \nhttp://www.infoq.com/cn/articles/BackgrounDRb
    \nhttp://backgroundrb.rubyforge.org/
    \nhttp://warpspire.com/tipsresources/programming/long-running-tasks-in-rails-backgroundrb/

    ", "created_at"=>2008-01-20 08:20:13 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    svn co      http://svn.devjavu.com/backgroundrb/trunk      backgroundrb
    \nrake backgroundrb:setup
    \n或者:script/plugin install svn://rubyforge.org//var/svn/backgroundrb
    \n可用资源:
    \nhttp://www.infoq.com/cn/articles/BackgrounDRb
    \nhttp://backgroundrb.rubyforge.org/
    \nhttp://warpspire.com/tipsresources/programming/long-running-tasks-in-rails-backgroundrb/

    \n", "_id"=>730}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何把用到的gems附到verdor中", "body"=>"

    在本地装多少gems都无所谓,但是当在服务器上或者是 share host的时候,有的时候并不是您需要的gems都有安装的,这个时候,我们在想最好是在本地把需要的gems打包到vendor里面去,这样怎么迁移都不怕了。

    \n

    于是google了一番,发现老外们已经实践过了,方法其实也不难,主要是要区分一些gems是无法做大的,但是其他的貌似都是可以的。

    \n

    具体做法请参考如下这几个文章:

    \n

    1、http://hideto.javaeye.com/blog/82235(中文介绍的,比较简短)

    \n

    2、http://rubygems.org/read/chapter/10(介绍gem命令的)

    \n

    3、http://errtheblog.com/posts/50-vendor-everything(具体实现的)

    \n

    如上三篇文章。用到的命令主要就是gem,所以附带了上面那篇gem的参考:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack uuidtools  
    2. \n
    3. Unpacked gem: 'uuidtools-1.0.1'  
    4. \n
    5.   
    6. \n
    7. E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack rio  
    8. \n
    9. Unpacked gem: 'rio-0.4.1'  
    10. \n
    11.   
    12. \n
    13. E:\\Ysl\\dev\\1ster\\vendor\\gems>ls  
    14. \n
    15. rio-0.4.1        uuidtools-1.0.1  
    16. \n
    17.   
    18. \n
    19. E:\\Ysl\\dev\\1ster\\vendor\\gems> 
      \n
    20. \n
    \n
    \n

    ", "created_at"=>2008-01-21 08:46:15 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在本地装多少gems都无所谓,但是当在服务器上或者是 share host的时候,有的时候并不是您需要的gems都有安装的,这个时候,我们在想最好是在本地把需要的gems打包到vendor里面去,这样怎么迁移都不怕了。
    \n于是google了一番,发现老外们已经实践过了,方法其实也不难,主要是要区分一些gems是无法做大的,但是其他的貌似都是可以的。
    \n具体做法请参考如下这几个文章:
    \n1、http://hideto.javaeye.com/blog/82235(中文介绍的,比较简短)
    \n2、http://rubygems.org/read/chapter/10gem命令的)(介绍
    \n3、http://errtheblog.com/posts/50-vendor-everything(具体实现的)
    \n如上三篇文章。用到的命令主要就是gem,所以附带了上面那篇gem的参考:
    \n
    \n
    \nRuby代码
    \n
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack uuidtools  
    \n Unpacked gem: 'uuidtools-1.0.1'  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack rio  
    \n Unpacked gem: 'rio-0.4.1'  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>ls  
    \n rio-0.4.1        uuidtools-1.0.1  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems> 
    \n
    \n
    \n

    \n", "_id"=>731}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Open Flash Chart Plugin for Ruby on Rails - Graphs", "body"=>"

    刚刚写完上一篇文章Open flash chart 生成动态有一些交互效果的图表 ,因为其实用PHP做为例子来演示的,偶还想用RubyOnRails来改写一把,down下他的zip包,发现有两个ruby的类库,一个是作者自己写的,比较简陋;而另外一个是pullmonkey 写的,看了下代码和readme,发现他已经用RoR实现了。 去他的网站上看看,果然又有更新,看下其效果,相当不错。 \"\"

    \n

    \"\"

    \n

    \"\"

    \n
    \n

    I ported the php code for open flash chart to ruby and so far it has worked quite well with Rails. Just ported the latest 1.9.6 version – see the many graph examples below. To install and use the open flash chart plugin for Rails do the following:

    \n
    \n
      \n
    1. script/plugin install http://svn.pullmonkey.com/plugins/trunk/open_flash_chart/
    2. \n
    3. Move the open_flash_chart.swf file into your RAILS_ROOT/public directory
    4. \n
    5. Create a controller and a view as in my examples below.
    6. \n
    \n

    可以在http://pullmonkey.com/projects/open_flash_chart 查看详细的代码和示例。

    \n

    看一段3D bar的代码,如下:````
    \n

    \n
    Ruby代码
    \n
      \n
    1. def view  
    2. \n
    3.   @graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/bar_3d'false'/projects/')             
    4. \n
    5. end  
    6. \n
    7. def bar_3d  
    8. \n
    9.         bar_red = Bar3d.new(75, '#D54C78')  
    10. \n
    11.         bar_red.key('2006', 10)  
    12. \n
    13.         bar_blue = Bar3d.new(75, '#3334AD')  
    14. \n
    15.         bar_blue.key('2007', 10)  
    16. \n
    17.   
    18. \n
    19.         10.times do |t|  
    20. \n
    21.                 bar_red.data << rand(3) + 2  
    22. \n
    23.                 bar_blue.data << rand(4) + 5  
    24. \n
    25.         end  
    26. \n
    27.   
    28. \n
    29.         g = Graph.new  
    30. \n
    31.         g.title("3D Bar Chart""{font-size:20px; color: #FFFFFF; margin: 5px;background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}")  
    32. \n
    33.         g.data_sets << bar_red  
    34. \n
    35.         g.data_sets << bar_blue  
    36. \n
    37.   
    38. \n
    39.         g.set_x_axis_3d(12)  
    40. \n
    41.         g.set_x_axis_color('#ffffff''#fDB5C7')  
    42. \n
    43.         g.set_y_axis_color('#ffffff''#fDB5C7')  
    44. \n
    45.   
    46. \n
    47.         g.set_x_labels(%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct))  
    48. \n
    49.         g.set_y_max(10)  
    50. \n
    51.         g.set_y_label_steps(5)  
    52. \n
    53.         g.set_y_legend("OPEN FLASH CHART", 12, "#736AFF")  
    54. \n
    55.         render :text => g.render  
    56. \n
    57. end  
    58. \n
    \n
    \n```

    ", "created_at"=>2008-01-24 02:54:00 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    刚刚写完上一篇文章Open flash chart 生成动态有一些交互效果的图表 ,因为其实用PHP做为例子来演示的,偶还想用RubyOnRails来改写一把,down下他的zip包,发现有两个ruby的类库,一个是作者自己写的,比较简陋;而另外一个是pullmonkey 写的,看了下代码和readme,发现他已经用RoR实现了。 去他的网站上看看,果然又有更新,看下其效果,相当不错。
    \n
    \n
    \n
    \nI ported the php code for open flash chart to ruby and so far it has worked quite well with Rails. Just ported the latest 1.9.6 version – see the many graph examples below. To install and use the open flash chart plugin for Rails do the following:
    \n
    \n
    \n script/plugin install http://svn.pullmonkey.com/plugins/trunk/open_flash_chart/
    \n Move the open_flash_chart.swf file into your RAILS_ROOT/public directory
    \n Create a controller and a view as in my examples below.
    \n
    \n可以在http://pullmonkey.com/projects/open_flash_chart 查看详细的代码和示例。
    \n看一段3D bar的代码,如下:`<br />
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol start="1" class="dp-rb">
    \n <li class="alt"><span><span class="keyword">def</span><span>&nbsp;view&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;<span class="variable">@graph</span><span>&nbsp;=&nbsp;open_flash_chart_object(500,250,&nbsp;</span><span class="string">'/projects/open_flash_chart/bar_3d'</span><span>,&nbsp;</span><span class="keyword">false</span><span>,&nbsp;</span><span class="string">'/projects/'</span><span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span><span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span><span class="keyword">def</span><span>&nbsp;bar_3d&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red&nbsp;=&nbsp;Bar3d.<span class="keyword">new</span><span>(75,&nbsp;</span><span class="string">'#D54C78'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red.key(<span class="string">'2006'</span><span>,&nbsp;10)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue&nbsp;=&nbsp;Bar3d.<span class="keyword">new</span><span>(75,&nbsp;</span><span class="string">'#3334AD'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue.key(<span class="string">'2007'</span><span>,&nbsp;10)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.times&nbsp;<span class="keyword">do</span><span>&nbsp;|t|&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red.data&nbsp;&lt;&lt;&nbsp;rand(3)&nbsp;+&nbsp;2&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue.data&nbsp;&lt;&lt;&nbsp;rand(4)&nbsp;+&nbsp;5&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g&nbsp;=&nbsp;Graph.<span class="keyword">new</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.title(<span class="string">&quot;3D&nbsp;Bar&nbsp;Chart&quot;</span><span>,&nbsp;</span><span class="string">&quot;{font-size:20px;&nbsp;color:&nbsp;#FFFFFF;&nbsp;margin:&nbsp;5px;background-color:&nbsp;#505050;&nbsp;padding:5px;&nbsp;padding-left:&nbsp;20px;&nbsp;padding-right:&nbsp;20px;}&quot;</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.data_sets&nbsp;&lt;&lt;&nbsp;bar_red&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.data_sets&nbsp;&lt;&lt;&nbsp;bar_blue&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_axis_3d(12)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_axis_color(<span class="string">'#ffffff'</span><span>,&nbsp;</span><span class="string">'#fDB5C7'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_axis_color(<span class="string">'#ffffff'</span><span>,&nbsp;</span><span class="string">'#fDB5C7'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_labels(%w(Jan&nbsp;Feb&nbsp;Mar&nbsp;Apr&nbsp;May&nbsp;Jun&nbsp;Jul&nbsp;Aug&nbsp;Sep&nbsp;Oct))&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_max(10)&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_label_steps(5)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_legend(<span class="string">&quot;OPEN&nbsp;FLASH&nbsp;CHART&quot;</span><span>,&nbsp;12,&nbsp;</span><span class="string">&quot;#736AFF&quot;</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render&nbsp;<span class="symbol">:text</span><span>&nbsp;=&gt;&nbsp;g.render&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span><span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n</ol>
    \n</div>
    \n

    \n", "_id"=>732}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"突然感觉到picasaweb的速度好快!", "body"=>"

    我很早前就开始使用picasaweb,但是以前老觉得速度慢,加上上传速度都比较一般,所以用的时间不是很多。

    \n

    但是最近发现(特别是今天),上传的时候相当快,而且在其他页面引用显示的时候也相当快的,前些时间,看到很多人说google日历、gmail都加速了,加上现在我感觉的picasaweb的加速,google又要有所大的举动了,难道。。

    \n

    加速当然是好事,以后我在技能云发文章的时候,都是把需要的图片upload到picasaweb上,再引用的,这样很好。

    \n

    一来可以保存自我图片到google,比较安全;

    \n

    二来不用在技能云上传图片啥的,节省空间不说,也减少维护的繁琐。

    ", "created_at"=>2008-01-24 03:16:43 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    我很早前就开始使用picasaweb,但是以前老觉得速度慢,加上上传速度都比较一般,所以用的时间不是很多。
    \n但是最近发现(特别是今天),上传的时候相当快,而且在其他页面引用显示的时候也相当快的,前些时间,看到很多人说google日历、gmail都加速了,加上现在我感觉的picasaweb的加速,google又要有所大的举动了,难道。。
    \n加速当然是好事,以后我在技能云上发文章的时候,都是把需要的图片upload到picasaweb上,再引用的,这样很好。
    \n一来可以保存自我图片到google,比较安全;
    \n二来不用在技能云上传图片啥的,节省空间不说,也减少维护的繁琐。

    \n", "_id"=>733}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遇到一个很奇怪Rails logger的问题~", "body"=>"

    最近技能云遇到一个很奇怪的问题,每天凌晨的时候,转换日志的时候都会出现一些问题,导致应用程序无法访问,每次都是重启后才能恢复,相当怪异。

    \n

    理了下,应该是从我使用backgroundrb任务队列以后开始的,原来是没有问题的,每天凌晨的时候会自动切换日志文件名称。

    \n

    而我在backgroundrb里面是定时的同步用户的Feeds用的,会调用相关的model中的方法解析RSS,入库等操作,自然这个过程中也是有日志的。

    \n

    看到报的错误如下:

    \n

     

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag/config/../log/sql/production_2008-01-24.log.20080124' already exists.):  
    2. \n
    3.     /usr/lib/ruby/1.8/logger.rb:501:in `write'  
    4. \n
    5.     /usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'  
    6. \n
    7.     /usr/lib/ruby/1.8/logger.rb:496:in `write'  
    8. \n
    9.     /usr/lib/ruby/1.8/logger.rb:326:in `add'  
    10. \n
    11.     /usr/lib/ruby/1.8/logger.rb:348:in `debug'  
    12. \n
    13.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:134:in `log_info'  
    14. \n
    15.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:127:in `log'  
    16. \n
    17.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:in `execute'  
    18. \n
    19.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:399:in `select'  
    20. \n
    21.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one'  
    22. \n
    23.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value'  
    24. \n
    25.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:212:in `execute_simple_calculation'  
    26. \n
    27.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:121:in `calculate'  
    28. \n
    29.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `catch'  
    30. \n
    31.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `calculate'  
    32. \n
    33.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:45:in `count'  
    34. \n
    35.     /app/models/motto.rb:9:in `get_rand'  
    36. \n
    37.     /app/controllers/application.rb:35:in `get_rand_motto'  
    38. \n
    \n
    \n

    看到的提示是“Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag

    \n

     

    \n
    /config/../log/sql/production_2008-01-24.log.20080124' already exists.):”
    \n
    看上去感觉是在1.25号凌晨的时候,将原来的日志改名为production_2008-01-24.log.20080124,而此时已经存在名字为“production_2008-01-24.log.20080124”的文件,导致改名失败的。
    \n但是这个“production_2008-01-24.log.20080124”是哪里来的呢?backgroundrb应该是没有进行改名操作的。
    \n
    \n于是乎开始google,找到有类似问题的文章如下:
    \n1、Rails application not working, no error displayed, just error code 500
    \n错误基本上是一样的,但是这个文章没有仔细说是什么原因,只说了:
    \n
    And the problem was almost solved - problem with log rotation.
    \nSo, if you face the same problem, try to perform few operations in your rails console... and if you are lucky, you will find the bug.
    \n
    也就是说是日志rotation的时候的问题。
    \n2、Rails Logging Tips
    \n这篇文章说了一些Rails中使用logger的技巧,没有说到这个问题,只是让我更清楚logg的机制。
    \n3、Strange logger rotation failure
    \n这个邮件列表说了基本上类似的问题,他的原因是由于配置了多个cronb,而导致的,说的比较详细。
    \n
    \n以上只是我的分析过程,而我遇到的这个问题,还有待进一步的分析和排查,有后续进展再补充。
    \n如果有遇到类似问题的朋友,还请指教一二,别让我重复造轮子,谢谢!
    ", "created_at"=>2008-01-25 02:19:06 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近技能云遇到一个很奇怪的问题,每天凌晨的时候,转换日志的时候都会出现一些问题,导致应用程序无法访问,每次都是重启后才能恢复,相当怪异。
    \n理了下,应该是从我使用backgroundrb任务队列以后开始的,原来是没有问题的,每天凌晨的时候会自动切换日志文件名称。
    \n而我在backgroundrb里面是定时的同步用户的Feeds用的,会调用相关的model中的方法解析RSS,入库等操作,自然这个过程中也是有日志的。
    \n看到报的错误如下:
    \n 
    \n
    \nXML/HTML代码
    \n
    \n Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag/config/../log/sql/production_2008-01-24.log.20080124' already exists.):  
    \n     /usr/lib/ruby/1.8/logger.rb:501:in write'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/1.8/monitor.rb:238:in&nbsp;
    synchronize'  
    \n     /usr/lib/ruby/1.8/logger.rb:496:in write'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/1.8/logger.rb:326:in&nbsp;
    add'  
    \n     /usr/lib/ruby/1.8/logger.rb:348:in debug'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:134:in&nbsp;
    log_info'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:127:in log'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:in&nbsp;
    execute'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:399:in select'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in&nbsp;
    select_one'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in select_value'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:212:in&nbsp;
    execute_simple_calculation'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:121:in calculate'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in&nbsp;
    catch'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in calculate'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:45:in&nbsp;
    count'  
    \n     /app/models/motto.rb:9:in get_rand'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/app/controllers/application.rb:35:in&nbsp;
    get_rand_motto'  
    \n
    \n
    \n看到的提示是“Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag
    \n 
    \n/config/../log/sql/production_2008-01-24.log.20080124' already exists.):”
    \n看上去感觉是在1.25号凌晨的时候,将原来的日志改名为production_2008-01-24.log.20080124,而此时已经存在名字为“production_2008-01-24.log.20080124”的文件,导致改名失败的。
    \n但是这个“production_2008-01-24.log.20080124”是哪里来的呢?backgroundrb应该是没有进行改名操作的。
    \n
    \n于是乎开始google,找到有类似问题的文章如下:
    \n1、Rails application not working, no error displayed, just error code 500
    \n错误基本上是一样的,但是这个文章没有仔细说是什么原因,只说了:
    \n And the problem was almost solved - problem with log rotation.
    \nSo, if you face the same problem, try to perform few operations in your rails console... and if you are lucky, you will find the bug.
    \n也就是说是日志rotation的时候的问题。
    \n2、Rails Logging Tips
    \n这篇文章说了一些Rails中使用logger的技巧,没有说到这个问题,只是让我更清楚logg的机制。
    \n3、Strange logger rotation failure
    \n这个邮件列表说了基本上类似的问题,他的原因是由于配置了多个cronb,而导致的,说的比较详细。
    \n
    \n以上只是我的分析过程,而我遇到的这个问题,还有待进一步的分析和排查,有后续进展再补充。
    \n如果有遇到类似问题的朋友,还请指教一二,别让我重复造轮子,谢谢!

    \n", "_id"=>734}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"升级本地Rails到2.02版本", "body"=>"

    Rails2版本出来已经有一段时间了,一直没来得及细看,也没有时间把以前写的几个APP升级到Rails2,今天突然心血来潮,就把本地的Rails升级到Rails2.02版本了。

    \n

    并最先把1.s.t的系统升级调试过了,途中遇到几个小问题,记录如下:

    \n

    1、升级Rails2.02的时候遇到的

    \n

    升级前,版本如下:

    \n
    iceskysl@IceskYsl:~$ gem -v
    \n0.93
    \niceskysl@IceskYsl:~$ rails -v
    \nRails 1.2.5
    \niceskysl@IceskYsl:~$ ruby -v
    \nruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
    \n
    \n

    升级命令如下:

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. iceskysl@IceskYsl:~$ gem update --system  
    2. \n
    3. iceskysl@IceskYsl:~$ gem update rails --include-dependencies   
    4. \n
    \n
    \n升级完,看下版本
    \niceskysl@IceskYsl:~$ gem -v: 1.0.1
    \niceskysl@IceskYsl:~$ rails -v

    \n

    出现rubygems.rb:379:in `report_activate_error': RubyG
    \nem version error: activesupport(1.4.2 not = 2.0.2) (Gem::LoadError)错误,看来有点问题。

    \n

    紧接着执行:gem update activesupport即可。

    \n

    2、出现View的问题

    \n

    \n

    \n
    XML/RHTML代码
    \n
      \n
    1. <%=link_to h(@topic.title),group_topic_path(:group_id => @topic.group, :id => @topic),{:class=>"notify_title"}%>  
    2. \n
    \n
    \n 必须是group_topic_path这样的,不能象Rails1.2.5时候topic_path这样的,其他类似。

    \n

    3、插件问题

    \n

    类似auto_complete_for这个不在包含在Rails核心中,而是以插件的发布,需要安装一下,如下:

    \n

    \n

    \n
    SHELL代码
    \n
      \n
    1. iceskysl@IceskYsl:/opt/devroot/1sters.net$ ./script/plugin  install http://dev.rubyonrails.org/svn/rails/plugins/auto_complete/  
    2. \n
    \n
    \n 还没发现其他问题,貌似没想像的那么多问题,可能是我代码写的比较好吧,:)
    \n

    ", "created_at"=>2008-01-26 12:13:28 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Rails2版本出来已经有一段时间了,一直没来得及细看,也没有时间把以前写的几个APP升级到Rails2,今天突然心血来潮,就把本地的Rails升级到Rails2.02版本了。
    \n并最先把1.s.t的系统升级调试过了,途中遇到几个小问题,记录如下:
    \n1、升级Rails2.02的时候遇到的
    \n升级前,版本如下:
    \niceskysl@IceskYsl:~$ gem -v
    \n0.93
    \niceskysl@IceskYsl:~$ rails -v
    \nRails 1.2.5
    \niceskysl@IceskYsl:~$ ruby -v
    \nruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
    \n
    \n升级命令如下:
    \n
    \n
    \nShell代码
    \n
    \n iceskysl@IceskYsl:~$ gem update --system  
    \n iceskysl@IceskYsl:~$ gem update rails --include-dependencies   
    \n
    \n
    \n升级完,看下版本
    \niceskysl@IceskYsl:~$ gem -v: 1.0.1
    \niceskysl@IceskYsl:~$ rails -v
    \n出现rubygems.rb:379:in `report_activate_error': RubyG
    \nem version error: activesupport(1.4.2 not = 2.0.2) (Gem::LoadError)错误,看来有点问题。
    \n紧接着执行:gem update activesupport即可。
    \n2、出现View的问题
    \n
    \n
    \nXML/RHTML代码
    \n
    \n <%=link_to h(@topic.title),group_topic_path(:group_id => @topic.group, :id => @topic),{:class=>"notify_title"}%>  
    \n
    \n
    \n 必须是group_topic_path这样的,不能象Rails1.2.5时候topic_path这样的,其他类似。
    \n 3、插件问题
    \n 类似auto_complete_for这个不在包含在Rails核心中,而是以插件的发布,需要安装一下,如下:
    \n
    \n
    \n SHELL代码
    \n
    \n iceskysl@IceskYsl:/opt/devroot/1sters.net$ ./script/plugin  install http://dev.rubyonrails.org/svn/rails/plugins/auto_complete/  
    \n
    \n
    \n 还没发现其他问题,貌似没想像的那么多问题,可能是我代码写的比较好吧,:)
    \n

    \n", "_id"=>735}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"MySQL设置编码", "body"=>"

    1、在my.ini文件的中设置所有数据库编码
    \ndefault-character-set=utf8
    \n
    \n 2、
    单独设置某个数据库:
    \n
    alter database testdb character set utf8;
    \n

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. mysql> alter database impsp character set utf8;  
    2. \n
    3. Query OK, 1 row affected (0.00 sec) 
      \n
    4. \n
    \n
    \n

    \n

    3、查看mysql支持的编码:
    \nshow character set;

    ", "created_at"=>2008-01-27 13:17:33 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    1、在my.ini文件的中设置所有数据库编码
    \ndefault-character-set=utf8
    \n
    \n 2、单独设置某个数据库:
    \n alter database testdb character set utf8;
    \n
    \n
    \n
    \nShell代码
    \n
    \n mysql> alter database impsp character set utf8;  
    \n Query OK, 1 row affected (0.00 sec) 
    \n
    \n
    \n
    \n
    \n 3、查看mysql支持的编码:
    \nshow character set;

    \n", "_id"=>736}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Upgrading your views to Rails 2.0", "body"=>"

    升级后VIEW的后缀有改变,可以使用如下命令改.

    \n
    \n
    Shell代码
    \n
      \n
    1. for old in `find app/views -name *.rhtml`; do    
    2. \n
    3.  svn mv $old `dirname $old`/`basename $old .rhtml`.html.erb; done    
    4. \n
    \n
    \n

    http://softiesonrails.com/2007/7/11/upgrading-your-views-to-rails-2-0

    ", "created_at"=>2008-01-28 12:57:10 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    升级后VIEW的后缀有改变,可以使用如下命令改.
    \n
    \nShell代码
    \n
    \n for old in find&nbsp;app/views&nbsp;-name&nbsp;*.rhtml; do    
    \n  svn mv $old dirname&nbsp;</span><span class="variable">$old</span><span>/basename&nbsp;</span><span class="variable">$old</span><span>&nbsp;.rhtml.html.erb; done    
    \n
    \n
    \nhttp://softiesonrails.com/2007/7/11/upgrading-your-views-to-rails-2-0

    \n", "_id"=>737}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"attachment_fu中callbacks_for方法出错解决!", "body"=>"

    前天晚上,把‘技能云’升级到Rails2.02版本后,只是大概的测试了下功能,把发现的问题予以修复,但是由于时间比肩紧急,没能全部覆盖到,昨天发现了不少遗留问题,都陆续的解决了,只有一个使用attachment_fu上传用户头像的地方还有些问题,下面是具体的分析和过程。

    \n

    \n

    \n
    错误日志
    \n
      \n
    1. Parameters: {"commit"=>"涓婁紶..", "action"=>"upload_user_pic", "controller"=>"user", "asset"=>{"uploaded_data"=>#<ActionController::UploadedStringIO:0xb6435ee8>, "user_id"=>"1"}}  
    2. \n
    3. Error:undefined method `callbacks_for' for #<Asset:0xb643149c>銆傘€?  
    4. \n
    \n
    \n从上面的作物日志可以看到,是调用callbacks_for的时候出的问题,而我当时使用的attachment_fu是比较老的版本,作者在后面更新过一次,于是:

    \n

    1、首先更新版本,发现依然无法使用,还是类似的错误

    \n

    2、在COR上发个帖子,大家都说自己的rmagick没有问题,奇怪的很。

    \n

    3、Google下,找到有人遇到类似问题,如下:

    \n\n

    而上面两个地址都给了另外一个页面的链接地址“Edge callback refactorings && attachment_fu" ,看来找到问题了,在其页面上说到:\n

    \n
    引用
    \n
      \n
    1. Edge changeset 8664 introduces ActiveSupport::Callbacks.  
    2. \n
    3. This currently breaks attachment_fu's callback internals and may affect other plugins as well ...  
    4. \n
    \n
    \n

    \n

    哦,原来是Rails中的改动影响了这个插件,\n

    \n
    改动message说明
    \n
      \n
    1. Extract ActiveSupport::Callbacks from Active Record, test case setup and teardown, and ActionController::Dispatcher. Closes #10727.   
    2. \n
    \n
    \n

    \n

    详细的你可以参考这个页面,我就不多说了,下面主要说说怎么解决。

    \n

    按照上面给出的俄那个页面上的方法,做如下处理,将下面这段代码中的三个方法copy到attachment_fu中的attachment_fu.rb 中,覆盖其原来的callback_with_args方法。

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. module Technoweenie  
    2. \n
    3.   module AttachmentFu  
    4. \n
    5.   
    6. \n
    7.     module InstanceMethods  
    8. \n
    9.   
    10. \n
    11.       def self.included( base )  
    12. \n
    13.         base.define_callbacks *[:after_resize:after_attachment_saved:before_thumbnail_saved]  
    14. \n
    15.       end    
    16. \n
    17.   
    18. \n
    19.       def callback_with_args(method, arg = self)  
    20. \n
    21.          notify(method)  
    22. \n
    23.   
    24. \n
    25.           result = run_callbacks(method, { :object => arg }) { |result, object| result == false }  
    26. \n
    27.   
    28. \n
    29.           if result != false && respond_to_without_attributes?(method)  
    30. \n
    31.             result = send(method)  
    32. \n
    33.           end  
    34. \n
    35.   
    36. \n
    37.           return result  
    38. \n
    39.       end        
    40. \n
    41.   
    42. \n
    43.       def run_callbacks(kind, options = {}, &block)  
    44. \n
    45.         options.reverse_merge!( :object => self )  
    46. \n
    47.         ::ActiveSupport::Callbacks::Callback.run(self.class.send("\#{kind}_callback_chain"), options[:object], options, &block)  
    48. \n
    49.       end        
    50. \n
    51.     end  
    52. \n
    53.   end  
    54. \n
    55. end  
    56. \n
    \n
    \n而后,需要确认下您的图片存放目录是可读写的,且其attachment_fu的申明需要指明图片处理器的名字,如下:\n
    \n
    Ruby代码
    \n
      \n
    1. has_attachment  :storage => :file_system,     
    2. \n
    3.   :max_size => 1.megabytes,    
    4. \n
    5.   :size => 1..1.megabyte,  
    6. \n
    7.   :content_type =>  :image,  
    8. \n
    9.   :processor => :MiniMagick,  
    10. \n
    11.   :thumbnails => { :main => '100x100>':thumb => '60x60>':tiny => '40x40>' },    
    12. \n
    13.   :path_prefix=>'public/upload/user_pics'  
    14. \n
    \n
    \n

    \n

    其他应该就没什么问题了,到此完毕。

    ", "created_at"=>2008-01-30 05:34:50 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前天晚上,把‘技能云’升级到Rails2.02版本后,只是大概的测试了下功能,把发现的问题予以修复,但是由于时间比肩紧急,没能全部覆盖到,昨天发现了不少遗留问题,都陆续的解决了,只有一个使用attachment_fu上传用户头像的地方还有些问题,下面是具体的分析和过程。
    \n
    \n
    \n错误日志
    \n
    \n Parameters: {"commit"=>"涓婁紶..", "action"=>"upload_user_pic", "controller"=>"user", "asset"=>{"uploaded_data"=>#<ActionController::UploadedStringIO:0xb6435ee8>, "user_id"=>"1"}}  
    \n Error:undefined method `callbacks_for' for #<Asset:0xb643149c>銆傘€?  
    \n
    \n
    \n从上面的作物日志可以看到,是调用callbacks_for的时候出的问题,而我当时使用的attachment_fu是比较老的版本,作者在后面更新过一次,于是:
    \n1、首先更新版本,发现依然无法使用,还是类似的错误
    \n2、在COR上发个帖子,大家都说自己的rmagick没有问题,奇怪的很。
    \n3、Google下,找到有人遇到类似问题,如下:
    \n
    \n attachment_fu: undefined method 'callbacks_for': updated
    \n Побился attachment_fu
    \n
    \n而上面两个地址都给了另外一个页面的链接地址“Edge callback refactorings && attachment_fu" ,看来找到问题了,在其页面上说到:
    \n
    \n引用
    \n
    \n Edge changeset 8664 introduces ActiveSupport::Callbacks.  
    \n This currently breaks attachment_fu's callback internals and may affect other plugins as well ...  
    \n
    \n
    \n
    \n哦,原来是Rails中的改动影响了这个插件,
    \n
    \n改动message说明
    \n
    \n Extract ActiveSupport::Callbacks from Active Record, test case setup and teardown, and ActionController::Dispatcher. Closes #10727.   
    \n
    \n
    \n
    \n详细的你可以参考这个页面,我就不多说了,下面主要说说怎么解决。
    \n按照上面给出的俄那个页面上的方法,做如下处理,将下面这段代码中的三个方法copy到attachment_fu中的attachment_fu.rb 中,覆盖其原来的callback_with_args方法。
    \n
    \n
    \nRuby代码
    \n
    \n module Technoweenie  
    \n   module AttachmentFu  
    \n   
    \n     module InstanceMethods  
    \n   
    \n       def self.included( base )  
    \n         base.define_callbacks *[:after_resize, :after_attachment_saved, :before_thumbnail_saved]  
    \n       end    
    \n   
    \n       def callback_with_args(method, arg = self)  
    \n          notify(method)  
    \n   
    \n           result = run_callbacks(method, { :object => arg }) { |result, object| result == false }  
    \n   
    \n           if result != false && respond_to_without_attributes?(method)  
    \n             result = send(method)  
    \n           end  
    \n   
    \n           return result  
    \n       end        
    \n   
    \n       def run_callbacks(kind, options = {}, &block)  
    \n         options.reverse_merge!( :object => self )  
    \n         ::ActiveSupport::Callbacks::Callback.run(self.class.send("\#{kind}_callback_chain"), options[:object], options, &block)  
    \n       end        
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n而后,需要确认下您的图片存放目录是可读写的,且其attachment_fu的申明需要指明图片处理器的名字,如下:
    \n
    \nRuby代码
    \n
    \n has_attachment  :storage => :file_system,     
    \n   :max_size => 1.megabytes,    
    \n   :size => 1..1.megabyte,  
    \n   :content_type =>  :image,  
    \n   :processor => :MiniMagick,  
    \n   :thumbnails => { :main => '100x100>', :thumb => '60x60>', :tiny => '40x40>' },    
    \n   :path_prefix=>'public/upload/user_pics'  
    \n
    \n
    \n
    \n其他应该就没什么问题了,到此完毕。

    \n", "_id"=>738}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"link_to中的小甜点", "body"=>"

    升级後技能云的公司展示页面出现一个很奇怪的问题,一直报告说:

    \n``ActionView::TemplateError (undefined method `[]' for nil:NilClass)
    on line #57 of companies/_cannot_edit_item.rhtml:
    而这行却是没有代码的,真的奇怪的很。翻遍这个文件也没有发现什么可疑的地方,最后
    没有办法就挨个的测试,发现有的公司展示页面是可以的,进数据库比较不同,发现有些
    字段是没有值的,难道这个问题,于是挨个的加上值,测试,果然通过,后来再仔细看看
    错误信息:
    错误日志
    1. vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:96:in `rewrite_url'  
    2. vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:82:in `rewrite'  
    3. vendor/rails/actionpack/lib/action_controller/base.rb:620:in `url_for'  
    4. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in `send'  
    5. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in `url_for'  
    6. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:144:in `link_to'  
    7. app/views/companies/_cannot_edit_item.rhtml:57:in  
    8. n_erb_47app47views47companies47_cannot_edit_item46rhtml'  
    看到url_for的身影,突然感觉到是那个公司地址的问题,再测,果然,如此,看看我的代码是这么写的》
    XML/HTML代码
    1. <%= link_to website.link_url, website.link_url %>  
    也就是,生成链接地址,但是当遇到这个字段为空的时候,就挂了,也就是上面这个错误的原因了。

    查看了下link_to 的源代码,如下:
    link_to代码
    1. 137       def link_to(name, options = {}, html_options = nil)  
    2. 138         url = case options  
    3. 139           when String  
    4. 140             options  
    5. 141           when :back  
    6. 142             @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()'  
    7. 143           else  
    8. 144             self.url_for(options)  
    9. 145           end  
    10. 146   
    11. 147         if html_options  
    12. 148           html_options = html_options.stringify_keys  
    13. 149           href = html_options['href']  
    14. 150           convert_options_to_javascript!(html_options, url)  
    15. 151           tag_options = tag_options(html_options)  
    16. 152         else  
    17. 153           tag_options = nil  
    18. 154         end  
    19. 155   
    20. 156         href_attr = "href=\\"\#{url}\\"" unless href  
    21. 157         "<a \#{href_attr}\#{tag_options}>\#{name || url}</a>"  
    22. 158       end  
    接着跟,如下:
    url_for代码
    1. 65       def url_for(options = {})  
    2. 66         case options  
    3. 67         when Hash  
    4. 68           show_path =  options[:host].nil? ? true : false  
    5. 69           options = { :only_path => show_path }.update(options.symbolize_keys)  
    6. 70           escape  = options.key?(:escape) ? options.delete(:escape) : true  
    7. 71           url     = @controller.send(:url_for, options)  
    8. 72         when String  
    9. 73           escape = true  
    10. 74           url    = options  
    11. 75         when NilClass  
    12. 76           url = @controller.send(:url_fornil)  
    13. 77         else  
    14. 78           escape = false  
    15. 79           url    = polymorphic_path(options)  
    16. 80         end  
    17. 81   
    18. 82         escape ? escape_once(url) : url  
    19. 83       end  
    原来如此,豁然开朗。另外还看到:back这样的link_to用法,:)```", "created_at"=>2008-01-30 06:56:27 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    升级後技能云的公司展示页面出现一个很奇怪的问题,一直报告说:
    \n`ActionView::TemplateError (undefined method[]' for nil:NilClass)on line #57 of companies/_cannot_edit_item.rhtml:而这行却是没有代码的,真的奇怪的很。翻遍这个文件也没有发现什么可疑的地方,最后没有办法就挨个的测试,发现有的公司展示页面是可以的,进数据库比较不同,发现有些字段是没有值的,难道这个问题,于是挨个的加上值,测试,果然通过,后来再仔细看看错误信息:错误日志vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:96:in rewrite_url'&nbsp;&nbsp;</span></span></li><li class=""><span>vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:82:in&nbsp;rewrite'  vendor/rails/actionpack/lib/action_controller/base.rb:620:in url_for'&nbsp;&nbsp;</span></li><li class=""><span>vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in&nbsp;send'  vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in url_for'&nbsp;&nbsp;</span></li><li class=""><span>vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:144:in&nbsp;link_to'  app/views/companies/_cannot_edit_item.rhtml:57:in  n_erb_47app47views47companies47_cannot_edit_item46rhtml'  看到url_for的身影,突然感觉到是那个公司地址的问题,再测,果然,如此,看看我的代码是这么写的》XML/HTML代码<%= link_to website.link_url, website.link_url %>  也就是,生成链接地址,但是当遇到这个字段为空的时候,就挂了,也就是上面这个错误的原因了。查看了下link_to 的源代码,如下:link_to代码137       def link_to(name, options = {}, html_options = nil)  138         url = case options  139           when String  140             options  141           when :back  142             @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()'  143           else  144             self.url_for(options)  145           end  146   147         if html_options  148           html_options = html_options.stringify_keys  149           href = html_options['href']  150           convert_options_to_javascript!(html_options, url)  151           tag_options = tag_options(html_options)  152         else  153           tag_options = nil  154         end  155   156         href_attr = "href=&quot;\#{url}&quot;" unless href  157         "<a \#{href_attr}\#{tag_options}>\#{name || url}</a>"  158       end  接着跟,如下:url_for代码65       def url_for(options = {})  66         case options  67         when Hash  68           show_path =  options[:host].nil? ? true : false  69           options = { :only_path => show_path }.update(options.symbolize_keys)  70           escape  = options.key?(:escape) ? options.delete(:escape) : true  71           url     = @controller.send(:url_for, options)  </

    \n\n

    li>72         when String  73           escape = true  74           url    = options  75         when NilClass  76           url = @controller.send(:url_for, nil)  77         else  78           escape = false  79           url    = polymorphic_path(options)  80         end  81   82         escape ? escape_once(url) : url  83       end  原来如此,豁然开朗。另外还看到:back这样的link_to用法,:)```

    \n", "_id"=>739}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用XMPP4r在RubyOnRails中集成IM功能", "body"=>"

    受到Frank文章的感染,决定把我使用XMPP4r在RubyOnRails中集成IM的过程按照其写的两篇文章的流程整理、分享给大家,谢谢Frank。

    \n

    本文根据Frank的风格,结合我在“技能云”中使用的实际过程写的,分成如下几个大的章节:

    \n

    一、XMPP概念以及原理简介
    \n二、实现方法篇
    \n三、结合“技能云”演示

    \n

    本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:

    \n

     使用XMPP4r在RubyOnRails中集成IM功能

    \n

    如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    ", "created_at"=>2008-01-31 02:53:08 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    受到Frank文章的感染,决定把我使用XMPP4r在RubyOnRails中集成IM的过程按照其写的两篇文章的流程整理、分享给大家,谢谢Frank。
    \n本文根据Frank的风格,结合我在“技能云”中使用的实际过程写的,分成如下几个大的章节:
    \n一、XMPP概念以及原理简介
    \n二、实现方法篇
    \n三、结合“技能云”演示
    \n本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:
    \n 使用XMPP4r在RubyOnRails中集成IM功能
    \n如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    \n", "_id"=>740}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"下午开始尝试回长沙的可能性!", "body"=>"
    下午我将去深圳火车站挤火车,如果形式良好,挤上火车,将离开深圳一段时间,到重灾区“长沙”慰问考察,指导工作。。
    \n
     
    \n
    期间水、电得不到保障,更没法连到互联网。。会尽量带上手机和充电器,抓住可能存在的机会充电,
    \n
    在 移动信号 不中断的情况下,可以保持手机联通,如果有我可以效劳的,还请酌情搔扰,多谢合作!
    ", "created_at"=>2008-02-02 02:15:10 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    下午我将去深圳火车站挤火车,如果形式良好,挤上火车,将离开深圳一段时间,到重灾区“长沙”慰问考察,指导工作。。
    \n 
    \n期间水、电得不到保障,更没法连到互联网。。会尽量带上手机和充电器,抓住可能存在的机会充电,
    \n在 移动信号 不中断的情况下,可以保持手机联通,如果有我可以效劳的,还请酌情搔扰,多谢合作!

    \n", "_id"=>741}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"离开这几天?我是怎么度过的?", "body"=>"

    本来没有打算回老家过年的,拿着1.31号的车票抱着试试看得心态2.2号去深圳火车站赶到长沙的火车,在地铁上,就想着肯定上不了车,这样赶去试试,如果人太多就退票留深圳过年了,甚至和Shine计划着以后几天在深圳的行程和安排,什么巴西烤肉啦,电影啦,花展啦啥的。

    \n

    可是,不幸的是我们竟然一路狂奔过去,竟然恰巧赶上火车,于是踏上回长沙的旅程,看着窗外皑皑白雪,火车摇摇晃晃,跑了15个小时终于到站:长沙。

    \n

    在长沙呆了一天,逛步行街的时候,不幸的事情发生了,买了不久的手机被小贼扒去了,虽然及时冻结了手机号码,无奈的是手机上的通讯录和拍的照片啥的全部丢失,可恶的小贼。(请各位朋友注意,以防欺骗!

    \n

    (目前,挂失的号码,已经重新开通,号码不变,正在物色新的手机,希望我的朋友们把自己的号码发到我邮箱吧 iceskysl@gmail.com)

    \n

    2.5号赶上长沙会合肥的飞机,第一次坐飞机,好小的的飞机哦,呵呵,天上飞的果然比地上跑的快,1个小时10分钟就降落在合肥机场,快!

    \n

    在合肥找到前天晚上到合肥的哥哥,坐上比平时价格翻了三倍的汽车,2.5号下午6.30分终于到家了。

    \n

    家里都还挺好,新盖的房子也挺好的,希望父母能住着舒服安心,我也可以安心了。

    \n

    好心的同时帮我预定了2.10号合肥到深圳的机票,一大早从家里出发,赶车到合肥,走的比较快,遭到了3个小时,竟然不能提前办理登机手续,又没吃饭,可恶的机场里面一盒大饼都要25元,真是强盗。寄存了行李,坐上一块钱的公交回合肥市找东西吃,路上遇到一个超市,下车买了填肚子的东西,真便宜,再BS下机场里面卖东西的。

    \n

    2.10下午5点抵达深圳机场,这次飞机好大,大的有点恐怖,呵呵。。

    \n

    我终于回来了,尽管背了本本,无奈没有网络,只能处于离网状态,回来后,一切恢复,新年新气象,本命年的我,今年要实现哪些目标呢?

    \n

    嘻嘻~流水帐~~

    ", "created_at"=>2008-02-11 13:26:36 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    本来没有打算回老家过年的,拿着1.31号的车票抱着试试看得心态2.2号去深圳火车站赶到长沙的火车,在地铁上,就想着肯定上不了车,这样赶去试试,如果人太多就退票留深圳过年了,甚至和Shine计划着以后几天在深圳的行程和安排,什么巴西烤肉啦,电影啦,花展啦啥的。
    \n可是,不幸的是我们竟然一路狂奔过去,竟然恰巧赶上火车,于是踏上回长沙的旅程,看着窗外皑皑白雪,火车摇摇晃晃,跑了15个小时终于到站:长沙。
    \n在长沙呆了一天,逛步行街的时候,不幸的事情发生了,买了不久的手机被小贼扒去了,虽然及时冻结了手机号码,无奈的是手机上的通讯录和拍的照片啥的全部丢失,可恶的小贼。(请各位朋友注意,以防欺骗!)
    \n(目前,挂失的号码,已经重新开通,号码不变,正在物色新的手机,希望我的朋友们把自己的号码发到我邮箱吧 iceskysl@gmail.com)
    \n2.5号赶上长沙会合肥的飞机,第一次坐飞机,好小的的飞机哦,呵呵,天上飞的果然比地上跑的快,1个小时10分钟就降落在合肥机场,快!
    \n在合肥找到前天晚上到合肥的哥哥,坐上比平时价格翻了三倍的汽车,2.5号下午6.30分终于到家了。
    \n家里都还挺好,新盖的房子也挺好的,希望父母能住着舒服安心,我也可以安心了。
    \n好心的同时帮我预定了2.10号合肥到深圳的机票,一大早从家里出发,赶车到合肥,走的比较快,遭到了3个小时,竟然不能提前办理登机手续,又没吃饭,可恶的机场里面一盒大饼都要25元,真是强盗。寄存了行李,坐上一块钱的公交回合肥市找东西吃,路上遇到一个超市,下车买了填肚子的东西,真便宜,再BS下机场里面卖东西的。
    \n2.10下午5点抵达深圳机场,这次飞机好大,大的有点恐怖,呵呵。。
    \n我终于回来了,尽管背了本本,无奈没有网络,只能处于离网状态,回来后,一切恢复,新年新气象,本命年的我,今年要实现哪些目标呢?
    \n嘻嘻~流水帐~~

    \n", "_id"=>742}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"xfce4面板丢失问题的解决", "body"=>"

    本本上的Ubuntu一直都是使用的xfce桌面系统,突然发现面板不见了,赶紧找时间找找原因,找到相关的文章,其解决的方法是:

    \n

    \n

    \n
    引用
    \n
      \n
    1. 由于Xfce是模块化的,所以所有的元素都有独立的进程。你只需重启那些进程即可。如果你想确认他们会在下次登录是自行启动的话,检查注销对话框中的”为下次登录保存会话”选项有无选中。  
    2. \n
    3. Panel————————xfce4-panel  
    4. \n
    5. Taskbar———————xftaskbar4 (Xfce 4.2 only)  
    6. \n
    7. Window Manager———xfwm4  
    8. \n
    9. Desktop———————xfdesktop (can depend on the dbus service, Xfce 4.4 only)  
    10. \n
    11. Desktop menus————xfdesktop  
    12. \n
    \n
    \nxfce4-panel&

    \n

    1、http://www.linuxfans.org/bbs/viewthread.php?tid=93633

    \n

    2、http://forum.ubuntu.org.cn/viewtopic.php?t=57203&sid=e4c2459767a54961ee8c7e142e043da7

    ", "created_at"=>2008-02-11 16:17:13 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    本本上的Ubuntu一直都是使用的xfce桌面系统,突然发现面板不见了,赶紧找时间找找原因,找到相关的文章,其解决的方法是:
    \n
    \n
    \n引用
    \n
    \n 由于Xfce是模块化的,所以所有的元素都有独立的进程。你只需重启那些进程即可。如果你想确认他们会在下次登录是自行启动的话,检查注销对话框中的”为下次登录保存会话”选项有无选中。  
    \n Panel————————xfce4-panel  
    \n Taskbar———————xftaskbar4 (Xfce 4.2 only)  
    \n Window Manager———xfwm4  
    \n Desktop———————xfdesktop (can depend on the dbus service, Xfce 4.4 only)  
    \n Desktop menus————xfdesktop  
    \n
    \n
    \nxfce4-panel&
    \n1、http://www.linuxfans.org/bbs/viewthread.php?tid=93633
    \n2、http://forum.ubuntu.org.cn/viewtopic.php?t=57203&sid=e4c2459767a54961ee8c7e142e043da7;

    \n", "_id"=>743}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"手机掉了,选购中...", "body"=>"

    春节回家时,在逛街的时候,才买了4个月的手机丢了(联想i908),回来后第一件事情就是再选一款合适的手机,说实在的,选手机我真不是行家,上次买i908的时候就选了好久,最后还是买贵了不少,呵呵。这次按照我的需要关注了如下几个手机。

    \n

    一、个人需求

    \n

    个人对手机的需求不是很赶“潮流”,认为够用就可以了,价格自然是越低越好,第一次用的是联想的i716,折叠的,而后就是丢掉的i908,直板的。目前认为直板的比较方便,不喜欢滑盖的。喜欢简约大气的类型,不喜欢花里胡哨的。

    \n

    个人喜欢在坐公交车的时候看看电子书(以前就是把PDF转成TXT直接看了不少技术文档)或者做些行程规划事务处理(最好是联网的,以前手机不支持,非常喜欢这个功能),处理电子邮件(用的是Gmail,需要只是SSLXHTML,以前的i908就不支持)。最好是有个拍照功能,喜欢随手拍些东西。最好有音乐功能(这两个貌似一般手机都支持了)。

    \n

    我还是比较看重手机品牌的,联想的我用过两个,质量还行,诺基亚的市场份额说明其质量不错。

    \n

    二、筛选过程

    \n

    1、联想i908

    \n

     

    \n

    \"\"

    \n

    最先看的是丢掉的那款,联想i908,我买的时候是1500多,现在商场报价大概在1100左右,网络报价有的只有900的样子,价格降了不少。加上我还剩余其配件(电板一块,耳机,充电器啥的都还在),选择这款的原因是这些配件不会浪费掉(因为都还比较新,浪费了实在可惜)。

    \n

    2、诺基亚N70

    \n

    \"\"

    \n

    这款机子我哥哥在用,试了下还是不错的,布局和功能都基本符合我的需求,且是一款智能手机(虽然不晓得用到的有多少,有朋友说 智能只是玩具,呵呵),价格大概在1700的样子,性价比还是挺不错的,

    \n

    3、诺基亚N73

    \n

    \"\"

    \n

    这款机子应该是很经典的啦,号称街机王,目前报价应该是2K以上,功能相当强大,也是一款智能手机。虽然上市有一段时间了,但是依然相当火爆。

    \n

    4、诺基亚 5310 XpressMusic

    \n

    \"\"

    \n

    这个手机我昨天在卖场看了下,商场给的价格还是2K以上,不过网上已经给出1900的价格,可是感觉太薄了,容易丢失。

    \n

    5、联想i909

    \n

    \"\"

    \n

    这个和i908差不多,估计原来的电池啥的还可以使用,屏幕大小也差不多,但是其定位是在“游戏手机”,我玩的不多。

    \n

    6、联想i968

    \n

    \"\"

    \n

    号称可以和N73相抗衡的手机,但是那个 蓝色的颜色我不是很喜欢。

    \n

    7、iphone

    \n

    \"\"

    \n

    这个只有看看的份,比较贵,且对其中文支持不放心,我不是mac迷,呵呵。

    \n

    其他的都还没来得及看,也没没有最终确定,有谁使用过如上手机的,说说感受哈,也希望能有人推荐其他的哈。

    \n

     

    ", "created_at"=>2008-02-13 03:39:12 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    春节回家时,在逛街的时候,才买了4个月的手机丢了(联想i908),回来后第一件事情就是再选一款合适的手机,说实在的,选手机我真不是行家,上次买i908的时候就选了好久,最后还是买贵了不少,呵呵。这次按照我的需要关注了如下几个手机。
    \n一、个人需求
    \n个人对手机的需求不是很赶“潮流”,认为够用就可以了,价格自然是越低越好,第一次用的是联想的i716,折叠的,而后就是丢掉的i908,直板的。目前认为直板的比较方便,不喜欢滑盖的。喜欢简约大气的类型,不喜欢花里胡哨的。
    \n个人喜欢在坐公交车的时候看看电子书(以前就是把PDF转成TXT直接看了不少技术文档)或者做些行程规划、事务处理(最好是联网的,以前手机不支持,非常喜欢这个功能),处理电子邮件(用的是Gmail,需要只是SSL和XHTML,以前的i908就不支持)。最好是有个拍照功能,喜欢随手拍些东西。最好有音乐功能(这两个貌似一般手机都支持了)。
    \n我还是比较看重手机品牌的,联想的我用过两个,质量还行,诺基亚的市场份额说明其质量不错。
    \n二、筛选过程
    \n1、联想i908
    \n 
    \n
    \n最先看的是丢掉的那款,联想i908,我买的时候是1500多,现在商场报价大概在1100左右,网络报价有的只有900的样子,价格降了不少。加上我还剩余其配件(电板一块,耳机,充电器啥的都还在),选择这款的原因是这些配件不会浪费掉(因为都还比较新,浪费了实在可惜)。
    \n2、诺基亚N70
    \n
    \n这款机子我哥哥在用,试了下还是不错的,布局和功能都基本符合我的需求,且是一款智能手机(虽然不晓得用到的有多少,有朋友说 智能只是玩具,呵呵),价格大概在1700的样子,性价比还是挺不错的,
    \n3、诺基亚N73
    \n
    \n这款机子应该是很经典的啦,号称街机王,目前报价应该是2K以上,功能相当强大,也是一款智能手机。虽然上市有一段时间了,但是依然相当火爆。
    \n4、诺基亚 5310 XpressMusic
    \n
    \n这个手机我昨天在卖场看了下,商场给的价格还是2K以上,不过网上已经给出1900的价格,可是感觉太薄了,容易丢失。
    \n5、联想i909
    \n
    \n这个和i908差不多,估计原来的电池啥的还可以使用,屏幕大小也差不多,但是其定位是在“游戏手机”,我玩的不多。
    \n6、联想i968
    \n
    \n号称可以和N73相抗衡的手机,但是那个 蓝色的颜色我不是很喜欢。
    \n7、iphone
    \n
    \n这个只有看看的份,比较贵,且对其中文支持不放心,我不是mac迷,呵呵。
    \n其他的都还没来得及看,也没没有最终确定,有谁使用过如上手机的,说说感受哈,也希望能有人推荐其他的哈。
    \n 

    \n", "_id"=>744}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加iTechTag的XSS防护功能", "body"=>"

    XSS目前越来越疯狂,虽然Rails提供了h()辅助方法用来防护,但是万一忘记了,就有可能被XSS了,技能云开发的时间比较零碎,没有全部考虑、过滤,比较危险,今天采用xss_terminate用来搞定。

    \n

    安装方法:
    \nscript/plugin install http://xssterminate.googlecode.com/svn/trunk/xss_terminate

    ", "created_at"=>2008-02-13 15:23:10 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    XSS目前越来越疯狂,虽然Rails提供了h()辅助方法用来防护,但是万一忘记了,就有可能被XSS了,技能云开发的时间比较零碎,没有全部考虑、过滤,比较危险,今天采用xss_terminate用来搞定。
    \n安装方法:
    \nscript/plugin install http://xssterminate.googlecode.com/svn/trunk/xss_terminate

    \n", "_id"=>745}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RubyOnRails中实现syntax highlighter", "body"=>"

    在我们平时开发基于WEB的系统时,有的时候需要对需要展示的源代码做些格式化、语法分析和高亮着色,比如在blog程序中贴技术文章时,在论坛中 讨论问 题的时候,不可避免的会贴出一些代码加以辅助说明,而如果能对该代码段进行语法分析和着色,效果会更加一目了然;Rails世界向来以选择的多样性著称, 如下列举几个可行的syntax highlighter,希望对您有所帮助。

    \n

    一、什么是Syntax_highlighting
    \n二、Syntax_highlighting的原理
    \n三、几个可用的实现方法
    \n    1、GeSHi
    \n    2、Syntax_Highlighter
    \n    3、Highlight.js
    \n    4、Ultraviolet
    \n    5、ColourCode
    \n    6、CodeRay
    \n    7、SHJS
    \n    8、google-code-prettify
    \n四、总结

    \n

    本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:

    \n

     在RubyOnRails中实现syntax highlighter

    \n

    如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    ", "created_at"=>2008-02-15 02:48:30 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在我们平时开发基于WEB的系统时,有的时候需要对需要展示的源代码做些格式化、语法分析和高亮着色,比如在blog程序中贴技术文章时,在论坛中 讨论问 题的时候,不可避免的会贴出一些代码加以辅助说明,而如果能对该代码段进行语法分析和着色,效果会更加一目了然;Rails世界向来以选择的多样性著称, 如下列举几个可行的syntax highlighter,希望对您有所帮助。
    \n一、什么是Syntax_highlighting
    \n二、Syntax_highlighting的原理
    \n三、几个可用的实现方法
    \n    1、GeSHi
    \n    2、Syntax_Highlighter
    \n    3、Highlight.js
    \n    4、Ultraviolet
    \n    5、ColourCode
    \n    6、CodeRay
    \n    7、SHJS
    \n    8、google-code-prettify
    \n四、总结
    \n本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:
    \n 在RubyOnRails中实现syntax highlighter
    \n如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    \n", "_id"=>746}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Five Balls of Life", "body"=>"

    偶然看到几个图片,虽然映像中以前见过,但是当再一次仔细的看的时候,我还是有些感慨,记录下来,希望看到此文的朋友,都能注意,共勉。

    \n

    最开始是一张做的很难看,但是说的很对的PPT图片

    \n

     

    \n

    \"\"

    \n

     

    \n


    \n然后找找来源,很快找到两张相关的图片,如下:
    \n\"\"

    \n

     

    \n

    \"\"

    \n

    几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩·戴森讲到工作与其他义务的关系:

    \n

    想象生命是一场不停丢掷五个球于空中的游戏。这五个球分别为工作家庭健康朋友心灵,而且你很努力地掷着这五个球,不让它们落地。很快地你会了解工作是一个橡皮球。如果你不幸失手落下它,它还是会弹回来。

    \n

    但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下,它们可能会少了一角,留下无法挽回的记号、刻痕、损坏甚至碎落一地。它们将永远不会跟以前一样。你必须了解这个道理,并且为平衡你的生命而努力。但要怎么才做得到呢?

    \n

    别拿自己和他人比较,这只会降低了你原有的价值。因为我们都是独一无二的,因为我们每一个人都很特别。

    \n

    别人认为重要的事不一定是你的目标,只有你才知道什么最适合你。

    ", "created_at"=>2008-02-18 02:34:33 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    偶然看到几个图片,虽然映像中以前见过,但是当再一次仔细的看的时候,我还是有些感慨,记录下来,希望看到此文的朋友,都能注意,共勉。
    \n最开始是一张做的很难看,但是说的很对的PPT图片
    \n 
    \n
    \n 
    \n
    \n然后找找来源,很快找到两张相关的图片,如下:
    \n
    \n 
    \n
    \n几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩·戴森讲到工作与其他义务的关系:
    \n想象生命是一场不停丢掷五个球于空中的游戏。这五个球分别为工作、家庭、健康、朋友和心灵,而且你很努力地掷着这五个球,不让它们落地。很快地你会了解工作是一个橡皮球。如果你不幸失手落下它,它还是会弹回来。
    \n但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下,它们可能会少了一角,留下无法挽回的记号、刻痕、损坏甚至碎落一地。它们将永远不会跟以前一样。你必须了解这个道理,并且为平衡你的生命而努力。但要怎么才做得到呢?
    \n别拿自己和他人比较,这只会降低了你原有的价值。因为我们都是独一无二的,因为我们每一个人都很特别。
    \n别人认为重要的事不一定是你的目标,只有你才知道什么最适合你。

    \n", "_id"=>747}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux之rm命令详解", "body"=>"

    [1sters@ iceskysl]$ rm --help
    \n用法:rm [选项]... 目录...
    \n删除指定的<文件>(即解除链接)。
    \n
    \n  -d, --directory       删除可能仍有数据的目录 (只限超级用户)
    \n  -f, --force           略过不存在的文件,不显示任何信息
    \n  -i, --interactive     进行任何删除操作前必须先确认
    \n  -r, -R, --recursive   同时删除该目录下的所有目录层
    \n  -v, --verbose         详细显示进行的步骤
    \n      --help     显示此帮助信息并离开
    \n      --version  显示版本信息并离开
    \n
    \n要删除第一个字符为‘-’的文件 (例如‘-foo’),请使用以下其中一种方法:
    \n  rm -- -foo
    \n
    \n  rm ./-foo
    \n
    \n请注意,如果使用 rm 来删除文件,通常仍可以将该文件恢复原状。如果想保证
    \n该文件的内容无法还原,请考虑使用 shred。

    \n

    范例:

    \n

    删除所有rb语言程序档;删除前逐一询问确认 :
    \nrm -i *.rb
    \n
    \n将 Finished 子目录及子目录中所有档案删除 :
    \nrm -r Finished

    ", "created_at"=>2008-02-20 01:28:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    [1sters@ iceskysl]$ rm --help
    \n用法:rm [选项]... 目录...
    \n删除指定的<文件>(即解除链接)。
    \n
    \n  -d, --directory       删除可能仍有数据的目录 (只限超级用户)
    \n  -f, --force           略过不存在的文件,不显示任何信息
    \n  -i, --interactive     进行任何删除操作前必须先确认
    \n  -r, -R, --recursive   同时删除该目录下的所有目录层
    \n  -v, --verbose         详细显示进行的步骤
    \n      --help     显示此帮助信息并离开
    \n      --version  显示版本信息并离开
    \n
    \n要删除第一个字符为‘-’的文件 (例如‘-foo’),请使用以下其中一种方法:
    \n  rm -- -foo
    \n
    \n  rm ./-foo
    \n
    \n请注意,如果使用 rm 来删除文件,通常仍可以将该文件恢复原状。如果想保证
    \n该文件的内容无法还原,请考虑使用 shred。
    \n范例:
    \n删除所有rb语言程序档;删除前逐一询问确认 :
    \nrm -i *.rb
    \n
    \n将 Finished 子目录及子目录中所有档案删除 :
    \nrm -r Finished

    \n", "_id"=>748}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保持SSH客户端不掉线", "body"=>"

    不管我是使用linux的的SSH还是windows下的putty、SecureCRT还是AbsoluteTelnet,当我连接到服务器端 后,离开一会或者做点其他的事情,再回到SSH的时候,常常发现客户端自动掉出来了;有的时候甚至跑一个需要时间比较长的JOB的时候,还没跑完就掉出来 了,导致JOB跑了一半,等等。。

    \n

    所以一直在找解决这个问题的办法,今天在googleReader上找到了一个解决办法,如下:

    \n
    \n

    Do you get annoyed when you have a SSH session open, visit your browser for a while, and then return only to find you were disconnected? Most home NAT routers are the cause of this. If your router doesn’t offer an option to not shut off idle connections, you are probably better off by setting a keep-alive setting.

    \n

    To do this, just open /etc/ssh/ssh_config on your home (client) computer. Add the following line:

    \n

     

    \n
    \n
    配置代码
    \n
      \n
    1. ServerAliveInterval 180  
    2. \n
    \n
    \nThere you have it! Just remember now, if you leave SSH open accidentally, anyone else can get on it. Remember to close your session when finished.PS:If you’re using AbsoluteTelnet (for Windows), you can do this from the Options->Properties->Connection page. There is an option there to enable keepalives and you can specify the duration between them.
    ", "created_at"=>2008-02-21 03:16:17 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    不管我是使用linux的的SSH还是windows下的putty、SecureCRT还是AbsoluteTelnet,当我连接到服务器端 后,离开一会或者做点其他的事情,再回到SSH的时候,常常发现客户端自动掉出来了;有的时候甚至跑一个需要时间比较长的JOB的时候,还没跑完就掉出来 了,导致JOB跑了一半,等等。。
    \n所以一直在找解决这个问题的办法,今天在googleReader上找到了一个解决办法,如下:
    \n
    \nDo you get annoyed when you have a SSH session open, visit your browser for a while, and then return only to find you were disconnected? Most home NAT routers are the cause of this. If your router doesn’t offer an option to not shut off idle connections, you are probably better off by setting a keep-alive setting.
    \nTo do this, just open /etc/ssh/ssh_config on your home (client) computer. Add the following line:
    \n 
    \n
    \n配置代码
    \n
    \n ServerAliveInterval 180  
    \n
    \n
    \nThere you have it! Just remember now, if you leave SSH open accidentally, anyone else can get on it. Remember to close your session when finished.PS:If you’re using AbsoluteTelnet (for Windows), you can do this from the Options->Properties->Connection page. There is an option there to enable keepalives and you can specify the duration between them.

    \n", "_id"=>749}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"这会是Gphone?", "body"=>"

    今天在GSeeker上看到一篇文章说三星可能会和Google合作在今年推出Gphone,还给了一个“假想图”,如下:

    \n

    \"\"

    \n

    据engadget的报道, 小道消息称三星在今年内将推出两款Google Phone,并且是打上Google品牌的,而不是三星自家品牌。该消息指三星将首先在9月份发布第一款Google Phone,然后在圣诞节期间再发布第二款。其中9月份所发布的Google Phone将会是高端产品,同时具备触控屏及全键盘,外型和黑莓相似(详见文章开头的假想图)。而圣诞节所发布的Google Phone则属于低价版(低于100美元)。

    \n

    不过我倒觉得这个Google的风格,qwerty风格的键盘我实在不觉得方便,偶觉得Google肯定不会这样滴,因为我不喜欢,呵呵。。 :)

    ", "created_at"=>2008-02-21 13:55:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    今天在GSeeker上看到一篇文章说三星可能会和Google合作在今年推出Gphone,还给了一个“假想图”,如下:
    \n
    \n据engadget的报道, 小道消息称三星在今年内将推出两款Google Phone,并且是打上Google品牌的,而不是三星自家品牌。该消息指三星将首先在9月份发布第一款Google Phone,然后在圣诞节期间再发布第二款。其中9月份所发布的Google Phone将会是高端产品,同时具备触控屏及全键盘,外型和黑莓相似(详见文章开头的假想图)。而圣诞节所发布的Google Phone则属于低价版(低于100美元)。
    \n不过我倒觉得这个Google的风格,qwerty风格的键盘我实在不觉得方便,偶觉得Google肯定不会这样滴,因为我不喜欢,呵呵。。 :)

    \n", "_id"=>750}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag && Ohloh", "body"=>"

    今天无意在Google订阅里面看到了人评价说“itechtag 纯粹靠自我声明或者相互吹捧的是没有办法 建立creditibility(可信度) 如果像ohloh.net那种有真凭实据的还差不多”。

    \n

    哦,有人这样评价技能云,还提到了ohloh.net,这个是什么网站呢?赶紧瞧瞧去。

    \n

    Ohloh is an open source network that connects people through the software they create and use.

    \n

     

    \n

    wowo,和我们的技能云的定位有些神似呀,有时间好好研究下:(

    \n

     

    ", "created_at"=>2008-02-21 14:03:01 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    今天无意在Google订阅里面看到了人评价说“itechtag 纯粹靠自我声明或者相互吹捧的是没有办法 建立creditibility(可信度) 如果像ohloh.net那种有真凭实据的还差不多”。
    \n哦,有人这样评价技能云,还提到了ohloh.net,这个是什么网站呢?赶紧瞧瞧去。
    \nOhloh is an open source network that connects people through the software they create and use.
    \n 
    \nwowo,和我们的技能云的定位有些神似呀,有时间好好研究下:(
    \n 

    \n", "_id"=>751}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加通过IM(GoogleTalk)更新ING功能", "body"=>"

    刚刚吃完泡面,接着上午的工作,一鼓作气完成通过IM(googletalk)发布自己的ING的功能,如下:
    \n\"\"

    \n

     

    \n

    使用方法是:
    \n1、添加”itechtag@gmail.com”为自己GoogleTalk的好友;
    \n2、发送”h”到”itechtag@gmail.com”查看帮助信息;
    \n3、输入”who”查看自己googletalk绑定的账户;
    \n4、输入”link email:password”绑定当前GoogleTalk至您指定的账号;
    \n5、输入”@Ing内容”添加ING内容到自己的ing.

    \n

     

    \n

    其他内容,请添加”itechtag@gmail.com”为自己GoogleTalk的好友后,输入h查看帮助信息。

    \n

     

    \n

    该机器人还在不断的完善中,如果遇到什么问题,请及时通知我;如果您有更好的建议,还请告诉我。

    ", "created_at"=>2008-02-23 06:34:00 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    刚刚吃完泡面,接着上午的工作,一鼓作气完成通过IM(googletalk)发布自己的ING的功能,如下:
    \n
    \n 
    \n使用方法是:
    \n1、添加”itechtag@gmail.com”为自己GoogleTalk的好友;
    \n2、发送”h”到”itechtag@gmail.com”查看帮助信息;
    \n3、输入”who”查看自己googletalk绑定的账户;
    \n4、输入”link email:password”绑定当前GoogleTalk至您指定的账号;
    \n5、输入”@Ing内容”添加ING内容到自己的ing.
    \n 
    \n其他内容,请添加”itechtag@gmail.com”为自己GoogleTalk的好友后,输入h查看帮助信息。
    \n 
    \n该机器人还在不断的完善中,如果遇到什么问题,请及时通知我;如果您有更好的建议,还请告诉我。

    \n", "_id"=>752}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"键盘快速启动工具 :Launchy", "body"=>"

    由于逐渐习惯了linux下的操作方式和基于命令的使用习惯,在windows上的时候,我也越来越觉得不习惯了,一直想找一个类似MAC下的QuickSilver的可以快速找到我需要的东西,进而启动的小工具。

    \n

    今天找到了,其就是Launchy,安装后,每次启动都驻留后台运行,按 ALT+空格可以跳出输入框,输入需要用到的程序名称(支持模糊匹配,显示个数等可以配置),还可以打开其他的东西,可以参考其安装目录下的Readme.pdf。

    \n

    \"\"

    \n

    另外,看到另外一款类似的程序 TypeAndRun,可以参考如下链接,选择自己需要的。

    \n

    【1】http://calon.weblogs.us/duibi_launchy_he_tar/

    ", "created_at"=>2008-02-25 02:02:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    由于逐渐习惯了linux下的操作方式和基于命令的使用习惯,在windows上的时候,我也越来越觉得不习惯了,一直想找一个类似MAC下的QuickSilver的可以快速找到我需要的东西,进而启动的小工具。
    \n今天找到了,其就是Launchy,安装后,每次启动都驻留后台运行,按 ALT+空格可以跳出输入框,输入需要用到的程序名称(支持模糊匹配,显示个数等可以配置),还可以打开其他的东西,可以参考其安装目录下的Readme.pdf。
    \n
    \n另外,看到另外一款类似的程序 TypeAndRun,可以参考如下链接,选择自己需要的。
    \n【1】http://calon.weblogs.us/duibi_launchy_he_tar/

    \n", "_id"=>753}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"制作视频教程的工具", "body"=>"

    经常看一些视频教程,觉得视频教程简单易懂,相当不错,如下两个文章列了一些制作视频教程的工具,被点名的有:

    \n

    AviScreen - As the name would imply, this capture program records the video into AVI files, but can also do BMP photos. It’s Windows only and does not record audio.

    \n

    CamStudio.org - An open source program for capturing your on-screen video and audio as AVI files. Windows only, and absolutely free.

    \n

    Copernicus - A free program for Macs that focuses heavily on making quick and speedy films by recording the video to your RAM for quicker access. Does not include any support for audio.

    \n

    JingProject.com - Beyond recording video, Jing allows you to take a picture of any portion fo your desktop, draw on it, add a message, and immediately upload your media to a free hosting account. You are then given a small URL that you can give to whomever needs to see the image or video. Works with Macs and Windows machines.

    \n

    Screencast-O-Matic.com - A Java-based screencasting tool that requires no downloads and will allow you to automatically upload to hosting. According to their site it works well with Macs and Windows machines, but does have some issues with Linux.

    \n

    Wink - Screencasting software that focuses on making tutorials with audio and text annotation abilities. Outputs to Flash, PDF, HTML, EXE files and more.
    \n
    \n以及在ubuntu下的xvidcap

    \n

    【1】http://www.freecharity.org.uk/2007/04/12/the-secret-to-screencasting-with-ubuntu-and-free-software/
    \n【2】http://mashable.com/2008/02/21/screencasting-video-tutorials/

    ", "created_at"=>2008-02-25 02:18:37 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    经常看一些视频教程,觉得视频教程简单易懂,相当不错,如下两个文章列了一些制作视频教程的工具,被点名的有:
    \nAviScreen - As the name would imply, this capture program records the video into AVI files, but can also do BMP photos. It’s Windows only and does not record audio.
    \nCamStudio.org - An open source program for capturing your on-screen video and audio as AVI files. Windows only, and absolutely free.
    \nCopernicus - A free program for Macs that focuses heavily on making quick and speedy films by recording the video to your RAM for quicker access. Does not include any support for audio.
    \nJingProject.com - Beyond recording video, Jing allows you to take a picture of any portion fo your desktop, draw on it, add a message, and immediately upload your media to a free hosting account. You are then given a small URL that you can give to whomever needs to see the image or video. Works with Macs and Windows machines.
    \nScreencast-O-Matic.com - A Java-based screencasting tool that requires no downloads and will allow you to automatically upload to hosting. According to their site it works well with Macs and Windows machines, but does have some issues with Linux.
    \nWink - Screencasting software that focuses on making tutorials with audio and text annotation abilities. Outputs to Flash, PDF, HTML, EXE files and more.
    \n
    \n以及在ubuntu下的xvidcap。
    \n【1】http://www.freecharity.org.uk/2007/04/12/the-secret-to-screencasting-with-ubuntu-and-free-software/
    \n【2】http://mashable.com/2008/02/21/screencasting-video-tutorials/

    \n", "_id"=>754}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"50 Questions to Evaluate the Quality of Your Website", "body"=>"

    作为一个互联网人,你对自己的网站有多少理解和把握,对其前途是否能看好,能否认识到目前的现况和不足,都是十分重要的。

    \n

    CarstenCumbrowski from SearchEngineJournal has come up with a great and pretty detailed list of 50 questions that a website owner should asked himself about his own website.

    \n

    If the answer to every question that follows below was answered with yes, you can be very pleased with yourself and consider yourself the top of the crop, because most websites have flaws for a number of different reasons, mostly related to the limitation of resources and sacrifices that must be made as a direct result of the shortage.

    \n

    These questions are divided into following main categories: Accessibility, Navigation, Design, Content, Security, Other Technical Considerations, Other Marketing Considerations and Legal Stuff/Re-Assurance/Legitimization.

    \n

    【1】http://www.searchenginejournal.com/50-questions-to-evaluate-the-quality-of-your-website/6400/

    ", "created_at"=>2008-02-25 02:25:27 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    作为一个互联网人,你对自己的网站有多少理解和把握,对其前途是否能看好,能否认识到目前的现况和不足,都是十分重要的。
    \nCarstenCumbrowski from SearchEngineJournal has come up with a great and pretty detailed list of 50 questions that a website owner should asked himself about his own website.
    \nIf the answer to every question that follows below was answered with yes, you can be very pleased with yourself and consider yourself the top of the crop, because most websites have flaws for a number of different reasons, mostly related to the limitation of resources and sacrifices that must be made as a direct result of the shortage.
    \nThese questions are divided into following main categories: Accessibility, Navigation, Design, Content, Security, Other Technical Considerations, Other Marketing Considerations and Legal Stuff/Re-Assurance/Legitimization.
    \n【1】http://www.searchenginejournal.com/50-questions-to-evaluate-the-quality-of-your-website/6400/

    \n", "_id"=>755}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu Mobile Edition:这个世界太疯狂了", "body"=>"

    虽然我使用Ubuntu工作已经很长一段时间,虽然我也使用过Kubuntu、Xubuntu,虽然我也对ubuntu的前途比较看好,虽然。。
    \nN多的虽然,但当我第一次看到Ubuntu Mobile Edition的时候,还是不免呢喃了一句“世界太疯狂了!”难道不是么。
    \n\"\"
    \n自从iphone的成功,到Google的潜力修行,加上nokia的大半市场和windowmobile的无可奈何,现在又多了Ubuntu Mobile Edition。

    \n
    \n

    “Ubuntu Mobile Edition 是 Ubuntu 家族的又一新成员。与 Kubuntu、Xubuntu、Edubuntu 这些版本相同的是,Ubuntu Mobile 一样基于 Ubuntu;不同的是,Ubuntu Mobile 是专门为 MID (Mobile Internet Devices,移动互联网设备) 而设计的。”

    \n

    “Ubuntu Mobile 不仅包含丰富的应用软件,而且集成了流行的 Web 2.0 服务,如 Facebook、MySpace、YouTube 等。使用者通过 Ubuntu Mobile 能够执行诸如网络浏览、收发邮件、分享视频/音乐/照片、即时通讯、撰写博客、玩游戏等常见操作。”

    \n
    \n

    其他的介绍:

    \n

    http://linuxtoy.org/archives/ubuntu-mobile-edition.html

    \n

    http://moblin.org/

    ", "created_at"=>2008-02-25 14:07:25 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    虽然我使用Ubuntu工作已经很长一段时间,虽然我也使用过Kubuntu、Xubuntu,虽然我也对ubuntu的前途比较看好,虽然。。
    \nN多的虽然,但当我第一次看到Ubuntu Mobile Edition的时候,还是不免呢喃了一句“世界太疯狂了!”难道不是么。
    \n
    \n自从iphone的成功,到Google的潜力修行,加上nokia的大半市场和windowmobile的无可奈何,现在又多了Ubuntu Mobile Edition。
    \n
    \n“Ubuntu Mobile Edition 是 Ubuntu 家族的又一新成员。与 Kubuntu、Xubuntu、Edubuntu 这些版本相同的是,Ubuntu Mobile 一样基于 Ubuntu;不同的是,Ubuntu Mobile 是专门为 MID (Mobile Internet Devices,移动互联网设备) 而设计的。”
    \n“Ubuntu Mobile 不仅包含丰富的应用软件,而且集成了流行的 Web 2.0 服务,如 Facebook、MySpace、YouTube 等。使用者通过 Ubuntu Mobile 能够执行诸如网络浏览、收发邮件、分享视频/音乐/照片、即时通讯、撰写博客、玩游戏等常见操作。”
    \n
    \n其他的介绍:
    \nhttp://linuxtoy.org/archives/ubuntu-mobile-edition.html
    \nhttp://moblin.org/

    \n", "_id"=>756}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正则真的很强大", "body"=>"

    毋庸置疑,正则表达式真的相当的博大精深,不要看懂几个正则的元字符就认为自己掌握了正则表达式,那连皮毛都没东呢,呵呵。

    \n

    年前买了一本《精通正则表达式》,没事的时候喜欢慢慢的读,才晓得原来如此神奇和精妙,如果能按照正则的思维去解决问题,显得如此的舒服和优雅。强烈推荐我行的人有时间可以仔细阅读。

    \n

    如下举个小例子,在一些社区、论坛上有些代码段还是挺不错的,但是常常被格式化后,复制下来就带有行号,如果你曾经一行一行的删掉这些行号的话,也不足为奇,因为我以前也这么干的,其实不用那么麻烦,那我最喜欢的文本编辑器Emeditor来看,这样就可搞定。\"\"

    \n

     

    ", "created_at"=>2008-02-26 01:40:23 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    毋庸置疑,正则表达式真的相当的博大精深,不要看懂几个正则的元字符就认为自己掌握了正则表达式,那连皮毛都没东呢,呵呵。
    \n年前买了一本《精通正则表达式》,没事的时候喜欢慢慢的读,才晓得原来如此神奇和精妙,如果能按照正则的思维去解决问题,显得如此的舒服和优雅。强烈推荐我行的人有时间可以仔细阅读。
    \n如下举个小例子,在一些社区、论坛上有些代码段还是挺不错的,但是常常被格式化后,复制下来就带有行号,如果你曾经一行一行的删掉这些行号的话,也不足为奇,因为我以前也这么干的,其实不用那么麻烦,那我最喜欢的文本编辑器Emeditor来看,这样就可搞定。
    \n 

    \n", "_id"=>757}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在CSDN的blog中添加技能云", "body"=>"

    有段时间没有使用CSDN的blog了,其实在是不够稳定,呵呵,但是不可否认的是其实目前国内比较大的程序员汇集区,而技能云针对的就是程序员,于是看了下如何在CSDN的blog中添加显示其在技能云上的widget。

    \n

    1、在CSDN的个人blog管理后台选择“配置”选项卡

    \n

    \"\"

    \n

    2、在“公告”的地方加上技能云的个人widget的引用,保存即可。

    \n

    \"\"

    \n

    3、前台即可正常显示个人的“技能云”,如下,还挺不错的。

    \n

    \"\"

    \n

    可以看我的CSDN上显示的效果

    \n

     

    ", "created_at"=>2008-02-26 01:49:46 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有段时间没有使用CSDN的blog了,其实在是不够稳定,呵呵,但是不可否认的是其实目前国内比较大的程序员汇集区,而技能云针对的就是程序员,于是看了下如何在CSDN的blog中添加显示其在技能云上的widget。
    \n1、在CSDN的个人blog管理后台选择“配置”选项卡
    \n
    \n2、在“公告”的地方加上技能云的个人widget的引用,保存即可。
    \n
    \n3、前台即可正常显示个人的“技能云”,如下,还挺不错的。
    \n
    \n可以看我的CSDN上显示的效果
    \n 

    \n", "_id"=>758}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail版Gtalk终于出现“隐身功能”", "body"=>"

    Gtalk虽然不及MSN普及,但是我周围的一些人还是很喜欢的,简洁、漂亮等是对其的评价,我也为此放弃了其他的IM工具,比如不喜欢QQ的商业气味和花哨,不喜欢MSN的莫名其妙的问题等等。

    \n

    作为一个技术人,我还是喜欢基于XMPP的Gtalk(我也在技能云中增加了对XMPP机器人的支持),当你工作的时候,还是不希望被人打扰到的,现在Gmail版本的Gtalk已经增加了“隐身”功能。

    \n

     

    \n

    \"\"

    \n

    但是桌面版及插件(gadget;网页)版的Gtalk还没有这个功能,也很久没有发布新版本了,还是慢慢等待吧。

    \n

    其他报道:http://www.gseeker.com/50226711/gtalkeeeaeie_139633.php

    \n

     

    ", "created_at"=>2008-02-27 01:06:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Gtalk虽然不及MSN普及,但是我周围的一些人还是很喜欢的,简洁、漂亮等是对其的评价,我也为此放弃了其他的IM工具,比如不喜欢QQ的商业气味和花哨,不喜欢MSN的莫名其妙的问题等等。
    \n作为一个技术人,我还是喜欢基于XMPP的Gtalk(我也在技能云中增加了对XMPP机器人的支持),当你工作的时候,还是不希望被人打扰到的,现在Gmail版本的Gtalk已经增加了“隐身”功能。
    \n 
    \n
    \n但是桌面版及插件(gadget;网页)版的Gtalk还没有这个功能,也很久没有发布新版本了,还是慢慢等待吧。
    \n其他报道:http://www.gseeker.com/50226711/gtalkeeeaeie_139633.php
    \n 

    \n", "_id"=>759}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"真的,个人在线声望越来越重要!", "body"=>"

    个人在线声望真的越来越被看重了,我一直在做的“技能云”的目的就是建立良好的个人声望,虽然目前国内的很多人还没有意识到这点,但毋庸置疑的是,真的越来越重要了,前段时间MR.6就写过一篇文章,几天又发现了一个文章专门说这个问题的,我也顺着这个思路说说看。

    \n

    先来看这篇文章“How To Manage Your Online Reputation”,文章中说到:You've spent a lot of time building up your reputation and image both online and off, so it's important to make sure that someone isn't out there dragging it through the mud. The latest tool for reputation management is Trackur, but its bottom-level price is $88/month, so the question on my mind, is: "Is it worth it?" There are already many different ways to monitor your online reputation as it is. Let's see how they stack up. 

    \n

    而后列举了几个可以使用的工具(网站)来管理自己的在线声望,其中提到了一个网站http://www.trackur.com/竟然是收费的,而且还不便宜,最便宜的还88美刀/月,另外还有像google通知等。详细的可以去看这篇文章:http://www.readwriteweb.com/archives/how_to_manage_your_online_reputation.php

    \n

    接着看上面说到的这个收费的网站,真的是个监视、管理个人在线声望的网站,价格也真不便宜,呵呵,看看他是怎么说个人声望的:

    \n

    Did you know that 52% of individuals put their trust in what others have to say about you?
    \n
    \nDid you know that 87% of consumers look at the reputation of your CEO, when judging your company's reputation?
    \n
    \nDid you know that 59% of hiring managers are influenced by your online reputation?
    \n
    \nDid you know that Trackur will monitor the web 24/7 and alert you whenever your reputation is being discussed?( 这条是宣传自己网站的)

    \n

    看看上面列举的几个数据,怎么来的,我们无法得知,但是其在一定程度上说明了个人声望是如何的重要,可能国外会更普及一点;但是对于国内来说,其他行业我不了解,至少和互联网沾边的,不如软件开发行业等,会比较看重的。

    \n

    都说国内什么都要落后老外们几年时间,但是值得我们高兴的事,我们这次我们的意识并没有晚,我们与2007年中开始做的”技能云“正是在这个方面的体现,我们希望的是通过用户的努力,创建良好的个人声望,并勇敢的把自己的声望show出去;此外,我们还将创建公司和项目的声望。

    \n

    虽然我们才刚刚起步,虽然很多人还不能意识到这点的重要性,但是我们相信,随着时间的推移,随着个人不断的体会和经历,加上技能云平台的不断完善,我们肯定会让所有的对自己声望在意的朋友建立起自己的”技能云“。

    ", "created_at"=>2008-02-27 07:33:01 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    个人在线声望真的越来越被看重了,我一直在做的“技能云”的目的就是建立良好的个人声望,虽然目前国内的很多人还没有意识到这点,但毋庸置疑的是,真的越来越重要了,前段时间MR.6就写过一篇文章,几天又发现了一个文章专门说这个问题的,我也顺着这个思路说说看。
    \n先来看这篇文章“How To Manage Your Online Reputation”,文章中说到:You've spent a lot of time building up your reputation and image both online and off, so it's important to make sure that someone isn't out there dragging it through the mud. The latest tool for reputation management is Trackur, but its bottom-level price is $88/month, so the question on my mind, is: "Is it worth it?" There are already many different ways to monitor your online reputation as it is. Let's see how they stack up. 
    \n而后列举了几个可以使用的工具(网站)来管理自己的在线声望,其中提到了一个网站http://www.trackur.com/竟然是收费的,而且还不便宜,最便宜的还88美刀/月,另外还有像google通知等。详细的可以去看这篇文章:http://www.readwriteweb.com/archives/how_to_manage_your_online_reputation.php
    \n接着看上面说到的这个收费的网站,真的是个监视、管理个人在线声望的网站,价格也真不便宜,呵呵,看看他是怎么说个人声望的:
    \nDid you know that 52% of individuals put their trust in what others have to say about you?
    \n
    \nDid you know that 87% of consumers look at the reputation of your CEO, when judging your company's reputation?
    \n
    \nDid you know that 59% of hiring managers are influenced by your online reputation?
    \n
    \nDid you know that Trackur will monitor the web 24/7 and alert you whenever your reputation is being discussed?( 这条是宣传自己网站的)
    \n看看上面列举的几个数据,怎么来的,我们无法得知,但是其在一定程度上说明了个人声望是如何的重要,可能国外会更普及一点;但是对于国内来说,其他行业我不了解,至少和互联网沾边的,不如软件开发行业等,会比较看重的。
    \n都说国内什么都要落后老外们几年时间,但是值得我们高兴的事,我们这次我们的意识并没有晚,我们与2007年中开始做的”技能云“正是在这个方面的体现,我们希望的是通过用户的努力,创建良好的个人声望,并勇敢的把自己的声望show出去;此外,我们还将创建公司和项目的声望。
    \n虽然我们才刚刚起步,虽然很多人还不能意识到这点的重要性,但是我们相信,随着时间的推移,随着个人不断的体会和经历,加上技能云平台的不断完善,我们肯定会让所有的对自己声望在意的朋友建立起自己的”技能云“。

    \n", "_id"=>760}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"FriendFeed高明在哪里?", "body"=>"

    最近比较清闲,就到处转悠,然后写些自己的感受,今天要说的是FriendFeed,FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends.

    \n

    注册试用了下,感觉比以前试用的那几个好点,比如facebook我一进去就晕,校内也差不多的模式,其他的什么占座之类的就看几眼就再不会去了。而FriendFeed有点点不一样,可能是由于其”亲缘“关系的缘故(大多数人都死来自Google成员)做事风格也和Google比较类似,简洁明了。其主要的抓取功能还是挺强大的,速度相当的快。

    \n

    应该是在Google中积累的经验,使得这个项目在Google排名等都表现相当不错,在改进”技能云“的时候可以学习下他的表现形式,再琢磨下Google的一些规则。

    \n

    我向来不是很喜欢这类SNS的东西,不过这个FriendFeed倒让我觉得可以忍受。

    \n

    慢慢的,我也学会了冷静的观察~

    ", "created_at"=>2008-02-28 02:44:31 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近比较清闲,就到处转悠,然后写些自己的感受,今天要说的是FriendFeed,FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends.
    \n注册试用了下,感觉比以前试用的那几个好点,比如facebook我一进去就晕,校内也差不多的模式,其他的什么占座之类的就看几眼就再不会去了。而FriendFeed有点点不一样,可能是由于其”亲缘“关系的缘故(大多数人都死来自Google成员)做事风格也和Google比较类似,简洁明了。其主要的抓取功能还是挺强大的,速度相当的快。
    \n应该是在Google中积累的经验,使得这个项目在Google排名等都表现相当不错,在改进”技能云“的时候可以学习下他的表现形式,再琢磨下Google的一些规则。
    \n我向来不是很喜欢这类SNS的东西,不过这个FriendFeed倒让我觉得可以忍受。
    \n慢慢的,我也学会了冷静的观察~

    \n", "_id"=>761}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用Active Merchant快速支付", "body"=>"

    采用Google在线文档书写和维护,请自行查看,如果有建议和意见,请在这里提出,谢谢~
    \n在Rails中使用Active Merchant快速支付

    \n

    尚未写完,有愿意的朋友可以一起写,谢谢!

    ", "created_at"=>2008-02-28 06:11:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    采用Google在线文档书写和维护,请自行查看,如果有建议和意见,请在这里提出,谢谢~
    \n在Rails中使用Active Merchant快速支付
    \n尚未写完,有愿意的朋友可以一起写,谢谢!

    \n", "_id"=>762}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"IP地址到物理地址的转化", "body"=>"

    以前我也写过一个类似的,找不到了,刚才看到axgle写了一个,挺轻巧的。

    \n
    \n
    Ruby代码
    \n
      \n
    1. 1. require 'net/http'    
    2. \n
    3. 2. require "uri"    
    4. \n
    5. 3.     
    6. \n
    7. 4. def ip2addr(ip="google.com")    
    8. \n
    9. 5. url=URI.parse("http://ip138.com/ips8.asp")    
    10. \n
    11. 6. res=Net::HTTP.post_form(url,:ip=>ip,:action=>2)    
    12. \n
    13. 7. res.body.scan(/<ul class="ul1">(.*)<\\/ul>/).to_s.scan(/<li>(.*?)<\\/li>/)    
    14. \n
    15. 8. end    
    16. \n
    17. 9.     
    18. \n
    19. 0. puts ip2addr    
    20. \n
    \n
    \n

    结果 \"\"
    \n
    \n本站主数据:美国
    \n查询结果2:美国
    \n查询结果3:美国 加利福尼亚州Mountain
    \n
    \nhttp://chinaonrails.com/topic/view/216.html

    \n

     

    ", "created_at"=>2008-03-07 05:05:12 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    以前我也写过一个类似的,找不到了,刚才看到axgle写了一个,挺轻巧的。
    \n
    \nRuby代码
    \n
    \n 1. require 'net/http'    
    \n 2. require "uri"    
    \n 3.     
    \n 4. def ip2addr(ip="google.com")    
    \n 5. url=URI.parse("http://ip138.com/ips8.asp")    
    \n 6. res=Net::HTTP.post_form(url,:ip=>ip,:action=>2)    
    \n 7. res.body.scan(/<ul class="ul1">(.)<\\/ul>/).to_s.scan(/<li>(.?)<\\/li>/)    
    \n 8. end    
    \n 9.     
    \n 0. puts ip2addr    
    \n
    \n
    \n结果
    \n
    \n本站主数据:美国
    \n查询结果2:美国
    \n查询结果3:美国 加利福尼亚州Mountain
    \n
    \nhttp://chinaonrails.com/topic/view/216.html
    \n 

    \n", "_id"=>763}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby中对正则表达式中的特殊字符转义的疑惑", "body"=>"

    转义正则表达式中的特殊字符
    \n===========================================
    \n使用Regexp.escape方法(别名方法是Regexp.quote),可以把正则表达式中的特殊字符统统转义:
    \nstr1 = "[*?]"
    \nstr2 = Regexp.escape(str1) # "\\[\\*\\?\\]"
    \n
    \nescape会转义掉[*?]这几个特殊的字符,但是其没有对另外一个字符‘/’进行任何处理,这个作为正则表达式的分隔符(//)中的字符难道不是特殊字符么。
    \n
    \n 看个例子:
    \npages="http://www.taojer.com/id=1&name=help"
    \nputs Regexp.escape(pages)
    \n
    \n 输出:
    \nE:\\Ysl\\Test>ruby exp.rb
    \nhttp://www\\.taojer\\.com/id=1&name=help
    \n
    \n可以看到其对/字符是没有进行处理的。
    \n
    \n这个可能会给如下这个需求带来一些问题:
    \n我想在一段String中找到所有以一个指定的URL开头的链接地址,程序大概是这样的:
    \nurl="http://www.taojer.com"
    \n按照我们的思路,可能会这么写:
    \ne_url = Regexp.escape(url)
    \n==》http://www\\.taojer\\.com
    \nstr.scan(/<a href="(e_url)">(.+?)<\\/a>/m)
    \n但是这样就会因为/字符存在而异常咯?
    \n
    \n正确是应该是:
    \nstr.scan(/<a href="(http:\\/\\/www\\.taojer\\.com)">(.+?)<\\/a>/m).each do |list|
    \n#do something
    \nend
    \n
    \n按照规定:
    \n特殊字符包括^、$、?、.、/、\\、[、]、{、}、(、)、+、*、
    \n为什么这个方法不转义/呢?
    \n有啥子高招,解决这个问题?
    \n参考:
    \nhttp://chinaonrails.com/topic/view/1418.html
    \nhttp://www.ruby-doc.org/core/classes/Regexp.html#M001227

    \n

    http://lzj520.javaeye.com/blog/143223

    ", "created_at"=>2008-03-12 07:51:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    转义正则表达式中的特殊字符
    \n===========================================
    \n使用Regexp.escape方法(别名方法是Regexp.quote),可以把正则表达式中的特殊字符统统转义:
    \nstr1 = "[?]"
    \nstr2 = Regexp.escape(str1) # "[
    \\?]"
    \n
    \nescape会转义掉[*?]这几个特殊的字符,但是其没有对另外一个字符‘/’进行任何处理,这个作为正则表达式的分隔符(//)中的字符难道不是特殊字符么。
    \n
    \n 看个例子:
    \npages="http://www.taojer.com/id=1&name=help;"
    \nputs Regexp.escape(pages)
    \n
    \n 输出:
    \nE:\\Ysl\\Test>ruby exp.rb
    \nhttp://www.taojer.com/id=1&name=help
    \n
    \n可以看到其对/字符是没有进行处理的。
    \n
    \n这个可能会给如下这个需求带来一些问题:
    \n我想在一段String中找到所有以一个指定的URL开头的链接地址,程序大概是这样的:
    \nurl="http://www.taojer.com"
    \n按照我们的思路,可能会这么写:
    \ne_url = Regexp.escape(url)
    \n==》http://www.taojer.com
    \nstr.scan(/<a href="(e_url)">(.+?)<\\/a>/m)
    \n但是这样就会因为/字符存在而异常咯?
    \n
    \n正确是应该是:
    \nstr.scan(/<a href="(http:\\/\\/www.taojer.com)">(.+?)<\\/a>/m).each do |list|

    \n\n

    do something

    \n\n

    end
    \n
    \n按照规定:
    \n特殊字符包括^、$、?、.、/、\\、[、]、{、}、(、)、+、*、
    \n为什么这个方法不转义/呢?
    \n有啥子高招,解决这个问题?
    \n参考:
    \nhttp://chinaonrails.com/topic/view/1418.html
    \nhttp://www.ruby-doc.org/core/classes/Regexp.html#M001227
    \nhttp://lzj520.javaeye.com/blog/143223

    \n", "_id"=>764}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux和windows之间的压缩包乱码", "body"=>"

    这个问题搞了我一晚上,到现在也没找到合适的方法,真是郁闷呀,记录下找到的东西,如下:

    \n

    问题:
    \n我在rails中使用fasterCSV导出DB里面的东西,编码为UTF-8,在linux上查看一切正常,但是我先后采用了zip,gzip,tar,7zip,rar,以及biz等压缩后传送给windows,打开发现是乱码。

    \n

    具体表现为:

    \n

    1、zip,tar,gzip,biz等压缩出来的,中文文件名和数据文件均乱码;

    \n

    2、用7zip和rar打包出来的,在windows下打开,中文名正常,但是内部的数据文件还是乱码。

    \n

     

    \n

    在linux与windows平台间交换压缩包文件,如果文件名中含有中文,有时候就会遇到乱码问题,给平台间的文件交换带来麻烦。今天仔细研究了一下,总结下面一些经验,供大家分享

    \n

    1. 7zip和rar(我用的是3.50,好像rar的旧版本不行)会对文件名编码进行转换,内部文件名编码使用

    \n

    unicode,所以使用这两种格式在linux和windows平台间交换不会有乱码问题,其他格式(比如tar.gz, tar.bz2)似乎不进行转换,所以不适合平台间交换。但鉴于linux的自由精神,不推荐使用商业软件rar,而推荐自由的7zip。但是,我发现用 Ubuntu中(我的是Edge)file-roller处理7zip文件还是会存在问题,而用命令行就没有问题,所以推荐大家用命令行的7zip。

    \n


    \n按照找到的资料,应该只有文件名会出现乱码,正文内容不会乱码的呀,真是奇怪。
    \n
    \n我本地测试用7zip或者rar压缩以后,中文的文件名正常了,但是内部的数据文件中的中文还是乱码,奇怪呀。。。

    \n

    有高手指点一下,多谢了哦。

    \n


    \n相关资料:
    \nhttp://linux.chinaitlab.com/administer/735727.html
    \nhttp://www.zdnet.com.cn/server/2008/0228/744257.shtml
    \nhttp://www.linuxidc.com/Linux/2007-12/9951.htm

    ", "created_at"=>2008-03-15 15:02:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    这个问题搞了我一晚上,到现在也没找到合适的方法,真是郁闷呀,记录下找到的东西,如下:
    \n问题:
    \n我在rails中使用fasterCSV导出DB里面的东西,编码为UTF-8,在linux上查看一切正常,但是我先后采用了zip,gzip,tar,7zip,rar,以及biz等压缩后传送给windows,打开发现是乱码。
    \n具体表现为:
    \n1、zip,tar,gzip,biz等压缩出来的,中文文件名和数据文件均乱码;
    \n2、用7zip和rar打包出来的,在windows下打开,中文名正常,但是内部的数据文件还是乱码。
    \n 
    \n在linux与windows平台间交换压缩包文件,如果文件名中含有中文,有时候就会遇到乱码问题,给平台间的文件交换带来麻烦。今天仔细研究了一下,总结下面一些经验,供大家分享
    \n1. 7zip和rar(我用的是3.50,好像rar的旧版本不行)会对文件名编码进行转换,内部文件名编码使用
    \nunicode,所以使用这两种格式在linux和windows平台间交换不会有乱码问题,其他格式(比如tar.gz, tar.bz2)似乎不进行转换,所以不适合平台间交换。但鉴于linux的自由精神,不推荐使用商业软件rar,而推荐自由的7zip。但是,我发现用 Ubuntu中(我的是Edge)file-roller处理7zip文件还是会存在问题,而用命令行就没有问题,所以推荐大家用命令行的7zip。
    \n
    \n按照找到的资料,应该只有文件名会出现乱码,正文内容不会乱码的呀,真是奇怪。
    \n
    \n我本地测试用7zip或者rar压缩以后,中文的文件名正常了,但是内部的数据文件中的中文还是乱码,奇怪呀。。。
    \n有高手指点一下,多谢了哦。
    \n
    \n相关资料:
    \nhttp://linux.chinaitlab.com/administer/735727.html
    \nhttp://www.zdnet.com.cn/server/2008/0228/744257.shtml
    \nhttp://www.linuxidc.com/Linux/2007-12/9951.htm

    \n", "_id"=>765}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中发送大文件", "body"=>"

    有个需求是需要在程序里生成压缩文件,并通过浏览器下载,在rails中发送文件的方式有2中,分别是send_data和send_file,两者还是有些区别的,详细的可以参考Rails的API文档(http://api.rubyonrails.com/classes/ActionController/Streaming.html),这里简单的记录2个方式,如下:

    \n``send_file '/path/to.zip'```\n
    (Sends the file by streaming it 4096 bytes at a time. This way the whole
    \nfile doesn‘t need to be read into memory at once. This makes it
    \nfeasible to send even large files.)
    \n
    \n``恩,我的需求差不多也是这样的,需要发送的文件比较大,大概在10M左右的大小,按照上
    面的这个说明,15M的文件差不多需要下载一分钟(理论速度,和实际的网速还是有关系的);
    挺方便了。
    参考:
    http://api.rubyonrails.com/classes/ActionController/Streaming.html
    http://www.javaeye.com/post/219997```", "created_at"=>2008-03-17 07:53:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有个需求是需要在程序里生成压缩文件,并通过浏览器下载,在rails中发送文件的方式有2中,分别是send_data和send_file,两者还是有些区别的,详细的可以参考Rails的API文档(http://api.rubyonrails.com/classes/ActionController/Streaming.html2个方式,如下:),这里简单的记录
    \n<strong>send_file '/path/to.zip'</strong>
    \n<blockquote>(Sends the file by streaming it <strong>4096 </strong>bytes at a time. This way the whole<br />
    \nfile doesn&lsquo;t need to be read into memory at once. This makes it<br />
    \nfeasible to send even large files.)<br />
    \n</blockquote>
    \n
    恩,我的需求差不多也是这样的,需要发送的文件比较大,大概在10M左右的大小,按照上<br />面的这个说明,15M的文件差不多需要下载一分钟(理论速度,和实际的网速还是有关系的);<br />挺方便了。<br />参考:<br />http://api.rubyonrails.com/classes/ActionController/Streaming.html<br />http://www.javaeye.com/post/219997``

    \n", "_id"=>766}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"别想馅饼啦,小心掉到陷阱里面去", "body"=>"

    最近,老是收到一封名字为“spam轉寄^_^”的邮件,内容相当老套,和以往的思路差不多,这次是鼓吹“比尔盖茨”多NB,说起在施舍自己的财富啥的,只要转发那个邮件就可以自动汇入多少多少美金。。

    \n

    对于这类的馅饼,偶从来就不放心上的,搞过计算机安全,偶也懂得一点的”社会工程学“的,利用社会学的例子,在不知不觉中,有些人就得到了其需要的东西而不会被人发觉。这就是社工的魅力和内涵。

    \n

    来看下这个邮件,其诱惑点有如下几个:

    \n

    1、有英文及其对应的翻译(繁体字),让人觉得有那么点可信;

    \n

    2、开始有几个炒作的,都说收到钱了,等等,让人稍微动心了;

    \n

    3、反正不费事,于是很多人就开始抱着试试看的心情大量转发咯;

    \n

    那么这样会给开始策划的人带来什么好处呢?

    \n

    具体的我不知道,有可能是测试中国人的心里;有可能是闹着玩等等,但是偶认为其还可以收集大家的工作邮箱,想想这么多人的真实、活跃邮箱,这可是比较珍贵的东西呀。

    \n

    抑或在某些版本的邮件接收中有类似跨站,取cookie、溢出下载等等的漏洞,这样就可以有更多的用处了。

    \n

    哎,对于这类”馅饼“,大家还是小心为妙,不要为了”馅饼“调到”陷阱“里啦。

    \n

    附:原文:

    \n

    請不要管它是真還是假,試一下! 如下文章的意思是:(水平有限,可能翻譯得不是很正確,班門弄斧了!)
    \n
    Dear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.

    \n
    親愛的朋友們,
    \n
    請不要把此郵件當作是垃圾郵件。比爾.蓋茨正在施捨他的財富。如果你無視此封郵件稍後你將會追悔莫及.Microsoft and AOL 是現今最大的因特網公司並致力於確保因特網Windows資源管理器依然是使用最廣的程序,Microsoft and AOL 正在進行E-mail第二個階段的測試。
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.

    \n
    噹你把此e-mail轉送給你的朋友時,微軟將跟在兩周內蹤它(如果你是Microsoft Windows 的使用者)。
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque.

    \n
    對於每一個轉發此mail給朋友的人,微軟將會付給你$245。對於每一個你轉發了的人,別人又繼續轉發的人,微軟將付給你$243並且每三個人收到此mail,你將會得及$241的付款。在兩周內,微軟將會聯繫你的地址並給你一張支票! 
    \n
    Dont Know True Or False, Just Have  a   Try
    \n
     
    \n
    Dear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque. 

    \n

    ", "created_at"=>2008-03-18 06:39:05 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近,老是收到一封名字为“spam轉寄^_^”的邮件,内容相当老套,和以往的思路差不多,这次是鼓吹“比尔盖茨”多NB,说起在施舍自己的财富啥的,只要转发那个邮件就可以自动汇入多少多少美金。。
    \n对于这类的馅饼,偶从来就不放心上的,搞过计算机安全,偶也懂得一点的”社会工程学“的,利用社会学的例子,在不知不觉中,有些人就得到了其需要的东西而不会被人发觉。这就是社工的魅力和内涵。
    \n来看下这个邮件,其诱惑点有如下几个:
    \n1、有英文及其对应的翻译(繁体字),让人觉得有那么点可信;
    \n2、开始有几个炒作的,都说收到钱了,等等,让人稍微动心了;
    \n3、反正不费事,于是很多人就开始抱着试试看的心情大量转发咯;
    \n那么这样会给开始策划的人带来什么好处呢?
    \n具体的我不知道,有可能是测试中国人的心里;有可能是闹着玩等等,但是偶认为其还可以收集大家的工作邮箱,想想这么多人的真实、活跃邮箱,这可是比较珍贵的东西呀。
    \n抑或在某些版本的邮件接收中有类似跨站,取cookie、溢出下载等等的漏洞,这样就可以有更多的用处了。
    \n哎,对于这类”馅饼“,大家还是小心为妙,不要为了”馅饼“调到”陷阱“里啦。
    \n附:原文:
    \n請不要管它是真還是假,試一下! 如下文章的意思是:(水平有限,可能翻譯得不是很正確,班門弄斧了!)
    \nDear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n親愛的朋友們,
    \n請不要把此郵件當作是垃圾郵件。比爾.蓋茨正在施捨他的財富。如果你無視此封郵件稍後你將會追悔莫及.Microsoft and AOL 是現今最大的因特網公司並致力於確保因特網Windows資源管理器依然是使用最廣的程序,Microsoft and AOL 正在進行E-mail第二個階段的測試。
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n噹你把此e-mail轉送給你的朋友時,微軟將跟在兩周內蹤它(如果你是Microsoft Windows 的使用者)。
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque.
    \n對於每一個轉發此mail給朋友的人,微軟將會付給你$245。對於每一個你轉發了的人,別人又繼續轉發的人,微軟將付給你$243並且每三個人收到此mail,你將會得及$241的付款。在兩周內,微軟將會聯繫你的地址並給你一張支票! 
    \nDon’t Know True Or False, Just Have  a   Try
    \n 
    \nDear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque. 

    \n", "_id"=>767}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart API去除流量限制 增加新特性", "body"=>"

    Google Chart API由于功能强大及使用简便,受到了大范围的好评。但用户也有强烈不满的地方,那便是Chart API有个流量限制,每用户每天最多只能执行5万次查询。为了满足大站用户的需求,Google今天去除了这个限制。
    \n
    \n此外,Chart API也对原有的一些特性进行了扩展,以及增加了新的特性。新的特性包括了支持了地图、雷达图等:

    \n

    \"\"
    \n详细的更新可进入Chart API主页查看(标准有extended或new的)。同样地,如果觉得这些文档不易阅读,也可参阅中文版,以及使用图形化的生成工具

    ", "created_at"=>2008-03-19 04:42:52 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Google Chart API由于功能强大及使用简便,受到了大范围的好评。但用户也有强烈不满的地方,那便是Chart API有个流量限制,每用户每天最多只能执行5万次查询。为了满足大站用户的需求,Google今天去除了这个限制。
    \n
    \n此外,Chart API也对原有的一些特性进行了扩展,以及增加了新的特性。新的特性包括了支持了地图、雷达图等:
    \n
    \n详细的更新可进入Chart API主页查看(标准有extended或new的)。同样地,如果觉得这些文档不易阅读,也可参阅中文版,以及使用图形化的生成工具。

    \n", "_id"=>768}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中调用系统的rar来打包文件包", "body"=>"

    由于项目需求,用户可以定制,下载一些数据和图片,于是乎就需要实现的功能有:打包,中文,以及下载等,这里大概的说一下,我也是测试了好久,查了好多资料踩搞明白一些问题,首先BS下window所谓的国际化.真是FT.

    \n

    先看如果压缩文件,看代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. pwd = Dir.pwd  
    2. \n
    3. logger.info("Dir.pwd=\#{pwd}")  
    4. \n
    5. Dir.chdir("\#{cp_dir}"do  
    6. \n
    7.   system "rar a  \#{local_dir_name} \#{local_dir_name}"  
    8. \n
    9. end   
    10. \n
    \n
    \n

    \n

    使用了Ruby的Dir及其代码块的临时切换目录的功能,实在是棒,开始的时候,我还在想使用Tar或者rar用-C参数来去掉打包后的文件夹路径;

    \n

    至于这里为什么使用rar而没有使用比较传统的tar或者gzip,zip或则7zip等,主要是乱码的问题,详细的大家可以查看我以前的文章<linux和windows之间的压缩包乱码>.

    \n

    而后下载的过程中,再次感觉WIn下IE的可恶,乱码,呵呵,没关系,我们可以这样做,如下: 
    \n

    \n
    Ruby代码
    \n
      \n
    1. res = Resource.find(params[:id])  
    2. \n
    3. res.update_attribute(:downed_count, res.downed_count + 1)  
    4. \n
    5. user_agent = request.user_agent.downcase  
    6. \n
    7. filename = File.basename(res.path)  
    8. \n
    9. if user_agent  =~ /msie/i  
    10. \n
    11.   send_file(RAILS_ROOT + res.path,:buffer =>  
    12. \n
    13.       "16384",:filename=>CGI::escape(filename))  
    14. \n
    15. else  
    16. \n
    17.   send_file(RAILS_ROOT + res.path,:buffer => "16384")  
    18. \n
    19. end   
    20. \n
    \n
    \n

    \n

    差不多这些都是关键,搞明白了,就基本上无敌了,呵呵.

    ", "created_at"=>2008-03-23 14:36:47 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    由于项目需求,用户可以定制,下载一些数据和图片,于是乎就需要实现的功能有:打包,中文,以及下载等,这里大概的说一下,我也是测试了好久,查了好多资料踩搞明白一些问题,首先BS下window所谓的国际化.真是FT.
    \n先看如果压缩文件,看代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n pwd = Dir.pwd  
    \n logger.info("Dir.pwd=\#{pwd}")  
    \n Dir.chdir("\#{cp_dir}") do  
    \n   system "rar a  \#{local_dir_name} \#{local_dir_name}"  
    \n end   
    \n
    \n
    \n
    \n使用了Ruby的Dir及其代码块的临时切换目录的功能,实在是棒,开始的时候,我还在想使用Tar或者rar用-C参数来去掉打包后的文件夹路径;
    \n至于这里为什么使用rar而没有使用比较传统的tar或者gzip,zip或则7zip等,主要是乱码的问题,详细的大家可以查看我以前的文章<linux和windows之间的压缩包乱码>.
    \n而后下载的过程中,再次感觉WIn下IE的可恶,乱码,呵呵,没关系,我们可以这样做,如下: 
    \n
    \nRuby代码
    \n
    \n res = Resource.find(params[:id])  
    \n res.update_attribute(:downed_count, res.downed_count + 1)  
    \n user_agent = request.user_agent.downcase  
    \n filename = File.basename(res.path)  
    \n if user_agent  =~ /msie/i  
    \n   send_file(RAILS_ROOT + res.path,:buffer =>  
    \n       "16384",:filename=>CGI::escape(filename))  
    \n else  
    \n   send_file(RAILS_ROOT + res.path,:buffer => "16384")  
    \n end   
    \n
    \n
    \n
    \n差不多这些都是关键,搞明白了,就基本上无敌了,呵呵.

    \n", "_id"=>769}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调优:大量的CLOSE_WAIT状态连接", "body"=>"

    这几天,项目上遇到一个很奇怪的问题,由于项目比较庞大,使用了3台独立的主机做服务器,前端用了硬件的radware采用轮询算法做了三台服务器的负载均衡,每台服务上部署了一台weblogic和一个前置apache做proxy,并且启用了apache的支持weblogic的集群功能,二次向三台weblogic做负载均衡(虽然这里我觉得没啥必要,但是原先他们就这么做了,我就不改了)。

    \n

    apache使用的是prefork模块,开了800个最大连接,配置了超时机制;后端的weblogic除了线程池和队列,文件句柄等做了修改外,其他的貌似没怎么修改。

    \n

    出现的问题的现象是,apache的线程全部用完(802个),weblogic相对比较空闲,内存消耗一般,CPU(4颗的)的idea也在50%左右;前端表现是页面打开速度相当慢,基本不可用。

    \n

    问题的分析过程是,先看到apache的error的log里面很多“文件找不到”错误,由于编辑做的页面上引了一些并不存在的资源,导致的,怀疑此类错误太多,会影响性能,于是找出错误页面,让编辑修复其中巍峨文件引用。但是效果不是很明显,虽然error少了很多。

    \n

    继续分析,使用netstat -an看到很多端口被占用,且很多处于CLOSE_WAIT状态,找个脚本统计下,如下:

    \n

    [wwwpps@IceskYsl]$ netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
    \nLAST_ACK 1
    \nSYN_RECV 15
    \nCLOSE_WAIT 7729
    \nESTABLISHED 471
    \nFIN_WAIT1 3
    \nFIN_WAIT2 52
    \nSYN_SENT 1
    \nTIME_WAIT 725

    \n

    可以看到,确实很多,感觉这里是有问题,google得到一些资料,说到这个问题会导致:“大量的CLOSE_WAIT连接,直接占满TCP队列,导致Apache失去响应。”

    \n

    解决这个问题的方法是修改系统的参数,系统默认超时时间的是7200秒,也就是2小时,这个太大了,对于我们这样的负荷来说,于是修改如下几个参数:

    \n

    sysctl -w net.ipv4.tcp_keepalive_time=30
    \nsysctl -w net.ipv4.tcp_keepalive_probes=2
    \nsysctl -w net.ipv4.tcp_keepalive_intvl=2

    \n

    然后,执行sysctl命令使修改生效,基本上就算完成了。目前正在观察中,看看下午高峰时候效果如何,就可以基本上得出结论了。

    \n

    参考文章:

    \n

    1、解释apache的几种模式的差别:http://www.servertechnology.cn/archives/314.html

    \n

    2、解释“CLOSE_WAIT生成的原因及其系统参数的意义”:http://haka.sharera.com/blog/BlogTopic/32309.htm

    \n

    3、解释如何修复:http://luobuwa.cn/tag.php?tag=apache&mode=1

    \n


    \n

    ", "created_at"=>2008-03-24 05:34:17 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    这几天,项目上遇到一个很奇怪的问题,由于项目比较庞大,使用了3台独立的主机做服务器,前端用了硬件的radware采用轮询算法做了三台服务器的负载均衡,每台服务上部署了一台weblogic和一个前置apache做proxy,并且启用了apache的支持weblogic的集群功能,二次向三台weblogic做负载均衡(虽然这里我觉得没啥必要,但是原先他们就这么做了,我就不改了)。
    \napache使用的是prefork模块,开了800个最大连接,配置了超时机制;后端的weblogic除了线程池和队列,文件句柄等做了修改外,其他的貌似没怎么修改。
    \n出现的问题的现象是,apache的线程全部用完(802个),weblogic相对比较空闲,内存消耗一般,CPU(4颗的)的idea也在50%左右;前端表现是页面打开速度相当慢,基本不可用。
    \n问题的分析过程是,先看到apache的error的log里面很多“文件找不到”错误,由于编辑做的页面上引了一些并不存在的资源,导致的,怀疑此类错误太多,会影响性能,于是找出错误页面,让编辑修复其中巍峨文件引用。但是效果不是很明显,虽然error少了很多。
    \n继续分析,使用netstat -an看到很多端口被占用,且很多处于CLOSE_WAIT状态,找个脚本统计下,如下:
    \n[wwwpps@IceskYsl]$ netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
    \nLAST_ACK 1
    \nSYN_RECV 15
    \nCLOSE_WAIT 7729
    \nESTABLISHED 471
    \nFIN_WAIT1 3
    \nFIN_WAIT2 52
    \nSYN_SENT 1
    \nTIME_WAIT 725
    \n可以看到,确实很多,感觉这里是有问题,google得到一些资料,说到这个问题会导致:“大量的CLOSE_WAIT连接,直接占满TCP队列,导致Apache失去响应。”
    \n解决这个问题的方法是修改系统的参数,系统默认超时时间的是7200秒,也就是2小时,这个太大了,对于我们这样的负荷来说,于是修改如下几个参数:
    \nsysctl -w net.ipv4.tcp_keepalive_time=30
    \nsysctl -w net.ipv4.tcp_keepalive_probes=2
    \nsysctl -w net.ipv4.tcp_keepalive_intvl=2
    \n然后,执行sysctl命令使修改生效,基本上就算完成了。目前正在观察中,看看下午高峰时候效果如何,就可以基本上得出结论了。
    \n参考文章:
    \n1、解释apache的几种模式的差别:http://www.servertechnology.cn/archives/314.html
    \n2、解释“CLOSE_WAIT生成的原因及其系统参数的意义”:http://haka.sharera.com/blog/BlogTopic/32309.htm
    \n3、解释如何修复:http://luobuwa.cn/tag.php?tag=apache&mode=1;
    \n

    \n", "_id"=>770}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RESTClient:Web开发测试助手", "body"=>"
    RESTClient is a Java platform client application to test RESTful webservices. It can be used to test variety of HTTP communications.

    \"\"
    使用很方便,但是需要java环境,如下:
    $ java
    -jar restclient-2.1-jar-with-dependencies.jar```\n

    关于这个的实现,可以参考这个文章:http://justtalkaboutweb.com/2008/01/25/building-restful-application-in-rails-20-step-by-step/

    ", "created_at"=>2008-03-25 03:47:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    RESTClient is a Java platform client application to test RESTful webservices. It can be used to test variety of HTTP communications.使用很方便,但是需要java环境,如下:$ java -jar restclient-2.1-jar-with-dependencies.jar```
    \n关于这个的实现,可以参考这个文章:http://justtalkaboutweb.com/2008/01/25/building-restful-application-in-rails-20-step-by-step/

    \n", "_id"=>771}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没有回到Windows下了", "body"=>"

    很久了,记不得什么时候开始使用ubuntu的,只记得当时还是7.04版本刚刚出来的时候,转眼间,ubuntu的8.04版本都快发布了,哦,这么算下来,差不多一年了吧。

    \n

    这么一年来的时间,在家工作或者学习、娱乐的时候都在ubuntu下完成的,感觉不到什么别扭,甚至觉得更加的习惯和舒服,一点点都不怀念Window,今天回到windows下,面对一些曾经熟悉的界面,竟然有点不晓得做什么,好在浏览器还是FF,多少还比较习惯。

    \n

    一年多的ubuntu,让我觉得lunix,非常适合我的需要,对一个不打游戏,不咋看电影,天天沉浸在coding的世界里,天天打交道的是IDE,SSH等等。这些都成为我工作之余的大部分内容,真的,ubuntu或者其他的发行版lunix,对程序员或者做互联网的人,非常的适合。

    \n

    一年来,系统再也没有出过啥问题,最多的一次就是xfec的面板不见了,google下,非常简单的一条命令即可搞定;虽然我在windows下也很少中毒,虽然我也不装杀毒软件,但是免不了,偶尔还要用iceword检查下系统是否安全;在ubuntu下,这都免了。

    \n

    我的本本上的window还没有彻底删除,主要是嫌转移资料,整理比较麻烦,反正ubuntu里面,可以直接读windows里的资料,就那么放着吧,有时间再重启进来瞧瞧,呵呵。

    \n

     

    ", "created_at"=>2008-03-29 12:27:25 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很久了,记不得什么时候开始使用ubuntu的,只记得当时还是7.04版本刚刚出来的时候,转眼间,ubuntu的8.04版本都快发布了,哦,这么算下来,差不多一年了吧。
    \n这么一年来的时间,在家工作或者学习、娱乐的时候都在ubuntu下完成的,感觉不到什么别扭,甚至觉得更加的习惯和舒服,一点点都不怀念Window,今天回到windows下,面对一些曾经熟悉的界面,竟然有点不晓得做什么,好在浏览器还是FF,多少还比较习惯。
    \n一年多的ubuntu,让我觉得lunix,非常适合我的需要,对一个不打游戏,不咋看电影,天天沉浸在coding的世界里,天天打交道的是IDE,SSH等等。这些都成为我工作之余的大部分内容,真的,ubuntu或者其他的发行版lunix,对程序员或者做互联网的人,非常的适合。
    \n一年来,系统再也没有出过啥问题,最多的一次就是xfec的面板不见了,google下,非常简单的一条命令即可搞定;虽然我在windows下也很少中毒,虽然我也不装杀毒软件,但是免不了,偶尔还要用iceword检查下系统是否安全;在ubuntu下,这都免了。
    \n我的本本上的window还没有彻底删除,主要是嫌转移资料,整理比较麻烦,反正ubuntu里面,可以直接读windows里的资料,就那么放着吧,有时间再重启进来瞧瞧,呵呵。
    \n 

    \n", "_id"=>772}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复OpenOffice中打开Word文档行距很大", "body"=>"

    平时用word的机会越来越少,虽然OpenOffice也挺不错,但是我还是习惯了Google的在线文档,简洁好用;但是偶尔也需要用OpenOffice打开以前的Word文档,发现其行距总是很宽,比较看着不舒服,查了下,原因及其解决办法为:

    \n

    Q: 为什么我在OpenOffice.org中打开Word文档,总是行距很宽?而且调整行距不起作用。
    \n
    \nA: 这是OpenOffice.org Writer里面一个选项造成的。在[格式]菜单里面选择[页面],在[文字网格]选项卡中选择[不使用网格],你的文档就回到正常状态啦!似乎 OpenOffice碰见亚洲字符的文档,就会自动给他加上网格,目前不太清楚如何自动关掉。

    \n

     

    ", "created_at"=>2008-03-30 00:14:37 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    平时用word的机会越来越少,虽然OpenOffice也挺不错,但是我还是习惯了Google的在线文档,简洁好用;但是偶尔也需要用OpenOffice打开以前的Word文档,发现其行距总是很宽,比较看着不舒服,查了下,原因及其解决办法为:
    \nQ: 为什么我在OpenOffice.org中打开Word文档,总是行距很宽?而且调整行距不起作用。
    \n
    \nA: 这是OpenOffice.org Writer里面一个选项造成的。在[格式]菜单里面选择[页面],在[文字网格]选项卡中选择[不使用网格],你的文档就回到正常状态啦!似乎 OpenOffice碰见亚洲字符的文档,就会自动给他加上网格,目前不太清楚如何自动关掉。
    \n 

    \n", "_id"=>773}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用缓存(码表)的方式", "body"=>"

    搞过Java的应该都晓得,经常会定义一些字典,然后将这些字典缓存带内存中以提高查询的效率和速度,也就是常说的缓存,有人叫码表.

    \n

    今天看看如何在Rails中实现类似的功能,思路是一样的,可以缓存在数组或者Hash里面,这里为了查找方便,我们选择使用Hash.

    \n

    也就是:如何创建一个变量从rails开始运行时初始化,一直维持到rails终止,而且对于每一个request都能共享的变量?

    \n

    1,首先在environment.rb里面(如果您使用的Rails2以上版本,建议放在initializers目录里面,自己创建一个文件即可)定义一个ruby中的全局变量即可,例如$actions_in_mem在ruby里面,以$开头的变量即自动申明为全局变量)。在rails启动的时候,执行在environment.rb和initializers里面的文件,初始化$actions_in_mem,这样$actions_in_mem即可持续使用了,如:

    \n
    \n
    Ruby代码
    \n
      \n
    1. $actions_in_mem = Hash.new 
      \n
    2. \n
    \n
    \n

     

    \n

    2,然后在controller或者model或者view里面都是可用的了,比如在model里面实现刷新:

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. #刷新缓存  
    2. \n
    3. def Action.refresh  
    4. \n
    5.   Action.get_actions(1).each do |ac|  
    6. \n
    7.     put_into_hash(ac.controller+"_"+ac.action,ac.id)  
    8. \n
    9.   end  
    10. \n
    11. end  
    12. \n
    13.   
    14. \n
    15. def Action.put_into_hash(key,value)  
    16. \n
    17.   $actions_in_mem.store(key, value)  
    18. \n
    19.   logger.info("@@actions_in_mem.size=\#{$actions_in_mem.size}---\#{key}=>\#{value}")  
    20. \n
    21. end 
      \n
    22. \n
    \n
    \n

    3,当然,你可以在controller中定义一个方法手工刷新这个全局变量,或者定时刷新即可,如下代码实现手工刷新.

    \n

     

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. #刷新缓存数据  
    2. \n
    3. def refresh_actions  
    4. \n
    5.   Action.refresh  
    6. \n
    7. end 
      \n
    8. \n
    \n
    \n

     

    \n

    4,最后是在view里面显示或者维护,如下代码段:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <ul>  
    2. \n
    3.   <% $actions_in_mem.each do |key,value|%>  
    4. \n
    5.     <li><%=key%>=><%=value%></li>  
    6. \n
    7.   <%end%>  
    8. \n
    9. </ul>  
    10. \n
    \n
    \n

    如上,就可以理解的差不多啦..

    \n

     

    \n

    关于如何查找,等下再写一篇说说.

    \n

     其他参考文档:

    \n

    1.http://blog.waynedeng.com/article.asp?id=628

    \n

    2.http://www.cnblogs.com/hardrock/archive/2006/09/07/497554.html

    \n

     

    ", "created_at"=>2008-03-30 15:09:38 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    搞过Java的应该都晓得,经常会定义一些字典,然后将这些字典缓存带内存中以提高查询的效率和速度,也就是常说的缓存,有人叫码表.
    \n今天看看如何在Rails中实现类似的功能,思路是一样的,可以缓存在数组或者Hash里面,这里为了查找方便,我们选择使用Hash.
    \n也就是:如何创建一个变量从rails开始运行时初始化,一直维持到rails终止,而且对于每一个request都能共享的变量?
    \n1,首先在environment.rb里面(如果您使用的Rails2以上版本,建议放在initializers目录里面,自己创建一个文件即可)定义一个ruby中的全局变量即可,例如$actionsin_mem在ruby里面,以$开头的变量即自动申明为全局变量)。在rails启动的时候,执行在environment.rb和initializers里面的文件,初始化$actions_in_mem,这样$actions_in_mem即可持续使用了,如:
    \n
    \nRuby代码
    \n
    \n $actions_in_mem = Hash.new 
    \n
    \n
    \n
    \n 
    \n2,然后在controller或者model或者view里面都是可用的了,比如在model里面实现刷新:
    \n 
    \n
    \nRuby代码
    \n
    \n #刷新缓存  
    \n def Action.refresh  
    \n   Action.get_actions(1).each do |ac|  
    \n     put_into_hash(ac.controller+"
    "+ac.action,ac.id)  
    \n   end  
    \n end  
    \n   
    \n def Action.put_into_hash(key,value)  
    \n   $actions_in_mem.store(key, value)  
    \n   logger.info("@@actions_in_mem.size=\#{$actions_in_mem.size}---\#{key}=>\#{value}")  
    \n end 
    \n
    \n
    \n
    \n3,当然,你可以在controller中定义一个方法手工刷新这个全局变量,或者定时刷新即可,如下代码实现手工刷新.
    \n 
    \n 
    \n
    \nRuby代码
    \n
    \n #刷新缓存数据  
    \n def refresh_actions  
    \n   Action.refresh  
    \n end 
    \n
    \n
    \n
    \n 
    \n4,最后是在view里面显示或者维护,如下代码段:
    \n
    \nXML/HTML代码
    \n
    \n <ul>  
    \n   <% $actions_in_mem.each do |key,value|%>  
    \n     <li><%=key%>=><%=value%></li>  
    \n   <%end%>  
    \n </ul>  
    \n
    \n
    \n如上,就可以理解的差不多啦..
    \n 
    \n关于如何查找,等下再写一篇说说.
    \n 其他参考文档:
    \n1.http://blog.waynedeng.com/article.asp?id=628
    \n2.http://www.cnblogs.com/hardrock/archive/2006/09/07/497554.html
    \n 

    \n", "_id"=>774}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的集合对象的遍历技巧", "body"=>"

    前面一篇文章说到了在Rails中实现缓存(码表),接下来就说说如何度缓存的码表做查询,这里说的缓存有可能是数组,或者是Hash.

    \n

    1.先看数组的

    \n

    可以使用delect或者select方法来查找需要的那个元素,代码段如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def get_object_by_id(collections,id)  
    2. \n
    3.     collections.select{|c| c.step_id == id}  
    4. \n
    5. end  
    6. \n
    \n
    \n2.Hash的,待续

    ", "created_at"=>2008-03-30 15:16:13 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前面一篇文章说到了在Rails中实现缓存(码表),接下来就说说如何度缓存的码表做查询,这里说的缓存有可能是数组,或者是Hash.
    \n1.先看数组的
    \n可以使用delect或者select方法来查找需要的那个元素,代码段如下:
    \n
    \n
    \nRuby代码
    \n
    \n def get_object_by_id(collections,id)  
    \n     collections.select{|c| c.step_id == id}  
    \n end  
    \n
    \n
    \n2.Hash的,待续

    \n", "_id"=>775}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout是个挺有趣的tools", "body"=>"

    Scout是Highgroove Studios写的一个很有趣的应用,他提供了一个大的框架,使得其他人可以以插件(集成)的方式实现他的方法(run),进而按照他预定的格式,将采集到的数据发送到其中央服务器,进而可以存储,并以报表的形式展示出来。

    \n

    我大概了看了下起实现方式,和插件的编写方式,其实也挺简单的,其原理也就是在*unix上可以采用crob之类的做定时调度,采集数据(可以使用系统的一些命令,比如ps,top)等等,再把数据组合成他预定义的格式就可以了。

    \n

    看个插件的代码以及我的注释,就很清楚了:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # TODO: use alternate process open to catch STDOUT, STDERR for those   
    2. \n
    3. # processes that use  
    4. \n
    5. #分析: IceskYsl@1sters!(http://iceskysl.1sters.com)  
    6. \n
    7. #这个插件实现的是,定时监控指定的进程,需要的时候重启,并生成报告  
    8. \n
    9. class KeepProcessRunning < Scout::Plugin  
    10. \n
    11.   
    12. \n
    13.   def run  
    14. \n
    15.     #预定义返回的数据格式  
    16. \n
    17.     report = {:report => {}, :alerts => [], :memory => {}}  
    18. \n
    19.     #取需要监控的进程的名字和重启进程的命令  
    20. \n
    21.     process_to_monitor = @options[:process_name] || ""  
    22. \n
    23.     restart_action     = @options[:restart_action] || process_to_monitor  
    24. \n
    25.       
    26. \n
    27.     # Search all running processes for the process (do not match the grep   
    28. \n
    29.     # process nor the locally running scout client).  
    30. \n
    31.     #这就是调用系统的ps命令,并grep,看是否有指定的进程存在  
    32. \n
    33.     ps_output = `ps auxww | grep "\#{process_to_monitor}" | grep -v "grep" | grep -v "scout"`  
    34. \n
    35.     #如果不存在,则根据上面给的重启命令来重启  
    36. \n
    37.     unless process_match = ps_output.to_a.first  # process not found  
    38. \n
    39.       # attempt to restart the process  
    40. \n
    41.       restart_output = `\#{restart_action}`  
    42. \n
    43.       report[:alerts] << {:subject => "\#{process_to_monitor} is not running. Restart reported: \#{restart_output}"}  
    44. \n
    45.     else # process is running  
    46. \n
    47.       # if we wanted to parse fields we could:  
    48. \n
    49.       # fields = process_match.downcase.split  
    50. \n
    51.       report[:report][process_to_monitor] = 1  
    52. \n
    53.     end    
    54. \n
    55.     #返回报告  
    56. \n
    57.     return report    
    58. \n
    59.   rescue Exception  
    60. \n
    61.     { :error => { :subject => "Could not keep the process running.",  
    62. \n
    63.                   :body    => "An exception was thrown:  \#{$!.message}" } }  
    64. \n
    65.   end  
    66. \n
    67. end  
    68. \n
    \n
    \n

    \n

    他采取的“Client Key”来做唯一性校验,也就是说,你必须获得这个“Client Key”,而这个将来可以成为其卖点(可行的方法是分级售卖,比如多少钱的帐号可以监控几个服务器之类的)。

    \n

    仔细一想,这个Idea还真不赖,呵呵~

    \n

    其他的参考资料:

    \n

    1、Scout主页:http://scoutapp.com/

    \n

    2、插件编写手册:http://scoutapp.com/plugin_urls/static/creating_a_plugin

    \n

    3、rubyinside的报道:http://www.rubyinside.com/scout-a-ruby-powered-web-monitoring-and-reporting-service-825.html

    ", "created_at"=>2008-03-31 03:40:38 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Scout是Highgroove Studios写的一个很有趣的应用,他提供了一个大的框架,使得其他人可以以插件(集成)的方式实现他的方法(run),进而按照他预定的格式,将采集到的数据发送到其中央服务器,进而可以存储,并以报表的形式展示出来。
    \n我大概了看了下起实现方式,和插件的编写方式,其实也挺简单的,其原理也就是在*unix上可以采用crob之类的做定时调度,采集数据(可以使用系统的一些命令,比如ps,top)等等,再把数据组合成他预定义的格式就可以了。
    \n看个插件的代码以及我的注释,就很清楚了:
    \n
    \n
    \nRuby代码
    \n
    \n # TODO: use alternate process open to catch STDOUT, STDERR for those   
    \n # processes that use  
    \n #分析: IceskYsl@1sters!(http://iceskysl.1sters.com)  
    \n #这个插件实现的是,定时监控指定的进程,需要的时候重启,并生成报告  
    \n class KeepProcessRunning < Scout::Plugin  
    \n   
    \n   def run  
    \n     #预定义返回的数据格式  
    \n     report = {:report => {}, :alerts => [], :memory => {}}  
    \n     #取需要监控的进程的名字和重启进程的命令  
    \n     process_to_monitor = @options[:process_name] || ""  
    \n     restart_action     = @options[:restart_action] || process_to_monitor  
    \n       
    \n     # Search all running processes for the process (do not match the grep   
    \n     # process nor the locally running scout client).  
    \n     #这就是调用系统的ps命令,并grep,看是否有指定的进程存在  
    \n     ps_output = ps&nbsp;auxww&nbsp;|&nbsp;grep&nbsp;<span class="string">&quot;\#{process_to_monitor}&quot;</span><span>&nbsp;|&nbsp;grep&nbsp;-v&nbsp;</span><span class="string">&quot;grep&quot;</span><span>&nbsp;|&nbsp;grep&nbsp;-v&nbsp;</span><span class="string">&quot;scout&quot;</span><span>  
    \n     #如果不存在,则根据上面给的重启命令来重启  
    \n     unless process_match = ps_output.to_a.first  # process not found  
    \n       # attempt to restart the process  
    \n       restart_output = <span class="comment">\#{restart_action}  
    \n       report[:alerts] << {:subject => "\#{process_to_monitor} is not running. Restart reported: \#{restart_output}"}  
    \n     else # process is running  
    \n       # if we wanted to parse fields we could:  
    \n       # fields = process_match.downcase.split  
    \n       report[:report][process_to_monitor] = 1  
    \n     end    
    \n     #返回报告  
    \n     return report    
    \n   rescue Exception  
    \n     { :error => { :subject => "Could not keep the process running.",  
    \n                   :body    => "An exception was thrown:  \#{$!.message}" } }  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n他采取的“Client Key”来做唯一性校验,也就是说,你必须获得这个“Client Key”,而这个将来可以成为其卖点(可行的方法是分级售卖,比如多少钱的帐号可以监控几个服务器之类的)。
    \n仔细一想,这个Idea还真不赖,呵呵~
    \n其他的参考资料:
    \n1、Scout主页:http://scoutapp.com/
    \n2、插件编写手册:http://scoutapp.com/plugin_urls/static/creating_a_plugin
    \n3、rubyinside的报道:http://www.rubyinside.com/scout-a-ruby-powered-web-monitoring-and-reporting-service-825.html

    \n", "_id"=>776}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"支持Elastic IP Addresses,EC2越来越成熟了.", "body"=>"

    晚上写完手上的代码,正准备睡觉的时候,收到Amazon的一封mail,以为是S3EC2的账单呢,打开一看,原来是EC2的好消息.

    \n

    Greetings AWS Developers, \n

    Last week brought some exciting, highly requested new Amazon EC2 features to the community - Elastic IP Addresses, Availability Zones, and User Selectable Kernels.

    \n

    wowo,真是个好东西,EC2一直以来都被人诟病之一的就是其IP地址的动态的,也就是当你重启您"镜像"后,你的IP地址会变化,也就是说,你的域名需要才信修改IP指向,或者采用一个老外写的一个插件(忘记脚啥名字了)来动态解析,比较不爽的很.现在EC2终于推出了"静态IP"功能,我粗略的看了下,其和账户是绑定的,也就是你重启自己的"镜像"后,并不失效.

    \n

    好东西,EC2会越来越好的...
    \n

    \n

    还是直接看英语的吧,呵呵:

    \n

    Elastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it. Unlike traditional static IP addresses, however, Elastic IP addresses allow you to mask instance or availability zone failures by programmatically remapping your public IP addresses to any instance associated with your account. Rather than waiting on a data technician to reconfigure or replace your host, or waiting for DNS to propagate to all of your customers, Amazon EC2 enables you to engineer around problems with your instance or software by programmatically remapping your Elastic IP address to a replacement instance.

    \n

    详细情况请参考:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346

    \n

    ", "created_at"=>2008-04-01 15:00:29 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    晚上写完手上的代码,正准备睡觉的时候,收到Amazon的一封mail,以为是S3或EC2的账单呢,打开一看,原来是EC2的好消息.
    \nGreetings AWS Developers,
    \n Last week brought some exciting, highly requested new Amazon EC2 features to the community - Elastic IP Addresses, Availability Zones, and User Selectable Kernels.
    \nwowo,真是个好东西,EC2一直以来都被人诟病之一的就是其IP地址的动态的,也就是当你重启您"镜像"后,你的IP地址会变化,也就是说,你的域名需要才信修改IP指向,或者采用一个老外写的一个插件(忘记脚啥名字了)来动态解析,比较不爽的很.现在EC2终于推出了"静态IP"功能,我粗略的看了下,其和账户是绑定的,也就是你重启自己的"镜像"后,并不失效.
    \n好东西,EC2会越来越好的...
    \n
    \n还是直接看英语的吧,呵呵:
    \nElastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it. Unlike traditional static IP addresses, however, Elastic IP addresses allow you to mask instance or availability zone failures by programmatically remapping your public IP addresses to any instance associated with your account. Rather than waiting on a data technician to reconfigure or replace your host, or waiting for DNS to propagate to all of your customers, Amazon EC2 enables you to engineer around problems with your instance or software by programmatically remapping your Elastic IP address to a replacement instance.
    \n详细情况请参考:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346

    \n", "_id"=>777}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu的快捷键", "body"=>"

    毫无疑问,熟练的使用快捷键可以大大的提高工作效率,windows如此,lunix也是如此,下面收录一些ubuntu的快捷键,没事的时候看看,用用,就记得了.
    \n* 打开主菜单 = Alt + F1
    \n* 运行 = Alt + F2
    \n* 显示桌面 = Ctrl + Alt + d
    \n* 最小化当前窗口 = Alt + F9
    \n* 最大化当前窗口 = Alt + F10
    \n* 关闭当前窗口 = Alt + F4
    \n* 截取全屏 = Print Screen
    \n* 截取窗口 = Alt + Print Screen
    \n默认特殊快捷键
    \n* 展示所有窗口程序 = F10
    \n* 展示当前窗口最上层程序 = F11
    \n* 展示当前窗口所有程序 = F12
    \n* 切换窗口 = Alt + Tab
    \n* 旋转3D桌面 = Ctrl + Alt + 左/右箭头(也可以把鼠标放在标题栏或桌面使用滚轮切换)
    \n* 旋转3D桌面( 活动窗口跟随) = Ctrl + Shift + Alt + 左/右箭头
    \n* 手动旋转3D桌面 = Ctrl + Alt + 左键单击并拖拽桌面空白处
    \n* 窗口透明/不透明 = possible with the “transset” utility or Alt + 滚轮
    \n* 放大一次 = 超级键 + 右击
    \n* 手动放大 = 超级键 + 滚轮向上
    \n* 手动缩小 = 超级键 + 滚轮向下
    \n* 移动窗口 = Alt + 左键单击
    \n* 移动窗口时贴住边框 = 左键开始拖动后再 Ctrl + Alt
    \n* 调整窗口大小 = Alt + 中击
    \n* Bring up the window below the top window = Alt + middle-click
    \n* 动态效果减速 = Shift + F10
    \n* 水纹 = 按住 Ctrl+超级键
    \n* 雨点 = Shift-F9
    \n* 桌面展开= Ctrl + Alt + 下箭头,然后按住 Ctrl + Alt 和左/右箭头选择桌面

    \n

     

    ", "created_at"=>2008-04-01 15:21:12 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    毫无疑问,熟练的使用快捷键可以大大的提高工作效率,windows如此,lunix也是如此,下面收录一些ubuntu的快捷键,没事的时候看看,用用,就记得了.
    \n* 打开主菜单 = Alt + F1
    \n* 运行 = Alt + F2
    \n* 显示桌面 = Ctrl + Alt + d
    \n* 最小化当前窗口 = Alt + F9
    \n* 最大化当前窗口 = Alt + F10
    \n* 关闭当前窗口 = Alt + F4
    \n* 截取全屏 = Print Screen
    \n* 截取窗口 = Alt + Print Screen
    \n默认特殊快捷键
    \n* 展示所有窗口程序 = F10
    \n* 展示当前窗口最上层程序 = F11
    \n* 展示当前窗口所有程序 = F12
    \n* 切换窗口 = Alt + Tab
    \n* 旋转3D桌面 = Ctrl + Alt + 左/右箭头(也可以把鼠标放在标题栏或桌面使用滚轮切换)
    \n* 旋转3D桌面( 活动窗口跟随) = Ctrl + Shift + Alt + 左/右箭头
    \n* 手动旋转3D桌面 = Ctrl + Alt + 左键单击并拖拽桌面空白处
    \n* 窗口透明/不透明 = possible with the “transset” utility or Alt + 滚轮
    \n* 放大一次 = 超级键 + 右击
    \n* 手动放大 = 超级键 + 滚轮向上
    \n* 手动缩小 = 超级键 + 滚轮向下
    \n* 移动窗口 = Alt + 左键单击
    \n* 移动窗口时贴住边框 = 左键开始拖动后再 Ctrl + Alt
    \n* 调整窗口大小 = Alt + 中击
    \n* Bring up the window below the top window = Alt + middle-click
    \n* 动态效果减速 = Shift + F10
    \n* 水纹 = 按住 Ctrl+超级键
    \n* 雨点 = Shift-F9
    \n* 桌面展开= Ctrl + Alt + 下箭头,然后按住 Ctrl + Alt 和左/右箭头选择桌面
    \n 

    \n", "_id"=>778}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BaiDu之Hi体验~", "body"=>"

    向来喜欢体验些新东西,虽然GoogleTalk已经让我觉得非常满意,虽然在linux上无法使用Hi,虽然我对Baidu并不十分的喜欢,但是看到订阅的一些RSS里面屡屡出现Baidu的Hi的身影的时候,我还在会看看他到底有啥不同,有啥奇特的?

    \n

    看到白鸽和麦田等等的介绍,我也发了封申请,今天收到Baidu的回复,下载,安装,加了个好友,试试这个传说中可以和QQ对抗的IM到底是啥样子。

    \n

    1、界面不算简洁,比QQ有余,比Gtalk不足

    \n

    都说Hi的界面清爽,偶看了下,比起QQ或者MSN确实干净了不少,QQ的花里胡哨最让我受不了,用了一段时间TM后,还是觉得不爽,最后就不用QQ了;MSN的界面上的广告太嚣张,偶尔还会弹出来,哎,也不喜欢。Gtalk的节目最简洁,简洁到我一使用就喜欢上了。Hi的界面,有点MSN的风格,但是暂时没发现广告,不晓得还能干净多久。

    \n

    2、功能实用,但有不足

    \n

    IM作为最实用的工具(中国是这样的),有些功能是必须的,即时消息,文件传输这两个我觉得是必须的;语音和视频可有可无,如果能支持SMS就更好了,呵呵。Hi基本上具备了这些功能(SMS的没有)。但是我在使用过程发现,文件传输比较不正常,开始想试试传输速度,无奈的900K的东西,半天没反应,又自动断了,还提示双方“对方取消”,引起不少误解;后来试了一个小的图片,还是不行。看来这里有BUG..

    \n

    3、自身功能还有待加强

    \n

    我修改设定了自己的图片,无奈的是报告错误而无法完成,这应该也有Bug。

    \n

    其他的没兴趣试了,此次的Baidu的Hi体验,非常一般。

    ", "created_at"=>2008-04-02 06:37:00 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    向来喜欢体验些新东西,虽然GoogleTalk已经让我觉得非常满意,虽然在linux上无法使用Hi,虽然我对Baidu并不十分的喜欢,但是看到订阅的一些RSS里面屡屡出现Baidu的Hi的身影的时候,我还在会看看他到底有啥不同,有啥奇特的?
    \n看到白鸽和麦田等等的介绍,我也发了封申请,今天收到Baidu的回复,下载,安装,加了个好友,试试这个传说中可以和QQ对抗的IM到底是啥样子。
    \n1、界面不算简洁,比QQ有余,比Gtalk不足
    \n都说Hi的界面清爽,偶看了下,比起QQ或者MSN确实干净了不少,QQ的花里胡哨最让我受不了,用了一段时间TM后,还是觉得不爽,最后就不用QQ了;MSN的界面上的广告太嚣张,偶尔还会弹出来,哎,也不喜欢。Gtalk的节目最简洁,简洁到我一使用就喜欢上了。Hi的界面,有点MSN的风格,但是暂时没发现广告,不晓得还能干净多久。
    \n2、功能实用,但有不足
    \nIM作为最实用的工具(中国是这样的),有些功能是必须的,即时消息,文件传输这两个我觉得是必须的;语音和视频可有可无,如果能支持SMS就更好了,呵呵。Hi基本上具备了这些功能(SMS的没有)。但是我在使用过程发现,文件传输比较不正常,开始想试试传输速度,无奈的900K的东西,半天没反应,又自动断了,还提示双方“对方取消”,引起不少误解;后来试了一个小的图片,还是不行。看来这里有BUG..
    \n3、自身功能还有待加强
    \n我修改设定了自己的图片,无奈的是报告错误而无法完成,这应该也有Bug。
    \n其他的没兴趣试了,此次的Baidu的Hi体验,非常一般。

    \n", "_id"=>779}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Mongrel之cluster::restart vs. stop/start的区别", "body"=>"

    最近终于用上了我一直比较推荐的Rails部署方式(Nginx+Mongrel集群),感觉相当的不错,关于这方面的技巧和配置,以后有时间再说,今天主要说说Mongrel集群的时候,其start./stoprestart有啥区别。\n

    \n
    XML/HTML代码
    \n
      \n
    1. mongrel_rails cluster::start #启动  
    2. \n
    3. mongrel_rails cluster::restart #重启  
    4. \n
    5. mongrel_rails cluster::stop #停止   
    6. \n
    \n
    \n

    \n

    如上三条命令为启动,停止和重启的命令,找我们的理解,重启应该是和stop/start一样的效果,其实不然,主要区别就是:

    \n

    1、stop/start模式就是先stop掉,再启动,他会等到线程结束后stop,启动时会再次读取配置文件。

    \n

    2、restart模式和这个类似,但是其不会重新加载配置文件,也就是说你如果修改了配置文件,restart是不起作用的。

    \n

    以上是我的理解,有不对的地方,还望指出,谢谢~

    \n

    参考文章:

    \n

    1.http://rubyforge.org/pipermail/mongrel-users/2006-June/000438.html

    \n

    2.http://linux.ccidnet.com/art/302/20080327/1403439_1.html

    ", "created_at"=>2008-04-07 06:14:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近终于用上了我一直比较推荐的Rails部署方式(Nginx+Mongrel集群),感觉相当的不错,关于这方面的技巧和配置,以后有时间再说,今天主要说说Mongrel集群的时候,其start./stop和restart有啥区别。
    \n
    \nXML/HTML代码
    \n
    \n mongrel_rails cluster::start #启动  
    \n mongrel_rails cluster::restart #重启  
    \n mongrel_rails cluster::stop #停止   
    \n
    \n
    \n
    \n如上三条命令为启动,停止和重启的命令,找我们的理解,重启应该是和stop/start一样的效果,其实不然,主要区别就是:
    \n1、stop/start模式就是先stop掉,再启动,他会等到线程结束后stop,启动时会再次读取配置文件。
    \n2、restart模式和这个类似,但是其不会重新加载配置文件,也就是说你如果修改了配置文件,restart是不起作用的。
    \n以上是我的理解,有不对的地方,还望指出,谢谢~
    \n参考文章:
    \n1.http://rubyforge.org/pipermail/mongrel-users/2006-June/000438.html
    \n2.http://linux.ccidnet.com/art/302/20080327/1403439_1.html

    \n", "_id"=>780}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中捕获TimeOut异常及其处理", "body"=>"

    把应用迁移到新的服务器上以后,发现经常有”超时“的错误信息,如/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error),恩,应该是网络不稳定或者是服务器响应太慢的结果,需要捕获下这个异常并做些处理,记录如下:

    \n

    需要注意的是,Timeout::Error不是StandardError的子类, 而是继承至 Interrupt class,所以捕获的时候,需要格外注意,演示如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'net/pop3'  
    2. \n
    3. begin  
    4. \n
    5.   Net::POP3.auth_only(@server@port@username@password)  
    6. \n
    7. rescue => e  
    8. \n
    9.   write_error_to_logfile(e)  
    10. \n
    11.   do_something_sensible  
    12. \n
    13. end  
    14. \n
    \n
    \n看上面的这段代码,当POP3服务器不能及时响应的时候,所触发的异常并不能被下面捕获到,原因就是上面说的,再看正确的处理代码:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'net/pop3'  
    2. \n
    3. begin  
    4. \n
    5.   Net::POP3.auth_only(@server@port@username@password)  
    6. \n
    7. rescue => e  
    8. \n
    9.   write_error_to_logfile(e)  
    10. \n
    11.   do_something_sensible  
    12. \n
    13. rescue Timeout::Error => e  
    14. \n
    15.   write_error_to_logfile(e)  
    16. \n
    17.   do_something_sensible_for_timeout  
    18. \n
    19. end  
    20. \n
    \n
    \n这段代码可以正常工作,并按照我们的意愿来处理了。

    \n

     如果您知道对方的服务器会比较慢的响应,或者你知道网络状态不好,你可以单独设置这个TimeOut的时间,代码如下:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'timeout'  
    2. \n
    3.   
    4. \n
    5. ...  
    6. \n
    7. ...  
    8. \n
    9. begin  
    10. \n
    11.   timeout(60) do  
    12. \n
    13.      resp, body=3Dh.get('/index.html')  
    14. \n
    15.      puts body  
    16. \n
    17.   end  
    18. \n
    19. rescue TimeoutError  
    20. \n
    21.        puts "Timed Out"  
    22. \n
    23. end 
      \n
    24. \n
    \n
    \n

    \n

    或者这样:(来源:http://textsnippets.com/posts/show/868)\n

    \n
    Ruby代码
    \n
      \n
    1. http = Net::HTTP.new(url.host, url.port)  
    2. \n
    3. http.read_timeout=time_out  
    4. \n
    \n
    \n

    \n

    参考资料:

    \n

    1.'rbuf_fill': execution expired (Timeout::Error): http://lindsaar.net/2007/12/9/rbuf_filltimeout-error

    \n

    2.How to catch Timeout::ERROR ? : http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170394

    \n

    3.Ruby's Thread#raise, Thread#kill, timeout.rb, and net/protocol.rb libraries are broken: http://headius.blogspot.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html

    \n

    4.How to change the Timeout::Error threshold for open_uri : http://www.ruby-forum.com/topic/146676

    \n

    5.http://griffin.oobleyboo.com/archive/ruby-net-http-exceptions/

    ", "created_at"=>2008-04-07 07:17:41 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    把应用迁移到新的服务器上以后,发现经常有”超时“的错误信息,如/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error),恩,应该是网络不稳定或者是服务器响应太慢的结果,需要捕获下这个异常并做些处理,记录如下:
    \n需要注意的是,Timeout::Error不是StandardError的子类, 而是继承至 Interrupt class,所以捕获的时候,需要格外注意,演示如下:
    \n
    \n
    \nRuby代码
    \n
    \n require 'net/pop3'  
    \n begin  
    \n   Net::POP3.auth_only(@server, @port, @username, @password)  
    \n rescue => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible  
    \n end  
    \n
    \n
    \n看上面的这段代码,当POP3服务器不能及时响应的时候,所触发的异常并不能被下面捕获到,原因就是上面说的,再看正确的处理代码:
    \n
    \n
    \nRuby代码
    \n
    \n require 'net/pop3'  
    \n begin  
    \n   Net::POP3.auth_only(@server, @port, @username, @password)  
    \n rescue => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible  
    \n rescue Timeout::Error => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible_for_timeout  
    \n end  
    \n
    \n
    \n这段代码可以正常工作,并按照我们的意愿来处理了。
    \n 如果您知道对方的服务器会比较慢的响应,或者你知道网络状态不好,你可以单独设置这个TimeOut的时间,代码如下:
    \n
    \nRuby代码
    \n
    \n require 'timeout'  
    \n   
    \n ...  
    \n ...  
    \n begin  
    \n   timeout(60) do  
    \n      resp, body=3Dh.get('/index.html')  
    \n      puts body  
    \n   end  
    \n rescue TimeoutError  
    \n        puts "Timed Out"  
    \n end 
    \n
    \n
    \n
    \n
    \n或者这样:(来源:http://textsnippets.com/posts/show/868
    \n
    \nRuby代码
    \n
    \n http = Net::HTTP.new(url.host, url.port)  
    \n http.read_timeout=time_out  
    \n
    \n
    \n
    \n参考资料:
    \n1.'rbuf_fill': execution expired (Timeout::Error): http://lindsaar.net/2007/12/9/rbuf_filltimeout-error
    \n2.How to catch Timeout::ERROR ? : http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170394
    \n3.Ruby's Thread#raise, Thread#kill, timeout.rb, and net/protocol.rb libraries are broken: http://headius.blogspot.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html
    \n4.How to change the Timeout::Error threshold for open_uri : http://www.ruby-forum.com/topic/146676
    \n5.http://griffin.oobleyboo.com/archive/ruby-net-http-exceptions/

    \n", "_id"=>781}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ubuntu7.10上装rar/unrar", "body"=>"

    早在我开始使用Ubuntu的时候(7.04)就安装了linux下的rar,这几天在一台新的服务器上上安装的时候,竟然花了这么大的牛劲,呵呵。

    \n

     先看下版本,如下:

    \n

    1sters@IceskYsl:~/sources$ uname -a
    \nLinux taojer 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux

    \n

    然后使用“sudo apt-get install rar”,却发现出错,如下:

    \n
    \n

    1sters@IceskYsl:~/sources$ sudo apt-get install rar
    \nPassword:
    \nReading package lists... Done
    \nBuilding dependency tree... Done
    \nPackage rar is not available, but is referred to by another package.
    \nThis may mean that the package is missing, has been obsoleted, or
    \nis only available from another source
    \nE: Package rar has no installation candidate

    \n
    \n

    找不到相应的包,哦,因该是源的问题,查了下Google,很多人说是源的问题,于是乎,胡乱加了一大堆的源,试了下,貌似不好使,再查,找到相应的源,如下:

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. deb http://archive.ubuntu.com/ubuntu dapper universe multiverse  
    2. \n
    3. deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse  
    4. \n
    \n
    \n再使用:\n
    \n
    Shell代码
    \n
      \n
    1. sudo aptitude upgrade  
    2. \n
    3. sudo aptitude install rar unrar  
    4. \n
    \n
    \n

    \n

    然后就差不多OK了。

    \n

    参考资料:

    \n

    1、http://ubuntuforums.org/showthread.php?t=571440

    ", "created_at"=>2008-04-08 05:34:05 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    早在我开始使用Ubuntu的时候(7.04)就安装了linux下的rar,这几天在一台新的服务器上上安装的时候,竟然花了这么大的牛劲,呵呵。
    \n 先看下版本,如下:
    \n1sters@IceskYsl:~/sources$ uname -a
    \nLinux taojer 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux
    \n然后使用“sudo apt-get install rar”,却发现出错,如下:
    \n
    \n1sters@IceskYsl:~/sources$ sudo apt-get install rar
    \nPassword:
    \nReading package lists... Done
    \nBuilding dependency tree... Done
    \nPackage rar is not available, but is referred to by another package.
    \nThis may mean that the package is missing, has been obsoleted, or
    \nis only available from another source
    \nE: Package rar has no installation candidate
    \n
    \n找不到相应的包,哦,因该是源的问题,查了下Google,很多人说是源的问题,于是乎,胡乱加了一大堆的源,试了下,貌似不好使,再查,找到相应的源,如下:
    \n
    \n
    \nShell代码
    \n
    \n deb http://archive.ubuntu.com/ubuntu dapper universe multiverse;  
    \n deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse;  
    \n
    \n
    \n再使用:
    \n
    \nShell代码
    \n
    \n sudo aptitude upgrade  
    \n sudo aptitude install rar unrar  
    \n
    \n
    \n
    \n然后就差不多OK了。
    \n参考资料:
    \n1、http://ubuntuforums.org/showthread.php?t=571440

    \n", "_id"=>782}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"再次遭遇乱码侵袭~", "body"=>"

    经历了Java/Rails的乱码洗礼,经过Zip/RAR/7zip等等的搔扰,经过不懈的恶补,偶以为面对乱码问题可以应对自如了,然而不幸的是,这次又遇到了,下面看过程。

    \n

    问题现象:

    \n

    1、在Rails中,上传本地的文件到服务器,服务器接收到以后,保存到服务器并记录其所在的路径,然后使用Rails中的 send_file来实现下载功能。我在本地开发环境上一切正常,但是在服务器上发生“找不到文件”的错误,SSH连进去看了下,原来保存在硬盘上时,中文文件名出现乱码,类似“2008_03_25_07_54_27_娣樺疂瓒呯骇鐢ㄦ埛鎼滅储寮曟搸.rar”这样的。

    \n

    2、在Rails中使用Ruby的File.new()、File.open()函数创建的文件,在硬盘上显示的中文名也是乱码。(这个人和我发现的问题类似:http://www.javaeye.com/topic/66371)

    \n

    问题分析及其定位:

    \n

    经过查找和分析,偶认为这与系统的字符集设置有关,因为在我本地开发机器上是可以正常显示和查看的,但是在服务器上就不可以,着重了解字符集的设置。

    \n

    分析过程:

    \n

    1、先看看系统

    \n

    1sters@IceskYsl:~$ uname -a
    \nLinux 1sters 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux

    \n

    恩,是linux的系统。

    \n

    2、再看看目前的字符集

    \n

    1sters@IceskYsl:~$ locale
    \nLANG=
    \nLC_CTYPE="POSIX"
    \nLC_NUMERIC="POSIX"
    \nLC_TIME="POSIX"
    \nLC_COLLATE="POSIX"
    \nLC_MONETARY="POSIX"
    \nLC_MESSAGES="POSIX"
    \nLC_PAPER="POSIX"
    \nLC_NAME="POSIX"
    \nLC_ADDRESS="POSIX"
    \nLC_TELEPHONE="POSIX"
    \nLC_MEASUREMENT="POSIX"
    \nLC_IDENTIFICATION="POSIX"
    \nLC_ALL=

    \n

    这是默认的POSIX。

    \n

    3、查看下系统支持的字符集

    \n

    locale -a

    \n

    修改方法:

    \n

    在/etc/bashrc中加入
    \nexport LC_ALL="zh_CN.utf8"
    \nexport LANG="zh_CN.utf8"
    \n系统默认的locale变成了zh_CN.utf8

    \n

    参考资料:

    \n

    1、如何更改普通用户的locale??http://linux.chinaunix.net/bbs/viewthread.php?tid=715236
    \n2、更改默认locale http://blog.chinaunix.net/u/22117/showart_257343.html
    \n3、关于locale的设定 http://blog.csdn.net/whoopee/archive/2006/09/28/1299891.aspx

    ", "created_at"=>2008-04-08 05:57:32 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    经历了Java/Rails的乱码洗礼,经过Zip/RAR/7zip等等的搔扰,经过不懈的恶补,偶以为面对乱码问题可以应对自如了,然而不幸的是,这次又遇到了,下面看过程。
    \n问题现象:
    \n1、在Rails中,上传本地的文件到服务器,服务器接收到以后,保存到服务器并记录其所在的路径,然后使用Rails中的 send_file来实现下载功能。我在本地开发环境上一切正常,但是在服务器上发生“找不到文件”的错误,SSH连进去看了下,原来保存在硬盘上时,中文文件名出现乱码,类似“2008_03_25_07_54_27_娣樺疂瓒呯骇鐢ㄦ埛鎼滅储寮曟搸.rar”这样的。
    \n2、在Rails中使用Ruby的File.new()、File.open()函数创建的文件,在硬盘上显示的中文名也是乱码。(这个人和我发现的问题类似:http://www.javaeye.com/topic/66371
    \n问题分析及其定位:
    \n经过查找和分析,偶认为这与系统的字符集设置有关,因为在我本地开发机器上是可以正常显示和查看的,但是在服务器上就不可以,着重了解字符集的设置。
    \n分析过程:
    \n1、先看看系统
    \n1sters@IceskYsl:~$ uname -a
    \nLinux 1sters 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux
    \n恩,是linux的系统。
    \n2、再看看目前的字符集
    \n1sters@IceskYsl:~$ locale
    \nLANG=
    \nLC_CTYPE="POSIX"
    \nLC_NUMERIC="POSIX"
    \nLC_TIME="POSIX"
    \nLC_COLLATE="POSIX"
    \nLC_MONETARY="POSIX"
    \nLC_MESSAGES="POSIX"
    \nLC_PAPER="POSIX"
    \nLC_NAME="POSIX"
    \nLC_ADDRESS="POSIX"
    \nLC_TELEPHONE="POSIX"
    \nLC_MEASUREMENT="POSIX"
    \nLC_IDENTIFICATION="POSIX"
    \nLC_ALL=
    \n这是默认的POSIX。
    \n3、查看下系统支持的字符集
    \nlocale -a
    \n修改方法:
    \n在/etc/bashrc中加入
    \nexport LC_ALL="zh_CN.utf8"
    \nexport LANG="zh_CN.utf8"
    \n系统默认的locale变成了zh_CN.utf8
    \n参考资料:
    \n1、如何更改普通用户的locale??http://linux.chinaunix.net/bbs/viewthread.php?tid=715236
    \n2、更改默认locale http://blog.chinaunix.net/u/22117/showart_257343.html
    \n3、关于locale的设定 http://blog.csdn.net/whoopee/archive/2006/09/28/1299891.aspx

    \n", "_id"=>783}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中调用系统的shell命令的异常", "body"=>"

    最近有点蹊跷,老是遇到一些莫名其妙的问题,呵呵,折腾吧.今天要说的问题是,在ruby中调用系统(*UNIX)中的shell命令来做些事情,本来没啥难度的事情,我却遇到了一个费解的问题.

    \n

    问题描述:

    \n

    由于需要给用户打包下载一系列的文件(图片),为了方便,我在ruby中调用系统的rar来打包需要下载的资源,然后再send_file下载下去,但是这里却遇到了奇怪的问题,调用系统命令的那句出现问题.

    \n

    关于在RUby中调用系统的shell,大家可以参考如下文章( 6 Ways to Run Shell Commands in Ruby: http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886),我就不多废话了.直接看我的相关代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. local_dir_name=1207667932_2  
    2. \n
    3. logger.info("rar a \#{local_dir_name} \#{local_dir_name}")  
    4. \n
    5. oo= %x{rar a \#{local_dir_name} \#{local_dir_name}}  
    6. \n
    7. logger.info("oo=\#{oo}")  
    8. \n
    \n
    \n上面的那个变量是按照时间取的唯一标识.这里使用的 %x{}(`)来获取执行的结果,以方便查看及问题定位,在本地机器(Ubuntu 7.10)上,一切正常,输出如下:\n
    \n
    本地输出日志
    \n
      \n
    1. rar a 1207667932_2 1207667932_2  
    2. \n
    3. oo=  
    4. \n
    5. RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    6. \n
    7. Shareware version Type RAR -? for help  
    8. \n
    9.   
    10. \n
    11. Evaluation copy. Please register.  
    12. \n
    13.   
    14. \n
    15. Creating archive 1207667932_2.rar  
    16. \n
    17.   
    18. \n
    19. Adding 1207667932_2/datas.csv OK  
    20. \n
    21. Adding 1207667932_2/images OK  
    22. \n
    23. Adding 1207667932_2 OK  
    24. \n
    25. Done  
    26. \n
    \n
    \n

    \n

    但是在服务器上 (这里使用的是DH的PS服务器),其不能正常运行,如下:

    \n

    \n

    \n
    服务器输出日志
    \n
      \n
    1. rar a 1207666290_2 1207666290_2  
    2. \n
    3. oo=  
    4. \n
    5. Program aborted  
    6. \n
    \n
    \n可以看到,如上发生了异常,但是原因无法得知.

    \n

    问题分析:

    \n

    奇怪的很,查了下环境,没啥不一样的呀,唯一发现不一样的是rar的版本不咋一致,DH上的rar版本比较老,分别如下:\n

    \n
    RAR的版本信息
    \n
      \n
    1. Localhost rar version is :  
    2. \n
    3. RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    4. \n
    5.   
    6. \n
    7. DH's rar version is :  
    8. \n
    9. [iceskysl]$ rar  
    10. \n
    11.   
    12. \n
    13. RAR 3.30 Copyright (c) 1993-2004 Eugene Roshal 22 Jan 2004  
    14. \n
    \n
    \n

    \n

    这难道会是原因,还真搞不清?难道DH上对进程啥的有特殊要求,还是其他的啥原因呢?有知道的朋友,请赐教,多谢了.

    \n

    参考文章:http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886

    ", "created_at"=>2008-04-08 15:55:53 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近有点蹊跷,老是遇到一些莫名其妙的问题,呵呵,折腾吧.今天要说的问题是,在ruby中调用系统(*UNIX)中的shell命令来做些事情,本来没啥难度的事情,我却遇到了一个费解的问题.
    \n问题描述:
    \n由于需要给用户打包下载一系列的文件(图片),为了方便,我在ruby中调用系统的rar来打包需要下载的资源,然后再send_file下载下去,但是这里却遇到了奇怪的问题,调用系统命令的那句出现问题.
    \n关于在RUby中调用系统的shell,大家可以参考如下文章( 6 Ways to Run Shell Commands in Ruby: http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886),我就不多废话了.直接看我的相关代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n local_dir_name=1207667932_2  
    \n logger.info("rar a \#{local_dir_name} \#{local_dir_name}")  
    \n oo= %x{rar a \#{local_dir_name} \#{local_dir_name}}  
    \n logger.info("oo=\#{oo}")  
    \n
    \n
    \n上面的那个变量是按照时间取的唯一标识.这里使用的 %x{}(`)来获取执行的结果,以方便查看及问题定位,在本地机器(Ubuntu 7.10)上,一切正常,输出如下:
    \n
    \n本地输出日志
    \n
    \n rar a 1207667932_2 1207667932_2  
    \n oo=  
    \n RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    \n Shareware version Type RAR -? for help  
    \n   
    \n Evaluation copy. Please register.  
    \n   
    \n Creating archive 1207667932_2.rar  
    \n   
    \n Adding 1207667932_2/datas.csv OK  
    \n Adding 1207667932_2/images OK  
    \n Adding 1207667932_2 OK  
    \n Done  
    \n
    \n
    \n
    \n但是在服务器上 (这里使用的是DH的PS服务器),其不能正常运行,如下:
    \n
    \n
    \n服务器输出日志
    \n
    \n rar a 1207666290_2 1207666290_2  
    \n oo=  
    \n Program aborted  
    \n
    \n
    \n可以看到,如上发生了异常,但是原因无法得知.
    \n问题分析:
    \n奇怪的很,查了下环境,没啥不一样的呀,唯一发现不一样的是rar的版本不咋一致,DH上的rar版本比较老,分别如下:
    \n
    \nRAR的版本信息
    \n
    \n Localhost rar version is :  
    \n RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    \n   
    \n DH's rar version is :  
    \n [iceskysl]$ rar  
    \n   
    \n RAR 3.30 Copyright (c) 1993-2004 Eugene Roshal 22 Jan 2004  
    \n
    \n
    \n
    \n这难道会是原因,还真搞不清?难道DH上对进程啥的有特殊要求,还是其他的啥原因呢?有知道的朋友,请赐教,多谢了.
    \n参考文章:http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886

    \n", "_id"=>784}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"设置/美化SecureCRT让其更加适合自己", "body"=>"

    时常还是要在另外一台电脑上使用windows,也只能使用putty或者SecureCRT,连接到服务器上,但是一直以来,都存在一些小问题,这里以SecureCRT为例把解决方法汇总下。

    \n

    1、中文显示乱码的问题

    \n

    该问题的现象是用SecureCRT连接到服务器上,比如tail应用日志的时候,其日志中的中文不能很好的显示(也就是乱码)。这个问题的根本原因是双方的编码方式不一致,因为一般的来说,服务器上的编码是UTF-8(我的服务器是这样的,或者被我设定为这样的)你可以在服务器上使用locale 查看,而SecureCRT的默认设置的字符编码是保持系统一致的,在中文windows上就是GBK或者其他编码;

    \n

    知道原因修改起来就比较简单了,分为两个部分:

    \n

    1)修改远程linux机器的配置
    \nvim /etc/sysconfig/i18n
    \n把LANG改成支持UTF-8的字符集
    \n如:
    \nLANG=”zh_CN.UTF-8″
    \n或者是
    \nLANG=”en_US.UTF-8″

    \n

    或者是修改指定用户的locale,编辑.bashrc文件,导入以上的编码即可。

    \n

    2)然后再改Secure CRT的设置
    \nOptions -> Session Options ->  Apperance -> Fonts -> Character(选项->会话选项->外观->字符编码->uft-8)
    \n
    \n退出,再重新登录。发现utf8的文件都能正确读了,utf8的文件名也能正确显示了。

    \n

    2、显示颜色

    \n

    显示颜色是个好习惯,一来直观明了,二来增加美感,对视力也有好处,在Secure CRT中设置显示颜色也比较简单,如下:
    \nOptions -> Session Options ->Terminal ->Emulation ->ANSI Color 选中就可以了。

    \n

    3、字体选择

    \n

    选择不同的字体,可以显示不同的效果,按照个人喜好,比如我自己就喜欢细一点的,清晰一点的字体,而这个字体在Secure CRT是可以设置的,其默认的是vt100,我个人比较喜欢“新宋体”的显示效果。(PS.很多人喜欢fixedsys 字体)。设置方法也很简单,如下:Options -> Session Options ->  Apperance -> Fonts 选择你需要的字体即可。

    ", "created_at"=>2008-04-09 01:31:33 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    时常还是要在另外一台电脑上使用windows,也只能使用putty或者SecureCRT,连接到服务器上,但是一直以来,都存在一些小问题,这里以SecureCRT为例把解决方法汇总下。
    \n1、中文显示乱码的问题
    \n该问题的现象是用SecureCRT连接到服务器上,比如tail应用日志的时候,其日志中的中文不能很好的显示(也就是乱码)。这个问题的根本原因是双方的编码方式不一致,因为一般的来说,服务器上的编码是UTF-8(我的服务器是这样的,或者被我设定为这样的)你可以在服务器上使用locale 查看,而SecureCRT的默认设置的字符编码是保持系统一致的,在中文windows上就是GBK或者其他编码;
    \n知道原因修改起来就比较简单了,分为两个部分:
    \n1)修改远程linux机器的配置
    \nvim /etc/sysconfig/i18n
    \n把LANG改成支持UTF-8的字符集
    \n如:
    \nLANG=”zh_CN.UTF-8″
    \n或者是
    \nLANG=”en_US.UTF-8″
    \n或者是修改指定用户的locale,编辑.bashrc文件,导入以上的编码即可。
    \n2)然后再改Secure CRT的设置
    \nOptions -> Session Options ->  Apperance -> Fonts -> Character(选项->会话选项->外观->字符编码->uft-8)
    \n
    \n退出,再重新登录。发现utf8的文件都能正确读了,utf8的文件名也能正确显示了。
    \n2、显示颜色
    \n显示颜色是个好习惯,一来直观明了,二来增加美感,对视力也有好处,在Secure CRT中设置显示颜色也比较简单,如下:
    \nOptions -> Session Options ->Terminal ->Emulation ->ANSI Color 选中就可以了。
    \n3、字体选择
    \n选择不同的字体,可以显示不同的效果,按照个人喜好,比如我自己就喜欢细一点的,清晰一点的字体,而这个字体在Secure CRT是可以设置的,其默认的是vt100,我个人比较喜欢“新宋体”的显示效果。(PS.很多人喜欢fixedsys 字体)。设置方法也很简单,如下:Options -> Session Options ->  Apperance -> Fonts 选择你需要的字体即可。

    \n", "_id"=>785}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"谈谈我使用过的几个国外服务器提供商", "body"=>"

    今天在月光的blog上看到其对DreamHost的抱怨,说起存在“过度销售”的现象,具体的可以看这里(http://www.williamlong.info/archives/1301.html)。

    \n

    这里说说我自己使用过的和了解到的国外服务器提供商的个人感受,纯属个人感受,请不要乱扣帽子。我选空间的用途主要是有2个,其一是运行一些我开发的开源的系统(比如1stlog,byeloo!等)的Demo,用来演示或者流量不大的应用;其二是为客户选择的跑商业化的RoR应用。所以我选择的服务区必须可以支持RubyOnRails应用。

    \n

    我使用过的国外提供商有BlueHostDreamHostSliceHost,我试用过的有亚马逊的EC2RaislHost,hostingrailsrailsplayground;我了解过的有mtRailsmeches,如下分别说说个人感受:

    \n

    1、BlueHost:这个是我最开始使用的国外的服务器,当时是从朋友那分了一些空间过来使用的,因为最开始的时候,Rails的服务器并不多,貌似只有BH和DH吧,呵呵,BH虽然支持Rails,但是限制相当多,我记得当时我写的“技能云”就放上面,那次被InfoQ报道了下后,那天流量稍微大些,就撑不住了。且速度一般般,映像不咋好,后来就撤离了。

    \n

    2、DreamHost:这个我使用的时间比较长,包括现在这个blog也是放在上面的,总的来说,马马虎虎,只能用来放个人blog和一些Demo等,不适合做商业站点使用;我开始使用的是Share模式的,但是后来开发的一个系统需要在后台跑一些定时JOB,其不支持,就只能开通其PS服务(这个速度相当慢,我等了20多天,来来回回的交互了好多次邮件,他们都说申请开通PS的客户太多,他们忙不过来,需要耐心的等,后来最后我怒了,说再不搞好,我就给我所有的客户选择SliceHost,这招见效,立马搞定,推荐大家使用,哈哈)。

    \n

    其Share模式的用户非常的多,月光说他的那个服务器上有380个shell用户和1600多的FTP,都是很正常的,主要是其销售模式,带来巨量的用户群,而其宣称的500G空间和5T的月流量,无限子域名,无限MYSQL库等等,都是扯淡的,为了吸引眼球和骗那些新入手的朋友,他们对CPU和内存的限制非常严格(这就是他们的高明之处),一旦超过内存和CPU,你必须升级到PS模式。

    \n

    而升级到PS模式(最低是150M内存/150MHZCPU/15美刀/月,以此随自己调解,以10MHZcpu/10M内存/1美刀/月的价格)以后,他会再三提醒您,如果mem不够,请增加自己的内存等。

    \n

    虽然PS号称是”私有服务器“,其效果和许诺的CPU和MEM都可以得到保证,但是也不是很稳定,毕竟用户群那么大,出问题的小概率事件也会很多的。

    \n

    值得称道的是,他们的技术支持还是不错的,我每次发邮件问,基本上很快就给我比较明确的答复;另外,DH的网速还是不错的(就我使用的那个服务器看);其操作面板比较容易操作,也非常强大。付款比较方便,支持信用卡,paypal以及google checkout等。

    \n

    总的来说:DH的share模式比较适合流量小的和一些demo演示之类的应用,不适合商业化的服务;PS模式稍微好点,但是要做好down机的准备,呵呵。

    \n

    3、SliceHost:这个应该是最便宜的VPN提供商了,其比较专业,以VPN的方式提供服务,可以选择的种类最低是256M独立内存,可以自己选择操作系统类型,自己装web服务器等,其技术文档比较多且可操作性比较好,但是其技术支持不是很到位,我只在chat里和他们沟通过,没发过邮件。

    \n

    SliceHost我上次使用的是256M的ubuntu7.10+nginx+mogrel集群跑的一个Rails应用,用apache的ab压力测了下,效果还不错,且没有出现down机等不稳定现象的出现,比较令人满意。

    \n

    但是有个问题,需要注意,我当时需要在程序里么net/http 取国内一些网站上的资源,速度很让人郁闷,有时候竟然只有900B/秒,相当慢。我曾和他们的技术支持沟通,他们给的解释是“SliceHsot在美国,而您要取得资源在中国,这个网路上的事情,我们也无能为力”,所以,如果您有类似需求,请千万注意。

    \n

    其他几个,类似EC2和Mt等,由于我没有实际长时间使用过,这里就不评价了,最近会逐一试试,以后再补充这个文章。

    \n

    如果您使用过其他的国外的服务器,还请分享一二;或者想更多的了解我使用过的这些服务器,请留言即可。

    ", "created_at"=>2008-04-11 05:52:22 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    今天在月光的blog上看到其对DreamHost的抱怨,说起存在“过度销售”的现象,具体的可以看这里(http://www.williamlong.info/archives/1301.html)。
    \n这里说说我自己使用过的和了解到的国外服务器提供商的个人感受,纯属个人感受,请不要乱扣帽子。我选空间的用途主要是有2个,其一是运行一些我开发的开源的系统(比如1stlog,byeloo!等)的Demo,用来演示或者流量不大的应用;其二是为客户选择的跑商业化的RoR应用。所以我选择的服务区必须可以支持RubyOnRails应用。
    \n我使用过的国外提供商有BlueHost,DreamHost和SliceHost,我试用过的有亚马逊的EC2,RaislHost,hostingrails和railsplayground;我了解过的有mt和Railsmeches,如下分别说说个人感受:
    \n1、BlueHost:这个是我最开始使用的国外的服务器,当时是从朋友那分了一些空间过来使用的,因为最开始的时候,Rails的服务器并不多,貌似只有BH和DH吧,呵呵,BH虽然支持Rails,但是限制相当多,我记得当时我写的“技能云”就放上面,那次被InfoQ报道了下后,那天流量稍微大些,就撑不住了。且速度一般般,映像不咋好,后来就撤离了。
    \n2、DreamHost:这个我使用的时间比较长,包括现在这个blog也是放在上面的,总的来说,马马虎虎,只能用来放个人blog和一些Demo等,不适合做商业站点使用;我开始使用的是Share模式的,但是后来开发的一个系统需要在后台跑一些定时JOB,其不支持,就只能开通其PS服务(这个速度相当慢,我等了20多天,来来回回的交互了好多次邮件,他们都说申请开通PS的客户太多,他们忙不过来,需要耐心的等,后来最后我怒了,说再不搞好,我就给我所有的客户选择SliceHost,这招见效,立马搞定,推荐大家使用,哈哈)。
    \n其Share模式的用户非常的多,月光说他的那个服务器上有380个shell用户和1600多的FTP,都是很正常的,主要是其销售模式,带来巨量的用户群,而其宣称的500G空间和5T的月流量,无限子域名,无限MYSQL库等等,都是扯淡的,为了吸引眼球和骗那些新入手的朋友,他们对CPU和内存的限制非常严格(这就是他们的高明之处),一旦超过内存和CPU,你必须升级到PS模式。
    \n而升级到PS模式(最低是150M内存/150MHZCPU/15美刀/月,以此随自己调解,以10MHZcpu/10M内存/1美刀/月的价格)以后,他会再三提醒您,如果mem不够,请增加自己的内存等。
    \n虽然PS号称是”私有服务器“,其效果和许诺的CPU和MEM都可以得到保证,但是也不是很稳定,毕竟用户群那么大,出问题的小概率事件也会很多的。
    \n值得称道的是,他们的技术支持还是不错的,我每次发邮件问,基本上很快就给我比较明确的答复;另外,DH的网速还是不错的(就我使用的那个服务器看);其操作面板比较容易操作,也非常强大。付款比较方便,支持信用卡,paypal以及google checkout等。
    \n总的来说:DH的share模式比较适合流量小的和一些demo演示之类的应用,不适合商业化的服务;PS模式稍微好点,但是要做好down机的准备,呵呵。
    \n3、SliceHost:这个应该是最便宜的VPN提供商了,其比较专业,以VPN的方式提供服务,可以选择的种类最低是256M独立内存,可以自己选择操作系统类型,自己装web服务器等,其技术文档比较多且可操作性比较好,但是其技术支持不是很到位,我只在chat里和他们沟通过,没发过邮件。
    \nSliceHost我上次使用的是256M的ubuntu7.10+nginx+mogrel集群跑的一个Rails应用,用apache的ab压力测了下,效果还不错,且没有出现down机等不稳定现象的出现,比较令人满意。
    \n但是有个问题,需要注意,我当时需要在程序里么net/http 取国内一些网站上的资源,速度很让人郁闷,有时候竟然只有900B/秒,相当慢。我曾和他们的技术支持沟通,他们给的解释是“SliceHsot在美国,而您要取得资源在中国,这个网路上的事情,我们也无能为力”,所以,如果您有类似需求,请千万注意。
    \n其他几个,类似EC2和Mt等,由于我没有实际长时间使用过,这里就不评价了,最近会逐一试试,以后再补充这个文章。
    \n如果您使用过其他的国外的服务器,还请分享一二;或者想更多的了解我使用过的这些服务器,请留言即可。

    \n", "_id"=>786}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BB入手,跨入智能时代", "body"=>"

    毕业那年为了找工作方便,花了1250大洋,跑了一天在汉口买中联想i816手机,用了两年后,换了另外一款联想的手机i908,把i816放到抽屉保存了起来,可惜刚买的i908没3个月,就在长沙步行街被小贼盗去,于是又重新拿出原来的i816凑合着使用,然后慢慢选择自己适合的手机,随着i816的老化,通话都受到影响,还为此影响了一次重要的事情后,于是下定决心,换!

    \n

    选了好久,不求花哨,但求个性,不求昂贵,只求实惠,在Nokia,联想等几个手机直接徘徊了很久,最后竟然选择了黑莓,也就是传说中的BB。

    \n

    偶受不了太大的个,所以选了个最苗条的,又有个很帅的“轨迹球”的8100系列,刷了最新的4.5系统,可以很好的支持中文,显示效果非常的榜。

    \n

    昨天玩了一天,基本上都熟悉了,还在不断的熟悉,把那么多的快捷键都记住了,会相当方便滴,满意。show个网上的照片,呵呵。

    \n

     

    \n

    \"\"

    \n


    \n关于使用体会啥的,有时间再说。

    \n

    偶也终于跨入PDA的时代,hoho。。。

    ", "created_at"=>2008-04-13 15:59:33 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    毕业那年为了找工作方便,花了1250大洋,跑了一天在汉口买中联想i816手机,用了两年后,换了另外一款联想的手机i908,把i816放到抽屉保存了起来,可惜刚买的i908没3个月,就在长沙步行街被小贼盗去,于是又重新拿出原来的i816凑合着使用,然后慢慢选择自己适合的手机,随着i816的老化,通话都受到影响,还为此影响了一次重要的事情后,于是下定决心,换!
    \n选了好久,不求花哨,但求个性,不求昂贵,只求实惠,在Nokia,联想等几个手机直接徘徊了很久,最后竟然选择了黑莓,也就是传说中的BB。
    \n偶受不了太大的个,所以选了个最苗条的,又有个很帅的“轨迹球”的8100系列,刷了最新的4.5系统,可以很好的支持中文,显示效果非常的榜。
    \n昨天玩了一天,基本上都熟悉了,还在不断的熟悉,把那么多的快捷键都记住了,会相当方便滴,满意。show个网上的照片,呵呵。
    \n 
    \n
    \n
    \n关于使用体会啥的,有时间再说。
    \n偶也终于跨入PDA的时代,hoho。。。

    \n", "_id"=>787}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby正则表达式小技巧", "body"=>"

    关于Ruby的正则表达式的基本的东西大家都很熟悉了,偶然会遇到一些没见过的小技巧,本篇用来收集和记录这些小技巧,如果你有其他小技巧,欢迎分享.

    \n

    pre_match和post_match这两个方法以前没使用过,他们分别是用来获取当前匹配结果的前一个和后一个匹配结果,看个例子既可以明白了. \n

    \n
    Ruby代码
    \n
      \n
    1. # #这个是分析URI的    
    2. \n
    3.  def self.split_uri( uri_str )    
    4. \n
    5.      m = %r<http://([^/]+)>.match(uri_str) or raise ArgumentError, "cannot parse URI: \#{uri_str}"    
    6. \n
    7.      host = m[1].strip    
    8. \n
    9.      path = m.post_match    
    10. \n
    11.      path = '/' if path.empty?    
    12. \n
    13.      puts host, path    
    14. \n
    15. # end  
    16. \n
    17.   
    18. \n
    19. url = http://www.1sters.com:80/this_is_a_string/and_this_is_too    
    20. \n
    21. puts(split_uri(url))  
    22. \n
    23. #  
    24. \n
    25. #Outout:  
    26. \n
    27. #www.1sters.com:80,this_is_a_string/and_this_is_too    
    28. \n
    \n
    \n如上这段代码很好的说明了post_match的作用.

    ", "created_at"=>2008-04-15 13:24:14 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    关于Ruby的正则表达式的基本的东西大家都很熟悉了,偶然会遇到一些没见过的小技巧,本篇用来收集和记录这些小技巧,如果你有其他小技巧,欢迎分享.
    \npre_match和post_match这两个方法以前没使用过,他们分别是用来获取当前匹配结果的前一个和后一个匹配结果,看个例子既可以明白了. 
    \n
    \nRuby代码
    \n
    \n # #这个是分析URI的    
    \n  def self.split_uri( uri_str )    
    \n      m = %r<http://([^/]+)>.match(uri_str) or raise ArgumentError, "cannot parse URI: \#{uri_str}"    
    \n      host = m[1].strip    
    \n      path = m.post_match    
    \n      path = '/' if path.empty?    
    \n      puts host, path    
    \n # end  
    \n   
    \n url = http://www.1sters.com:80/this_is_a_string/and_this_is_too    
    \n puts(split_uri(url))  
    \n #  
    \n #Outout:  
    \n #www.1sters.com:80,this_is_a_string/and_this_is_too    
    \n
    \n
    \n如上这段代码很好的说明了post_match的作用.

    \n", "_id"=>788}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,前途无量,充满乐趣", "body"=>"

    早在几天前,就在Gseek上看到关于GoogleAppEngine的介绍,可惜当时去晚了,没有申请到试用帐号,只大略的看了下,发现其实好东西,今天在infoQ上再次看到这个东西的就介绍,再跑过去看看,下载了SDK并看了下他的guider,和演示代码,发现其真的很有前途,是个很有诱惑力的东西。

    \n

    尽管Google说会支持其他很多环境,但是现在还只支持python,毫无疑问,Google内部对python的喜爱已经毋庸置疑的。当然,我期待着哪天其可以支持ruby(rails框架或者其他);或者我该抽点时间去学学python了,呵呵。
    \n看看他自己的说明:
    \nRun your web applications on Google's infrastructure.
    \nGoogle App Engine enables you to build web applications on the same scalable systems that power Google applications.
    \nNo assembly required.
    \nGoogle App Engine provides a fully-integrated application environment.
    \nIt's easy to scale.
    \nGoogle App Engine makes it easy to build scalable applications that grow from one user to millions of users without infrastructure headaches.
    \nIt's free to get started.
    \nEvery Google App Engine application can use up to 500MB of persistent storage and enough bandwidth and CPU for 5 million monthly page views.

    \n

    毫无疑问,如果能大规模的推广开,将会带来很大的web开发热浪,同时Google将在这个里面得到更多的东西,不仅仅限于卖这个服务的费用,还会给google自己的其他份额应用更好的支撑。

    \n

    同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。

    ", "created_at"=>2008-04-16 02:09:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    早在几天前,就在Gseek上看到关于GoogleAppEngine的介绍,可惜当时去晚了,没有申请到试用帐号,只大略的看了下,发现其实好东西,今天在infoQ上再次看到这个东西的就介绍,再跑过去看看,下载了SDK并看了下他的guider,和演示代码,发现其真的很有前途,是个很有诱惑力的东西。
    \n尽管Google说会支持其他很多环境,但是现在还只支持python,毫无疑问,Google内部对python的喜爱已经毋庸置疑的。当然,我期待着哪天其可以支持ruby(rails框架或者其他);或者我该抽点时间去学学python了,呵呵。
    \n看看他自己的说明:
    \nRun your web applications on Google's infrastructure.
    \nGoogle App Engine enables you to build web applications on the same scalable systems that power Google applications.
    \nNo assembly required.
    \nGoogle App Engine provides a fully-integrated application environment.
    \nIt's easy to scale.
    \nGoogle App Engine makes it easy to build scalable applications that grow from one user to millions of users without infrastructure headaches.
    \nIt's free to get started.
    \nEvery Google App Engine application can use up to 500MB of persistent storage and enough bandwidth and CPU for 5 million monthly page views.
    \n毫无疑问,如果能大规模的推广开,将会带来很大的web开发热浪,同时Google将在这个里面得到更多的东西,不仅仅限于卖这个服务的费用,还会给google自己的其他份额应用更好的支撑。
    \n同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。

    \n", "_id"=>789}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout已经长大,正式上线,试用手记~", "body"=>"

    前段时间我曾写过一篇介绍Scout插件编写规则的文章《Scout是个挺有趣的tools》,当时Scout尚未正式商用,今天收到Scout的邮件说,已经正式上线了。

    \n

    过去注册了一个free的帐号,在我的一个应用里面使用了下,感觉效果相当不错,将来肯定有大量的用户和开发者。

    \n

    Scout的模式相当好,对于Saas应用来说,这个模式相当不错,首先开发一个应用框架,Scout本身就是一个监控框架,然后制定相应的插件开发规则,让更多的人贡献智慧,而Scout本身作为一个数据存储中心,接收每个客户机上采集到的数据,入库保存,生成报表,并做适当的告警处理等。

    \n

    这个做法相当棒,他在用户注册的时候,会生成一个Client Key,然后您在安装Scout的时候,输入验证,如果通过,就认为是自己的客户。(至于客户的类型等等都是在服务器上保存的,客户端只需要这个key就OK了)。

    \n

    看了一眼价格,还真不便宜,Basc版本的都是 \t\t\t$14.00/mo,最高的是$119.00/mo,这样的价格,会带来不小的收益哦。

    \n

    另外,如果能集合SMS告警等,就不用SS每天的724监控了,呵呵。

    \n

    但是有一点需要注意的是:

    \n

    你在客户机上安装了Scout的gem后,其他插件并不需要再SSH上去安装,主要在Scout的UI界面上,选择你要的插件,简单的配置,即可安装,这么看来,其实可以让客户端系统安装任何插件了,如果有人非法利用,后果还是挺严重的,比后门还要NB呀~

    \n


    \n看下我测试的一个界面:

    \n

    \"\"

    ", "created_at"=>2008-04-16 03:30:51 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前段时间我曾写过一篇介绍Scout插件编写规则的文章《Scout是个挺有趣的tools》,当时Scout尚未正式商用,今天收到Scout的邮件说,已经正式上线了。
    \n过去注册了一个free的帐号,在我的一个应用里面使用了下,感觉效果相当不错,将来肯定有大量的用户和开发者。
    \nScout的模式相当好,对于Saas应用来说,这个模式相当不错,首先开发一个应用框架,Scout本身就是一个监控框架,然后制定相应的插件开发规则,让更多的人贡献智慧,而Scout本身作为一个数据存储中心,接收每个客户机上采集到的数据,入库保存,生成报表,并做适当的告警处理等。
    \n这个做法相当棒,他在用户注册的时候,会生成一个Client Key,然后您在安装Scout的时候,输入验证,如果通过,就认为是自己的客户。(至于客户的类型等等都是在服务器上保存的,客户端只需要这个key就OK了)。
    \n看了一眼价格,还真不便宜,Basc版本的都是 $14.00/mo,最高的是$119.00/mo,这样的价格,会带来不小的收益哦。
    \n另外,如果能集合SMS告警等,就不用SS每天的724监控了,呵呵。
    \n但是有一点需要注意的是:
    \n你在客户机上安装了Scout的gem后,其他插件并不需要再SSH上去安装,主要在Scout的UI界面上,选择你要的插件,简单的配置,即可安装,这么看来,其实可以让客户端系统安装任何插件了,如果有人非法利用,后果还是挺严重的,比后门还要NB呀~
    \n
    \n看下我测试的一个界面:

    \n", "_id"=>790}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"EC2支持Persistent Storage,日渐完善", "body"=>"

    "Last night Amazon announced persistent storage on EC2. Now you can create disks in S3 and attach them to EC2 instances. You want a terabyte of storage for your machine, just create it in S3 and mount it."

    \n

    很多人应该记得,EC2才宣布支持静态IP没几天,今天就看到消息称EC2支持Persistent Storage了,大家应该还记得,EC2发布以来,虽然带给大家无数的方便和快捷,但是其中两个诟病一直被人提及,那就是“不支持固定IP地址”和“没有”Persistent Storage“,这两个诟病使得:

    \n

    1、一旦你重启了EC2,你的IP地址就会变化,这就意味着你花了几个小时才解析生效的DNS又无法解析。

    \n

    2、一旦你的EC2重启,你必须及时的备份数据库和数据文件到S3上,以防止重启或者down机丢失数据。

    \n

    而这两个问题,到现在为止,已经全部完善了,EC2基本上很成熟了,剩下一个让国内开发者认为不爽的是,在国内,访问的速度实在不咋地。希望亚马逊有改善的计划,到时,就不用自己买服务器,托管啥的啦,甚至VPS都得靠边站,呵呵,就像我以前说的《RubyOnRails + S3 + EC2 = ? 》,依然好戏。

    \n

    或许是受到Google发布的Google App Engine的刺激,亚马逊才会在最近做这么大的动作,因为Google App Engine号称是亚马逊的EC2,S3,SQS以及SimpleDB的整体方案。对亚马逊有直接的竞争关系。

    \n

    前面一篇文章《Google App Engine,前途无量,充满乐趣 》就说了,这样的竞争,会带来更多的好处,好戏还会有,下一个改进会是什么呢?

    \n

    PS:这次公告中还提及一个新功能:
    \nAnother feature rolled out last night is snapshots. Need backup or the ability to rollback? Snapshot the instance and it’s on S3, ready to use. You can create new volumes from any particular snapshot.
    \n
    \nThese two features make Amazon’s grid computing platform a very nice place for startups to experiment, develop, and build out. All with little or no capital cost.

    ", "created_at"=>2008-04-16 04:41:26 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    "Last night Amazon announced persistent storage on EC2. Now you can create disks in S3 and attach them to EC2 instances. You want a terabyte of storage for your machine, just create it in S3 and mount it."
    \n很多人应该记得,EC2才宣布支持静态IP没几天,今天就看到消息称EC2支持Persistent Storage了,大家应该还记得,EC2发布以来,虽然带给大家无数的方便和快捷,但是其中两个诟病一直被人提及,那就是“不支持固定IP地址”和“没有”Persistent Storage“,这两个诟病使得:
    \n1、一旦你重启了EC2,你的IP地址就会变化,这就意味着你花了几个小时才解析生效的DNS又无法解析。
    \n2、一旦你的EC2重启,你必须及时的备份数据库和数据文件到S3上,以防止重启或者down机丢失数据。
    \n而这两个问题,到现在为止,已经全部完善了,EC2基本上很成熟了,剩下一个让国内开发者认为不爽的是,在国内,访问的速度实在不咋地。希望亚马逊有改善的计划,到时,就不用自己买服务器,托管啥的啦,甚至VPS都得靠边站,呵呵,就像我以前说的《RubyOnRails + S3 + EC2 = ? 》,依然好戏。
    \n或许是受到Google发布的Google App Engine的刺激,亚马逊才会在最近做这么大的动作,因为Google App Engine号称是亚马逊的EC2,S3,SQS以及SimpleDB的整体方案。对亚马逊有直接的竞争关系。
    \n前面一篇文章《Google App Engine,前途无量,充满乐趣 》就说了,这样的竞争,会带来更多的好处,好戏还会有,下一个改进会是什么呢?
    \nPS:这次公告中还提及一个新功能:
    \nAnother feature rolled out last night is snapshots. Need backup or the ability to rollback? Snapshot the instance and it’s on S3, ready to use. You can create new volumes from any particular snapshot.
    \n
    \nThese two features make Amazon’s grid computing platform a very nice place for startups to experiment, develop, and build out. All with little or no capital cost.

    \n", "_id"=>791}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"服务器最近有些异常", "body"=>"

    也许大家发现了,我的Blog这几天有些异样,经常出现500错误,开始我并不晓得是咋回事,后来看了下内存才发现,是内存不够了.

    \n

    这个Blog是放在DH的PS上的,虽然号称PS,但是感觉还不如sharemode的时候稳定,无语,DH的一个经的催我增加内存.FT...

    \n

    我基本上天天在线,如果你发现本站不能访问了,请在GoogleTalk上告诉我,我重启下PS服务器..正在和DH的交涉,应该很快就有结果.

    \n

     

    ", "created_at"=>2008-04-20 16:30:27 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    也许大家发现了,我的Blog这几天有些异样,经常出现500错误,开始我并不晓得是咋回事,后来看了下内存才发现,是内存不够了.
    \n这个Blog是放在DH的PS上的,虽然号称PS,但是感觉还不如sharemode的时候稳定,无语,DH的一个经的催我增加内存.FT...
    \n我基本上天天在线,如果你发现本站不能访问了,请在GoogleTalk上告诉我,我重启下PS服务器..正在和DH的交涉,应该很快就有结果.
    \n 

    \n", "_id"=>792}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog归来,人员征集中。", "body"=>"

    花了一个周末,把1stlog的代码整理了下,由于当时开发的时候Rails还是1.2的版本,里面用了一些方法和措施,在Rails2版本上市不支持的。加上当时学习Rails不久,写的代码也有点XXX。
    \n
    \n本次修改的主要有:
    \n1、增加对Rails2版本的支持;
    \n2、增加配置文件的缓存,提高性能;
    \n3、增加多模板支持;
    \n4、使用一套全新的后台管理界面。
    \n
    \n以上四者是主要的工作,其他都是小细节的修复,基本工作已经完成,马上即可发布版本,敬请关注,谢谢。
    \n(PS:还没有修改完,目前搭建了一套空壳子,有兴趣的请在这里看 :http://1stlog.1sters.com
    \n
    \n需要如下人员参与:
    \n1、文档编写者 --负责编写(在原来的基础上修改和完善)插件开发手册;使用手册、安装部署文档以及模板设计手册;
    \n2、UI设计师 -- 负责按照模板设计手册设计有个性的模板并与大家分享;
    \n3、开发人员  --负责Bug修复和部分开发工作;
    \n4、QA人员  --负责收集和整理Bug和新需求;
    \n5、测试人员  -负责功能性测试、可用性测试等及其问题验证;
    \n
    \n1stlog是开源的项目,代码和设计思路等都贡献给每个人,所以以上工作都需要您有激情,有希望做些开源的事情,谢谢。
    \n
    \n如果您有兴趣,请跟贴或者给我发Email(iceskysl@gmail.com)报名并附带自己愿意担任的角色和自己擅长的地方,谢谢。

    ", "created_at"=>2008-04-21 02:25:57 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    花了一个周末,把1stlog的代码整理了下,由于当时开发的时候Rails还是1.2的版本,里面用了一些方法和措施,在Rails2版本上市不支持的。加上当时学习Rails不久,写的代码也有点XXX。
    \n
    \n本次修改的主要有:
    \n1、增加对Rails2版本的支持;
    \n2、增加配置文件的缓存,提高性能;
    \n3、增加多模板支持;
    \n4、使用一套全新的后台管理界面。
    \n
    \n以上四者是主要的工作,其他都是小细节的修复,基本工作已经完成,马上即可发布版本,敬请关注,谢谢。
    \n(PS:还没有修改完,目前搭建了一套空壳子,有兴趣的请在这里看 :http://1stlog.1sters.com
    \n
    \n需要如下人员参与:
    \n1、文档编写者 --负责编写(在原来的基础上修改和完善)插件开发手册;使用手册、安装部署文档以及模板设计手册;
    \n2、UI设计师 -- 负责按照模板设计手册设计有个性的模板并与大家分享;
    \n3、开发人员  --负责Bug修复和部分开发工作;
    \n4、QA人员  --负责收集和整理Bug和新需求;
    \n5、测试人员  -负责功能性测试、可用性测试等及其问题验证;
    \n
    \n1stlog是开源的项目,代码和设计思路等都贡献给每个人,所以以上工作都需要您有激情,有希望做些开源的事情,谢谢。
    \n
    \n如果您有兴趣,请跟贴或者给我发Email(iceskysl@gmail.com)报名并附带自己愿意担任的角色和自己擅长的地方,谢谢。

    \n", "_id"=>793}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails之Component探析,引出Cells。", "body"=>"

    由于打算将我的第一个开源项目1stlog重构和完善,看了下以前的实现方式,除了用到了很对rails2不支持的方法和插件外(正在着手修改),还用到了Rails中的component的。而这正是被很多railser们告诫要小心的地方,甚至有人说component是evil的,新版1stlog发布在即,我得好好了解下component为什么evil。

    \n

    一、为什么当时选择component

    \n

    选择component是根据当时的设计需求来的,1stlog设计的时候是作为一个只有基本blog功能的大框架,而其他的一些个性化功能,需要由其他开发人员或者爱好者来按照一定的规范开发和编写,当时认为,使用component时自简单有效的策略,您可以参考我当时编写”1stlog插件开发指南“。

    \n

    二、为什么说component是邪恶的

    \n

    有人说Rails中的component是邪恶的,千万不要使用,原因呢,还真不清楚,看到有人这么写:\n

    \n
    Using Components 
    \n
    \n \n
      \n
    1. Components don’t belong in Rails. Don’t use them. They weren’t an
      \n
    2. \n
    3. extraction. They weren’t well planned. When you want to use a
      \n
    4. \n
    5. component it is probably because you misunderstand them or
      \n
    6. \n
    7. really want a partial. Rethink what you’re doing.
      \n
    8. \n
    9. The rest of the Rails world has written off components for a
      \n
    10. \n
    11. reason and they’ll probably be deprecated by 2.0. Resist.  
    12. \n
    \n
    \n

    \n

    也有人拿typo中使用component导致响应很迟钝的数据说明,可以参考“Components may not be evil, but they sure can be slow”,再看看Rails的DHH咋说的呢?哦,他说”Why engines and components are not evil but distracting

    \n

    这么看来,component并不邪恶了,只是慢一点,有些小问题罢了。

    \n

    三、还用不用?

    \n

    竟然大家都持谨慎态度,那么我们还用不用呢?用!但是或许得换个方式用。此话怎么讲?因为有一个既可以实现component功能,又不evil的东西出现了,那就是Cells,何谓Cells?还是看他的自白好了:

    \n

    \"\"

    \n
    \n

    A rails plugin to push things towards component-oriented architecture. Controller logic and views are encapsulated in lightweight cells and can be rendered like render_component.

    \n
    \n

    哦,看来是个好东西,还想多了解点,看看这些文章吧,"Cells: Bringing Components Back Into Rails 3"或者中文简要版本”插件Cells:把模块化带入Rails 应用中,组件导向轻量级的开发“,还可以看看道喜的简介”Rails框架:组件理念是否重返Rails框架“,或者看看中文的一个简单那的例子”有人用过cell么?“,如果想更深入的了解,可以看看”Ruby Component Web Frameworks

    \n

    四、还有更好的?

    \n

    我是不知道了,您要是知道的话,还请告诉我。

    \n

    参考资料:

    \n

    1、http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails

    \n

    2、http://usurffx-gmail-com.javaeye.com/blog/176186

    \n

    3、https://groups.google.com/group/ruby-component-web-frameworks

    \n

    4、http://chinaonrails.com/topic/view/1318/1.html

    \n

    5、http://www.lycom.de/past/2008/2/14/component-2008-02-14/#comments

    \n

    6、http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow

    \n

    7、http://weblog.rubyonrails.org/2005/11/11/why-engines-and-components-are-not-evil-but-distracting/

    \n

    8、http://rubyforge.org/projects/cells/

    ", "created_at"=>2008-04-21 07:36:43 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    由于打算将我的第一个开源项目1stlog重构和完善,看了下以前的实现方式,除了用到了很对rails2不支持的方法和插件外(正在着手修改),还用到了Rails中的component的。而这正是被很多railser们告诫要小心的地方,甚至有人说component是evil的,新版1stlog发布在即,我得好好了解下component为什么evil。
    \n一、为什么当时选择component
    \n选择component是根据当时的设计需求来的,1stlog设计的时候是作为一个只有基本blog功能的大框架,而其他的一些个性化功能,需要由其他开发人员或者爱好者来按照一定的规范开发和编写,当时认为,使用component时自简单有效的策略,您可以参考我当时编写”1stlog插件开发指南“。
    \n二、为什么说component是邪恶的
    \n有人说Rails中的component是邪恶的,千万不要使用,原因呢,还真不清楚,看到有人这么写:
    \n
    \nUsing Components 
    \n
    \n
    \n
    \n Components don’t belong in Rails. Don’t use them. They weren’t an
    \n
    \n extraction. They weren’t well planned. When you want to use a
    \n
    \n component it is probably because you misunderstand them or
    \n
    \n really want a partial. Rethink what you’re doing.
    \n
    \n The rest of the Rails world has written off components for a
    \n
    \n reason and they’ll probably be deprecated by 2.0. Resist.  
    \n
    \n
    \n
    \n也有人拿typo中使用component导致响应很迟钝的数据说明,可以参考“Components may not be evil, but they sure can be slow”,再看看Rails的DHH咋说的呢?哦,他说”Why engines and components are not evil but distracting“
    \n这么看来,component并不邪恶了,只是慢一点,有些小问题罢了。
    \n三、还用不用?
    \n竟然大家都持谨慎态度,那么我们还用不用呢?用!但是或许得换个方式用。此话怎么讲?因为有一个既可以实现component功能,又不evil的东西出现了,那就是Cells,何谓Cells?还是看他的自白好了:
    \n
    \n
    \nA rails plugin to push things towards component-oriented architecture. Controller logic and views are encapsulated in lightweight cells and can be rendered like render_component.
    \n
    \n哦,看来是个好东西,还想多了解点,看看这些文章吧,"Cells: Bringing Components Back Into Rails 3"或者中文简要版本”插件Cells:把模块化带入Rails 应用中,组件导向轻量级的开发“,还可以看看道喜的简介”Rails框架:组件理念是否重返Rails框架“,或者看看中文的一个简单那的例子”有人用过cell么?“,如果想更深入的了解,可以看看”Ruby Component Web Frameworks“
    \n四、还有更好的?
    \n我是不知道了,您要是知道的话,还请告诉我。
    \n参考资料:
    \n1、http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails
    \n2、http://usurffx-gmail-com.javaeye.com/blog/176186
    \n3、https://groups.google.com/group/ruby-component-web-frameworks
    \n4、http://chinaonrails.com/topic/view/1318/1.html
    \n5、http://www.lycom.de/past/2008/2/14/component-2008-02-14/#comments
    \n6、http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow
    \n7、http://weblog.rubyonrails.org/2005/11/11/why-engines-and-components-are-not-evil-but-distracting/
    \n8、http://rubyforge.org/projects/cells/

    \n", "_id"=>794}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"TibetIsXiZang,Tell this to all over the world,Tibet就是西藏!", "body"=>"

    首先,我并不是一个专业的SEOer而只是个懂点安全对于互联网充满期待的程序员…并且在业务时间喜欢去Zac的“SEO每天一贴”和点石互动转转,喜欢观察观察网络风云的“互联网重度使用者”。

    \n

    我喜欢安静的写着代码,而不喜欢参与到关于政治方面的讨论和争辩,但我敢拍着胸脯说,我为我的祖国自豪。经历这一次浩浩荡荡的,仍然在继续的事情,我被很多人感动着。

    \n

    面对3.14发生下西藏的特殊事件,国外媒体的声音让我们首先是愤怒,接着是无奈,最后市打心底里看不起。就像一个朋友到CNN的时候,联系到前段时间CNN捏造了所谓中国政府资助一些”黑客“入侵了一些网站的’黑客门事件‘等,朋友说了这么一句话,“原来国外的媒体素质是这么低,这么多年,真是高看他们了”,无奈,瞧不起,我打心底里是这样的。

    \n

    西藏的事件和最近闹得沸沸扬扬的“圣火传递事件”,再加上CNN的那个素质低下的主持人和BBC的一些话语,巴黎的一些让人震惊的行为,一些政客们无耻的嘴脸,一些被人、媒体操纵了的民众无知的行为,言论;还有那披着宗教的外衣到处兴风作浪的可怜的小人,以及某些国家的领导人虚情假意的外交辞令,这都是丑陋的;

    \n

    相反,我被国外留学生,网络上的爱国人士,去游街宣传奥运的人,抵制家乐福,支持奥运,挂上”红心china“的上班族们,那些QQ群,社区,还有那些以比较极端的”技术手段“让其网站飘满五星红旗而最后被迫关闭的一小撮人,都是值得骄傲的。

    \n

    但是,这些是不够的,看到前些日子Zac说,最需要网络营销的是我们的国家,因为很多外国的民众是善良的,被其媒体愚弄的,zac说的一句话让我映像深刻:新加坡的一位朋友问‘北京有楼房么?’。这不是少数,而是现况,世界真的不了解我们。

    \n

    该怎么办?在互联网的今天,网络的力量是巨大的,当你在Google输入'Tibet'的时候,当你输入’xizang‘或者”西藏“的时候,你找到的都是什么网页,什么信息。你可以自己去试试看。

    \n

    做为国内知名的SEO聚集区的点石,SEOer们用自己的方式,来感动我们,第二届中文搜索引擎优化大赛“的关键字由”TibetIsXiZang“改为“tibet xizang”和’西藏‘做为最终的比赛关键字,用意十分清晰。

    \n

    我虽然不是SEOer,也不会刻意的去注册域名,做一个网站参与比赛,但我会使用现有的资源做些力所能及的事情,比如在Google开通了”TibetIsXiZang“的Group,还会有其他的动作。

    \n

    让不久后,还世界一个真实的西藏,让世界所有的人知道,Tibet IS XiZang...

    ", "created_at"=>2008-04-22 05:49:37 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    首先,我并不是一个专业的SEOer,而只是个懂点安全对于互联网充满期待的程序员…并且在业务时间喜欢去Zac的“SEO每天一贴”和点石互动转转,喜欢观察观察网络风云的“互联网重度使用者”。
    \n我喜欢安静的写着代码,而不喜欢参与到关于政治方面的讨论和争辩,但我敢拍着胸脯说,我为我的祖国自豪。经历这一次浩浩荡荡的,仍然在继续的事情,我被很多人感动着。
    \n面对3.14发生下西藏的特殊事件,国外媒体的声音让我们首先是愤怒,接着是无奈,最后市打心底里看不起。就像一个朋友到CNN的时候,联系到前段时间CNN捏造了所谓中国政府资助一些”黑客“入侵了一些网站的’黑客门事件‘等,朋友说了这么一句话,“原来国外的媒体素质是这么低,这么多年,真是高看他们了”,无奈,瞧不起,我打心底里是这样的。
    \n将西藏的事件和最近闹得沸沸扬扬的“圣火传递事件”,再加上CNN的那个素质低下的主持人和BBC的一些话语,巴黎的一些让人震惊的行为,一些政客们无耻的嘴脸,一些被人、媒体操纵了的民众无知的行为,言论;还有那披着宗教的外衣到处兴风作浪的可怜的小人,以及某些国家的领导人虚情假意的外交辞令,这都是丑陋的;
    \n相反,我被国外留学生,网络上的爱国人士,去游街宣传奥运的人,抵制家乐福,支持奥运,挂上”红心china“的上班族们,那些QQ群,社区,还有那些以比较极端的”技术手段“让其网站飘满五星红旗而最后被迫关闭的一小撮人,都是值得骄傲的。
    \n但是,这些是不够的,看到前些日子Zac说,最需要网络营销的是我们的国家,因为很多外国的民众是善良的,被其媒体愚弄的,zac说的一句话让我映像深刻:新加坡的一位朋友问‘北京有楼房么?’。这不是少数,而是现况,世界真的不了解我们。
    \n该怎么办?在互联网的今天,网络的力量是巨大的,当你在Google输入'Tibet'的时候,当你输入’xizang‘或者”西藏“的时候,你找到的都是什么网页,什么信息。你可以自己去试试看。
    \n做为国内知名的SEO聚集区的点石,SEOer们用自己的方式,来感动我们,”第二届中文搜索引擎优化大赛“的关键字由”TibetIsXiZang“改为“tibet xizang”和’西藏‘做为最终的比赛关键字,用意十分清晰。
    \n我虽然不是SEOer,也不会刻意的去注册域名,做一个网站参与比赛,但我会使用现有的资源做些力所能及的事情,比如在Google开通了”TibetIsXiZang“的Group,还会有其他的动作。
    \n让不久后,还世界一个真实的西藏,让世界所有的人知道,Tibet IS XiZang...

    \n", "_id"=>795}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Amazon SQS,分布式作业不再费心", "body"=>"

    开始写这个之前,我不得不佩服下Amazon,不用说别的,就其SimpleDB,S3,EC2这几个就足以让业界大为惊叹,这些都比较熟悉了,今天说的是另外一个类似的东西,Amazon Simple Queue Service(SQS)。

    \n

    看名字,大概就可以猜出大概的意思了,对,就是队列服务,SQS就是一个简单的队列服务,你可以创建一个队列,然后从不同的地方往里面东西,然后又可以在不同的地方不停的往外东西,想想看,这不就是分布式协作么。

    \n

    但是需要注意的是,往里面放的时候,消息必须是txet,也就是是说不能放Hash或者数组啥的,如果您有类似需求,请接着往后看,我将提供一个变通的方法。

    \n

    一、简介SQS

    \n

    Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available.

    \n

    二、如何使用

    \n

    Ruby的社区足够活跃,每个应用都能找到对应的Gem或者插件,这给了我们足够的方便,针对SQS,我推荐的两个gem,分别是:

    \n

    1、SQS Gem
    \n

    \n

    这个插件是Amazon SQS官方站点写的教程《Using Amazon S3, EC2, SQS, Lucene, and Ruby for Web Spidering》上使用的,足够的简单,但是其主页貌似访问不了了,只能通过Google Cach看看。

    \n

    使用非常方便,流程如下

    \n

    1)安装:gem install SQS

    \n

    2)测试:ruby test/all_tests.rb

    \n

    3)使用示例\n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'sqs'  
    4. \n
    5.   
    6. \n
    7. SQS.access_key_id = 'YOURACCESSKEYID'  
    8. \n
    9. SQS.secret_access_key = 'YOURSECRETACCESSKEY'  
    10. \n
    11.   
    12. \n
    13. q = SQS.create_queue 'myFantasticQ'  
    14. \n
    15. puts q.url  
    16. \n
    17.   
    18. \n
    19. SQS.each_queue do |q|  
    20. \n
    21.   puts q.name  
    22. \n
    23. end  
    24. \n
    25.   
    26. \n
    27. q = SQS.get_queue 'myFantasticQ'  
    28. \n
    29.   
    30. \n
    31. q.send_message 'This is a message!'  
    32. \n
    33.   
    34. \n
    35. m = q.receive_message  
    36. \n
    37. puts m.body  
    38. \n
    39. m.delete  
    40. \n
    41.   
    42. \n
    43. q.each_message do |m|  
    44. \n
    45.   # note that #each_message is an infinite loop!  
    46. \n
    47.   # you must either break out of it, or delete each message you receive  
    48. \n
    49.   m.delete  
    50. \n
    51. end  
    52. \n
    53.   
    54. \n
    55. q.approximate_number_of_messages  
    56. \n
    57. q.visibility_timeout  
    58. \n
    59. q.visibiltit_timeout = 3  
    60. \n
    61.   
    62. \n
    63. q.delete  
    64. \n
    \n
    \n其他文章,可以自己Google。

    \n

    2、RightScale gems

    \n

    RightScale gemsRightScale 从其产品里面提取出来的,这个现象很常见,就像Shopify 中提取的Active Merchant一样,从一个成熟的产品中提取出来一个gem,其可用性是相当高的。

    \n

    使用方法大同小异,不再赘述,如果感兴趣,请到上面的地址上自行查看。

    \n

    三、如何扩展

    \n

    前面我们说了,SQS中容纳的消息是text的,但是看其文档表述,是这样写的:

    \n
    \n

    New messages can be added to a queue at any time. The message body can contain up to 8 KB of text in any format.

    \n
    \n

    any time?啥意思?奇怪。

    \n

    我认为一种可行的办法是,把Hash转成ymal格式的(.to_yaml),然后放进去后;取出的时候,直接YAML.load(message.body),然后再还原即可了。

    \n

    看段代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'SQS'  
    2. \n
    3. class Tsqs  
    4. \n
    5. SQS.conf_file = 'sqs_conf.yml'  
    6. \n
    7. s = SQS.new  
    8. \n
    9. puts s.api_version  
    10. \n
    11. puts s.conf_file  
    12. \n
    13. puts s.url_for_query  
    14. \n
    15. iceskysl = s.get_queue('iceskysl_message')  
    16. \n
    17. books_to_update = { 'bookid'=>"1",'url'=>"url1",'queue'=>"queue1"}  
    18. \n
    19. iceskysl.send_message(books_to_update.to_yaml)  
    20. \n
    21.   
    22. \n
    23. iceskysl_messages = iceskysl.receive_messages  
    24. \n
    25. puts iceskysl_messages.size  
    26. \n
    27. iceskysl_messages.each do |message|  
    28. \n
    29.  params = YAML.load(message.body)  
    30. \n
    31.  puts "bookid=" + params[:bookid] + ",url=" + params[:url] +  ",queue=" + params[:queue]  
    32. \n
    33.   message.delete  
    34. \n
    35. end  
    36. \n
    37. end  
    38. \n
    \n
    \n看明白了么,没问题吧,呵呵。另外,这里还有一篇文章使用的是RightScale gems。

    \n

    OK,差不多介绍完了,有疑问或者有其他好的gem请告诉我,谢谢。

    \n

    参考文档:

    \n
      \n
    1. SQS API:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1148&categoryID=102
    2. \n
    3. SQS主页:http://www.amazon.com/Simple-Queue-Service-home-page/b/ref=sc_fe_l_2/102-6256901-8077705?ie=UTF8&node=13584001&no=3435361&me=A36L942TSJ2AJA
    4. \n
    \n

     

    ", "created_at"=>2008-04-23 02:03:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    开始写这个之前,我不得不佩服下Amazon,不用说别的,就其SimpleDB,S3,EC2这几个就足以让业界大为惊叹,这些都比较熟悉了,今天说的是另外一个类似的东西,Amazon Simple Queue Service(SQS)。
    \n看名字,大概就可以猜出大概的意思了,对,就是队列服务,SQS就是一个简单的队列服务,你可以创建一个队列,然后从不同的地方往里面放东西,然后又可以在不同的地方不停的往外取东西,想想看,这不就是分布式协作么。
    \n但是需要注意的是,往里面放的时候,消息必须是txet,也就是是说不能放Hash或者数组啥的,如果您有类似需求,请接着往后看,我将提供一个变通的方法。
    \n一、简介SQS
    \nAmazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available.
    \n二、如何使用
    \nRuby的社区足够活跃,每个应用都能找到对应的Gem或者插件,这给了我们足够的方便,针对SQS,我推荐的两个gem,分别是:
    \n1、SQS Gem
    \n
    \n这个插件是Amazon SQS官方站点写的教程《Using Amazon S3, EC2, SQS, Lucene, and Ruby for Web Spidering》上使用的,足够的简单,但是其主页貌似访问不了了,只能通过Google Cach看看。
    \n使用非常方便,流程如下
    \n1)安装:gem install SQS
    \n2)测试:ruby test/all_tests.rb
    \n3)使用示例
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'sqs'  
    \n   
    \n SQS.access_key_id = 'YOURACCESSKEYID'  
    \n SQS.secret_access_key = 'YOURSECRETACCESSKEY'  
    \n   
    \n q = SQS.create_queue 'myFantasticQ'  
    \n puts q.url  
    \n   
    \n SQS.each_queue do |q|  
    \n   puts q.name  
    \n end  
    \n   
    \n q = SQS.get_queue 'myFantasticQ'  
    \n   
    \n q.send_message 'This is a message!'  
    \n   
    \n m = q.receive_message  
    \n puts m.body  
    \n m.delete  
    \n   
    \n q.each_message do |m|  
    \n   # note that #each_message is an infinite loop!  
    \n   # you must either break out of it, or delete each message you receive  
    \n   m.delete  
    \n end  
    \n   
    \n q.approximate_number_of_messages  
    \n q.visibility_timeout  
    \n q.visibiltit_timeout = 3  
    \n   
    \n q.delete  
    \n
    \n
    \n其他文章,可以自己Google。
    \n2、RightScale gems
    \nRightScale gems是RightScale 从其产品里面提取出来的,这个现象很常见,就像Shopify 中提取的Active Merchant一样,从一个成熟的产品中提取出来一个gem,其可用性是相当高的。
    \n使用方法大同小异,不再赘述,如果感兴趣,请到上面的地址上自行查看。
    \n三、如何扩展
    \n前面我们说了,SQS中容纳的消息是text的,但是看其文档表述,是这样写的:
    \n
    \nNew messages can be added to a queue at any time. The message body can contain up to 8 KB of text in any format.
    \n
    \nany time?啥意思?奇怪。
    \n我认为一种可行的办法是,把Hash转成ymal格式的(.to_yaml),然后放进去后;取出的时候,直接YAML.load(message.body),然后再还原即可了。
    \n看段代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n require 'SQS'  
    \n class Tsqs  
    \n SQS.conf_file = 'sqs_conf.yml'  
    \n s = SQS.new  
    \n puts s.api_version  
    \n puts s.conf_file  
    \n puts s.url_for_query  
    \n iceskysl = s.get_queue('iceskysl_message')  
    \n books_to_update = { 'bookid'=>"1",'url'=>"url1",'queue'=>"queue1"}  
    \n iceskysl.send_message(books_to_update.to_yaml)  
    \n   
    \n iceskysl_messages = iceskysl.receive_messages  
    \n puts iceskysl_messages.size  
    \n iceskysl_messages.each do |message|  
    \n  params = YAML.load(message.body)  
    \n  puts "bookid=" + params[:bookid] + ",url=" + params[:url] +  ",queue=" + params[:queue]  
    \n   message.delete  
    \n end  
    \n end  
    \n
    \n
    \n看明白了么,没问题吧,呵呵。另外,这里还有一篇文章使用的是RightScale gems。
    \nOK,差不多介绍完了,有疑问或者有其他好的gem请告诉我,谢谢。
    \n参考文档:
    \n
    \n SQS API:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1148&categoryID=102;
    \n SQS主页:http://www.amazon.com/Simple-Queue-Service-home-page/b/ref=sc_fe_l_2/102-6256901-8077705?ie=UTF8&node=13584001&no=3435361&me=A36L942TSJ2AJA;
    \n
    \n 

    \n", "_id"=>796}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"终于等到Google Docs Offline了", "body"=>"

    早就在Gseek看到GoogleDocs可以离线的消息,但是我的帐户里面一直还没有发现,好歹我也算Dcos的重度使用者,咋一直没看到这个功能呢?

    \n

    今天猛然发现,OK了,我等到了,呵呵。

    \n

    Overview: What is Google Docs Offline?
    \n 
    \nGoogle Docs now allows you to view and edit your documents offline, without an internet connection. To do all of this, Google Docs uses Google Gears, an open source browser extension that adds offline functionality directly to the browser. Google Docs can be accessed offline by typing http://docs.google.com into your browser or by clicking on the desktop shortcut that is downloaded during the installation process.

    \n

    挺好的,可以彻底不用Word和OpenOffice咯。三者比较下,我还是喜欢GoogleDocs的这个简洁和方便,不过不得不说几句,上次的改变,把那结果H1 H2 H3几个放到下拉菜单,不是好的用户体验,每次都多点一下,囧~

    \n

    有了离线后,以后带着本本就不怕没网络咯,Good~

    ", "created_at"=>2008-04-23 06:40:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    早就在Gseek看到GoogleDocs可以离线的消息,但是我的帐户里面一直还没有发现,好歹我也算Dcos的重度使用者,咋一直没看到这个功能呢?
    \n今天猛然发现,OK了,我等到了,呵呵。
    \nOverview: What is Google Docs Offline?
    \n 
    \nGoogle Docs now allows you to view and edit your documents offline, without an internet connection. To do all of this, Google Docs uses Google Gears, an open source browser extension that adds offline functionality directly to the browser. Google Docs can be accessed offline by typing http://docs.google.com into your browser or by clicking on the desktop shortcut that is downloaded during the installation process.
    \n挺好的,可以彻底不用Word和OpenOffice咯。三者比较下,我还是喜欢GoogleDocs的这个简洁和方便,不过不得不说几句,上次的改变,把那结果H1 H2 H3几个放到下拉菜单,不是好的用户体验,每次都多点一下,囧~
    \n有了离线后,以后带着本本就不怕没网络咯,Good~

    \n", "_id"=>797}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lower Data Transfer Costs,AWS降价,欢喜吧.", "body"=>"

    晚上收到Amazon的AWS的邮件,说降价了,哈,真是好消息,前台在写<Google App Engine,前途无量,充满乐趣>的时候,还说到"同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。",不想到,这么快,Amazon就有动作了,真是好消息,直接看原文吧,总觉得用中文把E文再重复一遍挺浪费的,也比较别扭,总感觉有些外文不好使用中文表述出来,呵呵.

    \n

    =====================start===================
    \n

    \n

    Dear Amazon Web Services developers,\n

    We've often told you that one of our goals is to drive down costs continuously and to pass those savings on to you. We have been able to reduce our costs for data transfer, so we're pleased to announce that we're lowering our pricing for data transfer, effective May 1, 2008. You'll notice below that we've reduced price at every existing usage tier of transfer out, as well as added an additional tier for the heaviest users.

    \n

    Current data transfer price (through April 30, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.180 per GB - first 10 TB / month data transfer out
    \n$0.160 per GB - next 40 TB / month data transfer out
    \n$0.130 per GB - data transfer out / month over 50 TB

    \n

    Data transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.

    \n

    New data transfer price (effective May 1, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.170 per GB - first 10 TB / month data transfer out
    \n$0.130 per GB - next 40 TB / month data transfer out
    \n$0.110 per GB - next 100 TB / month data transfer out
    \n$0.100 per GB - data transfer out / month over 150 TB

    \n

    Data transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.

    \n

    The result of this pricing change is that all customers will see a reduction in the price of transfer out. For example, a customer transferring 50TB a month will save 16% and a customer transferring 500TB a month will save 26% on transfer with the new pricing. Please see http://aws.amazon.com for full pricing information for each service.

    \n

    Sincerely,
    \nThe Amazon Web Services Team

    \n

    ================end-==================

    \n

    当然了,你也可以到Amazon官方网站上看到这个消息,"Announcement: Lower Data Transfer Costs"

    \n

    AWS越来越成熟,在继支持静态IP和固定存储后,这又是一个大的变化,如果啥时能使得国内的访问速度提上去的话,对国内的WEB人员将是最大的幸福了.继续期待...

    \n

     

    \n

    ", "created_at"=>2008-04-23 15:30:30 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    晚上收到Amazon的AWS的邮件,说降价了,哈,真是好消息,前台在写<Google App Engine,前途无量,充满乐趣>的时候,还说到"同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。",不想到,这么快,Amazon就有动作了,真是好消息,直接看原文吧,总觉得用中文把E文再重复一遍挺浪费的,也比较别扭,总感觉有些外文不好使用中文表述出来,呵呵.
    \n=====================start===================
    \n
    \nDear Amazon Web Services developers,
    \nWe've often told you that one of our goals is to drive down costs continuously and to pass those savings on to you. We have been able to reduce our costs for data transfer, so we're pleased to announce that we're lowering our pricing for data transfer, effective May 1, 2008. You'll notice below that we've reduced price at every existing usage tier of transfer out, as well as added an additional tier for the heaviest users.
    \nCurrent data transfer price (through April 30, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.180 per GB - first 10 TB / month data transfer out
    \n$0.160 per GB - next 40 TB / month data transfer out
    \n$0.130 per GB - data transfer out / month over 50 TB
    \nData transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.
    \nNew data transfer price (effective May 1, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.170 per GB - first 10 TB / month data transfer out
    \n$0.130 per GB - next 40 TB / month data transfer out
    \n$0.110 per GB - next 100 TB / month data transfer out
    \n$0.100 per GB - data transfer out / month over 150 TB
    \nData transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.
    \nThe result of this pricing change is that all customers will see a reduction in the price of transfer out. For example, a customer transferring 50TB a month will save 16% and a customer transferring 500TB a month will save 26% on transfer with the new pricing. Please see http://aws.amazon.com for full pricing information for each service.
    \nSincerely,
    \nThe Amazon Web Services Team
    \n================end-==================
    \n当然了,你也可以到Amazon官方网站上看到这个消息,"Announcement: Lower Data Transfer Costs"
    \nAWS越来越成熟,在继支持静态IP和固定存储后,这又是一个大的变化,如果啥时能使得国内的访问速度提上去的话,对国内的WEB人员将是最大的幸福了.继续期待...
    \n 

    \n", "_id"=>798}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用RMagick动态生成图片", "body"=>"

    很早前就有类似的需求了,但是当时恐惧RMagick的庞大身躯,加上其对中文的支持布什很完善,就没怎么去在意他,最近一个项目中需要生成一些动态的图片,本来使用了Google的那个chart功能,后来觉得有点牵强附会,于是乎,静下心来,仔细看看RMagick咋生成图片。

    \n

    我的需求很简单,就是动态生成一个指定大小的图片,然后再图片上写几个汉字或者数字,英文等,所以大概的步骤就是这样的,直接看代码吧:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'RMagick'  
    2. \n
    3. class DrawPrice  
    4. \n
    5.   
    6. \n
    7.     def self.draw(name,nickname,email,blog='http://iceskysl.1sters.com/',columns=240,rows=80,bg_color='white')  
    8. \n
    9.          img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    10. \n
    11.          gc = Magick::Draw.new    
    12. \n
    13.          gc.stroke('transparent')    
    14. \n
    15.          gc.pointsize(16)    
    16. \n
    17.          gc.font("fonts/simhei.ttf")    
    18. \n
    19.          gc.text(10,30, "姓名:\#{nickname}")    
    20. \n
    21.          gc.text(10,50, "Email:\#{email}.")    
    22. \n
    23.          gc.pointsize(13)    
    24. \n
    25.          gc.text(10,70, blog)    
    26. \n
    27.          gc.draw(img)    
    28. \n
    29.          img.write("files/\#{name}.jpg")  
    30. \n
    31.      end  
    32. \n
    33.   
    34. \n
    35.  end  
    36. \n
    37.   
    38. \n
    39.  DrawPrice.draw("Ysl","IceskYsl","iceskysl@gmail.com")  
    40. \n
    \n
    \n再看个效果图:

    \n

    虽然很多函数,但是我们用到的就那么几个,Good~不是吗?

    \n

    参考文档:

    \n

    http://www.javaeye.com/post/262865

    \n

    http://www.javaeye.com/topic/174048

    \n

    http://www.javaeye.com/post/380907

    \n

    http://www.simplesystems.org/RMagick/doc/image1.html#new

    \n

    http://rmagick.rubyforge.org/portfolio3.html

    \n

     

    ", "created_at"=>2008-04-24 08:20:28 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很早前就有类似的需求了,但是当时恐惧RMagick的庞大身躯,加上其对中文的支持布什很完善,就没怎么去在意他,最近一个项目中需要生成一些动态的图片,本来使用了Google的那个chart功能,后来觉得有点牵强附会,于是乎,静下心来,仔细看看RMagick咋生成图片。
    \n我的需求很简单,就是动态生成一个指定大小的图片,然后再图片上写几个汉字或者数字,英文等,所以大概的步骤就是这样的,直接看代码吧:
    \n
    \nRuby代码
    \n
    \n require 'RMagick'  
    \n class DrawPrice  
    \n   
    \n     def self.draw(name,nickname,email,blog='http://iceskysl.1sters.com/',columns=240,rows=80,bg_color='white')  
    \n          img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    \n          gc = Magick::Draw.new    
    \n          gc.stroke('transparent')    
    \n          gc.pointsize(16)    
    \n          gc.font("fonts/simhei.ttf")    
    \n          gc.text(10,30, "姓名:\#{nickname}")    
    \n          gc.text(10,50, "Email:\#{email}.")    
    \n          gc.pointsize(13)    
    \n          gc.text(10,70, blog)    
    \n          gc.draw(img)    
    \n          img.write("files/\#{name}.jpg")  
    \n      end  
    \n   
    \n  end  
    \n   
    \n  DrawPrice.draw("Ysl","IceskYsl","iceskysl@gmail.com")  
    \n
    \n
    \n再看个效果图:
    \n虽然很多函数,但是我们用到的就那么几个,Good~不是吗?
    \n参考文档:
    \nhttp://www.javaeye.com/post/262865
    \nhttp://www.javaeye.com/topic/174048
    \nhttp://www.javaeye.com/post/380907
    \nhttp://www.simplesystems.org/RMagick/doc/image1.html#new
    \nhttp://rmagick.rubyforge.org/portfolio3.html
    \n 

    \n", "_id"=>799}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu 8.04 LTS (Hardy Heron)和Netbeans6.1发布啦~", "body"=>"

    最近好热闹,不说 Google App Engine Amazon降价,又有两个和我相关的重磅消息,那就是 Ubuntu 8.04 LTS (Hardy Heron) 按时发布了,另外就是NetBeans IDE 6.1发布了。

    \n

    我个人使用NetBeans IDE在Ubuntu下好长一段时间了,这两个新闻自然和我息息相关咯,找个时间,把7.10升级到8.04去,啥时在Down个NetBeans IDE 6.1下来。

    \n

    哦,对了,刚看到一个消息,貌似MySQL 5.1.24 rc版本中已取消集群功能,意味着什么,意味着MYSQL也会被肢解,一部分拿去赚钱了,这是个坏消息。

    \n

    wowo~真热闹~

    ", "created_at"=>2008-04-24 20:38:11 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    最近好热闹,不说 Google App Engine 和Amazon降价,又有两个和我相关的重磅消息,那就是 Ubuntu 8.04 LTS (Hardy Heron) 按时发布了,另外就是NetBeans IDE 6.1发布了。
    \n我个人使用NetBeans IDE在Ubuntu下好长一段时间了,这两个新闻自然和我息息相关咯,找个时间,把7.10升级到8.04去,啥时在Down个NetBeans IDE 6.1下来。
    \n哦,对了,刚看到一个消息,貌似MySQL 5.1.24 rc版本中已取消集群功能,意味着什么,意味着MYSQL也会被肢解,一部分拿去赚钱了,这是个坏消息。
    \nwowo~真热闹~

    \n", "_id"=>800}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"成功升级到Ubuntu8.08和Netbeans6.1", "body"=>"

    正如前面的这篇文章说的,Ubuntu8.04和NB6.1都发布了,我自然得抓紧升级了,正好今天调班在家休息,一觉睡到12点多,起来开始升级,先把重要的资料备份到另外一台电脑上,然后按照google出来的资料升级,我是用命令行升级的.

    \n

    1.修改源地址

    \n

    我以前的源很乱,正好这次一并清理下,把以前的 710的时候的源备份下,然后测了下google出来的那些源,选了个台湾的最快,(后来升级的时候发现这个源上有几个包当时下载不了,后来又加了一组上海电信的源)

    \n

    sudo gedit /etc/apt/sources.list

    \n

    \n

    \n
    这是我使用的源
    \n
      \n
    1. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse  
    2. \n
    3. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse  
    4. \n
    5. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse  
    6. \n
    7. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse  
    8. \n
    9. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse  
    10. \n
    11. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse  
    12. \n
    13. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse  
    14. \n
    15. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse  
    16. \n
    17. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe  
    18. \n
    19. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse   
    20. \n
    21.   
    22. \n
    23. deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse  
    24. \n
    25. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse  
    26. \n
    27. deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse  
    28. \n
    29. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse  
    30. \n
    31. deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse  
    32. \n
    33. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse  
    34. \n
    35. deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse  
    36. \n
    37. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse  
    38. \n
    39. deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe  
    40. \n
    41. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse   
    42. \n
    43.   
    44. \n
    45. deb http://archive.ubuntu.org.cn/ubuntu-cn/ hardy main restricted universe multiverse  
    46. \n
    \n
    \n其他的请参考:http://hi.baidu.com/jmlover/blog/item/3b2e3bf3cd0e0b54352accd9.html

    \n

    2.执行升级命令

    \n

    sudo apt-get update

    \n

    sudo apt-get  upgrade

    \n

    3.修复相关问题

    \n

    由于我是使用Xfce的,所以最开始升级的时候忘记升级相应的xfce了,导致后来启动的时候,没有UI界面,并遇到了scree not found的问题;然后修复了小企鹅输入法的方块问题,并做了些美化.

    \n

    这些问题google都是可以找到答案的,我也没具体记是咋整的,呵呵,反正是可以解决的.

    \n

    4.安装了NB6.1版本

    \n

    差不多搞了一下午,,中途睡了一觉,遇到一些问题都解决了,呵呵,但没感觉到8.04的有啥不一样的地方,哈哈..

    \n

     

    ", "created_at"=>2008-04-25 15:04:23 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    正如前面的这篇文章说的,Ubuntu8.04和NB6.1都发布了,我自然得抓紧升级了,正好今天调班在家休息,一觉睡到12点多,起来开始升级,先把重要的资料备份到另外一台电脑上,然后按照google出来的资料升级,我是用命令行升级的.
    \n1.修改源地址
    \n我以前的源很乱,正好这次一并清理下,把以前的 710的时候的源备份下,然后测了下google出来的那些源,选了个台湾的最快,(后来升级的时候发现这个源上有几个包当时下载不了,后来又加了一组上海电信的源)
    \nsudo gedit /etc/apt/sources.list
    \n
    \n
    \n这是我使用的源
    \n
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse;   
    \n   
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse;   
    \n   
    \n deb http://archive.ubuntu.org.cn/ubuntu-cn/ hardy main restricted universe multiverse;  
    \n
    \n
    \n其他的请参考:http://hi.baidu.com/jmlover/blog/item/3b2e3bf3cd0e0b54352accd9.html
    \n2.执行升级命令
    \nsudo apt-get update
    \nsudo apt-get  upgrade
    \n3.修复相关问题
    \n由于我是使用Xfce的,所以最开始升级的时候忘记升级相应的xfce了,导致后来启动的时候,没有UI界面,并遇到了scree not found的问题;然后修复了小企鹅输入法的方块问题,并做了些美化.
    \n这些问题google都是可以找到答案的,我也没具体记是咋整的,呵呵,反正是可以解决的.
    \n4.安装了NB6.1版本
    \n差不多搞了一下午,,中途睡了一觉,遇到一些问题都解决了,呵呵,但没感觉到8.04的有啥不一样的地方,哈哈..
    \n 

    \n", "_id"=>801}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu Hardy(8.04)源列表大全不断更新中)", "body"=>"

    升级的时候老是寻找最可靠的源,下面收集一些来自互联网的UBuntu8.04的源,供大家使用,会不断的更新和测试,谢谢.

    \n

    如下列举了部分电信,网通和双线的源,每个人具体的所在位置有些不同,所以速度相对来说是不一样,甚至差别很大的,所以各位在选的时候,先ping下看看那组最快,谢谢.

    \n

    Ubuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):
    \n
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \n
    \nArchive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):
    \n
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \nMirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
    \n
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):
    \n
    \ndeb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n厦门大学更新服务器(教育网服务器):
    \n
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \n
    \n成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==
    \n
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe

    \n

    北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):
    \n
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):
    \n
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nubuntu.cnsite.org更新服务器(福建省福州市 电信):
    \n
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nmirror.rootguide.org更新服务器(上海市 电信):
    \n
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse
    \n
    \n
    \n台湾的官方源速度也相当不错,有时甚至快于内地的:
    \n
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

    ", "created_at"=>2008-04-26 00:55:54 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    升级的时候老是寻找最可靠的源,下面收集一些来自互联网的UBuntu8.04的源,供大家使用,会不断的更新和测试,谢谢.
    \n如下列举了部分电信,网通和双线的源,每个人具体的所在位置有些不同,所以速度相对来说是不一样,甚至差别很大的,所以各位在选的时候,先ping下看看那组最快,谢谢.
    \nUbuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):
    \n
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \n
    \nArchive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):
    \n
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \nMirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
    \n
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):
    \n
    \ndeb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n厦门大学更新服务器(教育网服务器):
    \n
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \n
    \n成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==
    \n
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):
    \n
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):
    \n
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nubuntu.cnsite.org更新服务器(福建省福州市 电信):
    \n
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nmirror.rootguide.org更新服务器(上海市 电信):
    \n
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse
    \n
    \n
    \n台湾的官方源速度也相当不错,有时甚至快于内地的:
    \n
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

    \n", "_id"=>802}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"利用Amazon Web Services(AWS)构建可扩展的WebApp应用", "body"=>"

    在上次(2008.01.10)简单了写了一篇《RubyOnRails + S3 + EC2 = ? 》至今已经有段时间了,经过一段时间的发展,Amazon Web Services到今天已经相当成熟了,一整套的解决方案可以给Web App带来很多的便利,再一系列的改进措施后,AWS基本上是成熟了。

    \n

    \"\"

    \n

    上面这个图片来源于slideshare上的一个PPT“Using Amazon SimpleDB with Ruby on Rails”,正如我上面截取的这个图片说的:

    \n
      \n
    • 静态文件存储在S3上;
    • \n
    • App server使用课余无限扩展的EC2;
    • \n
    • 结构化数据存储在SimpleDB上;
    • \n
    • 客户端/服务端的交互使用SQS;
    • \n
    \n

    看看AWS的几个应用,正好覆盖了WebApp的整个过程,以下逐一介绍下这几个服务:

    \n

    1、S3看上去就是一个大的硬盘,你可以把App中的所有数据都放上去,取回来,展示等等,是个比较安全的存储服务,省略了自己买磁盘阵列,维护等等费用,且号称是安全的。

    \n

    2、EC2的最大卖点就是其可以无限伸缩的,号称可以扩展到“云”上去,不用因为您的服务器压力过重而购买一批一批的机器,免得找机房,等等,可谓相当方便,在其推出固定IP固态存储之后,使得EC2相当成熟;

    \n

    3、SimpleDB推出的最早,但是一直没仔细看,以为其和S3差不多,今天仔细看了下,其实不然,看其名字是SimpleDB,是用来替代DB的,但是比普通的DB更加Simple,其实也就是一个结构化的存储,你可以把DB的东西(表,行)组合一下放进去,然后根据其有的API查询和存贮,省了维护数据库的人力物力,但是速度不晓得如何。

    \n

    4、SQS是前段时间了解的,不晓得这个服务当初推出的典型应用场景是什么样的,就我的理解,其就是一个队列,相当于一个缓冲队列,用在分布式处理或者作用同步上相当不错,有兴趣的可以看我以前的文章“Amazon SQS,分布式作业不再费心”。

    \n

    总的来说,AWS的几个服务都是将WebApp开发中涉及到的几个方面分拆出来做成服务,以来提供便捷,二来自己赚了一大笔,真是聪明,不过这些应用的维护不晓得Amazon 是怎么处理的,肯定不会是我们常见的人工维护,估计和Google存储差不多的自维护系统。

    \n

    如果您对AWS感兴趣,如果您和笔者一样使用的是RubyOnRails,你可以使用RightAws插件,其包含了以上4个应用的实现,相当不错。

    \n

    但是其不足之处依然存在,例如多国内用户,速度不敢恭维;也有人列举了“Top 10 Reasons to Avoid the SimpleDB Hype”,当然也有人针锋相对的回应了这10个问题“ Top 10 Reasons to Avoid Document Databases FUD  4 ”;另外还有其价格是否真的划算(现在支付美刀比较划算),以及其曾经出现过的问题,所以您在决定使用之前还请仔细考量,这几个应用我都有过尝试,虽然没有大规模的使用,但是基本上比较了解了,如果您有问题,或者其他的经验,欢迎和我交流。

    ", "created_at"=>2008-04-28 07:34:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在上次(2008.01.10)简单了写了一篇《RubyOnRails + S3 + EC2 = ? 》至今已经有段时间了,经过一段时间的发展,Amazon Web Services到今天已经相当成熟了,一整套的解决方案可以给Web App带来很多的便利,再一系列的改进措施后,AWS基本上是成熟了。
    \n
    \n上面这个图片来源于slideshare上的一个PPT“Using Amazon SimpleDB with Ruby on Rails”,正如我上面截取的这个图片说的:
    \n
    \n 静态文件存储在S3上;
    \n App server使用课余无限扩展的EC2;
    \n 结构化数据存储在SimpleDB上;
    \n 客户端/服务端的交互使用SQS;
    \n
    \n看看AWS的几个应用,正好覆盖了WebApp的整个过程,以下逐一介绍下这几个服务:
    \n1、S3看上去就是一个大的硬盘,你可以把App中的所有数据都放上去,取回来,展示等等,是个比较安全的存储服务,省略了自己买磁盘阵列,维护等等费用,且号称是安全的。
    \n2、EC2的最大卖点就是其可以无限伸缩的,号称可以扩展到“云”上去,不用因为您的服务器压力过重而购买一批一批的机器,免得找机房,等等,可谓相当方便,在其推出固定IP和固态存储之后,使得EC2相当成熟;
    \n3、SimpleDB推出的最早,但是一直没仔细看,以为其和S3差不多,今天仔细看了下,其实不然,看其名字是SimpleDB,是用来替代DB的,但是比普通的DB更加Simple,其实也就是一个结构化的存储,你可以把DB的东西(表,行)组合一下放进去,然后根据其有的API查询和存贮,省了维护数据库的人力物力,但是速度不晓得如何。
    \n4、SQS是前段时间了解的,不晓得这个服务当初推出的典型应用场景是什么样的,就我的理解,其就是一个队列,相当于一个缓冲队列,用在分布式处理或者作用同步上相当不错,有兴趣的可以看我以前的文章“Amazon SQS,分布式作业不再费心”。
    \n总的来说,AWS的几个服务都是将WebApp开发中涉及到的几个方面分拆出来做成服务,以来提供便捷,二来自己赚了一大笔,真是聪明,不过这些应用的维护不晓得Amazon 是怎么处理的,肯定不会是我们常见的人工维护,估计和Google存储差不多的自维护系统。
    \n如果您对AWS感兴趣,如果您和笔者一样使用的是RubyOnRails,你可以使用RightAws插件,其包含了以上4个应用的实现,相当不错。
    \n但是其不足之处依然存在,例如多国内用户,速度不敢恭维;也有人列举了“Top 10 Reasons to Avoid the SimpleDB Hype”,当然也有人针锋相对的回应了这10个问题“ Top 10 Reasons to Avoid Document Databases FUD  4 ”;另外还有其价格是否真的划算(现在支付美刀比较划算),以及其曾经出现过的问题,所以您在决定使用之前还请仔细考量,这几个应用我都有过尝试,虽然没有大规模的使用,但是基本上比较了解了,如果您有问题,或者其他的经验,欢迎和我交流。

    \n", "_id"=>803}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google更新PR~", "body"=>"

    Google正在更新PR,我放假回老家几天没上网,回来看到我的blog已经从以前的1更新到3,虽然不高,但是还是差不多体现了我blog的价值。

    \n

    基本上都是原创的内容,只是外链不多而已~

    ", "created_at"=>2008-05-05 02:24:36 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Google正在更新PR,我放假回老家几天没上网,回来看到我的blog已经从以前的1更新到3,虽然不高,但是还是差不多体现了我blog的价值。
    \n基本上都是原创的内容,只是外链不多而已~

    \n", "_id"=>804}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RoR中取得最近记录的方法", "body"=>"

    时常有类似于“查看最近一天发布的文章”,“最近一个星期发布的文章”等,与是找到一段代码,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class Topic < ActiveRecord::Base  
    2. \n
    3.   def self.find_latest(time = nil)  
    4. \n
    5.     r = %w( hour day week month year )  
    6. \n
    7.     if r.include?(time)  
    8. \n
    9.       self.find :all:conditions => ['created_at > ?', 1.send(time).ago]  
    10. \n
    11.     else  
    12. \n
    13.       self.find :all  
    14. \n
    15.     end  
    16. \n
    17.   end  
    18. \n
    19. end  
    20. \n
    21.   
    22. \n
    23. Topic.find_latest('day')  
    24. \n
    25. Topic.find_latest('week')  
    26. \n
    27. Topic.find_latest('year')  
    28. \n
    \n
    \n

    比较简单,就不罗嗦了,要是你有更好的方法,请分享下~

    ", "created_at"=>2008-05-05 02:37:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    时常有类似于“查看最近一天发布的文章”,“最近一个星期发布的文章”等,与是找到一段代码,如下:
    \n
    \nRuby代码
    \n
    \n class Topic < ActiveRecord::Base  
    \n   def self.find_latest(time = nil)  
    \n     r = %w( hour day week month year )  
    \n     if r.include?(time)  
    \n       self.find :all, :conditions => ['created_at > ?', 1.send(time).ago]  
    \n     else  
    \n       self.find :all  
    \n     end  
    \n   end  
    \n end  
    \n   
    \n Topic.find_latest('day')  
    \n Topic.find_latest('week')  
    \n Topic.find_latest('year')  
    \n
    \n
    \n比较简单,就不罗嗦了,要是你有更好的方法,请分享下~

    \n", "_id"=>805}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"F形网页浏览眼球轨迹的研究报告", "body"=>"

    这是个很古老的研究了,2006年4月,美国长期研究网站可用性的著名网站设计师杰柯柏·尼尔森(Jakob Nielsen)发表了一项《眼球轨迹的研究》报告(原文:F-Shaped Pattern For Reading Web Content)。
    \n报告称,大多数情况下浏览者都不由自主的以“F”形状的模式阅读网页,这种基本恒定的阅读习惯决定了网页呈现F形的关注热度。

    \n

     

    \n

    \"\"

    \n

    第一步:水平移动

    \n

    浏览者首先在网页最上部形成一个水平浏览轨迹。

    \n

    第二步:目光下移,短范围水平移动

    \n

    浏览者会将目光向下移,扫描比上一步短的区域。

    \n

    第三步:垂直浏览

    \n

    浏览者完成上两步后,会将目光沿网页左侧垂直扫描;这一步的浏览速度较慢,也较有系统性、条理性。

    \n

     

    \n

    附图:F形状网页浏览模式

    \n

    下面为杰柯柏·尼尔森报告中的3张热度图,用颜色来表示浏览者眼光聚集的热度,分为最热(红色)、较热(黄色)、不热(蓝色)和基本不关注(灰色)4种。其中图3搜索结果页因SERP中网站标题、网页摘要较宽,第二条线会随之加长,但仍然是F形状。

    \n

    \"Three

    \n

     

    \n

     

    \n

    详细的大家可以看:

    \n

    1、点石上一篇文章:尼尔森F形状网页浏览模式

    \n

    2、作者的原报告:F-Shaped Pattern For Reading Web Content

    ", "created_at"=>2008-05-07 03:33:50 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    这是个很古老的研究了,2006年4月,美国长期研究网站可用性的著名网站设计师杰柯柏·尼尔森(Jakob Nielsen)发表了一项《眼球轨迹的研究》报告(原文:F-Shaped Pattern For Reading Web Content)。
    \n报告称,大多数情况下浏览者都不由自主的以“F”形状的模式阅读网页,这种基本恒定的阅读习惯决定了网页呈现F形的关注热度。
    \n 
    \n
    \n第一步:水平移动
    \n浏览者首先在网页最上部形成一个水平浏览轨迹。
    \n第二步:目光下移,短范围水平移动
    \n浏览者会将目光向下移,扫描比上一步短的区域。
    \n第三步:垂直浏览
    \n浏览者完成上两步后,会将目光沿网页左侧垂直扫描;这一步的浏览速度较慢,也较有系统性、条理性。
    \n 
    \n附图:F形状网页浏览模式
    \n下面为杰柯柏·尼尔森报告中的3张热度图,用颜色来表示浏览者眼光聚集的热度,分为最热(红色)、较热(黄色)、不热(蓝色)和基本不关注(灰色)4种。其中图3搜索结果页因SERP中网站标题、网页摘要较宽,第二条线会随之加长,但仍然是F形状。
    \n
    \n 
    \n 
    \n详细的大家可以看:
    \n1、点石上一篇文章:尼尔森F形状网页浏览模式
    \n2、作者的原报告:F-Shaped Pattern For Reading Web Content

    \n", "_id"=>806}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Puppy Linux,放入U盘随身带的演示环境", "body"=>"

    在U盘价格卖到“白菜”一样的时候,你拿U盘来做什么,又可以做什么,你有想过把一个linux装到U盘里,打造一个随身携带的“生产环节”呢。

    \n

    设想下这么个场景,你是公司业务人员,受客户邀请和上司器重,去一个你并不熟悉的客户环境中讲解客户需要的产品,当你兴致勃勃的到达客户处时,却发现无法联上演示离不开的互联网来连到您的DEMO服务器,或者网路相当糟糕,让你不得不点一个按钮就停下里尴尬的等待,或者其他等等等情况。

    \n

    如果我告诉你,可以把Puppy Linux 4.00打造成这套演示环境(小生产环境)随手带在U盘里,随时随地的演示,你会不会心动?

    \n

    Ok,先看看“随身系统——Puppy Linux 4.00 初体验”,如何,挺不错吧,想自己做一个么,看“将 Puppy Linux 4.00 安装在U盘里 打造随身系统”,还想了解更多,看“E-PUP Linux 中文项目(Puppy Linux 中文版)您高效实用的小型Linux发行版”和"Puppy Linux Discussion Forum“。

    \n

    恩,差不多了,我想要的是一个带有Linux、Mysql,Ruby,Rails,gems,mogrels,nginx的小生产环境即可。至于开发环境下的JAVA,Netbeans等就无所谓了。有人能已经实践过了么,共享 :)

    ", "created_at"=>2008-05-07 09:48:04 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在U盘价格卖到“白菜”一样的时候,你拿U盘来做什么,又可以做什么,你有想过把一个linux装到U盘里,打造一个随身携带的“生产环节”呢。
    \n设想下这么个场景,你是公司业务人员,受客户邀请和上司器重,去一个你并不熟悉的客户环境中讲解客户需要的产品,当你兴致勃勃的到达客户处时,却发现无法联上演示离不开的互联网来连到您的DEMO服务器,或者网路相当糟糕,让你不得不点一个按钮就停下里尴尬的等待,或者其他等等等情况。
    \n如果我告诉你,可以把Puppy Linux 4.00打造成这套演示环境(小生产环境)随手带在U盘里,随时随地的演示,你会不会心动?
    \nOk,先看看“随身系统——Puppy Linux 4.00 初体验”,如何,挺不错吧,想自己做一个么,看“将 Puppy Linux 4.00 安装在U盘里 打造随身系统”,还想了解更多,看“E-PUP Linux 中文项目(Puppy Linux 中文版)您高效实用的小型Linux发行版”和"Puppy Linux Discussion Forum“。
    \n恩,差不多了,我想要的是一个带有Linux、Mysql,Ruby,Rails,gems,mogrels,nginx的小生产环境即可。至于开发环境下的JAVA,Netbeans等就无所谓了。有人能已经实践过了么,共享 :)

    \n", "_id"=>807}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"圣火登珠峰,卓望\"一键拍发\"助力新华网全球首发", "body"=>"

    \"\"

    \n

    北京时间2008年5月8日9时20分32秒,新华社向全球发布了扎西次仁从地球之巅拍摄的首张北京奥运圣火珠峰传递照片。
    \n此次照片的实时传递由卓望科技 提供技术支撑,使用卓望提供的“一键拍发”客户端软件,由新华社特约记者带着安装了卓望科技客户端软件的几台手机即拍即发,登顶后不到10分钟就有清晰的照片实时发布。新华社成为首家提供圣火珠峰传递照片的新闻单位。
    \nhttp://www.xinhuanet.com/
    \nhttp://news.xinhuanet.com/photo/2008-05/08/content_8126374.htm
    \nhttp://news.xinhuanet.com/sports/2008-05/08/content_8126456.htm

    ", "created_at"=>2008-05-08 02:32:29 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    北京时间2008年5月8日9时20分32秒,新华社向全球发布了扎西次仁从地球之巅拍摄的首张北京奥运圣火珠峰传递照片。
    \n此次照片的实时传递由卓望科技 提供技术支撑,使用卓望提供的“一键拍发”客户端软件,由新华社特约记者带着安装了卓望科技客户端软件的几台手机即拍即发,登顶后不到10分钟就有清晰的照片实时发布。新华社成为首家提供圣火珠峰传递照片的新闻单位。
    \nhttp://www.xinhuanet.com/
    \nhttp://news.xinhuanet.com/photo/2008-05/08/content_8126374.htm
    \nhttp://news.xinhuanet.com/sports/2008-05/08/content_8126456.htm

    \n", "_id"=>808}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Ruby测试AWS之S3国内数据存贮", "body"=>"

    一、S3概要介绍和其规范说明
    \n1、什么是S3
    \n    * Simple Storage Service Fron Amazon
    \n    * 一块无容量限制的网络硬盘
    \n    * 可以作为可靠、快速、可以无限扩展的网络存储服务
    \n
    \n2、S3的功能
    \n    * 支持最小1byte,最大5G的存储对象;
    \n    * 无存贮对象个数上的限制;
    \n    * 每个存储对象存储在bucket中,且由有个用户定义的唯一性key来标识;
    \n    * 可以对每个存贮对象设置访问权限;
    \n    * 提供了REST和SOAP接口对对象进行读写、删除等操作;
    \n    * 可靠时间为99.9%
    \n
    \n3、S3的价格
    \n4、S3中的概念
    \n5、S3中的操作
    \n6、S3的API和库
    \n7、S3客户端工具
    \n8、存在的问题
    \n
    \n二、实际测试
    \n1、测速代码:
    \n2、测速结果:
    \n
    \n参考资料

    \n

    详细文章,请阅读《 使用Amazon S3做资料存储》,我使用Google DOC写的,随时可能更新,不在另行通知,如果您有这方面的经验,欢迎探讨,分享。

    ", "created_at"=>2008-05-09 08:42:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一、S3概要介绍和其规范说明
    \n1、什么是S3
    \n    * Simple Storage Service Fron Amazon
    \n    * 一块无容量限制的网络硬盘
    \n    * 可以作为可靠、快速、可以无限扩展的网络存储服务
    \n
    \n2、S3的功能
    \n    * 支持最小1byte,最大5G的存储对象;
    \n    * 无存贮对象个数上的限制;
    \n    * 每个存储对象存储在bucket中,且由有个用户定义的唯一性key来标识;
    \n    * 可以对每个存贮对象设置访问权限;
    \n    * 提供了REST和SOAP接口对对象进行读写、删除等操作;
    \n    * 可靠时间为99.9%
    \n
    \n3、S3的价格
    \n4、S3中的概念
    \n5、S3中的操作
    \n6、S3的API和库
    \n7、S3客户端工具
    \n8、存在的问题
    \n
    \n二、实际测试
    \n1、测速代码:
    \n2、测速结果:
    \n
    \n参考资料
    \n详细文章,请阅读《 使用Amazon S3做资料存储》,我使用Google DOC写的,随时可能更新,不在另行通知,如果您有这方面的经验,欢迎探讨,分享。

    \n", "_id"=>809}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"LoadError: no such file to load -- RMagick", "body"=>"

    虽然在ubuntu上的rails里面使用过很多次的RMagick,但是却一直没有在单独的ruby

    \n

    script中使用过,这次需要单独使用来画一些图片,于是写了一段代码,但是却跑不起来,老是报"LoadError: no such file to load -- RMagick "错误,查了些资料,搞清楚原因,记录如下:

    \n

    1.注意大小写敏感度

    \n

    在windows或者mac上,不敏感大小写,可以:````require 'rmagick'```

    \n

    ````但是在linux上,却不行,需要写:``````` require 'RMagick'```

    \n

    ````否则您可能得到如下错误:```

    \n

    ```` MissingSourceFile: no such file to load -- rmagick```

    \n

    2.单独ruby中需要引用````rubygems```

    \n

    ````require 'rubygems'
    \nrequire 'RMagick'```

    \n

    ````如果不引用```````rubygems,可能会看到如下错误:```

    \n

    ```` `require': no such file to load -- rmagick (LoadError)```

    \n

    ````或者
    \n```

    \n

    ```` `require': no such file to load -- RMagick (LoadError)```

    \n

    参考文档:

    \n
      \n
    • 在Ubuntu上安装RMagic:http://www.hhtong.com/blog1/articles/2006/11/11/ubuntu20061111-install-rmagic
    • \n
    • Ruby on Rails RMagic:http://www.mysmallventures.com/ruby-on-rails-rmagick-linux-issues/
    • \n
    ", "created_at"=>2008-05-11 02:00:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    虽然在ubuntu上的rails里面使用过很多次的RMagick,但是却一直没有在单独的ruby
    \nscript中使用过,这次需要单独使用来画一些图片,于是写了一段代码,但是却跑不起来,老是报"LoadError: no such file to load -- RMagick "错误,查了些资料,搞清楚原因,记录如下:
    \n1.注意大小写敏感度
    \n在windows或者mac上,不敏感大小写,可以:require 'rmagick'```</p>
    \n<p>
    但是在linux上,却不行,需要写:require 'RMagick'```</p>
    \n<p>````否则您可能得到如下错误:```</p>
    \n<p>```` MissingSourceFile: no such file to load -- rmagick```</p>
    \n<p><strong>2.单独ruby中需要引用````rubygems```</strong></p>
    \n<p>````require 'rubygems'<br />
    \nrequire 'RMagick'```</p>
    \n<p>````如果不引用
    rubygems,可能会看到如下错误:</p>
    \n<p>
    require': no such file to load -- rmagick (LoadError)</p>
    \n<p>
    或者<br />
    \n
    </p>
    \n<p>
    `require': no such file to load -- RMagick (LoadError)`
    \n参考文档:
    \n
    \n 在Ubuntu上安装RMagic:http://www.hhtong.com/blog1/articles/2006/11/11/ubuntu20061111-install-rmagic
    \n Ruby on Rails RMagic:http://www.mysmallventures.com/ruby-on-rails-rmagick-linux-issues/

    \n", "_id"=>810}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇Magick::ImageMagickError", "body"=>"

    一段调用RMagic的Ruby脚本,在本地跑的好好的代码,放到服务器上出现这个错误:
    \n Non-conforming drawing primitive definition  (Magick::ImageMagickError)

    \n

    查了下服务器和本地,貌似只有Rmagic的版本不一样,如下:

    \n

    [iceskysl]$  gem list | grep rmagick
    \nrmagick (1.15.12, 1.15.10)
    \n[iceskysl]$ dpkg -l | grep magick
    \nii  imagemagick    6.2.4.5.dfsg1- Image manipulation programs
    \nii  libmagick6     6.0.6.2-2.9    Image manipulation library
    \nii  libmagick9     6.2.4.5.dfsg1- Image manipulation library
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.15.12-1      <insert up to 60 chars description>
    \nii  perlmagick     6.0.6.2-2.9    A perl interface to the libMagick graphics r
    \n
    \nand in my locolhost.it's:
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ gem list | grep rmagick
    \nrmagick (2.3.0, 1.15.10)

    \n

    iceskysl@IceskYsl:/opt/devroot/Taojer/lib$ dpkg -l | grep magick
    \nii  imagemagick                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation programs
    \nii  libmagick10                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library
    \nii  libmagick9                                 7:6.2.4.5.dfsg1-2ubuntu1            Image manipulation library
    \nii  libmagick9-dev                             7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library - development files
    \n不晓得是不是这个问题,查遍了Google也没找到合适的答案,记录在案,有遇到类似错误的还望指教,谢谢.

    \n

    \n

    \n
    附录:相关代码
    \n
      \n
    1. #!/usr/bin/ruby  
    2. \n
    3. require 'rubygems'  
    4. \n
    5. require 'RMagick'  
    6. \n
    7. #require 'RMagick'  
    8. \n
    9. class DrawPrice  
    10. \n
    11.     
    12. \n
    13.   #根据给出的文件名,路径等信息生成价图片  
    14. \n
    15.   def self.drawpic(dir,name,nickname,adrress,blog='http://iceskysl.1sters.com/',columns=200,rows=80,bg_color='white')  
    16. \n
    17.     img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    18. \n
    19.     puts "img=\#{img}"  
    20. \n
    21.     gc = Magick::Draw.new    
    22. \n
    23.     puts "gc=\#{gc}"  
    24. \n
    25.     gc.stroke('transparent')    
    26. \n
    27.     gc.pointsize(16)    
    28. \n
    29.     gc.font("fonts/simhei.ttf")    
    30. \n
    31.     gc.text(40,30, "姓名:\#{nickname}")    
    32. \n
    33.     gc.text(40,50, "地址:\#{adrress}.")    
    34. \n
    35.     gc.pointsize(13)    
    36. \n
    37.     gc.text(10,70, blog)    
    38. \n
    39.     gc.draw(img)    
    40. \n
    41.     img.write("\#{dir}/\#{name}.jpg")  
    42. \n
    43.   end  
    44. \n
    45.   
    46. \n
    47. end  
    48. \n
    49.   
    50. \n
    51. DrawPrice.drawpic("files","vip_price","IceskYsl","深圳")  
    52. \n
    \n
    \n

    \n

     

    ", "created_at"=>2008-05-11 02:12:48 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一段调用RMagic的Ruby脚本,在本地跑的好好的代码,放到服务器上出现这个错误:
    \n Non-conforming drawing primitive definition  (Magick::ImageMagickError)
    \n查了下服务器和本地,貌似只有Rmagic的版本不一样,如下:
    \n[iceskysl]$  gem list | grep rmagick
    \nrmagick (1.15.12, 1.15.10)
    \n[iceskysl]$ dpkg -l | grep magick
    \nii  imagemagick    6.2.4.5.dfsg1- Image manipulation programs
    \nii  libmagick6     6.0.6.2-2.9    Image manipulation library
    \nii  libmagick9     6.2.4.5.dfsg1- Image manipulation library
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.15.12-1      <insert up to 60 chars description>
    \nii  perlmagick     6.0.6.2-2.9    A perl interface to the libMagick graphics r
    \n
    \nand in my locolhost.it's:
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ gem list | grep rmagick
    \nrmagick (2.3.0, 1.15.10)
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ dpkg -l | grep magick
    \nii  imagemagick                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation programs
    \nii  libmagick10                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library
    \nii  libmagick9                                 7:6.2.4.5.dfsg1-2ubuntu1            Image manipulation library
    \nii  libmagick9-dev                             7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library - development files
    \n不晓得是不是这个问题,查遍了Google也没找到合适的答案,记录在案,有遇到类似错误的还望指教,谢谢.
    \n
    \n
    \n附录:相关代码
    \n
    \n #!/usr/bin/ruby  
    \n require 'rubygems'  
    \n require 'RMagick'  
    \n #require 'RMagick'  
    \n class DrawPrice  
    \n     
    \n   #根据给出的文件名,路径等信息生成价图片  
    \n   def self.drawpic(dir,name,nickname,adrress,blog='http://iceskysl.1sters.com/',columns=200,rows=80,bg_color='white')  
    \n     img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    \n     puts "img=\#{img}"  
    \n     gc = Magick::Draw.new    
    \n     puts "gc=\#{gc}"  
    \n     gc.stroke('transparent')    
    \n     gc.pointsize(16)    
    \n     gc.font("fonts/simhei.ttf")    
    \n     gc.text(40,30, "姓名:\#{nickname}")    
    \n     gc.text(40,50, "地址:\#{adrress}.")    
    \n     gc.pointsize(13)    
    \n     gc.text(10,70, blog)    
    \n     gc.draw(img)    
    \n     img.write("\#{dir}/\#{name}.jpg")  
    \n   end  
    \n   
    \n end  
    \n   
    \n DrawPrice.drawpic("files","vip_price","IceskYsl","深圳")  
    \n
    \n
    \n
    \n 

    \n", "_id"=>811}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail妙用点滴聚合收集", "body"=>"

    是的,我是一个重度Google产品使用者,包括Gmail,GoogleDoc,picasa,Google Sync,GoogleReader等等,Google的很多产品的都很有创意,也符合未来“云计算”的趋势,同时给我带来诸多的便利。

    \n

    本篇文章主要是用来记录一些我自己使用的Gmail技巧和tips,或者是一些技巧的文章链接,以备不时之需,如果您有其他的小技巧,请与我分享,谢谢。

    \n

    1、Gmail与Google在线办公结合

    \n

    可以通过设置Gmail的过滤器为“有附件”且包含“DOC or XML”关键字的邮件转发到您的GoogleDoc的“Email-In Your Documents and Files"中,详细说明可以参考”Gmail过滤器妙用 之与Google在线办公结合“。

    \n

    2、Gmail Labels和过滤器结合在备份中的妙用

    \n

    Gmail的lable功能很强大,和上面说的过滤器结合可以做很好的备份用,例如我订阅了很多的邮件列表,想nginx,mogrel等等,这些邮件列表相当活跃,如果每次都如inbox,会严重干扰我其他的邮件,这时lable和过滤器就可以结合来做归档了,详细的操作方法请参考”Gmail Labels在备份中的妙用

    \n

     

    ", "created_at"=>2008-05-12 03:14:47 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    是的,我是一个重度Google产品使用者,包括Gmail,GoogleDoc,picasa,Google Sync,GoogleReader等等,Google的很多产品的都很有创意,也符合未来“云计算”的趋势,同时给我带来诸多的便利。
    \n本篇文章主要是用来记录一些我自己使用的Gmail技巧和tips,或者是一些技巧的文章链接,以备不时之需,如果您有其他的小技巧,请与我分享,谢谢。
    \n1、Gmail与Google在线办公结合
    \n可以通过设置Gmail的过滤器为“有附件”且包含“DOC or XML”关键字的邮件转发到您的GoogleDoc的“Email-In Your Documents and Files"中,详细说明可以参考”Gmail过滤器妙用 之与Google在线办公结合“。
    \n2、Gmail Labels和过滤器结合在备份中的妙用
    \nGmail的lable功能很强大,和上面说的过滤器结合可以做很好的备份用,例如我订阅了很多的邮件列表,想nginx,mogrel等等,这些邮件列表相当活跃,如果每次都如inbox,会严重干扰我其他的邮件,这时lable和过滤器就可以结合来做归档了,详细的操作方法请参考”Gmail Labels在备份中的妙用“
    \n 

    \n", "_id"=>812}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"中国,挺起自己的脊梁来", "body"=>"

    本来以为08是个大喜的年,我们期待这阳光和无限希望,我们盼了许久的奥运终于来临,我们无比兴奋,憧憬美好的未来。

    \n

    谁料,我们等到的是:

    \n

    2月肆虐的雪灾,冻裂了中国大地;3月的拉萨暴力事件,烧伤了美丽的圣地;4月的奥运火炬传递受阻,刺伤了中国人向世界张开的双臂;善变的5月,胶济铁路 火车相撞,撞碎了多少旅人的梦;突然传遍全国的儿童手足口病,令全国父母心头纠结;震动传及东南亚的四川大地震,撼及整个中国的灵魂……

    \n

    面对困难,面对挫折,我们如此渺小,昨天是地震发生的日志,下班后,看着新闻直播,不断的刷新互联网上的的死亡人数报告,心里无比的痛楚。

    \n

    看到温总理的不断喊话和鼓励现场的人们,看着写完遗书去现场的突击队员们,看到记者冒着生命危险给大家带来最新的报道,看到朋友们一遍一遍的发送着祝福和祈愿,我们地处安全,却无能为力,我们只能不断的祷告和许愿,希望祖国人民,每个人都能平安,健康,上苍有好生之德,大家一起祈祷,祝愿那些朋友们尽快脱落危险。

    \n

    附录:转载:一个记者在地震抢救现场给我们上午做的直播?
    \n-----------------
    \n绮梦 10:07:29
    \n现场简直不能看了
    \n绮梦 10:08:33
    \n年过花甲的总理已经哭得不成样子了
    \n绮梦 10:10:16
    \n刚刚挖开的地方又塌方了
    \n绮梦 10:11:24
    \n这倒霉天气还在下雨,现在一线的军人已经被下达死命令,必须冒雨解救
    \n绮梦 10:11:30
    \n我就在现场
    \n绮梦 10:11:56
    \n我现在是在都江堰市
    \n绮梦 10:13:24
    \n交通已经瘫痪了,人员和物资很难运进去
    \n绮梦 10:13:47
    \n汶川现在还不让我们去
    \n绮梦 10:15:21
    \n汶川的交通完全封闭了,现场到底怎么样我不知道,不过早上总理指示军队不管有多大代价,必须进城
    \n绮梦 10:16:03
    \n倒霉天气在下雨,飞机几次都不能降落,伞兵马上就要起飞了
    \n绮梦 10:17:36
    \n飞机在汶川空投物资了
    \n绮梦 10:20:06
    \n被压在废墟下的300多学生现在很危险啊,刚才一次的营救又失败了,现在总理在现场组织再次营救。
    \n绮梦 10:20:47
    \n啊 总理摔到了,
    \n绮梦 10:21:35
    \n照片我正在传给北京,不经过审核的是不允许发布的
    \n绮梦 10:22:21
    \n我和几个同行现在开了9台电脑,同时在传消息
    \n绮梦 10:22:37
    \n这个QQ在关键时候传的真慢
    \n绮梦 10:23:39
    \n突击队又上了
    \n绮梦 10:25:04
    \n如果你现在看见老爷子的样子,你马上就会哭的
    \n绮梦 10:26:40
    \n老爷子的手臂受伤出血了,他把要给他包扎的医务人员推开了
    \n绮梦 10:27:09
    \n好消息,发现一名学生了
    \n绮梦 10:28:00
    \n总理跑到塌方点了,在帮忙呢
    \n绮梦 10:28:13
    \n向峨乡中学
    \n绮梦 10:28:33
    \n拖出来了,医生在抢救
    \n绮梦 10:28:56
    \n部队上来的人还不是很多
    \n绮梦 10:29:07
    \n交通太困难
    \n绮梦 10:29:42
    \n现在还不一定,这个看样子看活着,吊瓶氧气都挂上了
    \n绮梦 10:31:06
    \n啊,又塌了
    \n绮梦 10:31:28
    \n突击队一个人被埋进去了
    \n绮梦 10:31:40
    \n等等,我到前面看看
    \n绮梦 10:36:24
    \n我回来了,抢救出来了
    \n绮梦 10:37:16
    \n最新消息,彭州被困的10万群众危险!!!
    \n绮梦 10:38:49
    \n由于大雨的影响,工程兵几次架桥失败,附近已经出现泥石流迹象,电话直接是叫通总理的,情况很危险!!!
    \n绮梦 10:39:19
    \n由于桥梁倒塌,彭州市10万群众被堵在山中,救灾人员和物资无法运人。已经出现泥石流迹象
    \n绮梦 10:41:11
    \n总理电话里大喊,我不管你们怎么样,我只要这10万群众月兑险,这是命令。他把电话摔了
    \n绮梦 10:41:33
    \n头一次看见老爷子这么厉害
    \n绮梦 10:41:54
    \n汶川现在还没通知去,估计情况不是很好
    \n绮梦 10:42:16
    \n我现在在通讯帐篷里
    \n绮梦 10:43:54
    \n汶川最新消息,雨开始小了,空投物资已经扔下去了,空降兵已经在外围机场登机了
    \n绮梦 10:45:19
    \n现在所有的国外记者都在关注号称中国最精锐的特种部队首次公开亮相
    \n绮梦 10:46:50
    \n总理现在和登机部队领导说话
    \n绮梦 10:47:41
    \n总理说,我就一句话,是人民在养你们,你们自己看着办。
    \n绮梦 11:11:00
    \n大家好,我现在是在军用直升机上,头一次坐这种飞机,很紧张。
    \n绮梦 11:12:51
    \n我现在在直升机上,估计一个小时后就到什肪了
    \n绮梦 11:34:40
    \n最新消息,汶川的映秀、漩口、卧龙三镇通讯信号很弱,至今也无法联系。估计三镇有将近两万多人被困,余震不断,大雨连绵,情况非常严峻,由于能见度太差,无法判断准确情况。总参命令,当空降部队到达汶川上空时,如果条件不允许,就不惜代价强行伞降!
    \n绮梦 11:36:38
    \n没有,飞机要进人雷区了,我要关机了,等会再和你们聊。

    \n

    附录:
    \nhttp://review.feedsky.com/review/feedsky/iceskysl_1sters/~/txt/171/r.html

    \n

    \"\"

    ", "created_at"=>2008-05-13 08:51:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    本来以为08是个大喜的年,我们期待这阳光和无限希望,我们盼了许久的奥运终于来临,我们无比兴奋,憧憬美好的未来。
    \n谁料,我们等到的是:
    \n2月肆虐的雪灾,冻裂了中国大地;3月的拉萨暴力事件,烧伤了美丽的圣地;4月的奥运火炬传递受阻,刺伤了中国人向世界张开的双臂;善变的5月,胶济铁路 火车相撞,撞碎了多少旅人的梦;突然传遍全国的儿童手足口病,令全国父母心头纠结;震动传及东南亚的四川大地震,撼及整个中国的灵魂……
    \n面对困难,面对挫折,我们如此渺小,昨天是地震发生的日志,下班后,看着新闻直播,不断的刷新互联网上的的死亡人数报告,心里无比的痛楚。
    \n看到温总理的不断喊话和鼓励现场的人们,看着写完遗书去现场的突击队员们,看到记者冒着生命危险给大家带来最新的报道,看到朋友们一遍一遍的发送着祝福和祈愿,我们地处安全,却无能为力,我们只能不断的祷告和许愿,希望祖国人民,每个人都能平安,健康,上苍有好生之德,大家一起祈祷,祝愿那些朋友们尽快脱落危险。
    \n附录:转载:一个记者在地震抢救现场给我们上午做的直播?
    \n-----------------
    \n绮梦 10:07:29
    \n现场简直不能看了
    \n绮梦 10:08:33
    \n年过花甲的总理已经哭得不成样子了
    \n绮梦 10:10:16
    \n刚刚挖开的地方又塌方了
    \n绮梦 10:11:24
    \n这倒霉天气还在下雨,现在一线的军人已经被下达死命令,必须冒雨解救
    \n绮梦 10:11:30
    \n我就在现场
    \n绮梦 10:11:56
    \n我现在是在都江堰市
    \n绮梦 10:13:24
    \n交通已经瘫痪了,人员和物资很难运进去
    \n绮梦 10:13:47
    \n汶川现在还不让我们去
    \n绮梦 10:15:21
    \n汶川的交通完全封闭了,现场到底怎么样我不知道,不过早上总理指示军队不管有多大代价,必须进城
    \n绮梦 10:16:03
    \n倒霉天气在下雨,飞机几次都不能降落,伞兵马上就要起飞了
    \n绮梦 10:17:36
    \n飞机在汶川空投物资了
    \n绮梦 10:20:06
    \n被压在废墟下的300多学生现在很危险啊,刚才一次的营救又失败了,现在总理在现场组织再次营救。
    \n绮梦 10:20:47
    \n啊 总理摔到了,
    \n绮梦 10:21:35
    \n照片我正在传给北京,不经过审核的是不允许发布的
    \n绮梦 10:22:21
    \n我和几个同行现在开了9台电脑,同时在传消息
    \n绮梦 10:22:37
    \n这个QQ在关键时候传的真慢
    \n绮梦 10:23:39
    \n突击队又上了
    \n绮梦 10:25:04
    \n如果你现在看见老爷子的样子,你马上就会哭的
    \n绮梦 10:26:40
    \n老爷子的手臂受伤出血了,他把要给他包扎的医务人员推开了
    \n绮梦 10:27:09
    \n好消息,发现一名学生了
    \n绮梦 10:28:00
    \n总理跑到塌方点了,在帮忙呢
    \n绮梦 10:28:13
    \n向峨乡中学
    \n绮梦 10:28:33
    \n拖出来了,医生在抢救
    \n绮梦 10:28:56
    \n部队上来的人还不是很多
    \n绮梦 10:29:07
    \n交通太困难
    \n绮梦 10:29:42
    \n现在还不一定,这个看样子看活着,吊瓶氧气都挂上了
    \n绮梦 10:31:06
    \n啊,又塌了
    \n绮梦 10:31:28
    \n突击队一个人被埋进去了
    \n绮梦 10:31:40
    \n等等,我到前面看看
    \n绮梦 10:36:24
    \n我回来了,抢救出来了
    \n绮梦 10:37:16
    \n最新消息,彭州被困的10万群众危险!!!
    \n绮梦 10:38:49
    \n由于大雨的影响,工程兵几次架桥失败,附近已经出现泥石流迹象,电话直接是叫通总理的,情况很危险!!!
    \n绮梦 10:39:19
    \n由于桥梁倒塌,彭州市10万群众被堵在山中,救灾人员和物资无法运人。已经出现泥石流迹象
    \n绮梦 10:41:11
    \n总理电话里大喊,我不管你们怎么样,我只要这10万群众月兑险,这是命令。他把电话摔了
    \n绮梦 10:41:33
    \n头一次看见老爷子这么厉害
    \n绮梦 10:41:54
    \n汶川现在还没通知去,估计情况不是很好
    \n绮梦 10:42:16
    \n我现在在通讯帐篷里
    \n绮梦 10:43:54
    \n汶川最新消息,雨开始小了,空投物资已经扔下去了,空降兵已经在外围机场登机了
    \n绮梦 10:45:19
    \n现在所有的国外记者都在关注号称中国最精锐的特种部队首次公开亮相
    \n绮梦 10:46:50
    \n总理现在和登机部队领导说话
    \n绮梦 10:47:41
    \n总理说,我就一句话,是人民在养你们,你们自己看着办。
    \n绮梦 11:11:00
    \n大家好,我现在是在军用直升机上,头一次坐这种飞机,很紧张。
    \n绮梦 11:12:51
    \n我现在在直升机上,估计一个小时后就到什肪了
    \n绮梦 11:34:40
    \n最新消息,汶川的映秀、漩口、卧龙三镇通讯信号很弱,至今也无法联系。估计三镇有将近两万多人被困,余震不断,大雨连绵,情况非常严峻,由于能见度太差,无法判断准确情况。总参命令,当空降部队到达汶川上空时,如果条件不允许,就不惜代价强行伞降!
    \n绮梦 11:36:38
    \n没有,飞机要进人雷区了,我要关机了,等会再和你们聊。
    \n附录:
    \nhttp://review.feedsky.com/review/feedsky/iceskysl_1sters//txt/171/r.html~

    \n", "_id"=>813}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails多个应用中共享数据库", "body"=>"

    如果你现在是这样的:

    \n

     

    \n

    \"\"

    \n

    但是想做成这样的:

    \n

    \"\"

    \n

    估计没有类似需求的人是看不明白的,如果有类似需求或者遇到类似问题的,一看到这个标题就能明白我要说的是什么,对,就是在多个Rails应用之间共享一个数据库。

    \n

    用什么?自然是选择插件了,刚刚看到有人放出了这样的插件uses_connection Rails plugin,代码在Github上,有篇介绍的文章(Introducing the "uses_connection" Rails plugin)在railsfreaks上,bdl7x也发了一篇简单的介绍《不同程序同一个数据库连接-插件uses_connection》,在chinaonrails上。看这些,应该就可以明白这个插件是做啥的了。

    \n

    这里说下可能存在的应用场景,你有一套系统对外提供服务,比如说是个新闻发布系统,您需要及时的抓取内容或者发布新的内容,以保证这个新闻系统的及时性,但是在一台主机上操作会比较耗费资源,这个时候,你可以开发几个后端发布系统,分开部署,共享这套数据库,然后就可以使用后端系统轻松发布、增加新的内容到数据库,然后前端输出就可以源源不断了。

    \n

    这个例子可能不是很清晰,但是我相信有类似需求的人一看就明白这样做的好处,我就不多说了。

    ", "created_at"=>2008-05-14 03:24:44 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    如果你现在是这样的:
    \n 
    \n
    \n但是想做成这样的:
    \n
    \n估计没有类似需求的人是看不明白的,如果有类似需求或者遇到类似问题的,一看到这个标题就能明白我要说的是什么,对,就是在多个Rails应用之间共享一个数据库。
    \n用什么?自然是选择插件了,刚刚看到有人放出了这样的插件uses_connection Rails plugin,代码在Github上,有篇介绍的文章(Introducing the "uses_connection" Rails plugin)在railsfreaks上,bdl7x也发了一篇简单的介绍《不同程序同一个数据库连接-插件uses_connection》,在chinaonrails上。看这些,应该就可以明白这个插件是做啥的了。
    \n这里说下可能存在的应用场景,你有一套系统对外提供服务,比如说是个新闻发布系统,您需要及时的抓取内容或者发布新的内容,以保证这个新闻系统的及时性,但是在一台主机上操作会比较耗费资源,这个时候,你可以开发几个后端发布系统,分开部署,共享这套数据库,然后就可以使用后端系统轻松发布、增加新的内容到数据库,然后前端输出就可以源源不断了。
    \n这个例子可能不是很清晰,但是我相信有类似需求的人一看就明白这样做的好处,我就不多说了。

    \n", "_id"=>814}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dreamhost的Share Rails确实已经采用了mod_rails(Passenger)", "body"=>"

    看到http://chinaonrails.com/topic/view/1620.html上说DH已经采用了mod_rails(Passenger ),但是没看到效果,按照其介绍文章"Introducing Passenger for Ruby on Rails",登录我的DH帐户后,果然发现已经支持了,见我抓的图片。

    \n

     

    \n

    \"\"

    \n

    难道mod_rails真的是share rails的好的选择,偶没研究过,不发表观点,不晓得性能如何,晚上切换过去压下试试。

    ", "created_at"=>2008-05-14 10:28:48 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    看到http://chinaonrails.com/topic/view/1620.htmlDH已经采用了mod_rails(Passenger上说 ),但是没看到效果,按照其介绍文章"Introducing Passenger for Ruby on Rails",登录我的DH帐户后,果然发现已经支持了,见我抓的图片。
    \n 
    \n
    \n难道mod_rails真的是share rails的好的选择,偶没研究过,不发表观点,不晓得性能如何,晚上切换过去压下试试。

    \n", "_id"=>815}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用 NetBeans 开发 Blackberry", "body"=>"

    虽然我的Blackberry入手还不是很久,但是非常喜欢的说,看了些软件和API,doc,发现最BB上的开发应该也挺好玩的,毕竟BB还算开放的。

    \n

    如下找到几个相关的文章,没事的时候爱捣鼓捣鼓,写几个自己的小程序用也不错,由于本人偏爱Netbeans,于是关注点就是Netbeans+Blackberry + Mobility了。

    \n

    使用 NetBeans Mobility 开发 Blackberry”说了如何在NB上搭建BB的开发环境,“Service Is Living”这个Blog上不少不错的资料和文章,“Blackberry JDE 4.30 黑莓Java开发环境软件”这里是JDE安装软件,“NetBeans Mobility 开发 Blackberry 的环境设置”这里记录了一些NB上的BB开发环境,其他的都忘记存了,呵呵。

    \n

    要不要增加一个blog分类呢?思考ing....

    ", "created_at"=>2008-05-20 06:59:02 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    虽然我的Blackberry入手还不是很久,但是非常喜欢的说,看了些软件和API,doc,发现最BB上的开发应该也挺好玩的,毕竟BB还算开放的。
    \n如下找到几个相关的文章,没事的时候爱捣鼓捣鼓,写几个自己的小程序用也不错,由于本人偏爱Netbeans,于是关注点就是Netbeans+Blackberry + Mobility了。
    \n“使用 NetBeans Mobility 开发 Blackberry”说了如何在NB上搭建BB的开发环境,“Service Is Living”这个Blog上不少不错的资料和文章,“Blackberry JDE 4.30 黑莓Java开发环境软件”这里是JDE安装软件,“NetBeans Mobility 开发 Blackberry 的环境设置”这里记录了一些NB上的BB开发环境,其他的都忘记存了,呵呵。
    \n要不要增加一个blog分类呢?思考ing....

    \n", "_id"=>816}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"汶川地震,让我震撼的这瞬间", "body"=>"

    毫无疑问,我们每个人或多或少的被汶川大地震中的一些话语,场景,图片,故事感动着,逝者已去,我们不禁回想起自己遇到的一些瞬间,莫名的被感动着,本系列文章是由我们自发组织和撰写的那些真实的,震撼着我们的瞬间。

    \n

    采用Ping(点击文章下方的Trackbacks图标即可看到Trackbacks地址)或者留言的方式告诉我们您撰写的震撼你的那一瞬间,我们将召集网友,翻译成多种语言版本,展示给全世界的人们。

    \n

     

    ", "created_at"=>2008-05-21 02:10:14 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    毫无疑问,我们每个人或多或少的被汶川大地震中的一些话语,场景,图片,故事感动着,逝者已去,我们不禁回想起自己遇到的一些瞬间,莫名的被感动着,本系列文章是由我们自发组织和撰写的那些真实的,震撼着我们的瞬间。
    \n采用Ping(点击文章下方的Trackbacks图标即可看到Trackbacks地址)或者留言的方式告诉我们您撰写的震撼你的那一瞬间,我们将召集网友,翻译成多种语言版本,展示给全世界的人们。
    \n 

    \n", "_id"=>817}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"红十字会紧急救援队,救援队员写下个人资料以备不测", "body"=>"

    \"\"

    \n

    第一次看到这个图片是2008.05.17早上到长沙,坐公交车的时候买的一份义卖报纸上的图片新闻,一群红十字会紧急救援队队员在出发前,队员让其战友在自己的衣服背后写上其个人资料,以备不测。

    \n

    看到上面写的姓名单位血型证号等个人信息,我瞬间被震撼了,他们已经在为遇到的可能危险做准备,如果不幸牺牲,不用等待亲人辨认身份(因为有证号和姓名);如果重伤,不用验血就可以直接输血抢救(因为有血型了),等等。

    \n

    无法猜测当时他们的心情如何,但毫无疑问,我被这样一群勇敢的战士深深的震撼和感动了。

    ", "created_at"=>2008-05-21 02:22:19 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    第一次看到这个图片是2008.05.17早上到长沙,坐公交车的时候买的一份义卖报纸上的图片新闻,一群红十字会紧急救援队队员在出发前,队员让其战友在自己的衣服背后写上其个人资料,以备不测。
    \n看到上面写的姓名,单位,血型,证号等个人信息,我瞬间被震撼了,他们已经在为遇到的可能危险做准备,如果不幸牺牲,不用等待亲人辨认身份(因为有证号和姓名);如果重伤,不用验血就可以直接输血抢救(因为有血型了),等等。
    \n无法猜测当时他们的心情如何,但毫无疑问,我被这样一群勇敢的战士深深的震撼和感动了。

    \n", "_id"=>818}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lockdown: A authentication/authorization system for RubyOnRails", "body"=>"

    RubyOnRails让我们无限惊喜,插件,gem,部署方式,协助方式等等层出不穷,让我们足够的惊喜,今天介绍的是一款用户权限控制系统Lockdown。

    \n

    Lockdown的使用也是足够的简单(包括安装和使用),但是也有些不足和缺陷,后面会说到,但是有些东西还是可以借鉴的。

    \n

    安装方便:

    \n

    $ sudo gem install lockdown
    \n$ cd <your_project_directory>
    \n$ lockdown .

    \n

    使用前需要配置:

    \n

    需要人工在init.rb 中配置角色和权限,不能通过界面维护,这点不是方便。

    \n

    定制不算复杂:

    \n

    定制角色和权限,以及权限的分配不是很复杂,但是显得比较呆板。

    \n

    其他不足:

    \n

    由于其兼顾了merb,导致很多代码混在一起,比较不轻便。

    \n

    详细的使用方法和特点请参考其主页上的说明,不再赘述。

    \n

    其他实现方案:

    \n

    我还是认为我自己写的一款角色控制、分配系统比较好用,只是没有插件化,不方便移植,实现的方式是初始化的时候将资源(action)入库,可以随时建立角色和用户组,每个用户组可以拥有多个角色,每个角色可以拥有多个资源权限,做了一些缓存以提高性能,另外,每次action前作适当的鉴权。

    \n

    有时间可以改成插件或者gem。。

    ", "created_at"=>2008-05-21 03:20:37 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    RubyOnRails让我们无限惊喜,插件,gem,部署方式,协助方式等等层出不穷,让我们足够的惊喜,今天介绍的是一款用户权限控制系统Lockdown。
    \nLockdown的使用也是足够的简单(包括安装和使用),但是也有些不足和缺陷,后面会说到,但是有些东西还是可以借鉴的。
    \n安装方便:
    \n$ sudo gem install lockdown
    \n$ cd <your_project_directory>
    \n$ lockdown .
    \n使用前需要配置:
    \n需要人工在init.rb 中配置角色和权限,不能通过界面维护,这点不是方便。
    \n定制不算复杂:
    \n定制角色和权限,以及权限的分配不是很复杂,但是显得比较呆板。
    \n其他不足:
    \n由于其兼顾了merb,导致很多代码混在一起,比较不轻便。
    \n详细的使用方法和特点请参考其主页上的说明,不再赘述。
    \n其他实现方案:
    \n我还是认为我自己写的一款角色控制、分配系统比较好用,只是没有插件化,不方便移植,实现的方式是初始化的时候将资源(action)入库,可以随时建立角色和用户组,每个用户组可以拥有多个角色,每个角色可以拥有多个资源权限,做了一些缓存以提高性能,另外,每次action前作适当的鉴权。
    \n有时间可以改成插件或者gem。。

    \n", "_id"=>819}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇ActionController::InvalidAuthenticityToken", "body"=>"

    一直没有自己亲自试试客户端直接POST一些数据到rails应用上,今天正好遇到这个需求,原以为会很简单的,在应用中加个action响应,再组合一个hash数据Post到这个action上就好了,赶紧试试,却遭遇ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)错误,唉,貌似有点不对哦.

    \n

    Google下,找到

    ", "created_at"=>2008-05-21 14:55:17 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一直没有自己亲自试试客户端直接POST一些数据到rails应用上,今天正好遇到这个需求,原以为会很简单的,在应用中加个action响应,再组合一个hash数据Post到这个action上就好了,赶紧试试,却遭遇ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)错误,唉,貌似有点不对哦.
    \nGoogle下,找到

    \n", "_id"=>820}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新增“安全相关 | Security”分类", "body"=>"

    网络安全绝对是个很有前途的领域,同样,新技术层出不穷,手法和花样就像病毒变种一样,非常丰富。我接触安全领域有段历史了,现在依然是一个网络安全杂志的“新漏洞”栏目编辑和策划,自身对安全漏洞比较关注,尽管我的Rails的漏洞关注的不多,但是凭着这么多年的功底,还是比较容易的啦。

    \n

    本分类将关注Rails或者其他的语言或者系统的Security问题,例如SQL,CFRS,XSS等等以往的或者最新的安全知识,主要是针对RubyOnRails的安全问题予以分析和说明,并发布我发现的一些bug或者其他讯息。

    \n

    另外,本分类会经常关注其他同类bloger撰写的外文文章,做一些测试和再组合,以使得更多的国内读者能了解最新的Security问题。

    \n

    如果您有类似心得,还望交流指教,谢谢。

    ", "created_at"=>2008-05-22 03:06:19 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    网络安全绝对是个很有前途的领域,同样,新技术层出不穷,手法和花样就像病毒变种一样,非常丰富。我接触安全领域有段历史了,现在依然是一个网络安全杂志的“新漏洞”栏目编辑和策划,自身对安全漏洞比较关注,尽管我的Rails的漏洞关注的不多,但是凭着这么多年的功底,还是比较容易的啦。
    \n本分类将关注Rails或者其他的语言或者系统的Security问题,例如SQL,CFRS,XSS等等以往的或者最新的安全知识,主要是针对RubyOnRails的安全问题予以分析和说明,并发布我发现的一些bug或者其他讯息。
    \n另外,本分类会经常关注其他同类bloger撰写的外文文章,做一些测试和再组合,以使得更多的国内读者能了解最新的Security问题。
    \n如果您有类似心得,还望交流指教,谢谢。

    \n", "_id"=>821}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CSRF: 不要低估了我的危害和攻击能力", "body"=>"
    \n
    \n
    CSRF这种攻击方式虽然提出来很久(在2006年的时候就有了)了,但是这个沉睡的攻击巨人直到前不久才逐渐走入我们的视线,到底CSRF是啥,危害到底有多大?常见的利用方式是如何的,今天作为“安全相关 | Security”分类的第一篇文章,我按照自己的理解告诉你,不要低估了CSRF危害性和攻击能力。
    \n
    \n一、什么是CSRF

    \n先看看CSRF的原文说明,如下:
    \n
    \n
    Cross Site Reference Forgery works by including malicious code or a link in a page that accesses a web application that the user is believed to have authenticated. If the session for that web application has not timed out, an attacker may execute unauthorized commands.
    \n
    二、CSRF案例说明和分析
    \n自然,这里拿Rails程序来举例子说明这些问题,大家知道Rails2之前是把session放在服务器端(文件或者DB或者缓存中),客户但在 cookie中保存sessionid;而到了Rails2后,还有一种方式是把session放在基于cookie的客户端中。当然这两样都各有道理, 各有优劣,不在我们这次说的范围之内。我们继续说,当我们向一个域名发送一个请求的时候,如果本店存在这个域名的cookie,浏览器会自动的把 cookie附带上。这样本来没有啥问题,也是我们为了解决http无状态记录的解决方案,但是有个问题出现了,如果出现一个到其他域名的请求,浏览区在 加载的时候,也把cookie给带上了,会有什么问题?我们举个简单的也很常见的例子来说明这个问题。
    \n-----------------------------案例------------------------------
    \n1、Bob在自己的电脑上刚刚查看完自己的银行A账户余额,然后比较无聊就跑到一个公开的BBS上灌水,当他看到一篇“银行A的内部照片”的帖子,很有兴趣的打开这个帖子想看看自己信任的银行A的内部图片是啥样子的,殊不知,这其实是一个attacker精心设计的骗局。
    \n2、在这个帖子中确实有几个图片,看上去真的像是银行A的照片,但是其中有个图片没显示出来,Bob以为是自己网速太慢,导致这个图片没有加载进来,也没在意。只是对这些并不是十分满意的照片摇摇头,就关了这个帖子。
    \n3、几天后,Bob猛然发现自己在银行A的账户上少了1000元,到底是怎么了?
    \n
    \n分析:

    \n为什么钱少了呢?我们得分析一下上面这个案例,好记得当时Bob说有个图片没显示么,是的,我们来看看这个图片的地址,惊奇的发现是:<img .src="http://www.banka.com/transfer?account=myself&amount=1000&destination=attacker">,这是一个什么地址?聪明的您一定很快就能明白,这个地址是邪恶的,看上去,他的意思是打开这个地址的人,给attacker转了1000元。
    \n这怎么可能?你肯定急了,我怎么能随便给一个人转1000元呢,而且我都不知道呀!但是,注意了,这其实是完全有可能的。还记得当时Bob刚刚查看完整及的帐号信息,基于银行A的cookie并不过期,当出现如上链接出现在src的时候(
    note that .src is meant to be src),浏览器尝试着按照本地的cookie去加载上面这个URL,而银行A验证了来源请求的cookie是可以的,所以就这样事情就悄悄的发生了。
    \n
    -------------------------------案例结束---------------------------
    \n
    \n
    ok,看明白了么,这就是CSRF,一句话给他下个定义就是:借你的cookie在你不知道的时候悄悄的做了一些你不愿意做 的事情。恶日期这里有个更要命的是,这个包含上述URL的图片或者链接,并不需要一定是放在银行A的服务器上,相反可以在任一地方,比如blog,公开的 BBS,或者一些群发的Mail中等等,如此多的场合下,这些都有可能存在陷阱。
    \n再看一副图片吧,其说明的正是CSRF的攻击原理。
    \n\"\"
    \n
    \n 三、CSRF的预防
    \n看上去很恐怖吧,是的,确实恐怖,意识到恐怖是个好事情,这样会促使你接着往下看如何改进和防止类似的漏洞出现。
    \n总体来说,预防CSRF主要从2个方面入手,分别是:
    \n1、正确使用GET,POST和Cookie;
    \n2、在non-GET请求中使用Security token;
    \n
    \n
    一般上,大家知道的浏览器发送请求的方式有GET或者POST,但是还有一种比较常用的是Cookie,至于其他的HTTP协议请求方式,你可以google,一般按照W3C的规范:
    \n1、GET常用在查看,列举,展示的时候;
    \n2、POST常用在下达订单,改变一个资源的属性或者做其他一些事情

    \n
    \nok,我们这里拿Rails按照前面列举的2种预防手段做说明,首先,我们可以在Rails的控制权中(controller)将一些方法(action)限定(verify)为只能使用POST或者GET,例如:\n
    \n
    Ruby代码
    \n
      \n
    1. verify :method => :post:only => [ :transfer ], :redirect_to => { :action => :list }   
    2. \n
    \n
    \n恩,很好,这样做下限制以后,前面案例中的方法就失效了,因为这里我们限定了transfer必须使用POST来提交请求,当GET请求来的时候并不会被响应。
    \n万事大吉了?NO!因为POST的请求也是可以被构造出来后自动发送的,如何实现,看下面吧,你肯定会吃惊的。
    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <a .href="http://www.1sters.com/" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 'http://www.example.com/account/destroy'; f.submit();return false;">点我试试</a>  
    2. \n
    \n
    \n是的,这就是一个活生生的例子(.href is meant to be href),使用link的href或者img的src都可以的,再想想一个Attacher放了一个图片,然后写了一个
    onmouseover方法,执行上述的那段JS,如下,或者使用AJAX。\n
    \n
    XML/HTML代码
    \n
      \n
    1. <img .src="http://www.harmless.com/img" width="400" height="400" onmouseover="…" /> 
      \n
    2. \n
    \n
    \n所以,限定为POST后还不是非常的保险,怎么办?不急,我们还有第二步,给non-GET的请求设置 security token,如何实现,在Rails2以后非常简单(也是默认的),我们只需要在environment.rb中添加如下代码:
    \n
    \n
    Ruby代码
    \n
      \n
    1. config.action_controller.session = {  
    2. \n
    3.   :session_key => '_csrf_session',  
    4. \n
    5.   :secret      => 'ae4b43dda38ff78bb50898b2935da76d1e224061ab72a9399d34cea4c6178eee6dae815fff920a20642f27abda83b793da4e9b6cf20c4838805e80abf53e318a'  
    6. \n
    7. }  
    8. \n
    \n
    \n然后
    application controller中包含如下security token设置:
    \n
    \n
    Ruby代码
    \n
      \n
    1. protect_from_forgery  :secret => '053cef294a333f72c3584311799c69d2' 
    2. \n
    \n
    \nok,基本上安全了,如果这时POST请求过去,但是
    security token和session计算出来的secret和服务端的secret匹配不上的话,就会返回一个ActionController::InvalidAuthenticityToken错误,防止该类缺陷的出现。
    \n安全了,也许你要说,那我如果能破解出
    protect_from_forgery,不进OK了么,按照理论上是,但是实际是破解是基本上不可能的,因为有人曾计算过,暴力破解该串大概需要2的11次方时间,后续我将再写一篇文章详细的介绍,这里不再赘述。
    \n
    \n
    四、总结
    \n总的来说,CSRF的兴起刚刚开始,网络上肯定会有一股热潮,Railser们一定要注意自己的程序的安全性,CSRF比你我能想到的更有威胁,千万别小瞧了它。
    ", "created_at"=>2008-05-22 03:48:41 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    CSRF这种攻击方式虽然提出来很久(在2006年的时候就有了)了,但是这个沉睡的攻击巨人直到前不久才逐渐走入我们的视线,到底CSRF是啥,危害到底有多大?常见的利用方式是如何的,今天作为“安全相关 | Security”分类的第一篇文章,我按照自己的理解告诉你,不要低估了CSRF危害性和攻击能力。
    \n
    \n一、什么是CSRF
    \n先看看CSRF的原文说明,如下:
    \n
    \nCross Site Reference Forgery works by including malicious code or a link in a page that accesses a web application that the user is believed to have authenticated. If the session for that web application has not timed out, an attacker may execute unauthorized commands.
    \n二、CSRF案例说明和分析
    \n自然,这里拿Rails程序来举例子说明这些问题,大家知道Rails2之前是把session放在服务器端(文件或者DB或者缓存中),客户但在 cookie中保存sessionid;而到了Rails2后,还有一种方式是把session放在基于cookie的客户端中。当然这两样都各有道理, 各有优劣,不在我们这次说的范围之内。我们继续说,当我们向一个域名发送一个请求的时候,如果本店存在这个域名的cookie,浏览器会自动的把 cookie附带上。这样本来没有啥问题,也是我们为了解决http无状态记录的解决方案,但是有个问题出现了,如果出现一个到其他域名的请求,浏览区在 加载的时候,也把cookie给带上了,会有什么问题?我们举个简单的也很常见的例子来说明这个问题。
    \n-----------------------------案例------------------------------
    \n1、Bob在自己的电脑上刚刚查看完自己的银行A账户余额,然后比较无聊就跑到一个公开的BBS上灌水,当他看到一篇“银行A的内部照片”的帖子,很有兴趣的打开这个帖子想看看自己信任的银行A的内部图片是啥样子的,殊不知,这其实是一个attacker精心设计的骗局。
    \n2、在这个帖子中确实有几个图片,看上去真的像是银行A的照片,但是其中有个图片没显示出来,Bob以为是自己网速太慢,导致这个图片没有加载进来,也没在意。只是对这些并不是十分满意的照片摇摇头,就关了这个帖子。
    \n3、几天后,Bob猛然发现自己在银行A的账户上少了1000元,到底是怎么了?
    \n
    \n分析:
    \n为什么钱少了呢?我们得分析一下上面这个案例,好记得当时Bob说有个图片没显示么,是的,我们来看看这个图片的地址,惊奇的发现是:<img .src="http://www.banka.com/transfer?account=myself&amount=1000&destination=attacker;">,这是一个什么地址?聪明的您一定很快就能明白,这个地址是邪恶的,看上去,他的意思是打开这个地址的人,给attacker转了1000元。
    \n这怎么可能?你肯定急了,我怎么能随便给一个人转1000元呢,而且我都不知道呀!但是,注意了,这其实是完全有可能的。还记得当时Bob刚刚查看完整及的帐号信息,基于银行A的cookie并不过期,当出现如上链接出现在src的时候(note that .src is meant to be src),浏览器尝试着按照本地的cookie去加载上面这个URL,而银行A验证了来源请求的cookie是可以的,所以就这样事情就悄悄的发生了。
    \n-------------------------------案例结束---------------------------
    \n
    \nok,看明白了么,这就是CSRF,一句话给他下个定义就是:借你的cookie在你不知道的时候悄悄的做了一些你不愿意做 的事情。恶日期这里有个更要命的是,这个包含上述URL的图片或者链接,并不需要一定是放在银行A的服务器上,相反可以在任一地方,比如blog,公开的 BBS,或者一些群发的Mail中等等,如此多的场合下,这些都有可能存在陷阱。
    \n再看一副图片吧,其说明的正是CSRF的攻击原理。
    \n
    \n
    \n 三、CSRF的预防
    \n看上去很恐怖吧,是的,确实恐怖,意识到恐怖是个好事情,这样会促使你接着往下看如何改进和防止类似的漏洞出现。
    \n总体来说,预防CSRF主要从2个方面入手,分别是:
    \n1、正确使用GET,POST和Cookie;
    \n2、在non-GET请求中使用Security token;
    \n
    \n一般上,大家知道的浏览器发送请求的方式有GET或者POST,但是还有一种比较常用的是Cookie,至于其他的HTTP协议请求方式,你可以google,一般按照W3C的规范:
    \n1、GET常用在查看,列举,展示的时候;
    \n2、POST常用在下达订单,改变一个资源的属性或者做其他一些事情;
    \n
    \nok,我们这里拿Rails按照前面列举的2种预防手段做说明,首先,我们可以在Rails的控制权中(controller)将一些方法(action)限定(verify)为只能使用POST或者GET,例如:
    \n
    \nRuby代码
    \n
    \n verify :method => :post, :only => [ :transfer ], :redirect_to => { :action => :list }   
    \n
    \n
    \n恩,很好,这样做下限制以后,前面案例中的方法就失效了,因为这里我们限定了transfer必须使用POST来提交请求,当GET请求来的时候并不会被响应。
    \n万事大吉了?NO!因为POST的请求也是可以被构造出来后自动发送的,如何实现,看下面吧,你肯定会吃惊的。
    \n
    \nXML/HTML代码
    \n
    \n <a .href="http://www.1sters.com/" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 'http://www.example.com/account/destroy f.submit();return false';;">点我试试</a>  
    \n
    \n
    \n是的,这就是一个活生生的例子(.href is meant to be href),使用link的href或者img的src都可以的,再想想一个Attacher放了一个图片,然后写了一个onmouseover方法,执行上述的那段JS,如下,或者使用AJAX。
    \n
    \nXML/HTML代码
    \n
    \n <img .src="http://www.harmless.com/img" width="400" height="400" onmouseover="…" /> 
    \n
    \n
    \n
    \n所以,限定为POST后还不是非常的保险,怎么办?不急,我们还有第二步,给non-GET的请求设置 security token,如何实现,在Rails2以后非常简单(也是默认的),我们只需要在environment.rb中添加如下代码:
    \n
    \nRuby代码
    \n
    \n config.action_controller.session = {  
    \n   :session_key => '_csrf_session',  
    \n   :secret      => 'ae4b43dda38ff78bb50898b2935da76d1e224061ab72a9399d34cea4c6178eee6dae815fff920a20642f27abda83b793da4e9b6cf20c4838805e80abf53e318a'  
    \n }  
    \n
    \n
    \n然后在application controller中包含如下security token设置:
    \n
    \nRuby代码
    \n
    \n protect_from_forgery  :secret => '053cef294a333f72c3584311799c69d2' 
    \n
    \n
    \nok,基本上安全了,如果这时POST请求过去,但是security token和session计算出来的secret和服务端的secret匹配不上的话,就会返回一个ActionController::InvalidAuthenticityToken错误,防止该类缺陷的出现。
    \n安全了,也许你要说,那我如果能破解出protect_from_forgery,不进OK了么,按照理论上是,但是实际是破解是基本上不可能的,因为有人曾计算过,暴力破解该串大概需要2的11次方时间,后续我将再写一篇文章详细的介绍,这里不再赘述。
    \n
    \n四、总结
    \n总的来说,CSRF的兴起刚刚开始,网络上肯定会有一股热潮,Railser们一定要注意自己的程序的安全性,CSRF比你我能想到的更有威胁,千万别小瞧了它。

    \n", "_id"=>822}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Sites开放,建立IceskYsl@Docs", "body"=>"

    很早前就用上了Google Docs来写一些技术文档,我个人觉得用GoogleDocs些技术文档相当好,可以随时修改和编辑,且可以保存版本信息,非常好。
    \n我已经使用GoogleDocs写了诸如“使用Amazon S3做资料存储”,“Twitter的Widget实现探析”,"Amazon SQS,分布式作业不再费心","CSRF: 不要低估了我的危害和攻击能力"等技术文档,也曾在blog上发布了一些,以前都是在Blog简要的写个介绍,然后贴上Docs的链接地址,但是一直有个问题困扰我。
    \n我理想的状态是可以在页面上直接展示发布的docs,这样看上去更加直观,而不用每次都再点一次链接,曾经尝试过GoogleBlogger,但是除了被GFW外,他的布局我也不是很喜欢。一直在寻找另外可行的方式。
    \n今天看到Gseeker上说到Google Sites正式开放,Google Sites我以前也试过,只是当时还不成熟,竟然这次正式开放了,那么肯定比较成熟了。
    \n\"\"
    \n赶紧试试,很不错,正好满足我的需要,于是赶快建立一个IceskYsl@Docs,把以前在Doc上写的文档都包含进去,效果挺好,除了可以插入Doc外,还可以插入表格,视频等等。
    \n
    \n以后我还使用Doc写更多的技术文档,并随时更新,修改,届时将第一时间放在IceskYsl@Docs上,同时将会在这个blog上的发布。
    \n
    \n有兴趣的赶紧去瞧瞧吧,有啥子问题记得给我留言。

    ", "created_at"=>2008-05-22 12:39:29 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很早前就用上了Google Docs来写一些技术文档,我个人觉得用GoogleDocs些技术文档相当好,可以随时修改和编辑,且可以保存版本信息,非常好。
    \n我已经使用GoogleDocs写了诸如“使用Amazon S3做资料存储”,“Twitter的Widget实现探析”,"Amazon SQS,分布式作业不再费心","CSRF: 不要低估了我的危害和攻击能力"等技术文档,也曾在blog上发布了一些,以前都是在Blog简要的写个介绍,然后贴上Docs的链接地址,但是一直有个问题困扰我。
    \n我理想的状态是可以在页面上直接展示发布的docs,这样看上去更加直观,而不用每次都再点一次链接,曾经尝试过GoogleBlogger,但是除了被GFW外,他的布局我也不是很喜欢。一直在寻找另外可行的方式。
    \n今天看到Gseeker上说到Google Sites正式开放,Google Sites我以前也试过,只是当时还不成熟,竟然这次正式开放了,那么肯定比较成熟了。
    \n
    \n赶紧试试,很不错,正好满足我的需要,于是赶快建立一个IceskYsl@Docs,把以前在Doc上写的文档都包含进去,效果挺好,除了可以插入Doc外,还可以插入表格,视频等等。
    \n
    \n以后我还使用Doc写更多的技术文档,并随时更新,修改,届时将第一时间放在IceskYsl@Docs上,同时将会在这个blog上的发布。
    \n
    \n有兴趣的赶紧去瞧瞧吧,有啥子问题记得给我留言。

    \n", "_id"=>823}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CsrfKiller: 看CSRF还怎么乐的起来", "body"=>"

    前面一篇文章《CSRF: 不要低估了我的危害和攻击能力》说到了CSRF是相当恐怖的,前面也说了,在Rails2中可以设置安全码来进一步的防止,另外,今天给大家分享一个插件,是csrf_killer,详细的介绍请参考README

    \n``CsrfKiller
    ==========

    This plugin helps protect against possible CSRF attacks. If you don't know what a Cross Site Request Forgery attack is, check these links:

    * http://isc.sans.org/diary.html?storyid=1750
    * http://en.wikipedia.org/wiki/Cross-site_request_forgery

    This plugin works by extending all forms created with #form_tag (including #form_for, #form_remote_tag, and #remote_form_for) by adding
    a token unique to each session id. It also adds a filter that checks all non-GET requests for the existence of this token. This should
    ensure that all non-GET actions have been correctly submitted from a form on your site.```", "created_at"=>2008-05-22 13:28:39 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前面一篇文章《CSRF: 不要低估了我的危害和攻击能力》说到了CSRF是相当恐怖的,前面也说了,在Rails2中可以设置安全码来进一步的防止,另外,今天给大家分享一个插件,是csrf_killer,详细的介绍请参考README。
    \n<strong>CsrfKiller</strong><br />==========<br /><br />This plugin helps protect against possible CSRF attacks. If you don't know what a Cross Site Request Forgery attack is, check these links:<br /><br />* http://isc.sans.org/diary.html?storyid=1750<br />* http://en.wikipedia.org/wiki/Cross-site_request_forgery<br /><br />This plugin works by extending all forms created with #form_tag (including #form_for, #form_remote_tag, and #remote_form_for) by adding<br />a token unique to each session id. It also adds a filter that checks all non-GET requests for the existence of this token. This should<br />ensure that all non-GET actions have been correctly submitted from a form on your site.`

    \n", "_id"=>824}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"与时俱进,使用Git", "body"=>"

    与时俱进总是好的,由Rails带动起来的东西真的不少,虽然Git早已大名鼎鼎,但是一直没有走入一般开发人员的视线,而Rails的到来,把Git带入了大家的视野,普遍认为Git比SVN更懂得协作的概念,呵呵,N多人推荐呀,眼看着merb,rails,vlad以及许多的gems都转移到Git,偶也安奈不住了。

    \n

    其实关注GIt挺早了,草草的看了几篇介绍,囫囵吞枣,没有看到其哦精髓,以为没啥了不起的,于是乎就没有继续深入进去,今天周末晚上,终于又想来了,把他从头到尾的看了一遍,看了不少文章(外文居多 ),总算得到一些启示,Git很好,很强大,不多说,下次有机会再说吧,反正偶已经悄悄的用上了Git。

    \n

    推荐几个参考文档,都读完就会了:

    \n

    http://git.or.cz/course/svn.html

    \n

    http://www.bitsun.com/documents/gittutorcn.htm

    \n

    http://eagain.net/articles/git-for-computer-scientists/

    ", "created_at"=>2008-05-23 16:19:22 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    与时俱进总是好的,由Rails带动起来的东西真的不少,虽然Git早已大名鼎鼎,但是一直没有走入一般开发人员的视线,而Rails的到来,把Git带入了大家的视野,普遍认为Git比SVN更懂得协作的概念,呵呵,N多人推荐呀,眼看着merb,rails,vlad以及许多的gems都转移到Git,偶也安奈不住了。
    \n其实关注GIt挺早了,草草的看了几篇介绍,囫囵吞枣,没有看到其哦精髓,以为没啥了不起的,于是乎就没有继续深入进去,今天周末晚上,终于又想来了,把他从头到尾的看了一遍,看了不少文章(外文居多 ),总算得到一些启示,Git很好,很强大,不多说,下次有机会再说吧,反正偶已经悄悄的用上了Git。
    \n推荐几个参考文档,都读完就会了:
    \nhttp://git.or.cz/course/svn.html
    \nhttp://www.bitsun.com/documents/gittutorcn.htm
    \nhttp://eagain.net/articles/git-for-computer-scientists/

    \n", "_id"=>825}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将1stlog迁移到GitHub上.", "body"=>"

    经过昨天的试用,发现GIT真的很不错,于是将1stlog迁移了过去,原来GoogleCode上的SVN将保持同步更新,另外主要活动将在Git上,望周知。
    \n
    \nPublic Clone URL:git://github.com/IceskYsl/1stlog.git
    \nGit地址:http://github.com/IceskYsl/1stlog/tree
    \n
    \n稍微赶紧了下,发现GitHub还真是快,相当的快,难怪昨天Raecoo说“速度是相当的棒!”,虽然还是有点不熟悉,但是还是觉得Git还是挺好的。
    \n继续学习中,继续开发中...

    ", "created_at"=>2008-05-24 02:30:17 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    经过昨天的试用,发现GIT真的很不错,于是将1stlog迁移了过去,原来GoogleCode上的SVN将保持同步更新,另外主要活动将在Git上,望周知。
    \n
    \nPublic Clone URL:git://github.com/IceskYsl/1stlog.git
    \nGit地址:http://github.com/IceskYsl/1stlog/tree
    \n
    \n稍微赶紧了下,发现GitHub还真是快,相当的快,难怪昨天Raecoo说“速度是相当的棒!”,虽然还是有点不熟悉,但是还是觉得Git还是挺好的。
    \n继续学习中,继续开发中...

    \n", "_id"=>826}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Vlad通过Git在 Nginx+mogrels上部署RubyOnRails应用.", "body"=>"

    一个周末又快过完了,这个周末主要看了下如何自动部署RubyOnRails,目前用的比较多的是capistrano和Vlad,两者各有优缺点,但是考虑到自身的情况和未来的趋势,我主要看的是Vlad,这里就说说如何试用Vlad来把RoR应用自动部署到Nginx,Mogrels,当然,我们这里就不堪SVN了,我们看看Git的实现。

    \n

    Vlad的最新版本中已经支持了Git,但是尚不支持Nginx,于是我们需要自己代码,我在GitHub上fork了一份Vlad的代码,然后添加了对nginx的支持,然后就按照自己的使用方便,修改了他的core文件,添加了自动生成配置文件的方法。

    \n

    1、增加对Nginx的支持,可以通过Vlad来start,stop,restart Nginx服务器;

    \n

    2、可以自动生成匹配web服务器,app服务器和scm的deploy.rb配置文件;

    \n

    3、可以根据deploy.rb自动生成合适的nginx的配置文件,并上传到服务器;(需要rsync支持.)

    \n

    4、可以通过Git自动clone需要的代码,自动发布。(需要服务器上有git支持)

    \n

    详细的信息,感兴趣的可以查看我的vlad的git,使用帮助信息,请查看“/how_to_generate_configs.txt”,有啥子意见,请告诉我,:)

    ", "created_at"=>2008-05-25 15:33:09 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一个周末又快过完了,这个周末主要看了下如何自动部署RubyOnRails,目前用的比较多的是capistrano和Vlad,两者各有优缺点,但是考虑到自身的情况和未来的趋势,我主要看的是Vlad,这里就说说如何试用Vlad来把RoR应用自动部署到Nginx,Mogrels,当然,我们这里就不堪SVN了,我们看看Git的实现。
    \nVlad的最新版本中已经支持了Git,但是尚不支持Nginx,于是我们需要自己代码,我在GitHub上fork了一份Vlad的代码,然后添加了对nginx的支持,然后就按照自己的使用方便,修改了他的core文件,添加了自动生成配置文件的方法。
    \n1、增加对Nginx的支持,可以通过Vlad来start,stop,restart Nginx服务器;
    \n2、可以自动生成匹配web服务器,app服务器和scm的deploy.rb配置文件;
    \n3、可以根据deploy.rb自动生成合适的nginx的配置文件,并上传到服务器;(需要rsync支持.)
    \n4、可以通过Git自动clone需要的代码,自动发布。(需要服务器上有git支持)
    \n详细的信息,感兴趣的可以查看我的vlad的git,使用帮助信息,请查看“/how_to_generate_configs.txt”,有啥子意见,请告诉我,:)

    \n", "_id"=>827}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"git-svn: 整合使用git和svn", "body"=>"

    前面已经说了“与时俱进,使用Git”,用了几天git后,越来越觉得不错,如下说说SVNGit的主要区别:

    \n
    \n

    Git是分布式SCM,而SVN是基于服务器的,也就是说每个开发者本地都有一套git库,每个人维护自己的版本(或者合并其他人的版本),而SVN是每个人写完代码后都及时的checkin到服务器上,进行合并。

    \n
    \n

    如果上面这段话还不能让你真正了解Git的好处,而不想使用git来替代你的svn的话,那么我再列举几个我认为不错的比较直观的场景:

    \n

    1、可以在本地(离线)就做好版本控制,而不用时刻连网,特别是Soho一族或者喜欢经常到处跑,又喜欢在路上、车上或者马路旁边的小凳子上coding的人;这个时候你可以在自己的Git库上进行版本控制,而不用到处找网络把代码搞到svn上去。

    \n

    2、分布式的SCM更加安全和健壮,有没有想过,如果你的SVN版本服务器挂掉了(硬盘坏了或者网络不可用等等),你会咋样,能修复的好么,一旦修复不好,资料都完蛋了,而Git的分布式SCM,其中的几个节点挂掉影响并不大。

    \n

    3、速度,你如果使用GoogleCode或者其他的SVN服务的话,不知道你是否有呆呆的等待chenkin完成的情况(我是经常有的),而Git,毫无疑问,速度快的多,(就算是使用GitHub也快),究其原因,应该是Git是打包好了上传,而不像SVN单个文件上传。

    \n

    4、版本、分支管理

    \n

    还有啥?想不来了,差不多就这样了,视个人情况而定,但是我认为Git会让你更加满意。

    \n

    但是有人可能会有这样的想法,我本地使用git,然后定时的checkin到SVN上,这样岂不是更好,啊哈,好吧,你还不习惯或者还有其他的特殊情况(比如其他开发者不喜欢git,或者原来的代码在svn上等等),这里看看如何把git和svn结合起来一起使用。

    \n

    1、比较笨的方法

    \n

    同时使用Git和SVN,然后再各自的“忽略”列表里面加加上对方的版本库,比如在svn的忽略列表中加上.git,而同时在git的.gitignore中加上.svn;然后执行各自的命令。

    \n

    2、比较靠谱的方法

    \n

    使用git-svn应该算更加科学和靠谱的方法,安装好git-svn(这个是需要单独安装的)后,就可以使用啦,基本上是这样的:

    \n

    mkdir 1stlog
    \ncd 1stlog && git-svn init http://1stlog.googlecode.com/svn/trunk/

    \n

    其他的就不多说了,可以参考“git and subversion”和“Howto use Git and svn together”以及“git-svn 常用功能示例”。

    ", "created_at"=>2008-05-27 05:14:42 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前面已经说了“与时俱进,使用Git”,用了几天git后,越来越觉得不错,如下说说SVN和Git的主要区别:
    \n
    \nGit是分布式SCM,而SVN是基于服务器的,也就是说每个开发者本地都有一套git库,每个人维护自己的版本(或者合并其他人的版本),而SVN是每个人写完代码后都及时的checkin到服务器上,进行合并。
    \n
    \n如果上面这段话还不能让你真正了解Git的好处,而不想使用git来替代你的svn的话,那么我再列举几个我认为不错的比较直观的场景:
    \n1、可以在本地(离线)就做好版本控制,而不用时刻连网,特别是Soho一族或者喜欢经常到处跑,又喜欢在路上、车上或者马路旁边的小凳子上coding的人;这个时候你可以在自己的Git库上进行版本控制,而不用到处找网络把代码搞到svn上去。
    \n2、分布式的SCM更加安全和健壮,有没有想过,如果你的SVN版本服务器挂掉了(硬盘坏了或者网络不可用等等),你会咋样,能修复的好么,一旦修复不好,资料都完蛋了,而Git的分布式SCM,其中的几个节点挂掉影响并不大。
    \n3、速度,你如果使用GoogleCode或者其他的SVN服务的话,不知道你是否有呆呆的等待chenkin完成的情况(我是经常有的),而Git,毫无疑问,速度快的多,(就算是使用GitHub也快),究其原因,应该是Git是打包好了上传,而不像SVN单个文件上传。
    \n4、版本、分支管理
    \n还有啥?想不来了,差不多就这样了,视个人情况而定,但是我认为Git会让你更加满意。
    \n但是有人可能会有这样的想法,我本地使用git,然后定时的checkin到SVN上,这样岂不是更好,啊哈,好吧,你还不习惯或者还有其他的特殊情况(比如其他开发者不喜欢git,或者原来的代码在svn上等等),这里看看如何把git和svn结合起来一起使用。
    \n1、比较笨的方法
    \n同时使用Git和SVN,然后再各自的“忽略”列表里面加加上对方的版本库,比如在svn的忽略列表中加上.git,而同时在git的.gitignore中加上.svn;然后执行各自的命令。
    \n2、比较靠谱的方法
    \n使用git-svn应该算更加科学和靠谱的方法,安装好git-svn(这个是需要单独安装的)后,就可以使用啦,基本上是这样的:
    \nmkdir 1stlog
    \ncd 1stlog && git-svn init http://1stlog.googlecode.com/svn/trunk/
    \n其他的就不多说了,可以参考“git and subversion”和“Howto use Git and svn together”以及“git-svn 常用功能示例”。

    \n", "_id"=>828}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,正式向所有用户开放并推出收费计划", "body"=>"

    \"\"
    \n经常来我blog的人应该还记得,前段时间介绍了“Google App Engine,前途无量,充满乐趣”,当时还是内测版本,我也去晚了没有申请到,只是下了SDK看了下,觉得很有前途,并说了多Amazon的EC2等服务有竞争关系(后来不久Amazon就降价了)。

    \n

    刚刚看到Gseeker上放出消息说“Google App Engine向所有用户开放 推出收费计划”,貌似不错,赶紧去试试,发现我的mail还在waitlist里面,囧~~

    \n

    但是,消息应该是真的,因为其实Google在“Google I/O大会”上宣布的,只是貌似还是只针对Py的支持,对Rails等还不支持,继续等待,也等待Amazon有没有其他的动作。

    ", "created_at"=>2008-05-28 05:46:59 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    经常来我blog的人应该还记得,前段时间介绍了“Google App Engine,前途无量,充满乐趣”,当时还是内测版本,我也去晚了没有申请到,只是下了SDK看了下,觉得很有前途,并说了多Amazon的EC2等服务有竞争关系(后来不久Amazon就降价了)。
    \n刚刚看到Gseeker上放出消息说“Google App Engine向所有用户开放 推出收费计划”,貌似不错,赶紧去试试,发现我的mail还在waitlist里面,囧~~
    \n但是,消息应该是真的,因为其实Google在“Google I/O大会”上宣布的,只是貌似还是只针对Py的支持,对Rails等还不支持,继续等待,也等待Amazon有没有其他的动作。

    \n", "_id"=>829}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我为什么那么喜欢GoogleDoc呢?", "body"=>"

    很早前就说过,我非常喜欢使用GoogleDoc来写技术文章,其好处有很多:

    \n

    \"\"

    \n

    1、编辑、组织、协作、维护方便

    \n

    GoogleDoc编辑器我非常喜欢,去掉Word中那些我基本上用不上的功能,而只提供需要的功能,这是比较难得可贵的,“不要让用户思考”是一种好的用户体验,而我深信,google在这个方面比盖茨大叔做的更符合我的需求。

    \n

    我可以按照不同的文件夹或者Tag来组织我的文章,可以快速方便的索引和搜索到需要找到的文档。

    \n

    GoogleDoc的协助功能也非常的榜,我经常和其他人一起完成一份文档的编写,这比在本地写一份文档传来传去要方便,合理的多。我们经常一起编写,在意见不一致的地方批注,等待其他人的确认等等。

    \n

    另外,每次修改都有历史版本信息,可以很轻松的找到以前的版本,这点相当的好呀。

    \n

    2、在线存储,更加方便

    \n

    GoogleDoc是在线存储的,按照google和amazon的“云计算”的概念,这应该算云计算的一种了,其强大的云存储能力,我相信比存在我本地或者我自己的服务器上更加安全和可靠,且我可以随时随地的联网更新和查看,而不需要随身拿个U盘带来带去,还要提防丢失U盘的噩梦。

    \n

    另外,这样比直接发布在自己的Blog要可靠的多,谁知道您的blog服务商或者自己的blog服务器会不会那天罢工,或者哪天你的域名失效,或者那天您的数据库崩溃了,还有。。。

    \n

    3、离线功能,锦上添花

    \n

    以前有人说“要是我上不了网,那我岂不是死翘翘了!”,呵呵,现在有了离线功能,可以在本地编辑,然后在有网络的时候再传上去就OK了。

    \n

    4、不一安装,且自动更新,不断完善

    \n

    GoogleDoc还有个好处是,其不用每次修复一个漏洞或者增加一个新功能都要down下来重新安装,他在服务端更新了,我就可以即刻体验,免去一切不必要的麻烦。另外,他的功能还在不断的增加,比如我就很期待一个可以自动给代码着色的功能,那样我写文章里面的代码就可以更加直观了。只是我不知道谁还有和我类似的需求,也没有找到反馈的地方,有人有类似需求的么?帮我一起反馈上去吧 :)

    \n

    相信随着网速的越来越快,所谓的云计算都能得到很好的应用。我现在只有工作的时候写相关文档才被迫使用Word,虽然在家的本本上的Ubuntu下有Openoffice,但是写自己的一些技术文章的时候,我还都是使用GoogleDoc。且可以利用其它的技术(比如GoogleSite)来整合、组织和展示文档。大家可以在IceskYsl@Docs上看到我分享出来的一些技术文档。

    \n

     

    ", "created_at"=>2008-05-30 03:39:06 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很早前就说过,我非常喜欢使用GoogleDoc来写技术文章,其好处有很多:
    \n
    \n1、编辑、组织、协作、维护方便
    \nGoogleDoc的编辑器我非常喜欢,去掉Word中那些我基本上用不上的功能,而只提供需要的功能,这是比较难得可贵的,“不要让用户思考”是一种好的用户体验,而我深信,google在这个方面比盖茨大叔做的更符合我的需求。
    \n我可以按照不同的文件夹或者Tag来组织我的文章,可以快速方便的索引和搜索到需要找到的文档。
    \nGoogleDoc的协助功能也非常的榜,我经常和其他人一起完成一份文档的编写,这比在本地写一份文档传来传去要方便,合理的多。我们经常一起编写,在意见不一致的地方批注,等待其他人的确认等等。
    \n另外,每次修改都有历史版本信息,可以很轻松的找到以前的版本,这点相当的好呀。
    \n2、在线存储,更加方便
    \nGoogleDoc是在线存储的,按照google和amazon的“云计算”的概念,这应该算云计算的一种了,其强大的云存储能力,我相信比存在我本地或者我自己的服务器上更加安全和可靠,且我可以随时随地的联网更新和查看,而不需要随身拿个U盘带来带去,还要提防丢失U盘的噩梦。
    \n另外,这样比直接发布在自己的Blog要可靠的多,谁知道您的blog服务商或者自己的blog服务器会不会那天罢工,或者哪天你的域名失效,或者那天您的数据库崩溃了,还有。。。
    \n3、离线功能,锦上添花
    \n以前有人说“要是我上不了网,那我岂不是死翘翘了!”,呵呵,现在有了离线功能,可以在本地编辑,然后在有网络的时候再传上去就OK了。
    \n4、不一安装,且自动更新,不断完善
    \nGoogleDoc还有个好处是,其不用每次修复一个漏洞或者增加一个新功能都要down下来重新安装,他在服务端更新了,我就可以即刻体验,免去一切不必要的麻烦。另外,他的功能还在不断的增加,比如我就很期待一个可以自动给代码着色的功能,那样我写文章里面的代码就可以更加直观了。只是我不知道谁还有和我类似的需求,也没有找到反馈的地方,有人有类似需求的么?帮我一起反馈上去吧 :)
    \n相信随着网速的越来越快,所谓的云计算都能得到很好的应用。我现在只有工作的时候写相关文档才被迫使用Word,虽然在家的本本上的Ubuntu下有Openoffice,但是写自己的一些技术文章的时候,我还都是使用GoogleDoc。且可以利用其它的技术(比如GoogleSite)来整合、组织和展示文档。大家可以在IceskYsl@Docs上看到我分享出来的一些技术文档。
    \n 

    \n", "_id"=>830}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"发布Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术系列文章", "body"=>"

    前面已经说了,我非常喜欢使用GoogleDoc来写一些文章,一来是编写、协助、维护方便,二来是可以更加安全、长远的保存;而可以和其他的产品,比如GoogleSite整合展示,这里发布我最近翻译、实践、整理、撰写的“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列文章,该类文章旨在全面,详细的告诉你如何在UbuntuHardy下使用Nginx+Mongrel(后续可能会加上Thin或者Memcached等)搭建一套很棒的Rails生产环境。

    \n

    考虑编写,协助和维护的方便,已经可能存在的blog服务器出现问题的风险,该类及其以后类似系列文章都将使用GoogleDoc来编写和保持。然后在IceskYsl@Docs上整合组织展示,并在这个blog上发布更新信息等。

    \n

    本次“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列,已经编写如下几个文章:

    \n\n

    如果你有类似的经验需要分享或者想参与进来,一些协助完成一些专题、系列文章的整理,实践和撰写,欢迎加入一起编写和维护,请发送Mail到(iceskysl_At_Gmail.com)或者留言告诉我(需要你有Google帐号,否则协作不了)。

    ", "created_at"=>2008-05-30 03:58:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前面已经说了,我非常喜欢使用GoogleDoc来写一些文章,一来是编写、协助、维护方便,二来是可以更加安全、长远的保存;而可以和其他的产品,比如GoogleSite整合展示,这里发布我最近翻译、实践、整理、撰写的“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列文章,该类文章旨在全面,详细的告诉你如何在UbuntuHardy下使用Nginx+Mongrel(后续可能会加上Thin或者Memcached等)搭建一套很棒的Rails生产环境。
    \n考虑编写,协助和维护的方便,已经可能存在的blog服务器出现问题的风险,该类及其以后类似系列文章都将使用GoogleDoc来编写和保持。然后在IceskYsl@Docs上整合组织展示,并在这个blog上发布更新信息等。
    \n本次“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列,已经编写如下几个文章:
    \n
    \n RubyOnRails , Ubuntu Hardy , Nginx and Mongrel
    \n 使用aptitude安装Nginx
    \n 从源码编译安装Nginx
    \n 添加启动脚本
    \n 配置Nginx
    \n 定制Nginx目录结构
    \n Nginx虚拟主机配置详解
    \n 让Nginx支持虚拟主机
    \n
    \n如果你有类似的经验需要分享或者想参与进来,一些协助完成一些专题、系列文章的整理,实践和撰写,欢迎加入一起编写和维护,请发送Mail到(iceskysl_At_Gmail.com)或者留言告诉我(需要你有Google帐号,否则协作不了)。

    \n", "_id"=>831}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Windows command shell (cmd.exe)下设置Proxy", "body"=>"

    For use appcfg.py to upload you app datas behind an HTTP proxy in Google App Engine
    \n,or use with gems, cpan,etc. Inside cmd.exe, typed:
    \n
    \nset HTTP_proxy=http://my.proxy.server:8000

    ", "created_at"=>2008-05-30 05:51:59 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    For use appcfg.py to upload you app datas behind an HTTP proxy in Google App Engine
    \n,or use with gems, cpan,etc. Inside cmd.exe, typed:
    \n
    \nset HTTP_proxy=http://my.proxy.server:8000

    \n", "_id"=>832}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails的find中使用DISTINCT功能(MYSQL)", "body"=>"

    有的时候需要在SQL里面加上distinck来过滤一些重复的记录,使用SQL比较好写,但是在Rails的API里面并没有找到DISTINCK的参数,于是google了一把,看到不少人有类似的需求,最后找到方案,整理如下:
    \n1、使用:select

    \n
    Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ),这里就可以使用DISTINCT参数但是你可能很郁闷的发现,这
    样select出来的结果并不完全符合您的要求或者预想,呵呵。

    2、加上:group参数
    前面说的,如果只有:select参数,这样出来的结果可能会让你郁闷的发现,并不是您的预期,原因是前面的:select会对
    “fieldname1,filename2,filename3”做DISTINCT,所有不满足您的预期;
    我们可以再加上group参数即可,类似语句如下:
    Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ,:group => 'fieldname1')

    最后还要说下这个:select参数,他可以很好的提高性能,因为在Rails中的find会把所有字段都select出来,如果遇到大字
    段会很影像性能的,所有在必要的时候,最好是用:select限制下要取出的列。

    参考:
    1、Using :select in Rails for Better Performance (这篇文章详细的说了使用select来提高性能)
    2、说Mysql的distinct语句和group by,order by (这篇文章说了distinct、group by和order by的关系)```", "created_at"=>2008-06-01 00:44:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有的时候需要在SQL里面加上distinck来过滤一些重复的记录,使用SQL比较好写,但是在Rails的API里面并没有找到DISTINCK的参数,于是google了一把,看到不少人有类似的需求,最后找到方案,整理如下:
    \n1、使用:select
    \nItem.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ),这里就可以使用DISTINCT参数但是你可能很郁闷的发现,这样select出来的结果并不完全符合您的要求或者预想,呵呵。2、加上:group参数前面说的,如果只有:select参数,这样出来的结果可能会让你郁闷的发现,并不是您的预期,原因是前面的:select会对“fieldname1,filename2,filename3”做DISTINCT,所有不满足您的预期;我们可以再加上group参数即可,类似语句如下:Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ,:group => 'fieldname1')最后还要说下这个:select参数,他可以很好的提高性能,因为在Rails中的find会把所有字段都select出来,如果遇到大字段会很影像性能的,所有在必要的时候,最好是用:select限制下要取出的列。参考:1、Using :select in Rails for Better Performance (这篇文章详细的说了使用select来提高性能)2、说Mysql的distinct语句和group by,order by (这篇文章说了distinct、group by和order by的关系)```

    \n", "_id"=>833}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1 释出,众多特性值的尝试", "body"=>"

    在距离Rails2.0发布六个月后,Rails2.1于6.1号(儿童节)又释出了,按照DHH的说法,在过去的6个月中,有差不多1400名贡献者提交了1600多个patch,也可以在GitHub上看到Rails的最活跃的,这次发布包含的新功能有:

    \n\n

    Railscasts上游很多视频教程,在ryandaigle哪里有很多的特性介绍文章,另外,按照“新教程:跟着2.1转 Rolling with Rails 2.1”上的介绍:功能上增强,以及性能上的优化,促使必定要upgrade 到2.1。

    \n

    Update:
    \n刚刚仔细的看了下新特性,发现有几个还是挺不错的,也是我一直以来认为Rails比较别扭的地方,现在改进了很多,例如gem的install和unpack;只update修改的字段,改进migrate的命名规范,dbconsole等等;另外,关于性能的测试还没有进行,测试后将分享给大家。

    ", "created_at"=>2008-06-02 03:15:59 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在距离Rails2.0发布六个月后,Rails2.1于6.1号(儿童节)又释出了,按照DHH的说法,在过去的6个月中,有差不多1400名贡献者提交了1600多个patch,也可以在GitHub上看到Rails的最活跃的,这次发布包含的新功能有:
    \n
    \n Time zones (by Geoff Buesing): Tutorial | Introdction | Railscast
    \n Dirty tracking: Introduction (partial updates) | Railscast
    \n Gem Dependencies: Introduction | Railscast
    \n Named scope (by Nick Kallen): Introduction | Railscast
    \n UTC-based migrations: Introduction | Railscast
    \n Better caching: Introduction
    \n
    \n在Railscasts上游很多视频教程,在ryandaigle哪里有很多的特性介绍文章,另外,按照“新教程:跟着2.1转 Rolling with Rails 2.1”上的介绍:功能上增强,以及性能上的优化,促使必定要upgrade 到2.1。
    \nUpdate:
    \n刚刚仔细的看了下新特性,发现有几个还是挺不错的,也是我一直以来认为Rails比较别扭的地方,现在改进了很多,例如gem的install和unpack;只update修改的字段,改进migrate的命名规范,dbconsole等等;另外,关于性能的测试还没有进行,测试后将分享给大家。

    \n", "_id"=>834}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fork了backup_fu 插件,将添加FTP传输支持等新特性.", "body"=>"

    因为项目需要定时将资料打包备份到远程主机或者AmazonS3上存储以备不测,我自己写了自动打包,备份的代码,用的也挺好的,但是一直想着可以做成插件之类的分享给更多的人。

    \n

    今天重新看了下backup_fu这个插件,其实知道这个插件很早了,但是一直没仔细看它到底是做啥的,今天仔细看了下,原来是专门用来打包、上传到Amazon的S3的上一个插件,其使用的是aws-s3类。简单了看了下起代码,发现挺简单的,于是fork了一份回来。

    \n

    然后我将在其基础上做一些现在可以想到的修改和完善:

    \n

    1、增加FTP远程备份功能 --这个是我fork过来的主要用途,因为不是每个人都用S3的,很多人会选择通过FTP远程备份到另为的主机上;

    \n

    2、增加对RightScale gems的支持  --尽管aws-s3的口碑不错,但是RightScale 的AWS的gems更加完备和健壮,且有产品级的支持,我自己环境用的也是这个gems,于是打算加入这个的支持。

    \n

    3、其他的一些比较的修改   --按照我的习惯来修改,如果作者愿意,可以pull过去,呵呵。

    \n

    如果您有类似的需求,请关注我fork的github:IceskYsl / backup_fu
    \n

    \n

     

    ", "created_at"=>2008-06-02 04:50:27 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    因为项目需要定时将资料打包备份到远程主机或者Amazon的S3上存储以备不测,我自己写了自动打包,备份的代码,用的也挺好的,但是一直想着可以做成插件之类的分享给更多的人。
    \n今天重新看了下backup_fu这个插件,其实知道这个插件很早了,但是一直没仔细看它到底是做啥的,今天仔细看了下,原来是专门用来打包、上传到Amazon的S3的上一个插件,其使用的是aws-s3类。简单了看了下起代码,发现挺简单的,于是fork了一份回来。
    \n然后我将在其基础上做一些现在可以想到的修改和完善:
    \n1、增加FTP远程备份功能 --这个是我fork过来的主要用途,因为不是每个人都用S3的,很多人会选择通过FTP远程备份到另为的主机上;
    \n2、增加对RightScale gems的支持  --尽管aws-s3的口碑不错,但是RightScale 的AWS的gems更加完备和健壮,且有产品级的支持,我自己环境用的也是这个gems,于是打算加入这个的支持。
    \n3、其他的一些比较的修改   --按照我的习惯来修改,如果作者愿意,可以pull过去,呵呵。
    \n如果您有类似的需求,请关注我fork的github:IceskYsl / backup_fu
    \n
    \n 

    \n", "_id"=>835}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails+Memcached,跑起来嗖嗖的", "body"=>"

    很早前接触Rails的时候就知道memcached了,只是在自己的服务器上尚未看到这个需求,但是真的不久将来可能出现的情况,还是提前做下功课比较靠谱。

    \n

    今天在看一篇比较不错的文章“ 从LiveJournal后台发展看大规模网站性能优化方法”,该文章说了其LiveJournal发展过程中的几个阶段,逐渐的扩展和完善架构,从一个真实的环境中看出其架构的基本趋势。文中提到了memcached,原来memcached就诞生于此,很有兴趣的再多了解一些,memcached属于Danga,旗下还有其他几个很著名的东西,比如MogileFS等。
    \nMemcached 是高效、快速的分布式内存对象缓存系统,主要用于加速 WEB 动态应用程序。关于Memcached的安装等,可以参考“PHP & memcached”这篇文章的说明,基本上和其他unix下的程序安装差不多,下载源码、编译等等,不再赘述。

    \n

    其使用非常简单,直接就一个命令,连配置文件都省了,如下:

    \n

    /usr/bin/memcached -d -m 128 -l 192.168.10.1 -p 11211 -u httpd

    \n

    参数分别代表:

    \n

     

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. -d 以守护程序(daemon)方式运行 memcached;  
    2. \n
    3. -m 设置 memcached 可以使用的内存大小,单位为 M;  
    4. \n
    5. -l 设置监听的 IP 地址,如果是本机的话,通常可以不设置此参数;  
    6. \n
    7. -p 设置监听的端口,默认为 11211,所以也可以不设置此参数;  
    8. \n
    9. -u 指定用户,如果当前为 root 的话,需要使用此参数指定用户。  
    10. \n
    \n
    \n

    如果你想了解在Rails中如何使用,请参cai同学翻译的”Ruby on Rails + Memcached“,或者直接去看原文;另外,如果你和我一样比较喜欢Nginx做webserver,你可以看看我写的Nginx在Ubuntu上的一系列文章,马上会加上Memcached的相关内容。

    \n

     

    \n
     ```", "created_at"=>2008-06-04 04:55:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很早前接触Rails的时候就知道memcached了,只是在自己的服务器上尚未看到这个需求,但是真的不久将来可能出现的情况,还是提前做下功课比较靠谱。
    \n今天在看一篇比较不错的文章“ 从LiveJournal后台发展看大规模网站性能优化方法”,该文章说了其LiveJournal发展过程中的几个阶段,逐渐的扩展和完善架构,从一个真实的环境中看出其架构的基本趋势。文中提到了memcached,原来memcached就诞生于此,很有兴趣的再多了解一些,memcached属于Danga,旗下还有其他几个很著名的东西,比如MogileFS等。
    \nMemcached 是高效、快速的分布式内存对象缓存系统,主要用于加速 WEB 动态应用程序。关于Memcached的安装等,可以参考“PHP & memcached”这篇文章的说明,基本上和其他unix下的程序安装差不多,下载源码、编译等等,不再赘述。
    \n其使用非常简单,直接就一个命令,连配置文件都省了,如下:
    \n/usr/bin/memcached -d -m 128 -l 192.168.10.1 -p 11211 -u httpd
    \n其参数分别代表:
    \n 
    \n
    \nXML/HTML代码
    \n
    \n -d 以守护程序(daemon)方式运行 memcached;  
    \n -m 设置 memcached 可以使用的内存大小,单位为 M;  
    \n -l 设置监听的 IP 地址,如果是本机的话,通常可以不设置此参数;  
    \n -p 设置监听的端口,默认为 11211,所以也可以不设置此参数;  
    \n -u 指定用户,如果当前为 root 的话,需要使用此参数指定用户。  
    \n
    \n
    \n如果你想了解在Rails中如何使用,请参cai同学翻译的”Ruby on Rails + Memcached“,或者直接去看原文;另外,如果你和我一样比较喜欢Nginx做webserver,你可以看看我写的Nginx在Ubuntu上的一系列文章,马上会加上Memcached的相关内容。
    \n 
    \n ```

    \n", "_id"=>836}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用WWW::Mechanize来开发爬虫程序.", "body"=>"

    有的时候需要去一个URL上取一些文字或者简介啥的下来,或者取一些自己需要的内容下来,这个时候虽然可以直接使用http-net连到URL上,取回内容,然后自己解析等,但是这在一定程度上算是网络爬虫的范畴。

    \n

    WWW::Mechanize:The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. 

    \n

    啊哈,貌似不错,在这个上面构建自己的爬虫应该简单的多了,可以使用它模拟浏览器的行为,但是需要注意的一点是,他模拟浏览器的时候会按照浏览器一样记住“历史”,如果你不设定历史条数,wowo,请留意你的内存吧,详细的请查看“ashchan”的文章”Mechanize的内存问题“。

    \n

    再看段例子吧,真的很简单,他里面使用的是hpricot,大家都比较熟悉了,呵呵,看段代码,如下:

    \n

    \n

    \n
    Google
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'mechanize'  
    4. \n
    5.   
    6. \n
    7. agent = WWW::Mechanize.new  
    8. \n
    9. agent.user_agent_alias = 'Mac Safari'  
    10. \n
    11. page = agent.get("http://www.google.com/")  
    12. \n
    13. search_form = page.forms.with.name("f").first  
    14. \n
    15. search_form.q = "Hello"  
    16. \n
    17. search_results = agent.submit(search_form)  
    18. \n
    19. puts search_results.body  
    20. \n
    \n
    \n简单吧,其他的请参考他的“EXAMPLES.txt”,其他信息请到其“Documentation”页面上查看吧。

    ", "created_at"=>2008-06-06 02:49:50 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有的时候需要去一个URL上取一些文字或者简介啥的下来,或者取一些自己需要的内容下来,这个时候虽然可以直接使用http-net连到URL上,取回内容,然后自己解析等,但是这在一定程度上算是网络爬虫的范畴。
    \nWWW::Mechanize:The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. 
    \n啊哈,貌似不错,在这个上面构建自己的爬虫应该简单的多了,可以使用它模拟浏览器的行为,但是需要注意的一点是,他模拟浏览器的时候会按照浏览器一样记住“历史”,如果你不设定历史条数,wowo,请留意你的内存吧,详细的请查看“ashchan”的文章”Mechanize的内存问题“。
    \n再看段例子吧,真的很简单,他里面使用的是hpricot,大家都比较熟悉了,呵呵,看段代码,如下:
    \n
    \n
    \nGoogle
    \n
    \n require 'rubygems'  
    \n require 'mechanize'  
    \n   
    \n agent = WWW::Mechanize.new  
    \n agent.user_agent_alias = 'Mac Safari'  
    \n page = agent.get("http://www.google.com/")  
    \n search_form = page.forms.with.name("f").first  
    \n search_form.q = "Hello"  
    \n search_results = agent.submit(search_form)  
    \n puts search_results.body  
    \n
    \n
    \n简单吧,其他的请参考他的“EXAMPLES.txt”,其他信息请到其“Documentation”页面上查看吧。

    \n", "_id"=>837}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提升MYSQL性能可用思路和方案的技术分析", "body"=>"

    MYSQL成为越来越多的web2站点的选择的DB的时候,当站点越来越大,流量越来越多,用户越来越多的时候,数据库往往第一个成为系统的瓶颈,如何提升DB的性能成为系统成败的关键点,本文只是从自己的认识上说说可以从几个方面提升MYSQL的性能,以及可以采取的扩展方式。但是不会详细的阐述,详细的说明和操作,分析方法以后有时间再仔细分享。

    \n

    一、选择合适的数据库存贮引擎

    \n

    MYSQL支持的引擎很多,例如MyISAMMEMORYInnoDB等等类型,每个类型试用的场景是不一样的,恰当的选择存储引擎可以节省你不少时间,详细的介绍你可以参考”第15章:存储引擎和表类型“。

    \n

    二、优化SQL语句

    \n

    不要以为SQL语句关系不大,按照以往的经验,往往几个畸形的SQL就可以拖垮一个DB,决定不是危言耸听,在从系统优化和DB优化及其扩展之前,请仔细检查系统中用到的SQL,先解决SQL可能带来的问题,而经验是,做好这步,就可以解决很多初期的性能问题。

    \n

    三、建立索引

    \n

    这和前面的SQL优化有一定的联系,仔细查看你的SQL语言,尽可能的优化他,然后建立必须的索引,千万不要忽视了索引的威力,我们曾经有过测试,2W条的基本数据,生成页面,没有索引前,推算其全部生成需要的时间是81个小时,而加上索引后,只需要12分钟,多大的性能提升,各位可以自己那计算器粗略的算算。

    \n

    四、建立分区&表空间

    \n

    很多人以为只有Oracle才有表空间,分区这些东西,不想到MYSQL中也有类似的东西吧,尽管这个东西是mysql5才引入的,尽管其还不是很成熟,但是毫无疑问,这是一个好的信号,在我们使用MYSQL的时候就有了更多的方案来提升性能了。

    \n

    分区一般分为水平分区和垂直分区,MYSQL目前只支持水平分区,有RANGE,LIST,HASH,KEY等等分区方式,详细说明以后再说,你可以参考”第18章:分区“,"通过分区(Partition)提升MySQL性能"等文章。

    \n

    表空间的相关话题,可以参考”第17章:MySQL簇“,不在赘述。

    \n

    五、调整MYSQL和系统参数

    \n

    这个方案是伴随着整个性能提升过程的,你的不时的调整参数以得到更好的性能,这个比较复杂,没有啥成文的规定,都是靠经验或者实践得到的。

    \n

    六、集群或者proxy

    \n

    到这里为止,单机的MYSQL基本上可以优化调整的都涉及到了,如果这个时候还是顶不住压力,该考虑水平扩展或者垂直扩展了,垂直扩展比较容易,只要针对单机的性能得到瓶颈的所在,增加CPU或者内存或者换比较强劲的设备就可以很快得到立竿见影的效果。

    \n

    但是垂直扩展能力有限,不可能得到无限级的扩展,风险也比较大,除了垂直扩展,大家选择较多的是水平扩展,也就是通过增加服务器,无限的得到性能的扩展,当然这个里面内容是很多的,如何做到数据库的备份同步等都是需要考虑和解决的问题,而且还要考虑这么多机器间的数据重复成都等问题;除此之外,还有可能将数据库缓存到memcached或者使用mysql proxy等实现连接池之类的方案,都是需要考虑和抉择的。

    \n

    以上每个分类都是个大的话题,这么一篇文章只是说明了优化的思路基本流程,其中涉及到很多东西,例如诊断分析等都是很有技术含量的,我们下次会一个专题一个专题的仔细分析,力求将MYSQL的性能达到尽可能的榜。

    \n

    本人也只是站在自己使用的角度以及一些前人的经验上分析和分享,如果你有类似经验,还望分享,如果文章中有错误的或者不到位的地方,还望指出,谢谢。

    ", "created_at"=>2008-06-06 03:41:52 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    当MYSQL成为越来越多的web2站点的选择的DB的时候,当站点越来越大,流量越来越多,用户越来越多的时候,数据库往往第一个成为系统的瓶颈,如何提升DB的性能成为系统成败的关键点,本文只是从自己的认识上说说可以从几个方面提升MYSQL的性能,以及可以采取的扩展方式。但是不会详细的阐述,详细的说明和操作,分析方法以后有时间再仔细分享。
    \n一、选择合适的数据库存贮引擎
    \nMYSQL支持的引擎很多,例如MyISAM,MEMORY,InnoDB等等类型,每个类型试用的场景是不一样的,恰当的选择存储引擎可以节省你不少时间,详细的介绍你可以参考”第15章:存储引擎和表类型“。
    \n二、优化SQL语句
    \n不要以为SQL语句关系不大,按照以往的经验,往往几个畸形的SQL就可以拖垮一个DB,决定不是危言耸听,在从系统优化和DB优化及其扩展之前,请仔细检查系统中用到的SQL,先解决SQL可能带来的问题,而经验是,做好这步,就可以解决很多初期的性能问题。
    \n三、建立索引
    \n这和前面的SQL优化有一定的联系,仔细查看你的SQL语言,尽可能的优化他,然后建立必须的索引,千万不要忽视了索引的威力,我们曾经有过测试,2W条的基本数据,生成页面,没有索引前,推算其全部生成需要的时间是81个小时,而加上索引后,只需要12分钟,多大的性能提升,各位可以自己那计算器粗略的算算。
    \n四、建立分区&表空间
    \n很多人以为只有Oracle才有表空间,分区这些东西,不想到MYSQL中也有类似的东西吧,尽管这个东西是mysql5才引入的,尽管其还不是很成熟,但是毫无疑问,这是一个好的信号,在我们使用MYSQL的时候就有了更多的方案来提升性能了。
    \n分区一般分为水平分区和垂直分区,MYSQL目前只支持水平分区,有RANGE,LIST,HASH,KEY等等分区方式,详细说明以后再说,你可以参考”第18章:分区“,"通过分区(Partition)提升MySQL性能"等文章。
    \n表空间的相关话题,可以参考”第17章:MySQL簇“,不在赘述。
    \n五、调整MYSQL和系统参数
    \n这个方案是伴随着整个性能提升过程的,你的不时的调整参数以得到更好的性能,这个比较复杂,没有啥成文的规定,都是靠经验或者实践得到的。
    \n六、集群或者proxy
    \n到这里为止,单机的MYSQL基本上可以优化调整的都涉及到了,如果这个时候还是顶不住压力,该考虑水平扩展或者垂直扩展了,垂直扩展比较容易,只要针对单机的性能得到瓶颈的所在,增加CPU或者内存或者换比较强劲的设备就可以很快得到立竿见影的效果。
    \n但是垂直扩展能力有限,不可能得到无限级的扩展,风险也比较大,除了垂直扩展,大家选择较多的是水平扩展,也就是通过增加服务器,无限的得到性能的扩展,当然这个里面内容是很多的,如何做到数据库的备份,同步等都是需要考虑和解决的问题,而且还要考虑这么多机器间的数据重复成都等问题;除此之外,还有可能将数据库缓存到memcached或者使用mysql proxy等实现连接池之类的方案,都是需要考虑和抉择的。
    \n以上每个分类都是个大的话题,这么一篇文章只是说明了优化的思路和基本流程,其中涉及到很多东西,例如诊断和分析等都是很有技术含量的,我们下次会一个专题一个专题的仔细分析,力求将MYSQL的性能达到尽可能的榜。
    \n本人也只是站在自己使用的角度以及一些前人的经验上分析和分享,如果你有类似经验,还望分享,如果文章中有错误的或者不到位的地方,还望指出,谢谢。

    \n", "_id"=>838}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"WWDC 2008中让人兴奋的那么些消息", "body"=>"

    昨天夜里熬夜看欧洲杯,看WWDC2008的直播,一边写代码,实在是够爽,欧洲杯的法国和尼日利亚最终打成0:0,场面比较沉闷,而WWDC却让人非常兴奋。

    \n

    \"\"

    \n

    在Twitter上有WWDC的直播,但是Twitter提前就发布消息说其WWDC大会会给twitter增加了10倍的流量,造成twitter非常慢,期间还出现了“超过”负荷导致twitter崩溃的小片断。

    \n

    WWDC上最令人激动的消息应该是iphone 3G的推出了,其最最让人激动的应该是其价格大降,8G的iPhone 3G卖199美元,16G的卖299美元(有白色版本可以选)。之前的iphone价格,不晓得之前 入手的是否会骂jobs呢。。。

    \n

    另外还有其他的的消息,大家可以去apple4us上去看,消息比较全面,这次也非常的及时。看来是时候可以入手了哦。

    \n

    另外,怎么没看到mac book的消息呢,不是说mac book马上也有新版本的推出么?偶可一直在等呢。。。

    ", "created_at"=>2008-06-10 00:14:51 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    昨天夜里熬夜看欧洲杯,看WWDC2008的直播,一边写代码,实在是够爽,欧洲杯的法国和尼日利亚最终打成0:0,场面比较沉闷,而WWDC却让人非常兴奋。
    \n
    \n在Twitter上有WWDC的直播,但是Twitter提前就发布消息说其WWDC大会会给twitter增加了10倍的流量,造成twitter非常慢,期间还出现了“超过”负荷导致twitter崩溃的小片断。
    \nWWDC上最令人激动的消息应该是iphone 3G的推出了,其最最让人激动的应该是其价格大降,8G的iPhone 3G卖199美元,16G的卖299美元(有白色版本可以选)。之前的iphone价格,不晓得之前 入手的是否会骂jobs呢。。。
    \n另外还有其他的的消息,大家可以去apple4us上去看,消息比较全面,这次也非常的及时。看来是时候可以入手了哦。
    \n另外,怎么没看到mac book的消息呢,不是说mac book马上也有新版本的推出么?偶可一直在等呢。。。

    \n", "_id"=>839}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PayPal携手Skype网络电话,让无线运营商见鬼去吧!", "body"=>"

    早上收到Paypal的mail,说和skype携手,提供更便宜的资费,又是一个好消息,难道不是么?

    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    可选套餐一国通套餐亚洲通套餐世界通套餐
    拨打范围可选择拨打全球34个国家地区之一可拨任意打亚洲4个国家地区可任意拨打全球34个国家地区
    超低资费44元/10000分钟50元/200分钟99元/10000分钟
    标准IP电话资费\n

    以中国大陆为例

    \n 0.3元/分钟
    \n

    以日本为例

    \n 3.6元/分钟
    \n

    以美国为例

    \n 2.4元/分钟
    打1小时可为您节省17.76元可为您节省201元可为您节省143.4元
    \n

    Good,详细信息可以看,“PayPal携手Skype网络电话——让您直通全球客户”,在IP电话逐渐盛行的今天,在iphone价格暴跌的现在,我想那些所谓的“运营商”们也该胆寒了吧,在自己围墙圈地,拿政策来发大财的时候,最后会发现,大家都绕着走,最后圈住的只是他们自己,这真是一个喜剧。

    ", "created_at"=>2008-06-10 01:54:37 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    早上收到Paypal的mail,说和skype携手,提供更便宜的资费,又是一个好消息,难道不是么?
    \n
    \n
    \n
    \n 可选套餐
    \n 一国通套餐
    \n 亚洲通套餐
    \n 世界通套餐
    \n
    \n
    \n 拨打范围
    \n 可选择拨打全球34个国家地区之一
    \n 可拨任意打亚洲4个国家地区
    \n 可任意拨打全球34个国家地区
    \n
    \n
    \n 超低资费
    \n 44元/10000分钟
    \n 50元/200分钟
    \n 99元/10000分钟
    \n
    \n
    \n 标准IP电话资费
    \n
    \n 以中国大陆为例
    \n 0.3元/分钟
    \n
    \n 以日本为例
    \n 3.6元/分钟
    \n
    \n 以美国为例
    \n 2.4元/分钟
    \n
    \n
    \n 打1小时
    \n 可为您节省17.76元
    \n 可为您节省201元
    \n 可为您节省143.4元
    \n
    \n
    \n
    \nGood,详细信息可以看,“PayPal携手Skype网络电话——让您直通全球客户”,在IP电话逐渐盛行的今天,在iphone价格暴跌的现在,我想那些所谓的“运营商”们也该胆寒了吧,在自己围墙圈地,拿政策来发大财的时候,最后会发现,大家都绕着走,最后圈住的只是他们自己,这真是一个喜剧。

    \n", "_id"=>840}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"HAProxy,智能分流的负载均衡方案。", "body"=>"

    以前说过,我最喜欢的一个跑Rails的方式是Nginx在前面,后端采用mongrel或者thin,采用nginx的原因不在多说,想详细了解 nginx的参考我以前的文章,按照道理来说,这样的方案已经很不错了,如果再加上memcached做cach,应该可以顶住不小的压力了。
    \n但是其当时也说到,Nginx的负载均衡到目前为止还是比较简单的轮训算法,他不会检测后端的mongrel是否压力过大,或者是否已经down下去了,这样就会初选,如果其中的一个mongrel挂掉了,nginx还是会把请求分过去的,这样就存在一个问题。
    \n
    \n于是就有这么一个需求,能不能监控到后端的mongrel的状况,做智能分发呢?啊哈,是的,可以,HAProxy就可以做到这点。先看个改进版的架构。
    \n\"\"
    \nok,比较清晰吧,Nginx接收到请求后,放到RequestQueue中,然后HAProxy从queue中取请求,智能的分发给后端的 App.Server。如此处理的好处就是HAProxy可以判断后端App.Server的负载情况以及是否down机情况,然后做智能分发。

    \n

    OK,比较清晰了,我们再把Memcached加上,再加上智能判断一台服务器Down掉的情况,我再画个图片,如下:

    \n

    \"\"

    \n

    参考文章:
    \n1、HAproxy做负载均衡
    \n2、nginx - Reading the fine print
    \n3、New Nginx.conf with optimizations
    \n4、Load Balancing & QoS with HAProxy
    \n5、Reviewing Application Health with HAProxy Stats

    ", "created_at"=>2008-06-10 09:38:09 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    以前说过,我最喜欢的一个跑Rails的方式是Nginx在前面,后端采用mongrel或者thin,采用nginx的原因不在多说,想详细了解 nginx的参考我以前的文章,按照道理来说,这样的方案已经很不错了,如果再加上memcached做cach,应该可以顶住不小的压力了。
    \n但是其当时也说到,Nginx的负载均衡到目前为止还是比较简单的轮训算法,他不会检测后端的mongrel是否压力过大,或者是否已经down下去了,这样就会初选,如果其中的一个mongrel挂掉了,nginx还是会把请求分过去的,这样就存在一个问题。
    \n
    \n于是就有这么一个需求,能不能监控到后端的mongrel的状况,做智能分发呢?啊哈,是的,可以,HAProxy就可以做到这点。先看个改进版的架构。
    \n
    \nok,比较清晰吧,Nginx接收到请求后,放到RequestQueue中,然后HAProxy从queue中取请求,智能的分发给后端的 App.Server。如此处理的好处就是HAProxy可以判断后端App.Server的负载情况以及是否down机情况,然后做智能分发。
    \nOK,比较清晰了,我们再把Memcached加上,再加上智能判断一台服务器Down掉的情况,我再画个图片,如下:
    \n
    \n参考文章:
    \n1、HAproxy做负载均衡
    \n2、nginx - Reading the fine print
    \n3、New Nginx.conf with optimizations
    \n4、Load Balancing & QoS with HAProxy
    \n5、Reviewing Application Health with HAProxy Stats

    \n", "_id"=>841}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用will_Paginate的分页技巧", "body"=>"

    WillPaginate这个插件很棒,以至于其取代了Rails中原有的Paginate方法,虽然看上其很简单,其实还是有不少技巧的,本篇用来记录我遇到的或者使用到的一些tips。
    \n
    \n1.直接使用paginate
    \n这个比较简单,也是使用的最多的,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.get_all_items_in_catelog( catelog_id,page,per_page="10")  
    2. \n
    3.   paginate :per_page => per_page, :page => page,  
    4. \n
    5.     :conditions =>["catelog_id = ? and caiji > 0",catelog_id],  
    6. \n
    7.     :order => 'created_at DESC ,updated_at  DESC'  
    8. \n
    9. end 
      \n
    10. \n
    \n
    \n

     2.使用Model.paginate_by_sql
    \n有的时候,你需要的SQL用Rails拼的时候有些不方便,这个时候可以考虑使用paginate_by_sql来实现,这个没啥好说的,你需要什么样的SQL直接写就可以了,例如:
    \n  #排行榜列表

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.get_all_items_in_rank(rank_id, page,per_page="10")  
    2. \n
    3.     Book.paginate_by_sql ["SELECT DISTINCT `books`.* FROM `books` LEFT OUTER JOIN `ranksorts`
      \n
    4. \n
    5. ON (`books`.`prodid` = `ranksorts`.`prodid`) LEFT OUTER JOIN `ranks` 
      \n
    6. \n
    7. ON (`ranks`.`id` = `ranksorts`.`rank_id`) WHERE (ranks.id = ?)
      \n
    8. \n
    9. ORDER BY books.updated_at DESC,books.created_at DESC", rank_id],  
    10. \n
    11.       :page => page, :per_page => per_page  
    12. \n
    13. end  
    14. \n
    \n
    \n

    还有其他的一些小技巧,慢慢添加,你如果有类似的技巧,期待您的分享。。
    \n
    \n参考文档:
    \n1、I'm Paginating Again

    ", "created_at"=>2008-06-10 17:34:21 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    WillPaginate这个插件很棒,以至于其取代了Rails中原有的Paginate方法,虽然看上其很简单,其实还是有不少技巧的,本篇用来记录我遇到的或者使用到的一些tips。
    \n
    \n1.直接使用paginate
    \n这个比较简单,也是使用的最多的,如下:
    \n
    \nRuby代码
    \n
    \n def self.get_all_items_in_catelog( catelog_id,page,per_page="10")  
    \n   paginate :per_page => per_page, :page => page,  
    \n     :conditions =>["catelog_id = ? and caiji > 0",catelog_id],  
    \n     :order => 'created_at DESC ,updated_at  DESC'  
    \n end 
    \n
    \n
    \n
    \n 2.使用Model.paginate_by_sql
    \n有的时候,你需要的SQL用Rails拼的时候有些不方便,这个时候可以考虑使用paginate_by_sql来实现,这个没啥好说的,你需要什么样的SQL直接写就可以了,例如:
    \n  #排行榜列表
    \n
    \nRuby代码
    \n
    \n def self.get_all_items_in_rank(rank_id, page,per_page="10")  
    \n     Book.paginate_by_sql ["SELECT DISTINCT books.* FROM books LEFT OUTER JOIN ranksorts
    \n
    \n ON (books.prodid = ranksorts.prodid) LEFT OUTER JOIN ranks 
    \n
    \n ON (ranks.id = ranksorts.rank_id) WHERE (ranks.id = ?)
    \n
    \n ORDER BY books.updated_at DESC,books.created_at DESC", rank_id],  
    \n       :page => page, :per_page => per_page  
    \n end  
    \n
    \n
    \n还有其他的一些小技巧,慢慢添加,你如果有类似的技巧,期待您的分享。。
    \n
    \n参考文档:
    \n1、I'm Paginating Again

    \n", "_id"=>842}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails在MySQL的大表中add_column很慢的问题!", "body"=>"

    项目使用Rails开发,DB采用的是MySQL,有一个不算复杂的表A,记录数差不多50W条数据,现在想增加一个列属性,于是很自然的想到Rails中的add_column,然后rake迁移数据,但是等了很久未见执行完毕,诡异。
    \n初步判断是由于表里的记录太多了,查下add_column是怎杨的,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. # File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 121  
    2. \n
    3. 121:       def add_column(table_name, column_name, type, options = {})  
    4. \n
    5. 122:         add_column_sql = "ALTER TABLE \#{table_name} ADD \#{quote_column_name(column_name)} \#{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"  
    6. \n
    7. 123:         add_column_options!(add_column_sql, options)  
    8. \n
    9. 124:         execute(add_column_sql)  
    10. \n
    11. 125:       end  
    12. \n
    \n
    \n

    恩,挺直接的,就是:
    \nALTER TABLE table_name ADD column_name ,貌似没啥问题,看来是MySQL的问题,和Rails无关,Google下资料,发现“change index or add column in a very big table”和我遇到的问题基本一致,但是其回复中并没有说道如何解决或者如何提升性能。
    \n继续Google,找到“Why MySQL could be slow with large tables ?”这篇文章,谈到了为什么说MySQL在大表的时候会很慢,其观点是和表的结构设计有关。其有人回复说“I have a table with 35 mil records. When I wanted to add a column (alter table) I would take about 2 days.”,和我的问题一致,这个文章很好,建议各位有时间的仔细看看。
    \n但是我的这个数据表结构并不复杂,如何能提升其速度呢,还在研究中,有了思路会再更新上来。
    \n

    ", "created_at"=>2008-06-12 09:05:21 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    项目使用Rails开发,DB采用的是MySQL,有一个不算复杂的表A,记录数差不多50W条数据,现在想增加一个列属性,于是很自然的想到Rails中的add_column,然后rake迁移数据,但是等了很久未见执行完毕,诡异。
    \n初步判断是由于表里的记录太多了,查下add_column是怎杨的,如下:
    \n
    \nRuby代码
    \n
    \n # File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 121  
    \n 121:       def add_column(table_name, column_name, type, options = {})  
    \n 122:         add_column_sql = "ALTER TABLE \#{table_name} ADD \#{quote_column_name(column_name)} \#{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"  
    \n 123:         add_column_options!(add_column_sql, options)  
    \n 124:         execute(add_column_sql)  
    \n 125:       end  
    \n
    \n
    \n恩,挺直接的,就是:
    \nALTER TABLE table_name ADD column_name ,貌似没啥问题,看来是MySQL的问题,和Rails无关,Google下资料,发现“change index or add column in a very big table”和我遇到的问题基本一致,但是其回复中并没有说道如何解决或者如何提升性能。
    \n继续Google,找到“Why MySQL could be slow with large tables ?”这篇文章,谈到了为什么说MySQL在大表的时候会很慢,其观点是和表的结构设计有关。其有人回复说“I have a table with 35 mil records. When I wanted to add a column (alter table) I would take about 2 days.”,和我的问题一致,这个文章很好,建议各位有时间的仔细看看。
    \n但是我的这个数据表结构并不复杂,如何能提升其速度呢,还在研究中,有了思路会再更新上来。

    \n", "_id"=>843}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu8.04安装gem install mysql 出错", "body"=>"

    问题:在ubuntu8.04中,使用

    \n
    \n
      \n
    1. sudo gem install mysql  
    2. \n
    \n
    \n
    sudo gem install mysql```\n

    出现:

    \n
    \n
      \n
    1. ERROR:  While executing gem ... (RuntimeError)  
    2. \n
    3.     ERROR: Failed to build gem native extension.  
    4. \n
    5. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys  
    6. \n
    \n
    \n
    ERROR:  While executing gem ... (RuntimeError)     ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys```\n

    解决方案
    \n1.先运行

    \n
    \n
      \n
    1. $ sudo apt-get install libmysqlclient15-dev  
    2. \n
    \n
    \n
    $ sudo apt-get install libmysqlclient15-dev```\n

    注意上面安装的库名为libmysqlclient15-dev而非libmysqlclient5-dev
    \n
    \n2.再运行
    \nsudo gem install mysql

    ", "created_at"=>2008-06-12 12:48:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    问题:在ubuntu8.04中,使用
    \n
    \n
    \n sudo gem install mysql  
    \n
    \n
    \nsudo gem install mysql
    \n<p>出现:</p>
    \n<div class="dp-highlighter">
    \n<ol start="1" class="dp-j">
    \n <li><span><span>ERROR:&nbsp;&nbsp;While&nbsp;executing&nbsp;gem&nbsp;...&nbsp;(RuntimeError)&nbsp;&nbsp;</span></span></li>
    \n <li><span>&nbsp;&nbsp;&nbsp;&nbsp;ERROR:&nbsp;Failed&nbsp;to&nbsp;build&nbsp;gem&nbsp;<span class="keyword">native</span><span>&nbsp;extension.&nbsp;&nbsp;</span></span></li>
    \n <li><span>Gem&nbsp;files&nbsp;will&nbsp;remain&nbsp;installed&nbsp;in&nbsp;/usr/lib/ruby/gems/<span class="number">1.8</span><span>/gems/mys&nbsp;&nbsp;</span></span></li>
    \n</ol>
    \n</div>
    \n<pre class="java" name="code" style="display: none;">ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys

    \n解决方案
    \n1.先运行
    \n
    \n
    \n $ sudo apt-get install libmysqlclient15-dev  
    \n
    \n
    \n$ sudo apt-get install libmysqlclient15-dev```
    \n注意上面安装的库名为libmysqlclient15-dev而非libmysqlclient5-dev
    \n
    \n2.再运行
    \nsudo gem install mysql

    \n", "_id"=>844}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu:gzip: stdout: No space left on device", "body"=>"

    问题:
    \niceskysl@IceskYsl:/boot$ sudo dpkg --configure -a
    \n正在设置 initramfs-tools (0.85eubuntu39.1) ...
    \nupdate-initramfs: deferring update (trigger activated)
    \n
    \n正在设置 linux-ubuntu-modules-2.6.24-18-generic (2.6.24-18.26) ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \n正在设置 linux-image-generic (2.6.24.18.20) ...
    \n正在设置 linux-generic (2.6.24.18.20) ...
    \nProcessing triggers for initramfs-tools ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \ngzip: stdout: No space left on device
    \nupdate-initramfs: failed for /boot/initrd.img-2.6.24-18-generic
    \ndpkg: 子进程 post-installation script 返回了错误号 1
    \n
    \n解决:
    \nuname -a 看自己用的什么
    \ndpkg --get-selections|grep linux 看机器里都装了什么
    \nsudo apt-get remove linux-image-2.6.XX 直接删 XX替代为不用的
    \n或者用新立得搜索到不用的卸载

    \n
    \n实践:
    \niceskysl@IceskYsl:~$ uname -a
    \nLinux IceskYsl 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
    \niceskysl@IceskYsl:~$ dpkg --get-selections|grep linux
    \nlibselinux1                    install
    \nlinux-generic                    install
    \nlinux-headers-2.6.20-15                install
    \nlinux-headers-2.6.20-15-generic            install
    \nlinux-headers-2.6.20-16                install
    \nlinux-headers-2.6.20-16-generic            install
    \nlinux-headers-2.6.24-16                install
    \nlinux-headers-2.6.24-16-generic            install
    \nlinux-headers-2.6.24-17                install
    \nlinux-headers-2.6.24-17-generic            install
    \nlinux-headers-2.6.24-18                install
    \nlinux-headers-2.6.24-18-generic            install
    \nlinux-headers-generic                install
    \nlinux-image-2.6.20-15-generic            deinstall
    \nlinux-image-2.6.20-16-generic            install
    \nlinux-image-2.6.22-14-generic            install
    \nlinux-image-2.6.24-16-generic            install
    \nlinux-image-2.6.24-17-generic            install
    \nlinux-image-2.6.24-18-generic            install
    \nlinux-image-generic                install
    \nlinux-libc-dev                    install
    \nlinux-restricted-modules-2.6.20-15-generic    deinstall
    \nlinux-restricted-modules-2.6.20-16-generic    install
    \nlinux-restricted-modules-2.6.22-14-generic    install
    \nlinux-restricted-modules-2.6.24-16-generic    install
    \nlinux-restricted-modules-2.6.24-17-generic    install
    \nlinux-restricted-modules-2.6.24-18-generic    install
    \nlinux-restricted-modules-common            install
    \nlinux-restricted-modules-generic        install
    \nlinux-sound-base                install
    \nlinux-ubuntu-modules-2.6.22-14-generic        install
    \nlinux-ubuntu-modules-2.6.24-16-generic        install
    \nlinux-ubuntu-modules-2.6.24-17-generic        install
    \nlinux-ubuntu-modules-2.6.24-18-generic        install
    \nutil-linux                    install
    \nutil-linux-locales                install
    \niceskysl@IceskYsl:~$ sudo apt-get remove linux-image-2.6.20-16-generic
    \n正在读取软件包列表... 完成
    \n正在分析软件包的依赖关系树      
    \n读取状态信息... 完成            
    \n下列软件包将被【卸载】:
    \n  linux-image-2.6.20-16-generic linux-restricted-modules-2.6.20-16-generic
    \n共升级了 0 个软件包,新安装了 0 个软件包,要卸载 2 个软件包,有 34 个软件未被升级。
    \n操作完成后,会释放 114MB 的磁盘空间。
    \n您希望继续执行吗?[Y/n]y
    \n(正在读取数据库 ... 系统当前总共安装有 218707 个文件和目录。)
    \n正在删除 linux-restricted-modules-2.6.20-16-generic ...
    \nFATAL: Could not open '/boot/System.map-2.6.20-16-generic': No such file or directory
    \n正在删除 linux-image-2.6.20-16-generic ...
    \nRunning postrm hook script /sbin/update-grub.
    \nSearching for GRUB installation directory ... found: /boot/grub
    \nSearching for default file ... found: /boot/grub/default
    \nTesting for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    \nSearching for splash image ... none found, skipping ...
    \nFound kernel: /vmlinuz-2.6.24-18-generic
    \nFound kernel: /memtest86+.bin
    \nUpdating /boot/grub/menu.lst ... done

    ", "created_at"=>2008-06-12 12:59:54 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    问题:
    \niceskysl@IceskYsl:/boot$ sudo dpkg --configure -a
    \n正在设置 initramfs-tools (0.85eubuntu39.1) ...
    \nupdate-initramfs: deferring update (trigger activated)
    \n
    \n正在设置 linux-ubuntu-modules-2.6.24-18-generic (2.6.24-18.26) ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \n正在设置 linux-image-generic (2.6.24.18.20) ...
    \n正在设置 linux-generic (2.6.24.18.20) ...
    \nProcessing triggers for initramfs-tools ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \ngzip: stdout: No space left on device
    \nupdate-initramfs: failed for /boot/initrd.img-2.6.24-18-generic
    \ndpkg: 子进程 post-installation script 返回了错误号 1
    \n
    \n解决:
    \nuname -a 看自己用的什么
    \ndpkg --get-selections|grep linux 看机器里都装了什么
    \nsudo apt-get remove linux-image-2.6.XX 直接删 XX替代为不用的
    \n或者用新立得搜索到不用的卸载
    \n
    \n实践:
    \niceskysl@IceskYsl:~$ uname -a
    \nLinux IceskYsl 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
    \niceskysl@IceskYsl:~$ dpkg --get-selections|grep linux
    \nlibselinux1                    install
    \nlinux-generic                    install
    \nlinux-headers-2.6.20-15                install
    \nlinux-headers-2.6.20-15-generic            install
    \nlinux-headers-2.6.20-16                install
    \nlinux-headers-2.6.20-16-generic            install
    \nlinux-headers-2.6.24-16                install
    \nlinux-headers-2.6.24-16-generic            install
    \nlinux-headers-2.6.24-17                install
    \nlinux-headers-2.6.24-17-generic            install
    \nlinux-headers-2.6.24-18                install
    \nlinux-headers-2.6.24-18-generic            install
    \nlinux-headers-generic                install
    \nlinux-image-2.6.20-15-generic            deinstall
    \nlinux-image-2.6.20-16-generic            install
    \nlinux-image-2.6.22-14-generic            install
    \nlinux-image-2.6.24-16-generic            install
    \nlinux-image-2.6.24-17-generic            install
    \nlinux-image-2.6.24-18-generic            install
    \nlinux-image-generic                install
    \nlinux-libc-dev                    install
    \nlinux-restricted-modules-2.6.20-15-generic    deinstall
    \nlinux-restricted-modules-2.6.20-16-generic    install
    \nlinux-restricted-modules-2.6.22-14-generic    install
    \nlinux-restricted-modules-2.6.24-16-generic    install
    \nlinux-restricted-modules-2.6.24-17-generic    install
    \nlinux-restricted-modules-2.6.24-18-generic    install
    \nlinux-restricted-modules-common            install
    \nlinux-restricted-modules-generic        install
    \nlinux-sound-base                install
    \nlinux-ubuntu-modules-2.6.22-14-generic        install
    \nlinux-ubuntu-modules-2.6.24-16-generic        install
    \nlinux-ubuntu-modules-2.6.24-17-generic        install
    \nlinux-ubuntu-modules-2.6.24-18-generic        install
    \nutil-linux                    install
    \nutil-linux-locales                install
    \niceskysl@IceskYsl:~$ sudo apt-get remove linux-image-2.6.20-16-generic
    \n正在读取软件包列表... 完成
    \n正在分析软件包的依赖关系树      
    \n读取状态信息... 完成            
    \n下列软件包将被【卸载】:
    \n  linux-image-2.6.20-16-generic linux-restricted-modules-2.6.20-16-generic
    \n共升级了 0 个软件包,新安装了 0 个软件包,要卸载 2 个软件包,有 34 个软件未被升级。
    \n操作完成后,会释放 114MB 的磁盘空间。
    \n您希望继续执行吗?[Y/n]y
    \n(正在读取数据库 ... 系统当前总共安装有 218707 个文件和目录。)
    \n正在删除 linux-restricted-modules-2.6.20-16-generic ...
    \nFATAL: Could not open '/boot/System.map-2.6.20-16-generic': No such file or directory
    \n正在删除 linux-image-2.6.20-16-generic ...
    \nRunning postrm hook script /sbin/update-grub.
    \nSearching for GRUB installation directory ... found: /boot/grub
    \nSearching for default file ... found: /boot/grub/default
    \nTesting for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    \nSearching for splash image ... none found, skipping ...
    \nFound kernel: /vmlinuz-2.6.24-18-generic
    \nFound kernel: /memtest86+.bin
    \nUpdating /boot/grub/menu.lst ... done

    \n", "_id"=>845}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留意你的layout和filter的摆放顺序", "body"=>"

    前几天发现Rails的log里面老是出现一些按照ID找不到记录的错误,如下:

    \n

    ActiveRecord::RecordNotFound (Couldn't find User without an ID):
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1248:in `find_from_ids'
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in `find'
    \n    /app/models/right.rb:7:in `chech_right'
    \n    /app/controllers/home_controller.rb:30:in `check_right'

    \n

    奇怪了,这个是我用来做权限控制的,按照道理来说,这个如果未登录的话,应该会被before_filter定向到其他的地方去的,咋会还显示这个页面呢,原来以为Rails会丢失session中的东西,不过仔细想想可能性不大,于是仔细检查了下代码,发现问题的根源是before_filter和layout的摆放顺序有问题,竟然是这样摆放的:

    \n
      layout "back"
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n
    \n

    看到其上面的layout竟然放在  before_filter之前了,哦,原来如此,修改下顺序,现在为:

    \n
      before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n  layout "back" 
    \n

    重启服务,OK,搞定。

    \n

     

    \n

     

    ", "created_at"=>2008-06-15 13:48:52 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前几天发现Rails的log里面老是出现一些按照ID找不到记录的错误,如下:
    \nActiveRecord::RecordNotFound (Couldn't find User without an ID):
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1248:in find_from_ids'<br />
    \n&nbsp;&nbsp;&nbsp; /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in
    find'
    \n    /app/models/right.rb:7:in chech_right'<br />
    \n&nbsp;&nbsp;&nbsp; /app/controllers/home_controller.rb:30:in
    check_right'
    \n奇怪了,这个是我用来做权限控制的,按照道理来说,这个如果未登录的话,应该会被before_filter定向到其他的地方去的,咋会还显示这个页面呢,原来以为Rails会丢失session中的东西,不过仔细想想可能性不大,于是仔细检查了下代码,发现问题的根源是before_filter和layout的摆放顺序有问题,竟然是这样摆放的:
    \n  layout "back"
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n
    \n看到其上面的layout竟然放在  before_filter之前了,哦,原来如此,修改下顺序,现在为:
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n  layout "back" 
    \n重启服务,OK,搞定。
    \n 
    \n 

    \n", "_id"=>846}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"推荐两款支持Rails的服务提供商(SliceHost&DreamHost)", "body"=>"

    上次写了一篇文章《谈谈我使用过的几个国外服务器提供商》,不少朋友来信要我再推荐好的Rails空间和优惠码,如果你正在找寻支持Rails的空间,不妨试试我使用过的这两款,看您的需求,选择合适的。
    \n1.SliceHost生产系统性价比最高)
    \nSliceHost是一家很棒的VPS服务商提供诸如Ubuntu(提供好几个版本)、CentOS、Debian 4.0、Fedora 9、Gentoo好几种系统发行版选择,可以选择256M、512M、1G等好几种方案,拥有root权限,完全自主,非常稳定且价格在VPS中是最便宜 的,适合做生产环境,极力推荐。
    \n如果你感兴趣,按照如下两个方式得到最大优惠:
    \n1.点击优惠的SliceHost过去注册;
    \n2.注册时“Referral email address”输入"iceskysl@gmail.com"即可。
    \n另外,值得一提的是,其可以重新rebuild发行版(会丢失数据,切记备份),使用Slicehost的感觉就是自己除了物理接触外,完全拥有。且其相关的教材、文章非常详细,我在其上部署的Nginx+Mongrel+Vlad+MySQL非常棒。
    \n体验站点IceskYsl@1sters! | Focus on Ruby on Rails ,Security, Web2.0, Idea, Business and Beyond.

    \n

    2.DreamHostDemo演示类性价比最高)

    \n

    DreamHost在Rails和PHP的支持上还是不错的,部署和定制都很方便,其支持无限域名绑定,500G硬盘和无限流量,虽然有赚取眼球的嫌疑,但是用来给客户做Demo演示、个人Blog等等非常适合,你可以按照如下两个中的任意方式得到其允许的最大优惠额度:
    \n1.直接按照优惠的DreamHost过去注册;
    \n2.注册时输入优惠码"1STERS";
    \n体验站点: 1sters! - Ruby on Rails web development(敏捷满足您个性化的需求...)!

    \n

    有任何问题,请联系我,很乐意帮忙:)

    \n

    其他的信息(例如优缺点,局限性等),请参考前面写的那篇《谈谈我使用过的几个国外服务器提供商》,不在赘述,本文只是就自己使用感受给大家推荐的,如果你试用过其他服务商,还请分享。

    ", "created_at"=>2008-06-16 03:01:06 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    上次写了一篇文章《谈谈我使用过的几个国外服务器提供商》,不少朋友来信要我再推荐好的Rails空间和优惠码,如果你正在找寻支持Rails的空间,不妨试试我使用过的这两款,看您的需求,选择合适的。
    \n1.SliceHost(生产系统性价比最高)
    \nSliceHost是一家很棒的VPS服务商提供诸如Ubuntu(提供好几个版本)、CentOS、Debian 4.0、Fedora 9、Gentoo好几种系统发行版选择,可以选择256M、512M、1G等好几种方案,拥有root权限,完全自主,非常稳定且价格在VPS中是最便宜 的,适合做生产环境,极力推荐。
    \n如果你感兴趣,按照如下两个方式得到最大优惠:
    \n1.点击优惠的SliceHost过去注册;
    \n2.注册时“Referral email address”输入"iceskysl@gmail.com"即可。
    \n另外,值得一提的是,其可以重新rebuild发行版(会丢失数据,切记备份),使用Slicehost的感觉就是自己除了物理接触外,完全拥有。且其相关的教材、文章非常详细,我在其上部署的Nginx+Mongrel+Vlad+MySQL非常棒。
    \n体验站点:IceskYsl@1sters! | Focus on Ruby on Rails ,Security, Web2.0, Idea, Business and Beyond.
    \n2.DreamHost(Demo演示类性价比最高)
    \nDreamHost在Rails和PHP的支持上还是不错的,部署和定制都很方便,其支持无限域名绑定,500G硬盘和无限流量,虽然有赚取眼球的嫌疑,但是用来给客户做Demo演示、个人Blog等等非常适合,你可以按照如下两个中的任意方式得到其允许的最大优惠额度:
    \n1.直接按照优惠的DreamHost过去注册;
    \n2.注册时输入优惠码"1STERS";
    \n体验站点: 1sters! - Ruby on Rails web development(敏捷满足您个性化的需求...)!
    \n有任何问题,请联系我,很乐意帮忙:)
    \n其他的信息(例如优缺点,局限性等),请参考前面写的那篇《谈谈我使用过的几个国外服务器提供商》,不在赘述,本文只是就自己使用感受给大家推荐的,如果你试用过其他服务商,还请分享。

    \n", "_id"=>847}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"协作翻译: Ruby On Raisl 2.1新特性(第二版)", "body"=>"

    昨天看到caiwangqin在CoR上发了一篇帖子说“RubyOnRails 2.1 what's new”这本书原文是葡萄牙的,由Brazilian社区翻译为英文,希望能有人组织翻译成中文版。

    \n

    我向来希望把自己了解的东西写下里,记录成Doc文档分享给其他的人,如果你经常关注我的blog,应该了解;于是花了中午午休的时候,按照以往的经验做了一份协作约定文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,然后翻译了索引篇《Ruby On Raisl 2.1新特性介绍》和第一章《第1章: 概述(Introduction)》,发布给其他成员。

    \n

    紧接着我有挑选了几篇感兴趣的翻译,其他成员积极性相当高,仅仅一下午,所有14章全部领取完毕,晚上看GoogleDoc发现大家都在辛苦工作,实在感动,谢谢各位。

    \n

    再次感受到社区的力量,很多朋友一般是不怎么联系的,但是这事情一发动就得到大家的积极响应,人多力量果然很大。

    \n

    相信,这本书很快就可以和大家见面了,:)

    \n

    这是个不错的模式,希望以后还能有机会找到好资料,大家协作完成。

    ", "created_at"=>2008-06-16 14:50:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    昨天看到caiwangqin在CoR上发了一篇帖子说“RubyOnRails 2.1 what's new”这本书原文是葡萄牙的,由Brazilian社区翻译为英文,希望能有人组织翻译成中文版。
    \n我向来希望把自己了解的东西写下里,记录成Doc文档分享给其他的人,如果你经常关注我的blog,应该了解;于是花了中午午休的时候,按照以往的经验做了一份协作约定文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,然后翻译了索引篇《Ruby On Raisl 2.1新特性介绍》和第一章《第1章: 概述(Introduction)》,发布给其他成员。
    \n紧接着我有挑选了几篇感兴趣的翻译,其他成员积极性相当高,仅仅一下午,所有14章全部领取完毕,晚上看GoogleDoc发现大家都在辛苦工作,实在感动,谢谢各位。
    \n再次感受到社区的力量,很多朋友一般是不怎么联系的,但是这事情一发动就得到大家的积极响应,人多力量果然很大。
    \n相信,这本书很快就可以和大家见面了,:)
    \n这是个不错的模式,希望以后还能有机会找到好资料,大家协作完成。

    \n", "_id"=>848}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"install and configuration vsftpd ftp service on Ubuntu Linux", "body"=>"

    Q. How do I install Ubuntu ftp service or server?

    \n

    A. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
    \n=> proftpd - Versatile, virtual-hosting FTP daemon

    \n

    => vsftpd - The Very Secure FTP Daemon

    \n

    => ftpd - FTP server

    \n

    => wu-ftpd - powerful and widely used FTP server

    \n

    => wzdftpd - A portable, modular, small and efficient ftp server

    \n

    => pure-ftpd - Pure-FTPd FTP server

    \n

    其中vsftpd相当优秀,其配置简单方便,且非常安全,如下是其主页上的说明:

    \n

    vsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.

    \n

    => Default ftp port : 21
    \n=> Default configuration file : /etc/vsftpd.conf

    \n

    Q:如何安装vsftpd

    \n

    很简单,即可搞,如下:
    \n

    \n### Step # 1: Install vsftpd\n

    Type apt-get command to install vsftpd
    \n````$ sudo apt-get install vsftpd```
    \nOutput:

    \n
    \n``Password:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
    vsftpd
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 121kB of archives.
    After unpacking 438kB of additional disk space will be used.
    Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
    Fetched 121kB in 0s (246kB/s)
    Selecting previously deselected package vsftpd.
    (Reading database ... 31396 files and directories currently installed.)
    Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
    Setting up vsftpd (2.0.4-0ubuntu5) ...
    Adding system user `ftp' with uid 106...
    Adding new user `ftp' (106) with group `nogroup'.
    Not creating home directory `/home/ftp'.
    * Starting FTP server: vsftpd```\n
    \n### Step # 2: Configure /etc/vsftpd.conf\n

    The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
    \n````$ sudo vi /etc/vsftpd.conf```

    \n

    Add the following line (uncomment line) to the vsftpd configuration file:
    \n````local_enable=YES```
    \nAbove config directive will allow local users to log in via ftp

    \n

    If you would like to allow users to upload file, add the following to the file:
    \n````write_enable=YES```

    \n

    For security you may restrict local users to their home directories. Add the following to the file:
    \n````chroot_local_user=YES```

    \n

    Save and close the file.

    \n### Step # 3: Restart vsftpd\n

    To restart vsftpd type the command :
    \n````$ sudo /etc/init.d/vsftpd restart```
    \nOutput:

    \n``* Stopping FTP server: vsftpd [ ok ]
    * Starting FTP server: vsftpd [ ok ]

    add following rules to your iptables script. Assuming that default
    incoming policy is drop. If protocol is TCP and destination port is 21
    (ftp):

    ````iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT```

    See - How do I open open ftp port 21 using iptables for more information.```\n

    There are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
    \n````$ man vsftpd.conf```

    \n``参考文档:
    1、http://www.cyberciti.biz/faq/ubuntu-vsftpd-ftp-service-server/
    2、http://school.cfan.com.cn/system/unix/2008-06-16/1213603744d188509.shtml```", "created_at"=>2008-06-17 12:33:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Q. How do I install Ubuntu ftp service or server?
    \nA. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
    \n=> proftpd - Versatile, virtual-hosting FTP daemon
    \n=> vsftpd - The Very Secure FTP Daemon
    \n=> ftpd - FTP server
    \n=> wu-ftpd - powerful and widely used FTP server
    \n=> wzdftpd - A portable, modular, small and efficient ftp server
    \n=> pure-ftpd - Pure-FTPd FTP server
    \n其中vsftpd相当优秀,其配置简单方便,且非常安全,如下是其主页上的说明:
    \nvsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.
    \n=> Default ftp port : 21
    \n=> Default configuration file : /etc/vsftpd.conf
    \nQ:如何安装vsftpd
    \n很简单,即可搞,如下:

    \n\n

    Step # 1: Install vsftpd

    \n\n

    Type apt-get command to install vsftpd
    \n`$ sudo apt-get install vsftpd
    \nOutput:
    \n
    \nPassword:<br />Reading package lists... Done<br />Building dependency tree<br />Reading state information... Done<br />The following NEW packages will be installed:<br /> vsftpd<br />0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.<br />Need to get 121kB of archives.<br />After unpacking 438kB of additional disk space will be used.<br />Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]<br />Fetched 121kB in 0s (246kB/s)<br />Selecting previously deselected package vsftpd.<br />(Reading database ... 31396 files and directories currently installed.)<br />Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...<br />Setting up vsftpd (2.0.4-0ubuntu5) ...<br />Adding system user `ftp' with uid 106...<br />Adding new user `ftp' (106) with group `nogroup'.<br />Not creating home directory `/home/ftp'.<br /> * Starting FTP server: vsftpd`

    \n\n

    Step # 2: Configure /etc/vsftpd.conf

    \n\n

    The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
    \n$ sudo vi /etc/vsftpd.conf```</strong></p>
    \n<p>Add the following line (uncomment line) to the vsftpd configuration file:<br />
    \n<strong>
    local_enable=YES</strong><br />
    \nAbove config directive will allow local users to log in via ftp</p>
    \n<p>If you would like to allow users to upload file, add the following to the file:<br />
    \n<strong>
    write_enable=YES</strong></p>
    \n<p>For security you may restrict local users to their home directories. Add the following to the file:<br />
    \n<strong>
    chroot_local_user=YES`
    \nSave and close the file.

    \n\n

    Step # 3: Restart vsftpd

    \n\n

    To restart vsftpd type the command :
    \n$ sudo /etc/init.d/vsftpd restart```</strong><br />
    \nOutput:</p>
    \n``* Stopping FTP server: vsftpd [ ok ]<br /> * Starting FTP server: vsftpd [ ok ]<br /><br />add following rules to your iptables script. Assuming that default<br />incoming policy is drop. If protocol is TCP and destination port is 21<br />(ftp):<br /><br /><em>
    iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT</em><br /><br />See - <a href="http://www.cyberciti.biz/faq/iptables-open-ftp-port-21/">How do I open open ftp port 21 using iptables</a> for more information.
    \nThere are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
    \n`$ man vsftpd.conf
    \n参考文档:<br />1、http://www.cyberciti.biz/faq/ubuntu-vsftpd-ftp-service-server/<br />2、http://school.cfan.com.cn/system/unix/2008-06-16/1213603744d188509.shtml`

    \n", "_id"=>849}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于这两天blog挂掉的说明", "body"=>"

    关注我Blog的朋友,这两天由于服务器问题,down了两天,深表歉意!

    \n

    挂掉这两天,和DH的客服反复较量了好多次,mail一封接一封,完全是我说啥,他查啥,够晕的,幸好最后我还是定位到问题了,他们就解决了,够晕的。

    \n

    比较庆幸的是我的E文他们看的明白,他们的mail我也懂,就这样一来一去的,拉锯了好多次,最后定位到时他们新加了一块硬盘,导致对我的帐户写在那个硬盘上的文件数被限制了。

    \n

    还在交涉赔偿事件,我倒要看看DH到底有uo难缠,多专业。

    ", "created_at"=>2008-06-20 18:59:54 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    关注我Blog的朋友,这两天由于服务器问题,down了两天,深表歉意!
    \n挂掉这两天,和DH的客服反复较量了好多次,mail一封接一封,完全是我说啥,他查啥,够晕的,幸好最后我还是定位到问题了,他们就解决了,够晕的。
    \n比较庆幸的是我的E文他们看的明白,他们的mail我也懂,就这样一来一去的,拉锯了好多次,最后定位到时他们新加了一块硬盘,导致对我的帐户写在那个硬盘上的文件数被限制了。
    \n还在交涉赔偿事件,我倒要看看DH到底有uo难缠,多专业。

    \n", "_id"=>850}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1中文文档翻译完成[已发布]", "body"=>"

    前几天发布了一篇文章说我们正在翻译Rails 2.1文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,经过3天不到的时间,我们就完稿了,参与翻译的都是COR中的做Rails的朋友,大家都很积极,从那天下午我做出“协作约定”开始领取翻译任务后,半天时间就认领完毕了,不得不赞下大家的热情和速度,特别是snow同学,上来就挑了个最大块头的第二章,呵呵。

    \n

    最后是我整理生成PDF文档的,现在已经发布出去,需要的朋友可以在这里看到“Ruby on Rails 2.1更新了什么?”,另外,infoQ也发布了新闻“Rails 2.1中文文档翻译计划完成”。

    \n

    另外,你可以通过如下几个方式查看:

    \n

    1、在slideshare上观看PPT版本

    \n

    2、通过Google Site上可以查看最新版本的google Doc,地址在我的GoogleSite上。

    \n

    3、Google Doc上的索引页面"Ruby On Rails 2.1新特性介绍".

    \n

    如果你发现错误的地方,或者有其他意见,请联系我修正,谢谢。

    ", "created_at"=>2008-06-20 19:13:09 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前几天发布了一篇文章说我们正在翻译Rails 2.1文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,经过3天不到的时间,我们就完稿了,参与翻译的都是COR中的做Rails的朋友,大家都很积极,从那天下午我做出“协作约定”开始领取翻译任务后,半天时间就认领完毕了,不得不赞下大家的热情和速度,特别是snow同学,上来就挑了个最大块头的第二章,呵呵。
    \n最后是我整理生成PDF文档的,现在已经发布出去,需要的朋友可以在这里看到“Ruby on Rails 2.1更新了什么?”,另外,infoQ也发布了新闻“Rails 2.1中文文档翻译计划完成”。
    \n另外,你可以通过如下几个方式查看:
    \n1、在slideshare上观看PPT版本
    \n2、通过Google Site上可以查看最新版本的google Doc,地址在我的GoogleSite上。
    \n3、Google Doc上的索引页面"Ruby On Rails 2.1新特性介绍".
    \n如果你发现错误的地方,或者有其他意见,请联系我修正,谢谢。

    \n", "_id"=>851}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何在Rails的controller中取得URL中的anchor值", "body"=>"

    有人问,如何在Rails的控制器中取得URL中的锚点的值,这个需求比较奇特,以前没搞过,于是google了一把,在“Getting the # value”这个帖子看到有人有类似的问题,他说出了在controller中直接取不到的原因是“For normal links/urls the #anchor is a client side feature and is often not even sent to the server as part of a request.”,恩,确实直接取不到,只能使用类似JS的方法来取了,因为其没有将URL全部提交到服务端,所以是无法取值的。

    \n

    另外,看了下Rails中生成anchor的方法比较简单,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. <%= url_for(:action => 'play':anchor => 'player') %>  
    2. \n
    3. # => /messages/play/#player  
    4. \n
    5.   
    6. \n
    7. <%= url_for(:action => 'checkout':anchor => 'tax&ship') %>  
    8. \n
    9. # => /testing/jump/#tax&ship  
    10. \n
    11.   
    12. \n
    13. <%= url_for(:action => 'checkout':anchor => 'tax&ship':escape => false) %>  
    14. \n
    15. # => /testing/jump/#tax&ship  
    16. \n
    \n
    \n详细的请参考API:ActionView::Helpers::UrlHelper

    ", "created_at"=>2008-06-23 09:12:45 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有人问,如何在Rails的控制器中取得URL中的锚点的值,这个需求比较奇特,以前没搞过,于是google了一把,在“Getting the # value”这个帖子看到有人有类似的问题,他说出了在controller中直接取不到的原因是“For normal links/urls the #anchor is a client side feature and is often not even sent to the server as part of a request.”,恩,确实直接取不到,只能使用类似JS的方法来取了,因为其没有将URL全部提交到服务端,所以是无法取值的。
    \n另外,看了下Rails中生成anchor的方法比较简单,如下:
    \n
    \n
    \nRuby代码
    \n
    \n <%= url_for(:action => 'play', :anchor => 'player') %>  
    \n # => /messages/play/#player  
    \n   
    \n <%= url_for(:action => 'checkout', :anchor => 'tax&ship') %>  
    \n # => /testing/jump/#tax&ship  
    \n   
    \n <%= url_for(:action => 'checkout', :anchor => 'tax&ship', :escape => false) %>  
    \n # => /testing/jump/#tax&ship  
    \n
    \n
    \n详细的请参考API:ActionView::Helpers::UrlHelper

    \n", "_id"=>852}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>853}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>854}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>855}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>856}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>857}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>858}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>859}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>860}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>861}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>862}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>863}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"RatProxy:Google提供的开源web应用安全工具", "body"=>"网络安全永远都是一个值得深究的领域,随着技术的不断发展,越来越多的技术手段被利用在网络安全中;而这其中,web安全越来越被人重视,攻击方式不断革新,技术手法层数不穷,但是目前的状况是,攻击和利用越来越自动化,但是防护和检查都还是偏向人工审核的方式,效率实在一般,但是基于web攻击手段的多样性和复杂性,一直没有一款比较不错的安全检查工具诞生。\r\nRatProxy是Google信息安全技术团队所研发的程序安全侦测工具,一向为Google 内部所使用。用于评估基于Web的应用程序的安全性Web Application Security Consortium在2006年的调查发现,31,373个被调查网站中有85.57%容易遭受跨站点脚本攻击,26.38%面临SQL注入攻击,15.70%有一些其它问题,可能导致数据丢失。\r\nGoogle信息安全工程师Michal Zalewski表示,Google决定将该工具免费开放是因为他们认为这将对信息安全社群有价值,强化社群理解与Web技术有关的安全问题。RatProxy能够分析诸如跨站威胁、防御伪装的跨站请求,以及侦测到快取问题或是潜在的信息泄露问题等。\r\n\"\"\r\nGoogle在文件中表示,RatProxy为一半自动、多数是被动的网络应用程序安全侦测工具,它同时补足了传统主动爬寻及手动侦测的缺点,而且特别针对潜在的问题及安全相关设计的精确侦测与自动批注进行优化。\r\n\r\n至于比起传统安全侦测工具,Google亦列出几项 RatProxy 的优势,包括在默认的操作模式中不会引起仿真攻击所带来的庞大流量,可避免正在使用的系统的瓦解,而且它提供直觉式的操作,并降低时间及带宽的使用,并能找出产品的问题与潜在的漏洞等。\r\n\r\nRatproxy采用Apache 2.0软件许可证,可以查找Web应用程序中的多种代码问题,支持Linux、FreeBSD、Mac OS X、Windows(Cygwin)等操作系统,特别适用于用户为先的Web 2.0环境。\r\n如果你感兴趣,请参考“RatproxyDoc ”", "created_at"=>2008-07-07 02:02:55 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    网络安全永远都是一个值得深究的领域,随着技术的不断发展,越来越多的技术手段被利用在网络安全中;而这其中,web安全越来越被人重视,攻击方式不断革新,技术手法层数不穷,但是目前的状况是,攻击和利用越来越自动化,但是防护和检查都还是偏向人工审核的方式,效率实在一般,但是基于web攻击手段的多样性和复杂性,一直没有一款比较不错的安全检查工具诞生。
    \nRatProxy是Google信息安全技术团队所研发的程序安全侦测工具,一向为Google 内部所使用。用于评估基于Web的应用程序的安全性。Web Application Security Consortium在2006年的调查发现,31,373个被调查网站中有85.57%容易遭受跨站点脚本攻击,26.38%面临SQL注入攻击,15.70%有一些其它问题,可能导致数据丢失。
    \nGoogle信息安全工程师Michal Zalewski表示,Google决定将该工具免费开放是因为他们认为这将对信息安全社群有价值,强化社群理解与Web技术有关的安全问题。RatProxy能够分析诸如跨站威胁、防御伪装的跨站请求,以及侦测到快取问题或是潜在的信息泄露问题等。
    \n
    \nGoogle在文件中表示,RatProxy为一半自动、多数是被动的网络应用程序安全侦测工具,它同时补足了传统主动爬寻及手动侦测的缺点,而且特别针对潜在的问题及安全相关设计的精确侦测与自动批注进行优化。

    \n\n

    至于比起传统安全侦测工具,Google亦列出几项 RatProxy 的优势,包括在默认的操作模式中不会引起仿真攻击所带来的庞大流量,可避免正在使用的系统的瓦解,而且它提供直觉式的操作,并降低时间及带宽的使用,并能找出产品的问题与潜在的漏洞等。

    \n\n

    Ratproxy采用Apache 2.0软件许可证,可以查找Web应用程序中的多种代码问题,支持Linux、FreeBSD、Mac OS X、Windows(Cygwin)等操作系统,特别适用于用户为先的Web 2.0环境。
    \n如果你感兴趣,请参考“RatproxyDoc ”

    \n", "_id"=>864}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Amoeba:分布式数据库Proxy解决方案", "body"=>"Amoeba 座落与Client、Database Server(s)之间。 具有负载均衡、高可用性、sql过滤、可承受高并发、读写分离、Query Route(解析sql query语句,并且根据条件与预先设定的规则,请求到指定的目标数据库。可并发请求多台数据库合并结果)、对客户端透明。\r\n主要降低 数据切分带来的复杂多数据库结构、数据切分规则 给应用带来的影响,能够轻易实现:\r\n
      \r\n\t
    • 读写分离
    • \r\n\t
    • Failover
    • \r\n\t
    • 负载均衡
    • \r\n\t
    • 数据切分
    • \r\n
    \r\n这个和mysql proxy是有一些差别的,按照其作者的说法为:“在 mysql proxy 上面如果想要读写分离并且 读集群、写集群 机器比较多情况下,用mysql proxy 需要相当大的工作量,目前mysql proxy没有现成的 lua脚本。mysql proxy根本没有配置文件,lua脚本就是它的全部,当然可以是相当方便的。那么同样这种东西需要编写大量的lua脚本才能完成一个复杂的配置“\r\n\r\n按照其说明文档中的”Amoeba:分布式数据库Proxy解决“说法,其主要也就扮演proxy的角色,目前已经发布了对mysql的proxy功能,其主要是为了支持分布式的DB系统,从读写、数据切分几个方面,来做到负载均衡并伴有故障转移等功能。\r\n\r\n想法好似很好的,但是其文件http://www.sourceforge.net/projects/amoeba我现在无法下载,没时间尝试,有时间可以再试试。\r\n\r\n参考文档:\r\n\r\n1、http://www.javaeye.com/topic/188598\r\n\r\n\r\n ", "created_at"=>2008-07-08 07:02:08 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Amoeba 座落与Client、Database Server(s)之间。 具有负载均衡、高可用性、sql过滤、可承受高并发、读写分离、Query Route(解析sql query语句,并且根据条件与预先设定的规则,请求到指定的目标数据库。可并发请求多台数据库合并结果)、对客户端透明。
    \n主要降低 数据切分带来的复杂多数据库结构、数据切分规则 给应用带来的影响,能够轻易实现:
    \n
    \n 读写分离
    \n Failover
    \n 负载均衡
    \n 数据切分
    \n
    \n这个和mysql proxy是有一些差别的,按照其作者的说法为:“在 mysql proxy 上面如果想要读写分离并且 读集群、写集群 机器比较多情况下,用mysql proxy 需要相当大的工作量,目前mysql proxy没有现成的 lua脚本。mysql proxy根本没有配置文件,lua脚本就是它的全部,当然可以是相当方便的。那么同样这种东西需要编写大量的lua脚本才能完成一个复杂的配置“

    \n\n

    按照其说明文档中的”Amoeba:分布式数据库Proxy解决“说法,其主要也就扮演proxy的角色,目前已经发布了对mysql的proxy功能,其主要是为了支持分布式的DB系统,从读写、数据切分几个方面,来做到负载均衡并伴有故障转移等功能。

    \n\n

    想法好似很好的,但是其文件http://www.sourceforge.net/projects/amoeba我现在无法下载,没时间尝试,有时间可以再试试。

    \n\n

    参考文档:

    \n\n

    1、http://www.javaeye.com/topic/188598

    \n\n

     

    \n", "_id"=>865}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails: How to use helper inside a controller & model", "body"=>"前几天一个朋友问我如何在Controller中使用helper,我当时说helper是view层的东西,C层没法使用,当时有点忙,虽然知道这个说法也过得去,但是一棍子打死的说法肯定不对。\r\n\r\n今天另外一个朋友问我如何在Model里面使用helper,我开始也说没法使用,并说以前我都是直接在model里面在copy一遍helper的东西。然后还是觉得应该是可以使用的,于是google到一篇tips,但是其访问不了了,还好使用google caceh还是看到了其内容,现在记录如下:\r\n\r\nThis is an easy to use any helpers that rails provides in any other place besides views and view helpers\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # create a new file inside lib/ and call it helpers.rb  
    2. \r\n\t
    3. # paste the following:  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. def help  
    8. \r\n\t
    9.     Helper.instance  
    10. \r\n\t
    11. end  
    12. \r\n\t
    13.    
    14. \r\n\t
    15. class Helper  
    16. \r\n\t
    17.     include Singleton  
    18. \r\n\t
    19.     # look inside ActionView::Helpers to include any other helpers that you might need  
    20. \r\n\t
    21.     include ActionView::Helpers::DateHelper  
    22. \r\n\t
    23.     include ActionView::Helpers::TextHelper  
    24. \r\n\t
    25. end  
    26. \r\n\t
    27.    
    28. \r\n\t
    29. # then in any model or controller:  
    30. \r\n\t
    31. require 'lib/helpers'  
    32. \r\n\t
    33.    
    34. \r\n\t
    35. # to use:  
    36. \r\n\t
    37. # help.name_of_helper  
    38. \r\n\t
    39. # EX: help.pluralize 10, \"person\"  
    40. \r\n
    \r\n
    \r\n然后又找到一篇类似的文档:http://snippets.dzone.com/posts/show/1799,摘个方法如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def check_for_max_donkeys  
    2. \r\n\t
    3.   if Donkey.find_fit_donkeys.size == APP_SETTINGS['max_fit_donkeys']  
    4. \r\n\t
    5.     flash_error \"The maximum of \#{help.pluralize(APP_SETTINGS['max_fit_donkeys'], 'donkey')} has been reached.\"  
    6. \r\n\t
    7.     redirect_to_index  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\nPS:Don't use the method name \"helper\" because Rails already uses that. Just \"help\" works fine.", "created_at"=>2008-07-10 08:33:29 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    前几天一个朋友问我如何在Controller中使用helper,我当时说helper是view层的东西,C层没法使用,当时有点忙,虽然知道这个说法也过得去,但是一棍子打死的说法肯定不对。

    \n\n

    今天另外一个朋友问我如何在Model里面使用helper,我开始也说没法使用,并说以前我都是直接在model里面在copy一遍helper的东西。然后还是觉得应该是可以使用的,于是google到一篇tips,但是其访问不了了,还好使用google caceh还是看到了其内容,现在记录如下:

    \n\n

    This is an easy to use any helpers that rails provides in any other place besides views and view helpers
    \n
    \nRuby代码
    \n
    \n # create a new file inside lib/ and call it helpers.rb  
    \n # paste the following:  
    \n   
    \n def help  
    \n     Helper.instance  
    \n end  
    \n    
    \n class Helper  
    \n     include Singleton  
    \n     # look inside ActionView::Helpers to include any other helpers that you might need  
    \n     include ActionView::Helpers::DateHelper  
    \n     include ActionView::Helpers::TextHelper  
    \n end  
    \n    
    \n # then in any model or controller:  
    \n require 'lib/helpers'  
    \n    
    \n # to use:  
    \n # help.name_of_helper  
    \n # EX: help.pluralize 10, "person"  
    \n
    \n
    \n然后又找到一篇类似的文档:http://snippets.dzone.com/posts/show/1799,摘个方法如下:
    \n
    \nRuby代码
    \n
    \n def check_for_max_donkeys  
    \n   if Donkey.find_fit_donkeys.size == APP_SETTINGS['max_fit_donkeys']  
    \n     flash_error "The maximum of \#{help.pluralize(APP_SETTINGS['max_fit_donkeys'], 'donkey')} has been reached."  
    \n     redirect_to_index  
    \n   end  
    \n end  
    \n
    \n
    \nPS:Don't use the method name "helper" because Rails already uses that. Just "help" works fine.

    \n", "_id"=>866}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby中的Mixin特性", "body"=>"在Ruby中,我们可以把一个模块混入(Mixin)到对象中,从而达到类似多重继承的效果。看几个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. module Mixin1  
    2. \r\n\t
    3.   def fun1  
    4. \r\n\t
    5.     puts \"I am fun1 from Mixin1\"  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9.   
    10. \r\n\t
    11.   def fun2  
    12. \r\n\t
    13.     puts \"I am fun2 from Mixin1. I’ll call a member function of the class which includes me\"  
    14. \r\n\t
    15.     mem_fun  
    16. \r\n\t
    17.   end  
    18. \r\n\t
    19.   
    20. \r\n\t
    21.   def fun3  
    22. \r\n\t
    23.     puts \"I am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me\"  
    24. \r\n\t
    25.     puts @mem_var  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29. end  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. class A  
    34. \r\n\t
    35.   include Mixin1  
    36. \r\n\t
    37.   def mem_fun  
    38. \r\n\t
    39.     puts \"I am a member fun of class A\"  
    40. \r\n\t
    41.   end  
    42. \r\n\t
    43.   
    44. \r\n\t
    45.   def initialize  
    46. \r\n\t
    47.     @mem_var =\"I am a member varaible of class A\"  
    48. \r\n\t
    49.   end  
    50. \r\n\t
    51. end  
    52. \r\n
    \r\n
    \r\n调用一下试试看:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. a = A.new  
    2. \r\n\t
    3. a.fun1  
    4. \r\n\t
    5. a.fun2  
    6. \r\n\t
    7. a.fun3  
    8. \r\n
    \r\n
    \r\n结果如下:\r\nI am fun1 from Mixin1\r\nI am fun2 from Mixin1. I’ll call a member function of the class which includes me\r\nI am a member fun of class A\r\nI am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me\r\nI am a member varaible of class A\r\n\r\n很明显了,不赘述。\r\n\r\n参考文档:\r\nhttp://thinkinginruby.javaeye.com/blog/148967\r\nhttp://my.donews.com/idlecat/2006/10/21/UDDxaYBkNCABNXNVgmIMuMwuKJMHiRXduBBu/\r\nhttp://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/", "created_at"=>2008-07-10 10:01:42 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在Ruby中,我们可以把一个模块混入(Mixin)到对象中,从而达到类似多重继承的效果。看几个例子:
    \n
    \nRuby代码
    \n
    \n module Mixin1  
    \n   def fun1  
    \n     puts "I am fun1 from Mixin1"  
    \n   end  
    \n   
    \n   def fun2  
    \n     puts "I am fun2 from Mixin1. I’ll call a member function of the class which includes me"  
    \n     mem_fun  
    \n   end  
    \n   
    \n   def fun3  
    \n     puts "I am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me"  
    \n     puts @mem_var  
    \n   end  
    \n end  
    \n   
    \n class A  
    \n   include Mixin1  
    \n   def mem_fun  
    \n     puts "I am a member fun of class A"  
    \n   end  
    \n   
    \n   def initialize  
    \n     @mem_var ="I am a member varaible of class A"  
    \n   end  
    \n end  
    \n
    \n
    \n调用一下试试看:
    \n
    \nRuby代码
    \n
    \n a = A.new  
    \n a.fun1  
    \n a.fun2  
    \n a.fun3  
    \n
    \n
    \n结果如下:
    \nI am fun1 from Mixin1
    \nI am fun2 from Mixin1. I’ll call a member function of the class which includes me
    \nI am a member fun of class A
    \nI am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me
    \nI am a member varaible of class A

    \n\n

    很明显了,不赘述。

    \n\n

    参考文档:
    \nhttp://thinkinginruby.javaeye.com/blog/148967
    \nhttp://my.donews.com/idlecat/2006/10/21/UDDxaYBkNCABNXNVgmIMuMwuKJMHiRXduBBu/
    \nhttp://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/

    \n", "_id"=>867}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机摔坏了,一个星期没开机", "body"=>"上次去北京出差的时候,下的士的时候没注意把手机摔下,结果屏幕黑了,啥也看不见了,于是回来这个星期一直在找手机。\r\n\r\n由于用了一段时间的BB,习惯了BB的键盘和强大的功能,其他手机我都不喜欢了,所以选了这么久也没选到合适的。\r\n\r\n本来打算再买一个BB的,心理有阴影了,因为看过一次拆机,发现其可靠的屏保其实很简单就可以贴上去,里面的配件,显示屏啥的都很简单就换了,实在是不咋放心。。\r\n\r\n需要联系我的朋友请发mail或者通过Gtalk,我基本上都在网上的。\r\n\r\n估计选中合适的手机,还得有段时日~", "created_at"=>2008-07-14 07:09:49 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    上次去北京出差的时候,下的士的时候没注意把手机摔下,结果屏幕黑了,啥也看不见了,于是回来这个星期一直在找手机。

    \n\n

    由于用了一段时间的BB,习惯了BB的键盘和强大的功能,其他手机我都不喜欢了,所以选了这么久也没选到合适的。

    \n\n

    本来打算再买一个BB的,心理有阴影了,因为看过一次拆机,发现其可靠的屏保其实很简单就可以贴上去,里面的配件,显示屏啥的都很简单就换了,实在是不咋放心。。

    \n\n

    需要联系我的朋友请发mail或者通过Gtalk,我基本上都在网上的。

    \n\n

    估计选中合适的手机,还得有段时日~

    \n", "_id"=>868}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Protocol Buffers:更简洁有效的数据交换格式!", "body"=>"“Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.”\r\n\r\nGoogle公司与本月初宣布其内部数据交换格式Protocol Buffers正式开源,基于Apache软件证书2.0发布,相关文档、实例和代码已经可以从Google Code上 访问到。\r\n\r\nProtocol Buffers被定义为一种数据描述语言(Data Description Language,DDL),广泛的应用于Google内部,用于结构化数据的描述、传输和存储。尽管其功能和用途与XML基本相似,但是 Protocol Buffers更为轻便。Google宣称其效率对于XML有很大提升,文本比XML要小3-10倍,而解析效率却提升至20-100倍。\r\n\r\n这真是和好消息,XML慢的诟病相比大家都非常清楚,JSON格式的又无法取代XML的强大地位,虽然Ruby中有Hpricot这样的XML解析利器,但是在大批量的解析中还是会有瓶颈出现,而Google此次放出的Protocol Buffers比XML小,且解析速度很快,足够引起广泛的关注了。\r\n\r\nInfoQ上有篇报道“Google开源数据交换格式Protocol Buffers”比较详细,你也可以在\"Protocol Buffers\"上查看。\r\n\r\n目前已经看到C++,Java,Python格式的API,但是没看到基于Ruby的API,何时会出现 ,应该很快就有了。", "created_at"=>2008-07-15 03:20:15 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    “Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.”

    \n\n

    Google公司与本月初宣布其内部数据交换格式Protocol Buffers正式开源,基于Apache软件证书2.0发布,相关文档、实例和代码已经可以从Google Code上 访问到。

    \n\n

    Protocol Buffers被定义为一种数据描述语言(Data Description Language,DDL),广泛的应用于Google内部,用于结构化数据的描述、传输和存储。尽管其功能和用途与XML基本相似,但是 Protocol Buffers更为轻便。Google宣称其效率对于XML有很大提升,文本比XML要小3-10倍,而解析效率却提升至20-100倍。

    \n\n

    这真是和好消息,XML慢的诟病相比大家都非常清楚,JSON格式的又无法取代XML的强大地位,虽然Ruby中有Hpricot这样的XML解析利器,但是在大批量的解析中还是会有瓶颈出现,而Google此次放出的Protocol Buffers比XML小,且解析速度很快,足够引起广泛的关注了。

    \n\n

    InfoQ上有篇报道“Google开源数据交换格式Protocol Buffers”比较详细,你也可以在"Protocol Buffers"上查看。

    \n\n

    目前已经看到C++,Java,Python格式的API,但是没看到基于Ruby的API,何时会出现 ,应该很快就有了。

    \n", "_id"=>869}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>870}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>871}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"http_load:压力测试小工具", "body"=>"命令行工具http_load看上去和apache的ab很相似,用来做网站的压力测试。其主要用法为:\r\n\r\n1.http_load -parallel 5 -fetches 1000 urls.txt\r\n2.http_load -rate 2 -seconds 300 urls.txt\r\n例子只是个参考,参数其实可以自由组合,参数之间的选择并没有什么限制。比如你写成http_load -parallel 5 -seconds 300 urls.txt也是可以的。我们把参数给大家简单说明一下。\r\n-parallel 简写-p :含义是并发的用户进程数。\r\n-fetches 简写-f :含义是总计的访问次数\r\n-rate    简写-p :含义是每秒的访问频率\r\n-seconds简写-s :含义是总计的访问时间\r\n\r\nurl 是你要访问的网址名,参数可以是单个的网址也可以使包含网址的文件。文件格式如下\r\n
    http://iceskysl.1sters.com/?action=show&id=336\r\nhttp://iceskysl.1sters.com/?action=show&id=335\r\nhttp://iceskysl.1sters.com/?action=show&id=332\r\nhttp://iceskysl.1sters.com/?action=show&id=32
    \r\n参数了解了,我们来看运行一条命令来看看它的返回结果\r\n\r\n命令:% ./http_load -rate 5 -seconds 10 urls\r\n说明执行了一个持续时间10秒的测试,每秒的频率为5。\r\n
    49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds\r\n5916 mean bytes/connection\r\n4.89274 fetches/sec, 28945.5 bytes/sec\r\nmsecs/connect: 28.8932 mean, 44.243 max, 24.488 min\r\nmsecs/first-response: 63.5362 mean, 81.624 max, 57.803 min\r\nHTTP response codes:\r\ncode 200 -- 49
    \r\n结果分析:\r\n1.49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds\r\n说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148秒\r\n2.5916 mean bytes/connection\r\n说明每一连接平均传输的数据量289884/49=5916\r\n3.4.89274 fetches/sec, 28945.5 bytes/sec\r\n说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec\r\n4.msecs/connect: 28.8932 mean, 44.243 max, 24.488 min\r\n说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs\r\n5.msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min\r\n6、HTTP response codes: code 200 -- 49\r\n\r\n说明打开响应页面的类型,如果403的类型过多,那可能要注意是否系统遇到了瓶颈。\r\n特殊说明:这里,我们一般会关注到的指标是fetches/sec、msecs/connect\r\n他们分别对应的常用性能指标参数\r\nQpt-每秒响应用户数和response time,每连接响应用户时间。\r\n测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的cpu、men进行分析,才能得出结论\r\n\r\n参考文档:\r\n\r\nhttp://www.ooso.net/index.php/archives/219\r\n\r\nhttp://www.acme.com/software/http_load/", "created_at"=>2008-07-17 08:30:26 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    命令行工具http_load看上去和apache的ab很相似,用来做网站的压力测试。其主要用法为:

    \n\n

    1.http_load -parallel 5 -fetches 1000 urls.txt
    \n2.http_load -rate 2 -seconds 300 urls.txt
    \n例子只是个参考,参数其实可以自由组合,参数之间的选择并没有什么限制。比如你写成http_load -parallel 5 -seconds 300 urls.txt也是可以的。我们把参数给大家简单说明一下。
    \n-parallel 简写-p :含义是并发的用户进程数。
    \n-fetches 简写-f :含义是总计的访问次数
    \n-rate    简写-p :含义是每秒的访问频率
    \n-seconds简写-s :含义是总计的访问时间

    \n\n

    url 是你要访问的网址名,参数可以是单个的网址也可以使包含网址的文件。文件格式如下
    \nhttp://iceskysl.1sters.com/?action=show&id=336;
    \nhttp://iceskysl.1sters.com/?action=show&id=335;
    \nhttp://iceskysl.1sters.com/?action=show&id=332;
    \nhttp://iceskysl.1sters.com/?action=show&id=32;
    \n参数了解了,我们来看运行一条命令来看看它的返回结果

    \n\n

    命令:% ./http_load -rate 5 -seconds 10 urls
    \n说明执行了一个持续时间10秒的测试,每秒的频率为5。
    \n49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
    \n5916 mean bytes/connection
    \n4.89274 fetches/sec, 28945.5 bytes/sec
    \nmsecs/connect: 28.8932 mean, 44.243 max, 24.488 min
    \nmsecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
    \nHTTP response codes:
    \ncode 200 -- 49
    \n结果分析:
    \n1.49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
    \n说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148秒
    \n2.5916 mean bytes/connection
    \n说明每一连接平均传输的数据量289884/49=5916
    \n3.4.89274 fetches/sec, 28945.5 bytes/sec
    \n说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec
    \n4.msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
    \n说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs
    \n5.msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
    \n6、HTTP response codes: code 200 -- 49

    \n\n

    说明打开响应页面的类型,如果403的类型过多,那可能要注意是否系统遇到了瓶颈。
    \n特殊说明:这里,我们一般会关注到的指标是fetches/sec、msecs/connect
    \n他们分别对应的常用性能指标参数
    \nQpt-每秒响应用户数和response time,每连接响应用户时间。
    \n测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的cpu、men进行分析,才能得出结论

    \n\n

    参考文档:

    \n\n

    http://www.ooso.net/index.php/archives/219

    \n\n

    http://www.acme.com/software/http_load/

    \n", "_id"=>872}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"潘多拉(Pandora)受限,谁来顶起这片天", "body"=>"很多人都说Pandora是目前最好的歌曲智能推荐的应用,其历时8年之久汇总的音乐DNA分类可以比较准确的推荐一些你喜欢的歌曲给你;其iphone版本也相当成功,详细的可以看“iPhone 软件介绍之潘多拉(Pandora)”,非常不错。\r\n\r\n当我一次次的打开其网站准备体验一把的时候,遇到的却是一篇致歉信,大概瞄了一遍,其说不对US之外的用户提供服务(自然是许可证原因),正好看到yeeyan上有篇翻译“Pandora Internet Radio的道歉信”,懒得看E文的可以去瞧瞧。\r\n\r\n很明显,Pandora受限后,其他做音乐的会有一个比较好的机会来迅速填补这个空缺,强占一定的用户,但问题是,谁有能力顶起这片天呢?让我们看看在中国的情况。\r\n\r\n中国的在线音乐网站非常多,但是形式都普遍的很单一,主要有三种形式:\r\n\r\n1、大部分都是首页上横七竖八的堆一堆排行榜,点了直接就听歌,其代表者有一听,九天等。\r\n\r\n2、另外一个代表者是Baidu MP3下载,虽然人气不错,但是其损害的是唱片公司或者是艺人的利益,一直以来都是官司缠身。\r\n\r\n3、还有一种是新兴的web2模式的音乐网站,有yobo.com8box等等网站,其加入社区和互动,yobo甚至还有点Pandora的味道,主推音乐DNA。就目前我用到的,我最看好的还是YOBO,虽然最近他们也遇到一些问题。\r\n\r\nYOBO成立于2006年12月,从1.0到2.0到3.0,和现在正在开发的4.0版本中,在一步步的完善,用户口碑也越来越好。其上的电台和频道功能相当不错,很多定制化的东西可以很容易的找到需要的歌曲,如果你习惯Pandora的智能推荐模式,那么你可以设置让其自动推荐,虽然有的时候结果可能并不能让你满意,但是,请注意,YOBO还不到2岁,他还在不断的完善。\r\n\r\n另外就是最近老是遇到服务器不能及时响应的事情,就我感觉,不排除有人使坏,还是流量真的大的顶不住。\r\n\r\n对了,还有一个last.fm,其现在推出的中版主打中国市场,但是其和其他舶来品差不多,有点水土不服,加上速度一直被人诟病,中文歌曲质量不高等,暂时还不是很看好。", "created_at"=>2008-07-22 01:39:35 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    很多人都说Pandora是目前最好的歌曲智能推荐的应用,其历时8年之久汇总的音乐DNA分类可以比较准确的推荐一些你喜欢的歌曲给你;其iphone版本也相当成功,详细的可以看“iPhone 软件介绍之潘多拉(Pandora)”,非常不错。

    \n\n

    当我一次次的打开其网站准备体验一把的时候,遇到的却是一篇致歉信,大概瞄了一遍,其说不对US之外的用户提供服务(自然是许可证原因),正好看到yeeyan上有篇翻译“Pandora Internet Radio的道歉信”,懒得看E文的可以去瞧瞧。

    \n\n

    很明显,Pandora受限后,其他做音乐的会有一个比较好的机会来迅速填补这个空缺,强占一定的用户,但问题是,谁有能力顶起这片天呢?让我们看看在中国的情况。

    \n\n

    中国的在线音乐网站非常多,但是形式都普遍的很单一,主要有三种形式:

    \n\n

    1、大部分都是首页上横七竖八的堆一堆排行榜,点了直接就听歌,其代表者有一听,九天等。

    \n\n

    2、另外一个代表者是Baidu MP3下载,虽然人气不错,但是其损害的是唱片公司或者是艺人的利益,一直以来都是官司缠身。

    \n\n

    3、还有一种是新兴的web2模式的音乐网站,有yobo.com,8box等等网站,其加入社区和互动,yobo甚至还有点Pandora的味道,主推音乐DNA。就目前我用到的,我最看好的还是YOBO,虽然最近他们也遇到一些问题。

    \n\n

    YOBO成立于2006年12月,从1.0到2.0到3.0,和现在正在开发的4.0版本中,在一步步的完善,用户口碑也越来越好。其上的电台和频道功能相当不错,很多定制化的东西可以很容易的找到需要的歌曲,如果你习惯Pandora的智能推荐模式,那么你可以设置让其自动推荐,虽然有的时候结果可能并不能让你满意,但是,请注意,YOBO还不到2岁,他还在不断的完善。

    \n\n

    另外就是最近老是遇到服务器不能及时响应的事情,就我感觉,不排除有人使坏,还是流量真的大的顶不住。

    \n\n

    对了,还有一个last.fm,其现在推出的中版主打中国市场,但是其和其他舶来品差不多,有点水土不服,加上速度一直被人诟病,中文歌曲质量不高等,暂时还不是很看好。

    \n", "_id"=>873}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Starling: 消息队列服务器", "body"=>"Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter's backend, and is in production across Twitter's cluster.\r\n\r\n参考文章:\r\n1、http://rubyforge.org/projects/starling/\r\n2、The complete guide to setting up Starling:http://rubypond.com/articles/2008/07/17/the-complete-guide-to-setting-up-starling/\r\n3、http://github.com/IceskYsl/starling/tree/master\r\n4、http://myspacesurfer.hee-ro.net/index.php?q=uggc%3A%2F%2Fjjj.eholvafvqr.pbz%2Ffgneyvat-naq-ehqrd-crefvfgrag-ehol-dhrhrf-958.ugzy", "created_at"=>2008-07-22 02:24:50 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter's backend, and is in production across Twitter's cluster.

    \n\n

    参考文章:
    \n1、http://rubyforge.org/projects/starling/
    \n2、The complete guide to setting up Starling:http://rubypond.com/articles/2008/07/17/the-complete-guide-to-setting-up-starling/
    \n3、http://github.com/IceskYsl/starling/tree/master
    \n4、http://myspacesurfer.hee-ro.net/index.php?q=uggc%3A%2F%2Fjjj.eholvafvqr.pbz%2Ffgneyvat-naq-ehqrd-crefvfgrag-ehol-dhrhrf-958.ugzy

    \n", "_id"=>874}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"原来我还不够果断", "body"=>"一直以为自己是个想做就做,行动第一的人,但是有些时候还是有些犹豫和不果断,非要把一切都把握在自己手里,才敢做,犹犹豫豫的,一拖再拖,这不是我希望的。\r\n\r\n立此文章为标,果断点,做回自己!", "created_at"=>2008-07-28 07:29:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    一直以为自己是个想做就做,行动第一的人,但是有些时候还是有些犹豫和不果断,非要把一切都把握在自己手里,才敢做,犹犹豫豫的,一拖再拖,这不是我希望的。

    \n\n

    立此文章为标,果断点,做回自己!

    \n", "_id"=>875}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fleximage:Rails图片处理新选择", "body"=>"Fleximage is a Rails plugin that tries to make image uploading and rendering super easy.\r\nThere are 2 pieces involved in making Rails image handling easy.\r\n1. Image Uploads\r\n2. Image Rendering\r\n其使用的是Magick\r\n\r\n参考文档:\r\n1.让rails处理图片再简单一点\r\n2.fleximage", "created_at"=>2008-07-29 02:54:14 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    Fleximage is a Rails plugin that tries to make image uploading and rendering super easy.
    \nThere are 2 pieces involved in making Rails image handling easy.
    \n1. Image Uploads
    \n2. Image Rendering
    \n其使用的是Magick

    \n\n

    参考文档:
    \n1.让rails处理图片再简单一点
    \n2.fleximage

    \n", "_id"=>876}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"收到《开源技术选型手册》,谢谢diuera", "body"=>"收到博文的diuera送的《开源技术选型手册》,还有段小故事,呵呵。大概翻了一下,内容虽然不是很深,但是涉及到的内容还是不错的,有预算的朋友可以买本放那,有时间翻阅下。\r\n\r\n\"\"\r\n\r\n另外,有我参与的一本书正在撰写中,希望早早完稿,出版;另外还在策划一本书,希望早早策划好,开始撰写。", "created_at"=>2008-07-29 09:26:09 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    收到博文的diuera送的《开源技术选型手册》,还有段小故事,呵呵。大概翻了一下,内容虽然不是很深,但是涉及到的内容还是不错的,有预算的朋友可以买本放那,有时间翻阅下。

    \n\n\n

    另外,有我参与的一本书正在撰写中,希望早早完稿,出版;另外还在策划一本书,希望早早策划好,开始撰写。

    \n", "_id"=>877}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"vi/vim命令大全壁纸", "body"=>"我一直苦恼记不住VI的那么多的命令,每次都要翻宝典,实在是效率低下,看到有人做了一份壁纸,挺好的,分享给大家。\r\n\"\"", "created_at"=>2008-08-02 01:30:57 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    我一直苦恼记不住VI的那么多的命令,每次都要翻宝典,实在是效率低下,看到有人做了一份壁纸,挺好的,分享给大家。

    \n", "_id"=>878}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装QQ的linux版本", "body"=>"以前是ubuntu下的使用gaim和eva都不是很好用QQ,7.31号QQ发布了linux版本,一直没来得及试试,今天搞好宽带后终于可以试试了,还行,还讲的过去。\r\n\r\n======安装过程===\r\n\r\niceskysl@IceskYsl:/home/software$ wget http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb\r\n--11:07:14--  http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb\r\n=> `linuxqq_1.0-Preview1_i386.deb'\r\n正在解析主机 dl_dir.qq.com... 121.11.68.3, 202.104.241.135, 202.104.241.136, ...\r\n正在连接 dl_dir.qq.com|121.11.68.3|:80... 已连接。\r\n已发出 HTTP 请求,正在等待回应... 200 OK\r\n长度: 4,870,522 (4.6M) [application/octet-stream]\r\n\r\n100%[====================================>] 4,870,522    122.24K/s    ETA 00:00\r\n\r\n11:08:05 (94.06 KB/s) - `linuxqq_1.0-Preview1_i386.deb' 已经保存 [4870522/4870522]\r\n\r\niceskysl@IceskYsl:/home/software$ dpkg -i linuxqq_1.0-Preview1_i386.deb\r\ndpkg: 该操作需要超级用户权限\r\niceskysl@IceskYsl:/home/software$ sudo dpkg -i linuxqq_1.0-Preview1_i386.deb\r\n选中了曾被取消选择的软件包 linuxqq。\r\n(正在读取数据库 ... 系统当前总共安装有 225548 个文件和目录。)\r\n正在解压缩 linuxqq (从 linuxqq_1.0-Preview1_i386.deb) ...\r\n正在设置 linuxqq (1.0-Preview1) ...\r\niceskysl@IceskYsl:/home/software$\r\n\r\n就不截图了,需要了解详细的去他官方了解吧:http://im.qq.com/qq/linux/", "created_at"=>2008-08-02 03:21:11 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    以前是ubuntu下的使用gaim和eva都不是很好用QQ,7.31号QQ发布了linux版本,一直没来得及试试,今天搞好宽带后终于可以试试了,还行,还讲的过去。

    \n\n

    ======安装过程===

    \n\n

    iceskysl@IceskYsl:/home/software$ wget http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb
    \n--11:07:14--  http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb
    \n=> `linuxqq_1.0-Preview1_i386.deb'
    \n正在解析主机 dl_dir.qq.com... 121.11.68.3, 202.104.241.135, 202.104.241.136, ...
    \n正在连接 dl_dir.qq.com|121.11.68.3|:80... 已连接。
    \n已发出 HTTP 请求,正在等待回应... 200 OK
    \n长度: 4,870,522 (4.6M) [application/octet-stream]

    \n\n

    100%[====================================>] 4,870,522    122.24K/s    ETA 00:00

    \n\n

    11:08:05 (94.06 KB/s) - `linuxqq_1.0-Preview1_i386.deb' 已经保存 [4870522/4870522]

    \n\n

    iceskysl@IceskYsl:/home/software$ dpkg -i linuxqq_1.0-Preview1_i386.deb
    \ndpkg: 该操作需要超级用户权限
    \niceskysl@IceskYsl:/home/software$ sudo dpkg -i linuxqq_1.0-Preview1_i386.deb
    \n选中了曾被取消选择的软件包 linuxqq。
    \n(正在读取数据库 ... 系统当前总共安装有 225548 个文件和目录。)
    \n正在解压缩 linuxqq (从 linuxqq_1.0-Preview1_i386.deb) ...
    \n正在设置 linuxqq (1.0-Preview1) ...
    \niceskysl@IceskYsl:/home/software$

    \n\n

    就不截图了,需要了解详细的去他官方了解吧:http://im.qq.com/qq/linux/

    \n", "_id"=>879}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) + String not valid UTF-8 +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"把Ajax文件寄放在Google,Yahoo!", "body"=>"在中国,电信,网通,联通等南北分化问题相当突出,电线的线路网通的访问可能会慢的无法忍受,解决这个问题的办法中,CDN比较靠谱,但是价格不是一般的贵,一般人玩不起,呵呵。一般会搞双线或者在每个网络中部署一套以提高用户体验。\r\n而在页面上,一般来说,AJAX用的JS库表会比较大,这个时候就可以考虑直接使用Google或者Yahoo的JS库,Google的“AJAX Libraries API  ”库包含了常见的jQuery, prototype, script.aculo.us, MooTools, and dojo.等等。\r\n这样一来可以省去不少的网络流量,也提高了各地的速度。而且是免费的,何乐而不为呢?\r\n还有类似YUI的UI库,也可以这样考虑。可以提高不少性能。", "created_at"=>2008-08-07 04:53:09 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在中国,电信,网通,联通等南北分化问题相当突出,电线的线路网通的访问可能会慢的无法忍受,解决这个问题的办法中,CDN比较靠谱,但是价格不是一般的贵,一般人玩不起,呵呵。一般会搞双线或者在每个网络中部署一套以提高用户体验。
    \n而在页面上,一般来说,AJAX用的JS库表会比较大,这个时候就可以考虑直接使用Google或者Yahoo的JS库,Google的“AJAX Libraries API  ”库包含了常见的jQuery, prototype, script.aculo.us, MooTools, and dojo.等等。
    \n这样一来可以省去不少的网络流量,也提高了各地的速度。而且是免费的,何乐而不为呢?
    \n还有类似YUI的UI库,也可以这样考虑。可以提高不少性能。

    \n", "_id"=>881}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Apache Tomcat Directory Traversal Vulnerability", "body"=>"``Title: Apache Tomcat Directory Traversal VulnerabilityAuthor: Simon Ryeo(bar4mi (at) gmail.com, barami (at) ahnlab.com)Severity: HighImpact: Remote File DisclosureVulnerable Version: prior to 6.0.18Solution: - Best Choice: Upgrade to 6.0.18 (http://tomcat.apache.org) - Hot fix: Disable allowLinking or do not set URIencoding to utf8 in order to avoid this vulnerability. - Tomcat 5.5.x and 4.1.x Users: The fix will be included in the next releases. Please apply the hot fix until next release.References: - http://tomcat.apache.org/security.html - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2938History: - 07.17.2008: Initiate notify (To Apache Security Team) - 08.02.2008: Responsed this problem fixed and released new version - 08.05.2008: Notify disclosure (To Apache Tomcat Security Team) - 08.10.2008: Responsed with some suggestions.\r\n\r\nDescriptionAs Apache Security Team, this problem occurs because of JAVA side.If your context.xml or server.xml allows 'allowLinking'and 'URIencoding' as'UTF-8', an attacker can obtain your important system files.(e.g. /etc/passwd)\r\n\r\nExploitIf your webroot directory has three depth(e.g /usr/local/wwwroot), Anattacker can access arbitrary files as below. (Proof-of-concept)\r\n\r\nhttp://www.target.com/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/foo/bar\r\n\r\n# milw0rm.com [2008-08-11]```", "created_at"=>2008-08-11 09:51:56 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    ``Title: Apache Tomcat Directory Traversal VulnerabilityAuthor: Simon Ryeo(bar4mi (at) gmail.com, barami (at) ahnlab.com)Severity: HighImpact: Remote File DisclosureVulnerable Version: prior to 6.0.18Solution: - Best Choice: Upgrade to 6.0.18 (http://tomcat.apache.org) - Hot fix: Disable allowLinking or do not set URIencoding to utf8 in order to avoid this vulnerability. - Tomcat 5.5.x and 4.1.x Users: The fix will be included in the next releases. Please apply the hot fix until next release.References: - http://tomcat.apache.org/security.html - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2938History: - 07.17.2008: Initiate notify (To Apache Security Team) - 08.02.2008: Responsed this problem fixed and released new version - 08.05.2008: Notify disclosure (To Apache Tomcat Security Team) - 08.10.2008: Responsed with some suggestions.

    \n\n

    DescriptionAs Apache Security Team, this problem occurs because of JAVA side.If your context.xml or server.xml allows 'allowLinking'and 'URIencoding' as'UTF-8', an attacker can obtain your important system files.(e.g. /etc/passwd)

    \n\n

    ExploitIf your webroot directory has three depth(e.g /usr/local/wwwroot), Anattacker can access arbitrary files as below. (Proof-of-concept)

    \n\n

    http://www.target.com/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/foo/bar

    \n\n

    milw0rm.com [2008-08-11]```

    \n", "_id"=>882}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"中国网民都在做什么?", "body"=>"\"\"\r\n\r\n有时间的看看其他人对中国网民的调查、分析、报告还是有好处的,至少可以让自己在一个宏观和趋势是了解中国网民在做什么和喜欢做什么,在08年1月的时候,在一篇《What Do Chinese Internet Users Do Online?》文章中看到《中国互联网络发展状况统计报告》,比较详细的说明了中国网民的构成,分布等等,非常不错。\r\n\r\n时隔半年,《TrendsSpotting Handbook Of Online China》这篇文章中又看到一个《Handbook of Online China》的PPT,该PPT分析了中国互联网用户的行为特征,从应用、搜索、web2等方面分析、比较了中国当下比较大的应用。\r\n\r\n在该报告中,我们可以看到,互联网应用中网络音乐,IM和在线视频,在线游戏都是热门,详细的可以进一步的查看该PPT。\r\n\r\n\"\"", "created_at"=>2008-08-13 03:24:20 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    有时间的看看其他人对中国网民的调查、分析、报告还是有好处的,至少可以让自己在一个宏观和趋势是了解中国网民在做什么和喜欢做什么,在08年1月的时候,在一篇《What Do Chinese Internet Users Do Online?》文章中看到《中国互联网络发展状况统计报告》,比较详细的说明了中国网民的构成,分布等等,非常不错。

    \n\n

    时隔半年,《TrendsSpotting Handbook Of Online China》这篇文章中又看到一个《Handbook of Online China》的PPT,该PPT分析了中国互联网用户的行为特征,从应用、搜索、web2等方面分析、比较了中国当下比较大的应用。

    \n\n

    在该报告中,我们可以看到,互联网应用中网络音乐,IM和在线视频,在线游戏都是热门,详细的可以进一步的查看该PPT。
    \nHandbook of Online China
    \nView SlideShare presentation (tags: web trend trends powerpoint olympics)
    \n

    \n", "_id"=>883}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID做ActiveRecord主键", "body"=>"大家都知道,在Rails中比较常见的做法是使用“auto increment”的id做为主键,虽然很便捷,但是也存在以下问题:\r\n\r\n1)敏感信息泄漏 --比如注册用户数,发表文章数等,内行一眼就看出你系统的规模;\r\n\r\n2)分布式DB存在冲突 --一个DB不够了,需要多个DB的时候,可能会存在ID冲突的情况;\r\n\r\n3)旧数据库影响  --导入、导出的时候可能存在一些问题(rake db:schema:dump)\r\n\r\n由于这些问题都是很关键的,所以很有必要做一些改变,思路很简单,使用UUID做主键,可以保证主键的唯一性(类似12f186e6-687e-11ad-843e-001b632783f1,全世界唯一),又能隐藏敏感信息,且实现很简单,如下:\r\n\r\n1、创建表,去掉ID属性,增加UUID属性\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. create_table :posts:id => false do |t|  
    2. \r\n\t
    3.   t.string :uuid:limit => 36, :primary => true  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n2、在Model中设置主键为UUID\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Post < ActiveRecord::Base  
    2. \r\n\t
    3.   set_primary_key \"uuid\"  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n3、安装UUID的gem\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. sudo gem install uuidtools  
    2. \r\n
    \r\n
    \r\n4、创建lib/uuid_helper.rb \r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'rubygems'  
    2. \r\n\t
    3. require 'uuidtools'  
    4. \r\n\t
    5.    
    6. \r\n\t
    7. module UUIDHelper  
    8. \r\n\t
    9.   def before_create()  
    10. \r\n\t
    11.     self.uuid = UUID.timestamp_create().to_s  
    12. \r\n\t
    13.   end  
    14. \r\n\t
    15. end  
    16. \r\n
    \r\n
    \r\n5、使用UUIDHelper\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Post < ActiveRecord::Base  
    2. \r\n\t
    3.   set_primary_key \"uuid\"  
    4. \r\n\t
    5.   include UUIDHelper  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\nOK,新建一个post,就可以看到,该字段被自动填入了。\r\n\r\n \r\n\r\nPS:需要注意的是,需要留意before_create是否有冲突。\r\n\r\n参考文章:\r\n\r\nhttp://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key/", "created_at"=>2008-08-14 02:43:06 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    大家都知道,在Rails中比较常见的做法是使用“auto increment”的id做为主键,虽然很便捷,但是也存在以下问题:

    \n\n

    1)敏感信息泄漏 --比如注册用户数,发表文章数等,内行一眼就看出你系统的规模;

    \n\n

    2)分布式DB存在冲突 --一个DB不够了,需要多个DB的时候,可能会存在ID冲突的情况;

    \n\n

    3)旧数据库影响  --导入、导出的时候可能存在一些问题(rake db:schema:dump)

    \n\n

    由于这些问题都是很关键的,所以很有必要做一些改变,思路很简单,使用UUID做主键,可以保证主键的唯一性(类似12f186e6-687e-11ad-843e-001b632783f1,全世界唯一),又能隐藏敏感信息,且实现很简单,如下:

    \n\n

    1、创建表,去掉ID属性,增加UUID属性

    \n\n

     
    \n
    \nRuby代码
    \n
    \n create_table :posts, :id => false do |t|  
    \n   t.string :uuid, :limit => 36, :primary => true  
    \n end  
    \n
    \n
    \n2、在Model中设置主键为UUID

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n class Post < ActiveRecord::Base  
    \n   set_primary_key "uuid"  
    \n end  
    \n
    \n
    \n3、安装UUID的gem

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n sudo gem install uuidtools  
    \n
    \n
    \n4、创建lib/uuid_helper.rb

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'uuidtools'  
    \n    
    \n module UUIDHelper  
    \n   def before_create()  
    \n     self.uuid = UUID.timestamp_create().to_s  
    \n   end  
    \n end  
    \n
    \n
    \n5、使用UUIDHelper

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n class Post < ActiveRecord::Base  
    \n   set_primary_key "uuid"  
    \n   include UUIDHelper  
    \n end  
    \n
    \n
    \nOK,新建一个post,就可以看到,该字段被自动填入了。

    \n\n

     

    \n\n

    PS:需要注意的是,需要留意before_create是否有冲突。

    \n\n

    参考文章:

    \n\n

    http://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key/

    \n", "_id"=>884}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID隐藏系统敏感信息", "body"=>"在前面一篇文章中已经说了如何使用“使用UUID做ActiveRecord主键”,其说到使用Rails默认的id做为自增变量的几个缺点,其中一条就是“敏感信息泄漏 ”,这个是很致命的,可以让您的竞争对手很清楚的了解到你的系统的数据量,比如多少注册用户,发布了多少个帖子等等,还可以根据这个计算出你系统的增长率,做趋势预测,总之,把这些敏感信息暴露出来非常危险(搞社工的都明白)。\r\n\r\n更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。\r\n\r\n而采用UUID来做逐渐,因为其每次生成的都是唯一的、类似12f186e6-687e-11ad-843e-001b632783f1这样的串,所以可以很大程度上避免敏感信息的泄露。也可以防止自动采集的发生。\r\n具体使用方法,请参考前面一篇文章“使用UUID做ActiveRecord主键”。安全意识还是要有的,切记。", "created_at"=>2008-08-14 02:53:05 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在前面一篇文章中已经说了如何使用“使用UUID做ActiveRecord主键”,其说到使用Rails默认的id做为自增变量的几个缺点,其中一条就是“敏感信息泄漏 ”,这个是很致命的,可以让您的竞争对手很清楚的了解到你的系统的数据量,比如多少注册用户,发布了多少个帖子等等,还可以根据这个计算出你系统的增长率,做趋势预测,总之,把这些敏感信息暴露出来非常危险(搞社工的都明白)。

    \n\n

    更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。

    \n\n

    而采用UUID来做逐渐,因为其每次生成的都是唯一的、类似12f186e6-687e-11ad-843e-001b632783f1这样的串,所以可以很大程度上避免敏感信息的泄露。也可以防止自动采集的发生。
    \n具体使用方法,请参考前面一篇文章“使用UUID做ActiveRecord主键”。安全意识还是要有的,切记。

    \n", "_id"=>885}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Yahoo! Music 放出API,音乐平台开放趋势凸显", "body"=>"在Last.fm宣布其开放API后,Yahoo! Music也宣布其开放API。直接看一段英文描述,不废话了,大家都看得懂,如下:\r\n
    The music API gives developers access to Yahoo!’s “catalog of artists, albums, tracks, videos, ratings and more,” according to the company. It allows developers to interface with Yahoo! Music’s database via “charts, search, similarities, genres, artists, and user recommendations and ratings.”\r\n\r\nThe REST-based API returns data in XML, JSON, and RSS and uses BBAuth to allow user authentication for Yahoo! Music users to access their personal data via external apps. Use of the API is currently limited to 5k queries per day.
    \r\n采用REST格式的API,使用Ruby来调用非常简单,看一段代码:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'yahoo-music'  
    2. \r\n\t
    3. include Yahoo::Music  
    4. \r\n\t
    5. Yahoo::Music.app_id = \"...\" # Put Your App ID Here  
    6. \r\n\t
    7. artist = Artist.new(\"Beirut\"# Searches by name and uses first result  
    8. \r\n\t
    9. album = artist.releases.detect{|r| r.title == \"Flying Club Cup\"}  
    10. \r\n\t
    11. puts album.title  
    12. \r\n\t
    13. puts album.artist  
    14. \r\n\t
    15. puts \"Release Date:\" + album.released_on.strftime(\"%m/%d/%Y\")  
    16. \r\n\t
    17. puts  
    18. \r\n\t
    19. puts \"Tracks\"  
    20. \r\n\t
    21. artist.tracks.each_with_index do |track, i|  
    22. \r\n\t
    23. puts \"\\t%d %s \\t%2d:%2d\" % [i, track.title, track.duration / 60, track.duration % 60]  
    24. \r\n\t
    25. end  
    26. \r\n
    \r\n
    \r\n详细资料,请参考:\r\n\r\nhttp://developer.yahoo.net/blog/archives/2008/08/y_music_battle_of_the_apis.html\r\n\r\nhttp://developer.yahoo.com/music/\r\n\r\nhttp://www.sitepoint.com/blogs/2008/08/05/yahoo-releases-music-api/\r\n\r\n ", "created_at"=>2008-08-15 06:32:02 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在Last.fm宣布其开放API后,Yahoo! Music也宣布其开放API。直接看一段英文描述,不废话了,大家都看得懂,如下:
    \nThe music API gives developers access to Yahoo!’s “catalog of artists, albums, tracks, videos, ratings and more,” according to the company. It allows developers to interface with Yahoo! Music’s database via “charts, search, similarities, genres, artists, and user recommendations and ratings.”

    \n\n

    The REST-based API returns data in XML, JSON, and RSS and uses BBAuth to allow user authentication for Yahoo! Music users to access their personal data via external apps. Use of the API is currently limited to 5k queries per day.
    \n采用REST格式的API,使用Ruby来调用非常简单,看一段代码:
    \n
    \nRuby代码
    \n
    \n require 'yahoo-music'  
    \n include Yahoo::Music  
    \n Yahoo::Music.app_id = "..." # Put Your App ID Here  
    \n artist = Artist.new("Beirut") # Searches by name and uses first result  
    \n album = artist.releases.detect{|r| r.title == "Flying Club Cup"}  
    \n puts album.title  
    \n puts album.artist  
    \n puts "Release Date:" + album.released_on.strftime("%m/%d/%Y")  
    \n puts  
    \n puts "Tracks"  
    \n artist.tracks.each_with_index do |track, i|  
    \n puts "\\t%d %s \\t%2d:%2d" % [i, track.title, track.duration / 60, track.duration % 60]  
    \n end  
    \n
    \n
    \n详细资料,请参考:

    \n\n

    http://developer.yahoo.net/blog/archives/2008/08/y_music_battle_of_the_apis.html

    \n\n

    http://developer.yahoo.com/music/

    \n\n

    http://www.sitepoint.com/blogs/2008/08/05/yahoo-releases-music-api/

    \n\n

     

    \n", "_id"=>886}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails Plugins]dnsbl_check过滤来源IP", "body"=>"dnsbl_check是个很有意思的插件,它其实就是一个前置过滤器,在请求第一次到来的时候,会根据DNS Blackhole Lists来判断来源IP是否合法,如果合法,放行,并在其session中标识已经被checked,而后再来源就不会再去校验(省了不少资源);如果来源IP在DBL内,就会显示“Access denied”页面,同时阻止其进一步访问。\r\n\r\n安装和使用:\r\n
      \r\n\t
    1. 在Rails项目的根目录下执行\"script/plugin install http://www.spacebabies.nl/svn/dnsbl_check\" ;
    2. \r\n\t
    3. 在需要早检查的controllers 中添加\"before_filter :dnsbl_check\" ;
    4. \r\n\t
    5. 重启应用程序.
    6. \r\n
    \r\n在 vendor/plugins 目录下需要包含如下结构文件:\r\n\r\n<site name>/vendor/plugins/dnsbl_check/\r\n|-- 403.html\r\n|-- README\r\n|-- init.rb\r\n|-- install.rb\r\n`-- lib\r\n`-- dnsbl_check.rb\r\n\r\n代码示例:\r\n```````\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class CommentsController < ApplicationController  
    2. \r\n\t
    3.   before_filter :dnsbl_check  
    4. \r\n\t
    5.   
    6. \r\n\t
    7.   # Let users submit comments.  
    8. \r\n\t
    9.   def submit  
    10. \r\n\t
    11.     ...  
    12. \r\n\t
    13.   end  
    14. \r\n\t
    15. end  
    16. \r\n
    \r\n
    \r\n参考:\r\nhttp://agilewebdevelopment.com/plugins/rbl_check\r\nhttp://spacebabies.nl/dnsbl_check/\r\nhttp://spacebabies.nl/svn/dnsbl_check/\r\n\r\nPS:其主页貌似无法访问了,不晓得哪里有代码下载。", "created_at"=>2008-08-15 09:02:06 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    dnsbl_check是个很有意思的插件,它其实就是一个前置过滤器,在请求第一次到来的时候,会根据DNS Blackhole Lists来判断来源IP是否合法,如果合法,放行,并在其session中标识已经被checked,而后再来源就不会再去校验(省了不少资源);如果来源IP在DBL内,就会显示“Access denied”页面,同时阻止其进一步访问。

    \n\n

    安装和使用:
    \n
    \n 在Rails项目的根目录下执行"script/plugin install http://www.spacebabies.nl/svn/dnsbl_check" ;
    \n 在需要早检查的controllers 中添加"before_filter :dnsbl_check" ;
    \n 重启应用程序.
    \n
    \n在 vendor/plugins 目录下需要包含如下结构文件:

    \n\n

    <site name>/vendor/plugins/dnsbl_check/
    \n|-- 403.html
    \n|-- README
    \n|-- init.rb
    \n|-- install.rb
    \n-- lib
    \n
    -- dnsbl_check.rb

    \n\n

    代码示例:
    \n```````
    \n
    \nRuby代码
    \n
    \n class CommentsController < ApplicationController  
    \n   before_filter :dnsbl_check  
    \n   
    \n   # Let users submit comments.  
    \n   def submit  
    \n     ...  
    \n   end  
    \n end  
    \n
    \n
    \n参考:
    \nhttp://agilewebdevelopment.com/plugins/rbl_check
    \nhttp://spacebabies.nl/dnsbl_check/
    \nhttp://spacebabies.nl/svn/dnsbl_check/

    \n\n

    PS:其主页貌似无法访问了,不晓得哪里有代码下载。

    \n", "_id"=>887}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"ulimit:修改和检查文件句柄数限制", "body"=>"在Linux下面部署应用的时候,有时候会遇上Socket/File: Can’t open so many files的问题,其实Linux是有文件句柄限制的,而且默认不是很高,一般都是1024,作为一台生产服务器,其实很容易就达到这个数量,因此我们需 要把这个值改大一些。\r\n\r\n我们可以用ulimit -a来查看所有限制值,我只关心文件句柄数量的问题\r\nopen files (-n) 1024\r\n这个就是限制数量 ,其指的是当前用户准备要运行的程序的限制。比较推荐的修改方法是:\r\n\r\n正确的做法,应该是修改/etc/security/limits.conf\r\n里面有很详细的注释,比如\r\n* soft nofile 2048\r\n* hard nofile 32768\r\n\r\n检查:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. #check file descriptor  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. echo  
    6. \r\n\t
    7. echo \"-----------------------------------------------\"  
    8. \r\n\t
    9. echo \"Begin to check the file descriptor limit\"  
    10. \r\n\t
    11. fd=`ulimit -n`  
    12. \r\n\t
    13. if [ $fd -lt 8192 ];  
    14. \r\n\t
    15.    then  
    16. \r\n\t
    17.    echo \"Fatal Error!\"  
    18. \r\n\t
    19.    echo \"The file descriptor limit is only '\"$fd\"'!\"  
    20. \r\n\t
    21.    echo \"Please make it more than 8192!\"  
    22. \r\n\t
    23.    exit  
    24. \r\n\t
    25. fi  
    26. \r\n\t
    27. echo \"OK, the file descriptor limit is\" $fd  
    28. \r\n\t
    29. echo \"-----------------------------------------------\"  
    30. \r\n\t
    31. echo  
    32. \r\n\t
    33. echo\r\n
    34. \r\n
    \r\n
    \r\n参考文章:\r\nhttp://blog.chinaunix.net/u2/64804/showart_1019246.html\r\nhttp://hi.baidu.com/leshy/blog/item/f57f4a903fb0898ea877a452.html", "created_at"=>2008-08-19 08:37:18 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在Linux下面部署应用的时候,有时候会遇上Socket/File: Can’t open so many files的问题,其实Linux是有文件句柄限制的,而且默认不是很高,一般都是1024,作为一台生产服务器,其实很容易就达到这个数量,因此我们需 要把这个值改大一些。

    \n\n

    我们可以用ulimit -a来查看所有限制值,我只关心文件句柄数量的问题
    \nopen files (-n) 1024
    \n这个就是限制数量 ,其指的是当前用户准备要运行的程序的限制。比较推荐的修改方法是:

    \n\n

    正确的做法,应该是修改/etc/security/limits.conf
    \n里面有很详细的注释,比如
    \n* soft nofile 2048
    \n* hard nofile 32768

    \n\n

    检查:
    \n
    \nRuby代码
    \n
    \n #check file descriptor  
    \n   
    \n echo  
    \n echo "-----------------------------------------------"  
    \n echo "Begin to check the file descriptor limit"  
    \n fd=ulimit -n  
    \n if [ $fd -lt 8192 ];  
    \n    then  
    \n    echo "Fatal Error!"  
    \n    echo "The file descriptor limit is only '"$fd"'!"  
    \n    echo "Please make it more than 8192!"  
    \n    exit  
    \n fi  
    \n echo "OK, the file descriptor limit is" $fd  
    \n echo "-----------------------------------------------"  
    \n echo  
    \n echo
    \n
    \n
    \n
    \n参考文章:
    \nhttp://blog.chinaunix.net/u2/64804/showart_1019246.html
    \nhttp://hi.baidu.com/leshy/blog/item/f57f4a903fb0898ea877a452.html

    \n", "_id"=>888}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"查看MYSQL表占用空间状态", "body"=>"比如需要查询库占用的空间和索引占用的空间:\r\n\r\n查整个库的状态:\r\nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,\r\nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,\r\nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,\r\nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size\r\nfrom information_schema.tables where TABLE_SCHEMA = 'databasename';\r\n\r\n查单表:\r\nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,\r\nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,\r\nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,\r\nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size\r\nfrom information_schema.tables where TABLE_NAME = 'tablename';", "created_at"=>2008-08-19 09:08:34 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    比如需要查询库占用的空间和索引占用的空间:

    \n\n

    查整个库的状态:
    \nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
    \nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
    \nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
    \nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
    \nfrom information_schema.tables where TABLE_SCHEMA = 'databasename';

    \n\n

    查单表:
    \nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
    \nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
    \nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
    \nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
    \nfrom information_schema.tables where TABLE_NAME = 'tablename';

    \n", "_id"=>889}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Prawn:Ruby生成PDF更简捷的选择", "body"=>"在InfoQ上看到《Prawn:使用Ruby生成PDF更简捷》,其说到的Prawn可以更加快捷的在Ruby中生成PDF文件。因为之前使用过很多版本的PDF生成类库都不尽如人意,有的太复杂,有的太慢,于是对这个做了测试。\r\n\r\n1、安装\r\n\r\n安装很简单,直接使用gem install prawn即可安装完成;\r\n\r\n2、使用\r\n\r\n比较简单,详细的参考其文档,我直接贴一段我测试用的代码,如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # coding: utf-8  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. $LOAD_PATH << File.join(File.dirname(__FILE__), '..''lib')  
    6. \r\n\t
    7. require \"prawn\"  
    8. \r\n\t
    9. start = Time.now  
    10. \r\n\t
    11. Prawn::Document.generate(\"utf8_text_flow.pdf\"do  
    12. \r\n\t
    13.   font \"\#{Prawn::BASEDIR}/data/fonts/simfang.ttf\"  
    14. \r\n\t
    15.   text \"我是中文,还有数字+yingwen+898\"* 2  
    16. \r\n\t
    17.   text \"This is a english text, and i will be here ...\"  
    18. \r\n\t
    19.   text \"This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,\"  
    20. \r\n\t
    21.     
    22. \r\n\t
    23.   font_size!(16)  
    24. \r\n\t
    25.   text \"At size 16\"  
    26. \r\n\t
    27.     
    28. \r\n\t
    29.   font_size!(16)  
    30. \r\n\t
    31.   text \"\\nIceskYsl@1sters!\"  
    32. \r\n\t
    33.   font_size!(10)  
    34. \r\n\t
    35.   text \"不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…\"  
    36. \r\n\t
    37.   font_size!(12)  
    38. \r\n\t
    39.   text \"更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。\"  
    40. \r\n\t
    41. \r\n
    42. \r\n\t
    43. end  
    44. \r\n\t
    45. puts \"Spend \#{Time.now-start}s\"  
    46. \r\n\t
    47.                                   
    48. \r\n\t
    49.         
    50. \r\n\t
    51.         
    52. \r\n
    \r\n
    \r\n生成的PDF效果还是比较让人满意的,如下是效果图:\r\n\r\n \r\n\r\n\"\"\r\n\r\n3、优缺点\r\n
      \r\n\t
    • 使用比较方便,API都比较简单;
    • \r\n\t
    • 相对来水比较快,从上面代码可以看到,生成如上这份PDF需要的时候是”Spend 4.36s“;
    • \r\n\t
    • 其本身支持14种内在字体,另外可以使用TTF字体文件来添加自己需要的字体;
    • \r\n\t
    • 支持UTF8字体,对中文等字体支持比较好
    • \r\n\t
    • 英文可以自动换行,但是我测试中文就不能自动换行了,如上图的红圈地方就是溢出的;--已经修复
    • \r\n\t
    • 定位方便;
    • \r\n\t
    • 支持图片插入;
    • \r\n\t
    • 支持表格,cell等等。
    • \r\n
    \r\n4、其他\r\n\r\n上面说的那个Bug我已经提交给作者,详细的参考这里”chinese text can not flow well “,应该很快就可以修复和完善了;\r\n\r\n让我惊奇的是其主页 上竟然有 中文版页面,难道有国人参与?\r\n\r\n其代码库在:http://github.com/sandal/prawn/tree/master\r\n\r\n5、更新\r\n\r\n上面说到的一个对中文自动换行的BUG,提交给作者后,他就修复了,现在我测试的效果非常棒,是我见过的最棒的一个PDF生成类库了,如下是效果图,可以和上面的那个比较下。\r\n\r\n\"\"", "created_at"=>2008-08-20 03:39:42 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    在InfoQ上看到《Prawn:使用Ruby生成PDF更简捷》,其说到的Prawn可以更加快捷的在Ruby中生成PDF文件。因为之前使用过很多版本的PDF生成类库都不尽如人意,有的太复杂,有的太慢,于是对这个做了测试。

    \n\n

    1、安装

    \n\n

    安装很简单,直接使用gem install prawn即可安装完成;

    \n\n

    2、使用

    \n\n

    比较简单,详细的参考其文档,我直接贴一段我测试用的代码,如下:
    \n
    \nRuby代码
    \n
    \n # coding: utf-8  
    \n   
    \n $LOADPATH << File.join(File.dirname(FILE_), '..', 'lib')  
    \n require "prawn"  
    \n start = Time.now  
    \n Prawn::Document.generate("utf8_text_flow.pdf") do  
    \n   font "\#{Prawn::BASEDIR}/data/fonts/simfang.ttf"  
    \n   text "我是中文,还有数字+yingwen+898"* 2  
    \n   text "This is a english text, and i will be here ..."  
    \n   text "This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,"  
    \n     
    \n   font_size!(16)  
    \n   text "At size 16"  
    \n     
    \n   font_size!(16)  
    \n   text "\\nIceskYsl@1sters!"  
    \n   font_size!(10)  
    \n   text "不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…"  
    \n   font_size!(12)  
    \n   text "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。"  
    \n
    \n
    \n end  
    \n puts "Spend \#{Time.now-start}s"  
    \n                                   
    \n         
    \n         
    \n
    \n
    \n生成的PDF效果还是比较让人满意的,如下是效果图:

    \n\n

     

    \n\n\n

    3、优缺点
    \n
    \n 使用比较方便,API都比较简单;
    \n 相对来水比较快,从上面代码可以看到,生成如上这份PDF需要的时候是”Spend 4.36s“;
    \n 其本身支持14种内在字体,另外可以使用TTF字体文件来添加自己需要的字体;
    \n 支持UTF8字体,对中文等字体支持比较好
    \n 英文可以自动换行,但是我测试中文就不能自动换行了,如上图的红圈地方就是溢出的;--已经修复
    \n 定位方便;
    \n 支持图片插入;
    \n 支持表格,cell等等。
    \n
    \n4、其他

    \n\n

    上面说的那个Bug我已经提交给作者,详细的参考这里”chinese text can not flow well “,应该很快就可以修复和完善了;

    \n\n

    让我惊奇的是其主页 上竟然有 中文版页面,难道有国人参与?

    \n\n

    其代码库在:http://github.com/sandal/prawn/tree/master

    \n\n

    5、更新

    \n\n

    上面说到的一个对中文自动换行的BUG,提交给作者后,他就修复了,现在我测试的效果非常棒,是我见过的最棒的一个PDF生成类库了,如下是效果图,可以和上面的那个比较下。

    \n\n", "_id"=>890}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BOSSMan: 用Ruby利用yahoo!Boss打造自己的搜索引擎", "body"=>"yahoo的BOSS web服务比之前Yahoo! Search API更加方便灵活,取消了诸多限制,比如检索的次数等等,其介绍如下:\r\n
    BOSS (Build your Own Search Service) is Yahoo!'s open search web services platform. The goal of BOSS is simple: to foster innovation in the search industry. Developers, start-ups, and large Internet companies can use BOSS to build and launch web-scale search products that utilize the entire Yahoo! Search index. BOSS gives you access to Yahoo!'s investments in crawling and indexing, ranking and relevancy algorithms, and powerful infrastructure. By combining your unique assets and ideas with our search technology assets, BOSS is a platform for the next generation of search innovation, serving hundreds of millions of users across the Web.
    \r\n\"\"\r\nJay Pignata已经用Ruby写了一个类库BOSSMan,使用非常方便,步骤如下:\r\n1、安装gem\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. gem sources -a http://gems.github.com  
    2. \r\n\t
    3. gem install jpignata-bossman\r\n
    4. \r\n
    \r\n
    \r\n2、编写代码\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'rubygems'  
    2. \r\n\t
    3. require 'bossman'  
    4. \r\n\t
    5. include BOSSMan  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. BOSSMan.application_id = \"Your Application ID here\"  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. news = BOSSMan::Search.news(\"IceskYsl\", 0, 3)  
    14. \r\n\t
    15. news.results.each do |result|  
    16. \r\n\t
    17.   puts \"\#{result.title} [from \#{result.source}]\"  
    18. \r\n\t
    19. end   
    20. \r\n
    \r\n
    \r\n参考文档:\r\nBOSSMan: Build Your Own Search Engine With Yahoo And Ruby: http://www.rubyinside.com/ruby-and-yahoo-boss-with-bossman-1047.html\r\n插件BOSSman:http://github.com/jpignata/bossman-gem/tree/master\r\n看视频介绍:http://developer.yahoo.com/search/boss/", "created_at"=>2008-08-20 06:50:33 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    yahoo的BOSS web服务比之前Yahoo! Search API更加方便灵活,取消了诸多限制,比如检索的次数等等,其介绍如下:
    \nBOSS (Build your Own Search Service) is Yahoo!'s open search web services platform. The goal of BOSS is simple: to foster innovation in the search industry. Developers, start-ups, and large Internet companies can use BOSS to build and launch web-scale search products that utilize the entire Yahoo! Search index. BOSS gives you access to Yahoo!'s investments in crawling and indexing, ranking and relevancy algorithms, and powerful infrastructure. By combining your unique assets and ideas with our search technology assets, BOSS is a platform for the next generation of search innovation, serving hundreds of millions of users across the Web.
    \n
    \nJay Pignata已经用Ruby写了一个类库BOSSMan,使用非常方便,步骤如下:
    \n1、安装gem
    \n
    \nRuby代码
    \n
    \n gem sources -a http://gems.github.com  
    \n gem install jpignata-bossman
    \n
    \n
    \n
    \n2、编写代码
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'bossman'  
    \n include BOSSMan  
    \n   
    \n BOSSMan.application_id = "Your Application ID here"  
    \n   
    \n news = BOSSMan::Search.news("IceskYsl", 0, 3)  
    \n news.results.each do |result|  
    \n   puts "\#{result.title} [from \#{result.source}]"  
    \n end   
    \n
    \n
    \n参考文档:
    \nBOSSMan: Build Your Own Search Engine With Yahoo And Ruby: http://www.rubyinside.com/ruby-and-yahoo-boss-with-bossman-1047.html
    \n插件BOSSman:http://github.com/jpignata/bossman-gem/tree/master
    \n看视频介绍:http://developer.yahoo.com/search/boss/

    \n", "_id"=>891}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Connection refused: SliceHost上SSH登录问题", "body"=>"N久前买的slicehost上一个VPN,上面跑了一个mysql,和mongrel,好久没SSH上去了,今天SSH的时候老是被拒绝“port 22: Connection refused”,真是怪异,开始以为是我把sshd的端口改了,赶紧使用web console连上去看看,先````nano /etc/ssh/sshd_config看到的端口还是22,并没有修改。```\r\n\r\n````接着看是不是限制了登录,发现也没有,再检查iptables发现也没有阻拦22端口,怪异哦。最后使用netstat -antp看下端口,发现没有22,寒,难道sshd没启动,赶紧启动下:```/etc/init.d/ssh start\r\n\r\n然后再查下端口,有了:\r\n
    root@iceskysl:/var/log# /etc/init.d/ssh start                                                                              * Starting OpenBSD Secure Shell server sshd                             [ OK ]                                         root@iceskysl:/var/log# netstat -antp                                                                                     Active Internet connections (servers and established)                                                                   Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name                        tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6427/ruby1.8                            tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      6430/ruby1.8                            tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      8985/mysqld                             tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      8561/nginx                              tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      9191/ruby1.8                            tcp        0      0 127.0.0.1:7001          0.0.0.0:*               LISTEN      9194/ruby1.8                            tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3266/master                             tcp6       0      0 :::22                   :::*                    LISTEN      15682/sshd                              root@iceskysl:/var/log#    再试试,可以SSH连上去了,真够折腾的。幸好slicehost还有个web console,要不然咋整? 紧接着做下iptables,限制下登录。                                                          ```", "created_at"=>2008-08-20 13:29:56 UTC, "updated_at"=>2012-06-24 15:47:02 UTC, "body_html"=>"

    N久前买的slicehost上一个VPN,上面跑了一个mysql,和mongrel,好久没SSH上去了,今天SSH的时候老是被拒绝“port 22: Connection refused”,真是怪异,开始以为是我把sshd的端口改了,赶紧使用web console连上去看看,先`nano /etc/ssh/sshd_config看到的端口还是22,并没有修改。

    \n\n

    `接着看是不是限制了登录,发现也没有,再检查iptables发现也没有阻拦22端口,怪异哦。最后使用netstat -antp看下端口,发现没有22,寒,难道sshd没启动,赶紧启动下:/etc/init.d/ssh start

    \n\n

    然后再查下端口,有了:
    \nroot@iceskysl:/var/log# /etc/init.d/ssh start                                                                              * Starting OpenBSD Secure Shell server sshd                             [ OK ]                                         root@iceskysl:/var/log# netstat -antp                                                                                     Active Internet connections (servers and established)                                                                   Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name                        tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6427/ruby1.8                            tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      6430/ruby1.8                            tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      8985/mysqld                             tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      8561/nginx                              tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      9191/ruby1.8                            tcp        0      0 127.0.0.1:7001          0.0.0.0:*               LISTEN      9194/ruby1.8                            tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3266/master                             tcp6       0      0 :::22                   :::*                    LISTEN      15682/sshd                              root@iceskysl:/var/log#    再试试,可以SSH连上去了,真够折腾的。幸好slicehost还有个web console,要不然咋整? 紧接着做下iptables,限制下登录。                                                          ```

    \n", "_id"=>892}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>893}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"《The Rails Way》召集railser协作翻译", "body"=>"\"\"\r\n\r\n引用YiTan帖子:\r\n
    The Rails Way是一本数一数二的Rails书籍,系统并全面地介绍Rails的使用和开发。也是那位写了 Mongrel,后来又暴走的Zed大牛唯一推荐的一本Rails书。
    \r\nLibin说:\r\n
    Obie 是我非常敬重的 Rubyist , The Rails Way 也是我最爱的 Ruby 书之一。
    \r\n最近将由人邮出版社引进。书比较厚,900+页 共22章。我们想找几个有兴趣参与的朋友,每人领取几章,共同翻译。\r\n\r\n目前已经有5个人(我,YiTan、陈恺、Libin、xue.yudi等)参与了,有时间,有兴趣的Railser,赶快确认。我这里有PDF版本,想了解内容的可以在Gtalk上找我要。报名后,YiTan会把相关说明和规范发给大家。\r\n\r\nPS:\r\n有稿费,但是偶个人比较看重的是翻译使我更仔细的去阅读和体会原文的意思,会收获更多。", "created_at"=>2008-08-21 03:05:20 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    引用YiTan帖子:
    \nThe Rails Way是一本数一数二的Rails书籍,系统并全面地介绍Rails的使用和开发。也是那位写了 Mongrel,后来又暴走的Zed大牛唯一推荐的一本Rails书。
    \nLibin说:
    \nObie 是我非常敬重的 Rubyist , The Rails Way 也是我最爱的 Ruby 书之一。
    \n最近将由人邮出版社引进。书比较厚,900+页 共22章。我们想找几个有兴趣参与的朋友,每人领取几章,共同翻译。

    \n\n

    目前已经有5个人(我,YiTan、陈恺、Libin、xue.yudi等)参与了,有时间,有兴趣的Railser,赶快确认。我这里有PDF版本,想了解内容的可以在Gtalk上找我要。报名后,YiTan会把相关说明和规范发给大家。

    \n\n

    PS:
    \n有稿费,但是偶个人比较看重的是翻译使我更仔细的去阅读和体会原文的意思,会收获更多。

    \n", "_id"=>894}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"cssh/DSH:ssh之cluster 管理工具", "body"=>"由于系统用到了很多的服务器,大致分成下面几组:\r\n
      \r\n\t
    • A组是做web服务器;
    • \r\n\t
    • B组是App服务器;
    • \r\n\t
    • C组是DB服务器;
    • \r\n
    \r\n每组服务器都有多台,APP服务器最多,有10多台,DB有5台,每次升级或者查询系统状况都是逐个的SSH登录,比较麻烦,一直在找一个可以按组管理多台服务器脚本或者客户端。\r\n在linuxtoy上看到对dshcssh的介绍,正好满足我的需求,记录一下。\r\n1、cssh:cluster 管理工具 (ssh)\r\n2、dsh:分布式 shell\r\n需要了解的,按照上面的链接了解。", "created_at"=>2008-08-21 06:24:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    由于系统用到了很多的服务器,大致分成下面几组:
    \n
    \n A组是做web服务器;
    \n B组是App服务器;
    \n C组是DB服务器;
    \n
    \n每组服务器都有多台,APP服务器最多,有10多台,DB有5台,每次升级或者查询系统状况都是逐个的SSH登录,比较麻烦,一直在找一个可以按组管理多台服务器脚本或者客户端。
    \n在linuxtoy上看到对dsh和cssh的介绍,正好满足我的需求,记录一下。
    \n1、cssh:cluster 管理工具 (ssh)
    \n2、dsh:分布式 shell
    \n需要了解的,按照上面的链接了解。

    \n", "_id"=>895}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用named_scope在Model中添加finder方法", "body"=>"在rubyfleebie上看到这篇文章,里面有个不错的技巧,在Rails 2.1中添加了named_scope特性,看下面这个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Story < ActiveRecord::Base  
    2. \r\n\t
    3.   named_scope :hilarious:conditions => [\"type = ?\",\"comedy\"]  
    4. \r\n\t
    5.   named_scope :popular:conditions => [\"popularity_level > ?\", 3]  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n使用方法如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. funny_stories = @all_stories.hilarious  
    2. \r\n\t
    3. funny_and_popular = @all_stories.hilarious.popular  
    4. \r\n
    \r\n
    \r\n很好很强大。", "created_at"=>2008-08-21 16:33:42 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在rubyfleebie上看到这篇文章,里面有个不错的技巧,在Rails 2.1中添加了named_scope特性,看下面这个例子:
    \n
    \nRuby代码
    \n
    \n class Story < ActiveRecord::Base  
    \n   named_scope :hilarious, :conditions => ["type = ?","comedy"]  
    \n   named_scope :popular, :conditions => ["popularity_level > ?", 3]  
    \n end  
    \n
    \n
    \n使用方法如下:
    \n
    \nRuby代码
    \n
    \n funny_stories = @all_stories.hilarious  
    \n funny_and_popular = @all_stories.hilarious.popular  
    \n
    \n
    \n很好很强大。

    \n", "_id"=>896}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby再曝REXML库的DOS漏洞", "body"=>"大家应该都还记得,前不久《Ruby暴出大量严重漏洞!》,当时我说“ruby走向成熟,离不开这样的检验。”,时间过去不久,又发现其REXML库存在漏洞,被利用的话可以导致DOS攻击。\r\n\r\n详细介绍在“DoS vulnerability in REXML”,中文翻译在“Ruby的REXML库缺陷将导致DOS攻击”。\r\n\r\n值得注意的是,Ruby的所有版本都存在这个问题,需要修复的安全前面文章中的方法啊修复;凡是在Rails中解析到XML用到REXML的都存在这个问题,但是个人认为使用REXML来解析XML的并不算很多,其速度不够快。很多人用的是hpricot。\r\n\r\n漏洞并不可怕,可怕的是被藏着掖着,期待Ruby的日趋成熟和完善。", "created_at"=>2008-08-25 01:24:50 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    大家应该都还记得,前不久《Ruby暴出大量严重漏洞!》,当时我说“ruby走向成熟,离不开这样的检验。”,时间过去不久,又发现其REXML库存在漏洞,被利用的话可以导致DOS攻击。

    \n\n

    详细介绍在“DoS vulnerability in REXML”,中文翻译在“Ruby的REXML库缺陷将导致DOS攻击”。

    \n\n

    值得注意的是,Ruby的所有版本都存在这个问题,需要修复的安全前面文章中的方法啊修复;凡是在Rails中解析到XML用到REXML的都存在这个问题,但是个人认为使用REXML来解析XML的并不算很多,其速度不够快。很多人用的是hpricot。

    \n\n

    漏洞并不可怕,可怕的是被藏着掖着,期待Ruby的日趋成熟和完善。

    \n", "_id"=>897}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决/var空间不足导致的无法登录问题", "body"=>"现象描述
    \r\n项目中有台服务器,其操作系统为RHEL 3 ,主要用途是实验室环境以及和第三方系统的FTP服务器,最近出现经常出现“假死”的情况,具体表现是Ping的通,但是ssh、ftp、telnet等都无法登陆,从lan console上看服务器运行正常。每次都是远程重启暂时解决问题。
    \r\n
    \r\n深入分析

    \r\n今天,另外一个负责主机维护的同事发现其/var/log/messages.x中有如下信息:
    \r\n
    \r\n
    Jul 30 17:36:15 www login(pam_unix)[11819]: session opened for user siteview by (uid=0)
    \r\nJul 30 17:36:15 www  -- siteview[11819]: LOGIN ON pts/0 BY siteview FROM 192.168.168.42
    \r\nJul 30 17:36:15 www login(pam_unix)[11819]: session closed for user siteview
    \r\nJul 30 17:47:17 www syslogd: /var/log/secure: No space left on device
    \r\nJul 30 19:11:58 www PAM-securetty[1611]: Couldn't open /etc/securetty
    \r\n 经过查找发现其原因是内核中开启的审核子系统LauS (Linux Auditing System)写的日志太多,把/var空间占了,再次登陆的时候,由于无法写日志导致挂在那里,出现假死现象。
    \r\n
    \r\n解决方法:
    \r\n定位到问题以后,就可以想办法解决了,目前可行的办法由四种,分别如下:
    \r\n1、定期手工删除/var/log/audit.d下的日志文件\r\n
    #删除7天前的
    \r\nfind ./ -mtime +7 -type f -exec rm {} \\;
    \r\n2、配置crob自动删除或者备份\r\n
    SEVEN_DAYS_OLD=`/usr/locale/ebin/date '+%d' --date '7 days ago'`
    \r\nif [ -f /var/log/audit/bin/bin.${SEVEN_DAYS_OLD} ]
    \r\nthen
    \r\nrm /var/log/audit/bin.${SEVEN_DAYS_OLD}
    \r\nfi
    \r\n
    \r\n3、修改/etc/audit/audit.conf配置文件
    \r\n可以通过修改audit.conf来配置,让其自动处理
    \r\n1)修改为自动删除的
    \r\n
    notify = \"/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'rm -f %f'\";
    \r\n[The notify line as above should (according to the docs) remove old 'save' files when the filesystem comes within 20% of full (change the figure after -T to specify how close to full you want to start deleting old files).]
    \r\n
    \r\n
    2)修改为自动备份的:(/backup 是另外您想保存数据的分区)\r\n
    notify = \"/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'mv %f /backup'\";
    \r\n
    \r\n4、
    禁用audtid服务
    \r\n如 果您不需要审核信息,禁用audtid服务 (\"chkconfig --del auditd\"),系统性能会有所提高. 如果想要彻底禁用内核中的audit,可以删除 /dev/audit文件,重新启动。以后可以通过在grub.conf 里kernel行最后加入audit=1来启用。
    \r\n
    \r\n
    \r\n
    \r\n参考文档 :\r\n
      \r\n\t
    • lAus相关: http://blog.chinaunix.net/u/6303/showart_275806.html
    • \r\n\t
    • console login hangs RHEL 3:http://www.linuxquestions.org/questions/linux-general-1/console-login-hangs-rhel-3-348072/
    • \r\n\t
    • Linux Console Hangs:http://www.usenet-forums.com/linux-networking/68241-linux-console-hangs-2.html
    • \r\n\t
    • /目录空间不足,清理/var/log/audit.d:http://blog.zhangjianfeng.com/article/386
    • \r\n
    ", "created_at"=>2008-08-26 03:37:04 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    现象描述
    \n项目中有台服务器,其操作系统为RHEL 3 ,主要用途是实验室环境以及和第三方系统的FTP服务器,最近出现经常出现“假死”的情况,具体表现是Ping的通,但是ssh、ftp、telnet等都无法登陆,从lan console上看服务器运行正常。每次都是远程重启暂时解决问题。
    \n
    \n深入分析
    \n今天,另外一个负责主机维护的同事发现其/var/log/messages.x中有如下信息:
    \n
    \nJul 30 17:36:15 www login(pam_unix)[11819]: session opened for user siteview by (uid=0)
    \nJul 30 17:36:15 www  -- siteview[11819]: LOGIN ON pts/0 BY siteview FROM 192.168.168.42
    \nJul 30 17:36:15 www login(pam_unix)[11819]: session closed for user siteview
    \nJul 30 17:47:17 www syslogd: /var/log/secure: No space left on device
    \nJul 30 19:11:58 www PAM-securetty[1611]: Couldn't open /etc/securetty
    \n 经过查找发现其原因是内核中开启的审核子系统LauS (Linux Auditing System)写的日志太多,把/var空间占了,再次登陆的时候,由于无法写日志导致挂在那里,出现假死现象。
    \n
    \n解决方法:
    \n定位到问题以后,就可以想办法解决了,目前可行的办法由四种,分别如下:
    \n1、定期手工删除/var/log/audit.d下的日志文件
    \n#删除7天前的
    \nfind ./ -mtime +7 -type f -exec rm {} \\;
    \n2、配置crob自动删除或者备份
    \nSEVEN_DAYS_OLD=/usr/locale/ebin/date '+%d' --date '7 days ago'
    \nif [ -f /var/log/audit/bin/bin.${SEVEN_DAYS_OLD} ]
    \nthen
    \nrm /var/log/audit/bin.${SEVEN_DAYS_OLD}
    \nfi
    \n
    \n3、修改/etc/audit/audit.conf配置文件
    \n可以通过修改audit.conf来配置,让其自动处理
    \n1)修改为自动删除的:
    \nnotify = "/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'rm -f %f'";
    \n[The notify line as above should (according to the docs) remove old 'save' files when the filesystem comes within 20% of full (change the figure after -T to specify how close to full you want to start deleting old files).]
    \n
    \n2)修改为自动备份的:(/backup 是另外您想保存数据的分区)
    \nnotify = "/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'mv %f /backup'";
    \n
    \n4、禁用audtid服务
    \n如 果您不需要审核信息,禁用audtid服务 ("chkconfig --del auditd"),系统性能会有所提高. 如果想要彻底禁用内核中的audit,可以删除 /dev/audit文件,重新启动。以后可以通过在grub.conf 里kernel行最后加入audit=1来启用。
    \n
    \n
    \n
    \n参考文档 :
    \n
    \n lAus相关: http://blog.chinaunix.net/u/6303/showart_275806.html
    \n console login hangs RHEL 3:http://www.linuxquestions.org/questions/linux-general-1/console-login-hangs-rhel-3-348072/
    \n Linux Console Hangs:http://www.usenet-forums.com/linux-networking/68241-linux-console-hangs-2.html
    \n /目录空间不足,清理/var/log/audit.d:http://blog.zhangjianfeng.com/article/386

    \n", "_id"=>898}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"God: 比Monit更好用的monitoring", "body"=>"God是一个使用Ruby写成的用于监视任务运行状态的可扩展框架,它的配置脚本采用Ruby来编写。因此,比起它的前辈Monit,God更为简单,灵活且易于扩展(尤其对于Ruby使用者),你可以很轻易的添加一些自定义规则。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. MINIONS = [  
    2. \r\n\t
    3.   { :rails_root => \"/home/mycoolapp/staging/current\",  
    4. \r\n\t
    5.     :mongrel_ports => [4001,4002,4003,4004,4005],  
    6. \r\n\t
    7.     :uid => 'mycoolapp',  
    8. \r\n\t
    9.     :gid => 'mycoolapp',  
    10. \r\n\t
    11.     :pid_path => '/home/mycoolapp/staging/shared/tmp/pids' }  
    12. \r\n\t
    13. ]  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. MINIONS.each do |minion|  
    18. \r\n\t
    19.   minion[:mongrel_ports].each do |port|  
    20. \r\n\t
    21.     God.watch do |w|  
    22. \r\n\t
    23.       w.name = \"mongrel-\#{port}\"  
    24. \r\n\t
    25.       w.uid = minion[:uid]  
    26. \r\n\t
    27.       w.gid = minion[:gid]  
    28. \r\n\t
    29.       w.interval = 30.seconds # default        
    30. \r\n\t
    31.       w.start = \"mongrel_rails start -c \#{minion[:rails_root]} -p \#{port} \\ 
    32. \r\n\t
    33.         -P \#{minion[:pid_path]}/mongrel.\#{port}.pid -e production -d\"  
    34. \r\n\t
    35.       w.stop = \"mongrel_rails stop -P \#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    36. \r\n\t
    37.       w.restart = \"mongrel_rails restart -P \#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    38. \r\n\t
    39.       w.start_grace = 10.seconds  
    40. \r\n\t
    41.       w.restart_grace = 10.seconds  
    42. \r\n\t
    43.       w.pid_file = \"\#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    44. \r\n\t
    45.       
    46. \r\n\t
    47.       w.behavior(:clean_pid_file)  
    48. \r\n\t
    49.   
    50. \r\n\t
    51.       w.start_if do |start|  
    52. \r\n\t
    53.         start.condition(:process_runningdo |c|  
    54. \r\n\t
    55.           c.interval = 5.seconds  
    56. \r\n\t
    57.           c.running = false  
    58. \r\n\t
    59.         end  
    60. \r\n\t
    61.       end  
    62. \r\n\t
    63.       
    64. \r\n\t
    65.       w.restart_if do |restart|  
    66. \r\n\t
    67.         restart.condition(:memory_usagedo |c|  
    68. \r\n\t
    69.           c.above = 150.megabytes  
    70. \r\n\t
    71.           c.times = [3, 5] # 3 out of 5 intervals  
    72. \r\n\t
    73.         end  
    74. \r\n\t
    75.       
    76. \r\n\t
    77.         restart.condition(:cpu_usagedo |c|  
    78. \r\n\t
    79.           c.above = 50.percent  
    80. \r\n\t
    81.           c.times = 5  
    82. \r\n\t
    83.         end  
    84. \r\n\t
    85.       end  
    86. \r\n\t
    87.       
    88. \r\n\t
    89.       # lifecycle  
    90. \r\n\t
    91.       w.lifecycle do |on|  
    92. \r\n\t
    93.         on.condition(:flappingdo |c|  
    94. \r\n\t
    95.           c.to_state = [:start:restart]  
    96. \r\n\t
    97.           c.times = 5  
    98. \r\n\t
    99.           c.within = 5.minute  
    100. \r\n\t
    101.           c.transition = :unmonitored  
    102. \r\n\t
    103.           c.retry_in = 10.minutes  
    104. \r\n\t
    105.           c.retry_times = 5  
    106. \r\n\t
    107.           c.retry_within = 2.hours  
    108. \r\n\t
    109.         end  
    110. \r\n\t
    111.       end  
    112. \r\n\t
    113.     end  
    114. \r\n\t
    115.   end  
    116. \r\n\t
    117. end  
    118. \r\n
    \r\n
    \r\n要了解更多资料,请参考如下文档:\r\nhttp://god.rubyforge.org/\r\nhttp://ihower.idv.tw/blog/archives/1762\r\nhttp://ezinearticles.com/?Why-Rails-Developers-Need-God&id=845672\r\nhttp://www.letrails.cn/archives/46", "created_at"=>2008-08-26 07:50:47 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    God是一个使用Ruby写成的用于监视任务运行状态的可扩展框架,它的配置脚本采用Ruby来编写。因此,比起它的前辈Monit,God更为简单,灵活且易于扩展(尤其对于Ruby使用者),你可以很轻易的添加一些自定义规则。
    \n
    \nRuby代码
    \n
    \n MINIONS = [  
    \n   { :rails_root => "/home/mycoolapp/staging/current",  
    \n     :mongrel_ports => [4001,4002,4003,4004,4005],  
    \n     :uid => 'mycoolapp',  
    \n     :gid => 'mycoolapp',  
    \n     :pid_path => '/home/mycoolapp/staging/shared/tmp/pids' }  
    \n ]  
    \n   
    \n MINIONS.each do |minion|  
    \n   minion[:mongrel_ports].each do |port|  
    \n     God.watch do |w|  
    \n       w.name = "mongrel-\#{port}"  
    \n       w.uid = minion[:uid]  
    \n       w.gid = minion[:gid]  
    \n       w.interval = 30.seconds # default        
    \n       w.start = "mongrel_rails start -c \#{minion[:rails_root]} -p \#{port} </span> 
    \n         -P \#{minion[:pid_path]}/mongrel.\#{port}.pid -e production -d"  
    \n       w.stop = "mongrel_rails stop -P \#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       w.restart = "mongrel_rails restart -P \#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       w.start_grace = 10.seconds  
    \n       w.restart_grace = 10.seconds  
    \n       w.pid_file = "\#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       
    \n       w.behavior(:clean_pid_file)  
    \n   
    \n       w.start_if do |start|  
    \n         start.condition(:process_running) do |c|  
    \n           c.interval = 5.seconds  
    \n           c.running = false  
    \n         end  
    \n       end  
    \n       
    \n       w.restart_if do |restart|  
    \n         restart.condition(:memory_usage) do |c|  
    \n           c.above = 150.megabytes  
    \n           c.times = [3, 5] # 3 out of 5 intervals  
    \n         end  
    \n       
    \n         restart.condition(:cpu_usage) do |c|  
    \n           c.above = 50.percent  
    \n           c.times = 5  
    \n         end  
    \n       end  
    \n       
    \n       # lifecycle  
    \n       w.lifecycle do |on|  
    \n         on.condition(:flapping) do |c|  
    \n           c.to_state = [:start, :restart]  
    \n           c.times = 5  
    \n           c.within = 5.minute  
    \n           c.transition = :unmonitored  
    \n           c.retry_in = 10.minutes  
    \n           c.retry_times = 5  
    \n           c.retry_within = 2.hours  
    \n         end  
    \n       end  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n要了解更多资料,请参考如下文档:
    \nhttp://god.rubyforge.org/
    \nhttp://ihower.idv.tw/blog/archives/1762
    \nhttp://ezinearticles.com/?Why-Rails-Developers-Need-God&id=845672;
    \nhttp://www.letrails.cn/archives/46

    \n", "_id"=>899}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL存储引擎选择和比较", "body"=>"大家都知道MYSQL有很多的存储引擎机制,有人曾说过“多个引擎说明这是MYSQL的软肋,它不能像oracle那样搞出一个通用的”,这句话的具体意思自己揣摩,我就不瞎解读了。\r\n\r\n今天看到一篇文章,是关于其存储引擎的,虽然不长,但是写的很不错,里面有些tips值得学习,不再翻译,其原文地址为《MySQL Storage Engines》。\r\n\r\n\"\"\r\n\r\nTip: A well designed MySQL-powered application will use different storage engines for different tables. If you're still stuck with all MyISAM tables, now may be a good time to revisit.", "created_at"=>2008-08-27 06:36:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    大家都知道MYSQL有很多的存储引擎机制,有人曾说过“多个引擎说明这是MYSQL的软肋,它不能像oracle那样搞出一个通用的”,这句话的具体意思自己揣摩,我就不瞎解读了。

    \n\n

    今天看到一篇文章,是关于其存储引擎的,虽然不长,但是写的很不错,里面有些tips值得学习,不再翻译,其原文地址为《MySQL Storage Engines》。

    \n\n\n

    Tip: A well designed MySQL-powered application will use different storage engines for different tables. If you're still stuck with all MyISAM tables, now may be a good time to revisit.

    \n", "_id"=>900}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"基于CookieStore的session存储机制的安全话题", "body"=>"最近在看一本《The Rails way》的书,其中关于session存贮机制一章中,对基于CookieStore的session存储机制持否定态度,认为其存在被破解和Replay attack的可能。就我了解的信息来看,这个观点是不妥的。\r\n最详细的一篇文章是写的laigongli写的这篇“Rails 2.0, cookie session store and security”,文章比较长,说的很详细,感兴趣的可以过去看看。其中主要观点为:\r\n
      \r\n\t
    1. The problems with PStore are significant enough to warrant a replacement default implementation.
    2. \r\n\t
    3. It’s a bad idea anyway to store sensitive information (like passwords) in the session. It doesn’t matter whether the session data can be seen by the client or not, it’s something nobody should ever do.
    4. \r\n\t
    5. Forging session data is only possible if cracking the secret is feasible.
    6. \r\n
    \r\n文中,其针对Rails的采用CookieStore机制时,其针对“449fe2e7daee471bffae2fd8dc02313d”这样一个密码是,按照其机型:\r\n“My machine, an Intel Core 2 Duo T5300, can try 285840.1 passwords per second with 2 threads.”\r\n破解下来需要的时间是:\r\n``16^32/2 / 285840.1= 5.952*10^32 seconds= 1.886*10^25 years```\r\n这是个什么概念?\r\n\r\n但是其也提到了由于Rails采用的 Ruby’s CGI::Session的session Id生成器中存在一个缺陷,导致其算法是可以被破解的,不过“Update November 28: The key generation security problem has been fixed.”已经修复了。所以,我也认为基于CookieStore的session存储机制是安全可靠的。\r\n\r\n参考:\r\n", "created_at"=>2008-08-28 02:42:18 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    最近在看一本《The Rails way》的书,其中关于session存贮机制一章中,对基于CookieStore的session存储机制持否定态度,认为其存在被破解和Replay attack的可能。就我了解的信息来看,这个观点是不妥的。
    \n最详细的一篇文章是写的laigongli写的这篇“Rails 2.0, cookie session store and security”,文章比较长,说的很详细,感兴趣的可以过去看看。其中主要观点为:
    \n
    \n The problems with PStore are significant enough to warrant a replacement default implementation.
    \n It’s a bad idea anyway to store sensitive information (like passwords) in the session. It doesn’t matter whether the session data can be seen by the client or not, it’s something nobody should ever do.
    \n Forging session data is only possible if cracking the secret is feasible.
    \n
    \n文中,其针对Rails的采用CookieStore机制时,其针对“449fe2e7daee471bffae2fd8dc02313d”这样一个密码是,按照其机型:
    \n“My machine, an Intel Core 2 Duo T5300, can try 285840.1 passwords per second with 2 threads.”
    \n破解下来需要的时间是:
    \n16^32/2 / 285840.1= 5.952*10^32 seconds= 1.886*10^25 years`
    \n这是个什么概念?

    \n\n

    但是其也提到了由于Rails采用的 Ruby’s CGI::Session的session Id生成器中存在一个缺陷,导致其算法是可以被破解的,不过“Update November 28: The key generation security problem has been fixed.”已经修复了。所以,我也认为基于CookieStore的session存储机制是安全可靠的。

    \n\n

    参考:
    \n
    \n Rails 2.0, cookie session store and security
    \n BustRailsCookie.rb

    \n", "_id"=>901}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Thin: A fast and very simple Ruby web server", "body"=>"知道Thin这个东西很久了,记忆中的还是下面这张和mongrel的性能比较图片,但是一直没深入进去了解其到底如何。\r\n\"\"\r\n从图上可以看到,除了总体性能好于mongrel以外,最大的区别在于其在100个并发的时候还能保证高性能,而100个并发的时候mongrel的性能非常差(且消耗很多的资源,经常由此导致请求无法处理,而出现503)。\r\n今天花了点时间,把Thin从头到尾的看了一遍,然后连到一个服务器上试验了下,总体感觉如下:\r\n
      \r\n\t
    • 安装方便,和mongrel差不多,一条命令就搞定;如果你需要还可以install到init下;
    • \r\n\t
    • 使用方便,嫌麻烦的直接thin start就OK了;
    • \r\n\t
    • 配置丰富,提供了很多可以配置的东西,比如max-conns,max-persistent-conns等;
    • \r\n\t
    • 可以集群,也非常方便,指定开始端口和实例的个数;
    • \r\n\t
    • 支持写配置文件,配置文件可以修改,重载。
    • \r\n\t
    • 支持做backend,前置nginx,配置和mongrel差不多。
    • \r\n\t
    • 可以走UNIX domain sockets;
    • \r\n\t
    • 节省资源,提供性能
    • \r\n
    \r\n使用过程大概如下,详细的参考资料:\r\n1、安装\r\nsudo gem install thin\r\n2、启动测试\r\ncd to/your/rails/app\r\nthin start\r\n3、配置集群\r\nthin config -C 1sters.yml -s2 -p 7000\r\n4、启动\r\nthin start -C 1sters.yml\r\n\r\n参考资料:\r\n
      \r\n\t
    • http://code.macournoyer.com/thin/
    • \r\n\t
    • http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin
    • \r\n\t
    • http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby
    • \r\n
    ", "created_at"=>2008-08-28 08:21:34 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    知道Thin这个东西很久了,记忆中的还是下面这张和mongrel的性能比较图片,但是一直没深入进去了解其到底如何。
    \n
    \n从图上可以看到,除了总体性能好于mongrel以外,最大的区别在于其在100个并发的时候还能保证高性能,而100个并发的时候mongrel的性能非常差(且消耗很多的资源,经常由此导致请求无法处理,而出现503)。
    \n今天花了点时间,把Thin从头到尾的看了一遍,然后连到一个服务器上试验了下,总体感觉如下:
    \n
    \n 安装方便,和mongrel差不多,一条命令就搞定;如果你需要还可以install到init下;
    \n 使用方便,嫌麻烦的直接thin start就OK了;
    \n 配置丰富,提供了很多可以配置的东西,比如max-conns,max-persistent-conns等;
    \n 可以集群,也非常方便,指定开始端口和实例的个数;
    \n 支持写配置文件,配置文件可以修改,重载。
    \n 支持做backend,前置nginx,配置和mongrel差不多。
    \n 可以走UNIX domain sockets;
    \n 节省资源,提供性能
    \n
    \n使用过程大概如下,详细的参考资料:
    \n1、安装
    \nsudo gem install thin
    \n2、启动测试
    \ncd to/your/rails/app
    \nthin start
    \n3、配置集群
    \nthin config -C 1sters.yml -s2 -p 7000
    \n4、启动
    \nthin start -C 1sters.yml

    \n\n

    参考资料:
    \n
    \n http://code.macournoyer.com/thin/
    \n http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin
    \n http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby

    \n", "_id"=>902}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Merb处理Rails中大文件上传难题", "body"=>"做Rails的应该知道,在Rails中处理大文件上传是很头疼的事情,比如你允许用户上传图片,那么其有的时候分辨率高的文件有1-2M的大小,这个时候rails的上传处理是很慢的,也不难理解,看段经典的上传代码:\r\n
    \r\n
    Rails代码
    \r\n
      \r\n\t
    1. def upload  
    2. \r\n\t
    3.   File.open(RAILS_ROOT+\"/uploads/\#{params[:file].original_filename}.\#{next_count}”, “w”) { |f| f.write(params[:file].read) }  
    4. \r\n\t
    5.   render :action => ‘index’  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n加上Rails是单线程的,这个时候处理大的IO非常慢,慢的后果是什么?拖死你的服务器,比如你使用mongrel,开了10个进程在跑,这个时候,用户上传一个文件要花2分钟,就会占着这个进程不放,导致其他的请求无法响应(好怀念weblogic的队列机制),所以你的系统抛给用户的可能就是503,504之类的错误。\r\n有人推荐,这个情况下可以使用merb,这东西也不会很陌生,从rails大红大紫后,其一直在后面追赶,其基本特性就是线程安全的,所以对一个请求可以多线程处理,会加快处理速度,看段类似处理上传的代码:\r\n
    \r\n
    Merb代码
    \r\n
      \r\n\t
    1. def upload  
    2. \r\n\t
    3.   FileUtils.mv params[:file][:tempfile].path, MERB_ROOT+”/uploads/\#{params[:file][:filename]}.\#{next_count}”  
    4. \r\n\t
    5.   render :action => ‘index’  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n详细的测试比较,请参考“File Uploads in Merb versus Rails”这里文章,其结论差不多是这样的“Merb’s average response time is 16 ms while Rails’s average is 205 ms (over 10x faster), yet the throughput is 3000 vs 2000 req/min (only 50% greater).”,针对其throughput提高不多的情况,merb的人给出的方案是add\":use_mutex: false\"in merb.yml,其原因说因为AR是非线程安全的才需要这个选项,设置成fasle后可以大大的提高性能。\r\n\r\n参考文章:\r\n", "created_at"=>2008-08-29 02:13:33 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    做Rails的应该知道,在Rails中处理大文件上传是很头疼的事情,比如你允许用户上传图片,那么其有的时候分辨率高的文件有1-2M的大小,这个时候rails的上传处理是很慢的,也不难理解,看段经典的上传代码:
    \n
    \nRails代码
    \n
    \n def upload  
    \n   File.open(RAILS_ROOT+"/uploads/\#{params[:file].original_filename}.\#{next_count}”, “w”) { |f| f.write(params[:file].read) }  
    \n   render :action => ‘index’  
    \n end  
    \n
    \n
    \n加上Rails是单线程的,这个时候处理大的IO非常慢,慢的后果是什么?拖死你的服务器,比如你使用mongrel,开了10个进程在跑,这个时候,用户上传一个文件要花2分钟,就会占着这个进程不放,导致其他的请求无法响应(好怀念weblogic的队列机制),所以你的系统抛给用户的可能就是503,504之类的错误。
    \n有人推荐,这个情况下可以使用merb,这东西也不会很陌生,从rails大红大紫后,其一直在后面追赶,其基本特性就是线程安全的,所以对一个请求可以多线程处理,会加快处理速度,看段类似处理上传的代码:
    \n
    \nMerb代码
    \n
    \n def upload  
    \n   FileUtils.mv params[:file][:tempfile].path, MERB_ROOT+”/uploads/\#{params[:file][:filename]}.\#{next_count}”  
    \n   render :action => ‘index’  
    \n end  
    \n
    \n
    \n详细的测试比较,请参考“File Uploads in Merb versus Rails”这里文章,其结论差不多是这样的“Merb’s average response time is 16 ms while Rails’s average is 205 ms (over 10x faster), yet the throughput is 3000 vs 2000 req/min (only 50% greater).”,针对其throughput提高不多的情况,merb的人给出的方案是add":use_mutex: false"in merb.yml,其原因说因为AR是非线程安全的才需要这个选项,设置成fasle后可以大大的提高性能。

    \n\n

    参考文章:
    \n
    \n File Uploads in Merb versus Rails
    \n [Mongrel] Uploading Large (100mb+) files
    \n Taking Merb for a Spin
    \n Uploading large files to Rails with Merb

    \n", "_id"=>903}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock: 非常值得期待的一组类库", "body"=>"\"\"\r\nNeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.\r\n\r\nRuby的伪线程,Rails的非线程安全性导致其性能始终上不去,前端时间发布的ruby1.9有多处修改,后面的Rails2.2也号称要做线程安全了,如果以上两个条件都满足,Rails的性能将得到大幅的提高。\r\n\r\n由于Rails的AR是非线程安全的,导致其IO性能不是很好,其Mysql驱动一直是单线,不能很好的提高性能,做个Oracle的应该很怀念Oracle,weblogic中的线程池,java5中的concurrent包用来写同步等处理非常方便和高效。\r\n\r\n很高兴看到Ruby世界也有类似的东西出现了,他就是NeverBlock,在其放出PostgreSQL的适配驱动后,近日有发布了针对MYSQL的版本,名字为mysqlplus,非常值得期待。\r\n\r\n另外,关于“同步、异步、阻塞和非阻塞的概念”,请参考其链接上的文章。\r\n\r\n参考文章:\r\n\r\nhttp://chinaonrails.com/topic/view/1974.html\r\n\r\nhttp://www.espace.com.eg/neverblock/blog/2008/08/28/neverblock-mysql-support/\r\n\r\nhttp://github.com/espace/mysqlplus/tree/master\r\n\r\nhttp://zhanjun.net/?q=node/7\r\n\r\n ", "created_at"=>2008-08-30 11:16:35 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    NeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.

    \n\n

    Ruby的伪线程,Rails的非线程安全性导致其性能始终上不去,前端时间发布的ruby1.9有多处修改,后面的Rails2.2也号称要做线程安全了,如果以上两个条件都满足,Rails的性能将得到大幅的提高。

    \n\n

    由于Rails的AR是非线程安全的,导致其IO性能不是很好,其Mysql驱动一直是单线,不能很好的提高性能,做个Oracle的应该很怀念Oracle,weblogic中的线程池,java5中的concurrent包用来写同步等处理非常方便和高效。

    \n\n

    很高兴看到Ruby世界也有类似的东西出现了,他就是NeverBlock,在其放出PostgreSQL的适配驱动后,近日有发布了针对MYSQL的版本,名字为mysqlplus,非常值得期待。

    \n\n

    另外,关于“同步、异步、阻塞和非阻塞的概念”,请参考其链接上的文章。

    \n\n

    参考文章:

    \n\n

    http://chinaonrails.com/topic/view/1974.html

    \n\n

    http://www.espace.com.eg/neverblock/blog/2008/08/28/neverblock-mysql-support/

    \n\n

    http://github.com/espace/mysqlplus/tree/master

    \n\n

    http://zhanjun.net/?q=node/7

    \n\n

     

    \n", "_id"=>904}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] 值得期待的internationalization", "body"=>"Rails2.2的脚步越来越近了,虽然Rails2.1才放出来没多久,不可否认的是Rails2.2的脚本也越来越近了,近期可以看到一些在Rails2.2中可能会包含的功能,值得期待和预先了解下。\r\n\r\n除了上次说到的Rails2.2中会实现线程安全外,今天在其weblog上看到,将包含另外一个很值得期待的功能:internationalization。\r\n\r\nRails2.2中将提供internationalization这个功能,有了这个功能,就可以更加方便的制作国际化的网站了,非常棒。以前我们都是使用插件的方式解决这个问题,可以选择的插件也挺多,各有优缺点,有的也有些bug,需要自己hack下,以后rails2.2中包含了i18n后,该有多方便呀。\r\n\r\nClemens Kofler’s已经做了个demo的演示,也提供了其代码,感兴趣的可以体检熟悉下。", "created_at"=>2008-08-30 17:10:00 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails2.2的脚步越来越近了,虽然Rails2.1才放出来没多久,不可否认的是Rails2.2的脚本也越来越近了,近期可以看到一些在Rails2.2中可能会包含的功能,值得期待和预先了解下。

    \n\n

    除了上次说到的Rails2.2中会实现线程安全外,今天在其weblog上看到,将包含另外一个很值得期待的功能:internationalization。

    \n\n

    Rails2.2中将提供internationalization这个功能,有了这个功能,就可以更加方便的制作国际化的网站了,非常棒。以前我们都是使用插件的方式解决这个问题,可以选择的插件也挺多,各有优缺点,有的也有些bug,需要自己hack下,以后rails2.2中包含了i18n后,该有多方便呀。

    \n\n

    Clemens Kofler’s已经做了个demo的演示,也提供了其代码,感兴趣的可以体检熟悉下。

    \n", "_id"=>905}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] Josh Peek,thread safety?", "body"=>"Rails上说有个叫做Josh Peek的家伙加入core,将带来thread safety,这无疑是个重磅炸弹,因为才Rails0.6到现在的Rails2.1都是非线程安全的,以至于其一些无法解决的问题,性能也一直被人诟病,其实也不能怪Rails,Ruby本身这个方面做的也不是很好。\r\n\r\n随着Ruby1.9的逐步推广,Rails2.2应该会对Ruby1.9广泛支持了吧,这个时候将会有很多新的东西加进来的吧,除了这里说的“线程安全”,还有前面说到的“国际化”,以及NeverBlock实现的一组同步组件包,其性能将会得到大幅的提高。\r\n\r\n另外,还有值得期待的就是Ruby的VM是否有改善?目前的GC还是问题大大的有,内存泄露也并不稀罕,希望有新的VM出来;另外,其Ruby的一些app服务器最近好像停止不前了,自从Zed A. Shaw闹脾气后,mongrel就很少有啥更新了,其maillist也冷冷清清的。thin还好,有些小的更新,这些server要针对Rails2.2和Ruby1.9做些大动作了。\r\n\r\nRuby的世界,前途无量。", "created_at"=>2008-08-30 17:29:28 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails上说有个叫做Josh Peek的家伙加入core,将带来thread safety,这无疑是个重磅炸弹,因为才Rails0.6到现在的Rails2.1都是非线程安全的,以至于其一些无法解决的问题,性能也一直被人诟病,其实也不能怪Rails,Ruby本身这个方面做的也不是很好。

    \n\n

    随着Ruby1.9的逐步推广,Rails2.2应该会对Ruby1.9广泛支持了吧,这个时候将会有很多新的东西加进来的吧,除了这里说的“线程安全”,还有前面说到的“国际化”,以及NeverBlock实现的一组同步组件包,其性能将会得到大幅的提高。

    \n\n

    另外,还有值得期待的就是Ruby的VM是否有改善?目前的GC还是问题大大的有,内存泄露也并不稀罕,希望有新的VM出来;另外,其Ruby的一些app服务器最近好像停止不前了,自从Zed A. Shaw闹脾气后,mongrel就很少有啥更新了,其maillist也冷冷清清的。thin还好,有些小的更新,这些server要针对Rails2.2和Ruby1.9做些大动作了。

    \n\n

    Ruby的世界,前途无量。

    \n", "_id"=>906}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Configatron&SimpleConfig: 在Rails中添加需要的配置", "body"=>"搞Java的人应该很习惯把一些配置(数据库连接、个性化配置等)写到配置文件中,一般会使用XML或者TXT文件中,在启动的时候读取配置,初始化等等。\r\nRails中也可以实现类似的功能,虽然Rails提倡“零配置”,但有的时候开发一个系统,比如Blog系统等还是需要一些个性化的配置,我们原来的实现方式是:增加一个配置文件,启动的时候读取,并保存为全局变量,用的时候直接使用。也很方便。\r\n其实还可以使用插件或者gem来做,Configatron就是这么一个gem,另外还有一个插件版的SimpleConfig,两者还是有些不同的,按照Configatron 作者的说法,其不同点在于:\r\n
    SimpleConfig looks nice, but it definitely has a few differences from Configatron. The first big difference is that SimpleConfig is limited to use with Rails. Configatron can be used with any framework, any application, and any script. Configatron also seems a bit easier to use. There are no mixins needed to use it. The configatron method lives in Kernel, which means it’s available everywhere, no ‘configuration’ needed. \":)\" Different strokes, eh? There are a few other configuration systems out there, I always encourage people to check out the options before they decide on a piece of software to use.
    \r\n其实我们自己也可以写,只是没有必要再搞一套,功能上来说,上述这两个足够了,下面简单的看看Configatron 的用法:\r\n1、安装\r\n$ sudo gem install configatron\r\n2、定义(支持namespace)\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron do |config|  
    2. \r\n\t
    3.   config.website_url = \"http://www.1sters.com\"  
    4. \r\n\t
    5.   config.namespace(:memsdo |mem|  
    6. \r\n\t
    7.     email.namespace(:iceskysldo |iceskysl|  
    8. \r\n\t
    9.       iceskysl.email = \"iceskysl@1sters.com\"  
    10. \r\n\t
    11.       pop.blog_url = \"http://iceskysl.1sters.com\"  
    12. \r\n\t
    13.       # etc ...  
    14. \r\n\t
    15.     end  
    16. \r\n\t
    17.     email.namespace(:shinedo |shine|  
    18. \r\n\t
    19.       smtp.email = \"shine@1sters.com\"  
    20. \r\n\t
    21.       smtp.blog_url = \"http://shine.1sters.com\"  
    22. \r\n\t
    23.       # etc ...  
    24. \r\n\t
    25.     end  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # etc...  
    30. \r\n\t
    31. end  
    32. \r\n
    \r\n
    \r\n3、使用\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron.mems.iceskysl.email # => \"iceskysl@1sters.com\"  
    2. \r\n\t
    3. configatron.mems.shine.blog_url # => \"http://shine.1sters.com\"  
    4. \r\n\t
    5. configatron.website_url # => \"http://www.1sters.com\"  
    6. \r\n
    \r\n
    \r\n4、重写\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron do |config|  
    2. \r\n\t
    3.   config.website_url = \"http://www.1sters.com/index\"  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\nPS:\r\n如果你是在自己的Rails里使用,可能simpleconfig会更加适合你,请参考其链接上的Readme。\r\n\r\n参考文档:\r\nhttp://www.mackframework.com/2008/08/29/configatron-100-released/\r\nhttp://www.rubyinside.com/configatron-ruby-app-configuration-library-1130.html\r\nhttp://github.com/lukeredpath/simpleconfig/tree/master", "created_at"=>2008-08-31 03:45:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    搞Java的人应该很习惯把一些配置(数据库连接、个性化配置等)写到配置文件中,一般会使用XML或者TXT文件中,在启动的时候读取配置,初始化等等。
    \nRails中也可以实现类似的功能,虽然Rails提倡“零配置”,但有的时候开发一个系统,比如Blog系统等还是需要一些个性化的配置,我们原来的实现方式是:增加一个配置文件,启动的时候读取,并保存为全局变量,用的时候直接使用。也很方便。
    \n其实还可以使用插件或者gem来做,Configatron就是这么一个gem,另外还有一个插件版的SimpleConfig,两者还是有些不同的,按照Configatron 作者的说法,其不同点在于:
    \nSimpleConfig looks nice, but it definitely has a few differences from Configatron. The first big difference is that SimpleConfig is limited to use with Rails. Configatron can be used with any framework, any application, and any script. Configatron also seems a bit easier to use. There are no mixins needed to use it. The configatron method lives in Kernel, which means it’s available everywhere, no ‘configuration’ needed. Different strokes, eh? There are a few other configuration systems out there, I always encourage people to check out the options before they decide on a piece of software to use.
    \n其实我们自己也可以写,只是没有必要再搞一套,功能上来说,上述这两个足够了,下面简单的看看Configatron 的用法:
    \n1、安装
    \n$ sudo gem install configatron
    \n2、定义(支持namespace)
    \n
    \nRuby代码
    \n
    \n configatron do |config|  
    \n   config.website_url = "http://www.1sters.com"  
    \n   config.namespace(:mems) do |mem|  
    \n     email.namespace(:iceskysl) do |iceskysl|  
    \n       iceskysl.email = "iceskysl@1sters.com"  
    \n       pop.blog_url = "http://iceskysl.1sters.com"  
    \n       # etc ...  
    \n     end  
    \n     email.namespace(:shine) do |shine|  
    \n       smtp.email = "shine@1sters.com"  
    \n       smtp.blog_url = "http://shine.1sters.com"  
    \n       # etc ...  
    \n     end  
    \n   end  
    \n   # etc...  
    \n end  
    \n
    \n
    \n3、使用
    \n
    \nRuby代码
    \n
    \n configatron.mems.iceskysl.email # => "iceskysl@1sters.com"  
    \n configatron.mems.shine.blog_url # => "http://shine.1sters.com"  
    \n configatron.website_url # => "http://www.1sters.com"  
    \n
    \n
    \n4、重写
    \n
    \nRuby代码
    \n
    \n configatron do |config|  
    \n   config.website_url = "http://www.1sters.com/index"  
    \n end  
    \n
    \n
    \nPS:
    \n如果你是在自己的Rails里使用,可能simpleconfig会更加适合你,请参考其链接上的Readme。

    \n\n

    参考文档:
    \nhttp://www.mackframework.com/2008/08/29/configatron-100-released/
    \nhttp://www.rubyinside.com/configatron-ruby-app-configuration-library-1130.html
    \nhttp://github.com/lukeredpath/simpleconfig/tree/master

    \n", "_id"=>907}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]log4r&Logging: 替代Rails中logger的日志记录库", "body"=>"Rail本身自带的logger虽然好用,但是还是有点太简易了,针对一些特殊的业务需求(比如需要记录一些业务日志供后续的报表系统分析、解析等)就显得有点力不从心了。这个时候可以找找其他的替代品。\r\n1、log4r\r\n做java的应该对这样的名字相当熟悉,大名鼎鼎的log4j在java的世界里非常流行和实用,看这个log4r的名字就可以感受到其强大的功能。\r\n
    Log4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a hierarchical logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness, XML and YAML configuration, and more.
    \r\n但是截至到目前为止的其log4r-1.0.5版本中和Rails2的版本还存在一个冲突,详细的可以参考“Ticket #3512” (reopened defect)。\r\n
    ActionView::TemplateError (Expected kind of Outputter, got NilClass) c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in `each' c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in `add' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:30:in `benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:57:in `render_partial' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:230:in `render'
    \r\n但是其从March 2004开始到现在都没人有维护和更新,看来需要寻找新的解决方案了。\r\n2、Logging\r\nLogging is a flexible logging library for use in Ruby programs based on the design of Java‘s log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.\r\n关于Logging的详细API可以参考其doc文档,其详细的用法和注意事项,可以参考“HowtoConfigureLogging”,下面看个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'logging'  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. logger = Logging::Logger['example_logger']  
    6. \r\n\t
    7. logger.add_appenders(  
    8. \r\n\t
    9.     Logging::Appender.stdout,  
    10. \r\n\t
    11.     Logging::Appenders::File.new('example.log')  
    12. \r\n\t
    13. )  
    14. \r\n\t
    15. logger.level = :info  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. logger.debug \"this debug message will not be output by the logger\"  
    20. \r\n\t
    21. logger.info \"just some friendly advice\"  
    22. \r\n
    \r\n
    \r\n参考文章:\r\nhttp://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging\r\nhttp://logging.rubyforge.org/\r\nhttp://log4r.sourceforge.net/index.html\r\nhttp://007surfing.com/index.php?hl=f5&q=uggc%3A%2F%2Fapupenvyf.oybtfcbg.pbz%2F2007%2F04%2Fybt.ugzy", "created_at"=>2008-08-31 04:59:20 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rail本身自带的logger虽然好用,但是还是有点太简易了,针对一些特殊的业务需求(比如需要记录一些业务日志供后续的报表系统分析、解析等)就显得有点力不从心了。这个时候可以找找其他的替代品。
    \n1、log4r
    \n做java的应该对这样的名字相当熟悉,大名鼎鼎的log4j在java的世界里非常流行和实用,看这个log4r的名字就可以感受到其强大的功能。
    \nLog4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a hierarchical logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness, XML and YAML configuration, and more.
    \n但是截至到目前为止的其log4r-1.0.5版本中和Rails2的版本还存在一个冲突,详细的可以参考“Ticket #3512” (reopened defect)。
    \nActionView::TemplateError (Expected kind of Outputter, got NilClass) c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in each' c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:inadd' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:30:in benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:57:inrender_partial' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:230:in `render'
    \n但是其从March 2004开始到现在都没人有维护和更新,看来需要寻找新的解决方案了。
    \n2、Logging
    \nLogging is a flexible logging library for use in Ruby programs based on the design of Java‘s log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.
    \n关于Logging的详细API可以参考其doc文档,其详细的用法和注意事项,可以参考“HowtoConfigureLogging”,下面看个例子:
    \n
    \nRuby代码
    \n
    \n require 'logging'  
    \n   
    \n logger = Logging::Logger['example_logger']  
    \n logger.add_appenders(  
    \n     Logging::Appender.stdout,  
    \n     Logging::Appenders::File.new('example.log')  
    \n )  
    \n logger.level = :info  
    \n   
    \n logger.debug "this debug message will not be output by the logger"  
    \n logger.info "just some friendly advice"  
    \n
    \n
    \n参考文章:
    \nhttp://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging
    \nhttp://logging.rubyforge.org/
    \nhttp://log4r.sourceforge.net/index.html
    \nhttp://007surfing.com/index.php?hl=f5&q=uggc%3A%2F%2Fapupenvyf.oybtfcbg.pbz%2F2007%2F04%2Fybt.ugzy;

    \n", "_id"=>908}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Flash Message Conductor :在Rails中整合各类消息提示", "body"=>"Rails中特有的falsh消息提示机制非常好用,其三种消息(error,message,notice)针对不同的应用场景提示用户,非常方便。\r\n但是由于其三种消息提示的含义不一样,UI制作人员经常会使用不同的CSS来展示(比如error的就用红色,notice就用黄色等等),这样就存在一个问题,当在一个共用页面上需要展示几种可能的消息时,就不是很好处理,这个时候,对通用型的UI是个挑战。\r\n\r\n如果能把三种消息自动区分,使用各种的样式表,该多方便!确实,已经有人这么做了, Robby给出了一个plugin,“Flash Message Conductor”,看其介绍:\r\n``A simple pattern for managing flash messages in your Ruby on Rails application.\r\n\r\n1、安装script/plugin install git://github.com/planetargon/flash-message-conductor.git2、使用```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # Controller helpers  
    2. \r\n\t
    3. add_message( 'foo' )  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. is the equivalent of  
    8. \r\n\t
    9. flash[:message] = 'foo'  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. Controller helpers included:  
    14. \r\n\t
    15. add_message( message )   
    16. \r\n\t
    17. add_notice( message )  
    18. \r\n\t
    19. add_error( message )  
    20. \r\n\t
    21.   
    22. \r\n\t
    23. # View helpers  
    24. \r\n\t
    25. <%= render_flash_messages %>  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. produces:  
    30. \r\n\t
    31. <div id=\"flash_messages\">  
    32. \r\n\t
    33.   <p class=\"message\">You have successfully done XYZ...</p>  
    34. \r\n\t
    35. </div>  
    36. \r\n\t
    37.   
    38. \r\n\t
    39. # or... if you set an error  
    40. \r\n\t
    41. <div id=\"flash_messages\">  
    42. \r\n\t
    43.   <p class=\"error\">Oops! Something went bonkers!</p>  
    44. \r\n\t
    45. </div>  
    46. \r\n
    \r\n
    \r\n``\r\n详细信息,参考上面给出的Github上的地址查看,谢谢!```", "created_at"=>2008-09-01 03:09:56 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails中特有的falsh消息提示机制非常好用,其三种消息(error,message,notice)针对不同的应用场景提示用户,非常方便。
    \n但是由于其三种消息提示的含义不一样,UI制作人员经常会使用不同的CSS来展示(比如error的就用红色,notice就用黄色等等),这样就存在一个问题,当在一个共用页面上需要展示几种可能的消息时,就不是很好处理,这个时候,对通用型的UI是个挑战。

    \n\n

    如果能把三种消息自动区分,使用各种的样式表,该多方便!确实,已经有人这么做了, Robby给出了一个plugin,“Flash Message Conductor”,看其介绍:
    \n``A simple pattern for managing flash messages in your Ruby on Rails application.

    \n\n

    1、安装script/plugin install git://github.com/planetargon/flash-message-conductor.git2、使用
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># Controller helpers</span><span>  </span></span></li>
    \n <li><span>add_message( <span class="string">'foo'</span><span> )  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>is the equivalent of  </span></li>
    \n <li class="alt"><span>flash[<span class="symbol">:message</span><span>] = </span><span class="string">'foo'</span><span>  </span></span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>Controller helpers included:  </span></li>
    \n <li><span>add_message( message )   </span></li>
    \n <li class="alt"><span>add_notice( message )  </span></li>
    \n <li><span>add_error( message )  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="comment"># View helpers</span><span>  </span></span></li>
    \n <li class="alt"><span>&lt;%= render_flash_messages %&gt;  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>produces:  </span></li>
    \n <li><span>&lt;div id=<span class="string">"flash_messages"</span><span>&gt;  </span></span></li>
    \n <li class="alt"><span>  &lt;p <span class="keyword">class</span><span>=</span><span class="string">"message"</span><span>&gt;You have successfully done XYZ...&lt;/p&gt;  </span></span></li>
    \n <li><span>&lt;/div&gt;  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="comment"># or... if you set an error</span><span>  </span></span></li>
    \n <li class="alt"><span>&lt;div id=<span class="string">"flash_messages"</span><span>&gt;  </span></span></li>
    \n <li><span>  &lt;p <span class="keyword">class</span><span>=</span><span class="string">"error"</span><span>&gt;Oops! Something went bonkers!&lt;/p&gt;  </span></span></li>
    \n <li class="alt"><span>&lt;/div&gt;  </span></li>
    \n</ol>
    \n</div>
    \n``
    \n详细信息,参考上面给出的Github上的地址查看,谢谢!

    \n", "_id"=>909}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Google手机现身: 值得期待", "body"=>"今天在Donews上终于看到GooglePhone出现了,样式如下:\r\n\"\"\r\n\r\n在发售时间上,这款采用Android系统的HTC Dream手机将于9月17日面向T-Mobile用户进行预售,而手机型号则会被命名为G1,并提供白色、棕色和黑色等三种色彩款式选择,而正式面向其他地区的发售时间则在今年10月。\r\n\r\n说句实在话,我不是很喜欢iphone,虽然也试了下,但是我还是不是很喜欢,因为我生活中用到的Mac的东西太少了,与之相比,我认为在iphone和blackberry之间选择的话,我会选择BB,虽然我的第一款BB8100寿命不长,但是我非常喜欢,近期已经在联系入手一款升级版的BB8110。\r\n相比BB和iphone,我更加期待GooglePhone的上市,虽然Iphone在大陆上市一波三折,可能Gphone会吸取教训,更迅速的打开国内市场。\r\n为什么更加期待Google Phone,应该归于与生活中使用到Google的东西太多了,GoogleReader,GoogleDoc,Gmail,Google日历等等,都是必不可少的东西,若干Google手机上可以很好的把这些东西都整合进来,又能保证不会太笨重的话,我会买一部。\r\n期待赶快来吧,详细介绍请移步“iPhone也得低头 万众期待超炫Google手机现身”.", "created_at"=>2008-09-01 04:58:51 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    今天在Donews上终于看到GooglePhone出现了,样式如下:

    \n\n

    在发售时间上,这款采用Android系统的HTC Dream手机将于9月17日面向T-Mobile用户进行预售,而手机型号则会被命名为G1,并提供白色、棕色和黑色等三种色彩款式选择,而正式面向其他地区的发售时间则在今年10月。

    \n\n

    说句实在话,我不是很喜欢iphone,虽然也试了下,但是我还是不是很喜欢,因为我生活中用到的Mac的东西太少了,与之相比,我认为在iphone和blackberry之间选择的话,我会选择BB,虽然我的第一款BB8100寿命不长,但是我非常喜欢,近期已经在联系入手一款升级版的BB8110。
    \n相比BB和iphone,我更加期待GooglePhone的上市,虽然Iphone在大陆上市一波三折,可能Gphone会吸取教训,更迅速的打开国内市场。
    \n为什么更加期待Google Phone,应该归于与生活中使用到Google的东西太多了,GoogleReader,GoogleDoc,Gmail,Google日历等等,都是必不可少的东西,若干Google手机上可以很好的把这些东西都整合进来,又能保证不会太笨重的话,我会买一部。
    \n期待赶快来吧,详细介绍请移步“iPhone也得低头 万众期待超炫Google手机现身”.

    \n", "_id"=>910}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"开发Rails插件的方法和步骤", "body"=>"Rails丰富的插件真是强大,幻想着把各个功能都做出插件,以后开发系统就像搭积木一样堆积就好啦,呵呵。\r\n开发个Rails插件其实不难,或者说很简单,流程基本如下:\r\n1、生成骨架\r\n在Rails的script下有个generate,可以直接生成骨架,执行:\r\n# ruby script/generate plugin foo\r\n就会在$RAILS_ROOT/vendor/plugins下生成一个foo目录,如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. /1stlog$ruby script/generate plugin foo  
    2. \r\n\t
    3.       create  vendor/plugins/foo/lib  
    4. \r\n\t
    5.       create  vendor/plugins/foo/tasks  
    6. \r\n\t
    7.       create  vendor/plugins/foo/test  
    8. \r\n\t
    9.       create  vendor/plugins/foo/README  
    10. \r\n\t
    11.       create  vendor/plugins/foo/MIT-LICENSE  
    12. \r\n\t
    13.       create  vendor/plugins/foo/Rakefile  
    14. \r\n\t
    15.       create  vendor/plugins/foo/init.rb  
    16. \r\n\t
    17.       create  vendor/plugins/foo/install.rb  
    18. \r\n\t
    19.       create  vendor/plugins/foo/uninstall.rb  
    20. \r\n\t
    21.       create  vendor/plugins/foo/lib/foo.rb  
    22. \r\n\t
    23.       create  vendor/plugins/foo/tasks/foo_tasks.rake  
    24. \r\n\t
    25.       create  vendor/plugins/foo/test/foo_test.rb  
    26. \r\n
    \r\n
    \r\n2、编写相关代码\r\n在lib/foo.rb 下编写你的插件代码即可。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. module Foo  
    2. \r\n\t
    3.   def say_hello name  
    4. \r\n\t
    5.     \"hello \#{name}\"  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n3、混入到core中去\r\n在init.rb中编写混入代码即可。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'foo'    
    2. \r\n\t
    3. ActionController::Base.send :include, Foo\r\n
    4. \r\n
    \r\n
    \r\n参考文档:\r\nhttp://blog.ericsk.org/archives/769\r\nhttp://blog.railschina.com/637/viewspace-236\r\nhttp://kyoleelqh.javaeye.com/blog/215090", "created_at"=>2008-09-01 08:56:56 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails丰富的插件真是强大,幻想着把各个功能都做出插件,以后开发系统就像搭积木一样堆积就好啦,呵呵。
    \n开发个Rails插件其实不难,或者说很简单,流程基本如下:
    \n1、生成骨架
    \n在Rails的script下有个generate,可以直接生成骨架,执行:

    \n\n

    ruby script/generate plugin foo

    \n\n

    就会在$RAILS_ROOT/vendor/plugins下生成一个foo目录,如下:
    \n
    \nRuby代码
    \n
    \n /1stlog$ruby script/generate plugin foo  
    \n       create  vendor/plugins/foo/lib  
    \n       create  vendor/plugins/foo/tasks  
    \n       create  vendor/plugins/foo/test  
    \n       create  vendor/plugins/foo/README  
    \n       create  vendor/plugins/foo/MIT-LICENSE  
    \n       create  vendor/plugins/foo/Rakefile  
    \n       create  vendor/plugins/foo/init.rb  
    \n       create  vendor/plugins/foo/install.rb  
    \n       create  vendor/plugins/foo/uninstall.rb  
    \n       create  vendor/plugins/foo/lib/foo.rb  
    \n       create  vendor/plugins/foo/tasks/foo_tasks.rake  
    \n       create  vendor/plugins/foo/test/foo_test.rb  
    \n
    \n
    \n2、编写相关代码
    \n在lib/foo.rb 下编写你的插件代码即可。
    \n
    \nRuby代码
    \n
    \n module Foo  
    \n   def say_hello name  
    \n     "hello \#{name}"  
    \n   end  
    \n end  
    \n
    \n
    \n3、混入到core中去
    \n在init.rb中编写混入代码即可。
    \n
    \nRuby代码
    \n
    \n require 'foo'    
    \n ActionController::Base.send :include, Foo
    \n
    \n
    \n
    \n参考文档:
    \nhttp://blog.ericsk.org/archives/769
    \nhttp://blog.railschina.com/637/viewspace-236
    \nhttp://kyoleelqh.javaeye.com/blog/215090

    \n", "_id"=>911}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Chrome: Google推浏览器正面迎战IE8", "body"=>"昨天说到“Google手机现身: 值得期待”,然而今天又看到另外一个更让你期待的东西——Chrome,Google推出的浏览器。\r\n\"\"\r\n相比GooglePhone,Chrome或许更让人们期待,因为它是免费的,也无需等待,只有发布就可以下载使用的,同样,是整合了大量google应用的。\r\nChrome的诞生肯定不是偶然,按照google的实力,别说搞个浏览器,搞个操作系统出来也不是不可能。相传N年前就流传Google要推出自己的浏览器,但是一直没有下文,按照现在的说法,Chrome已经开发了差不多两年时间,也就是说这么段时间内,Chrome都是在进行中的。\r\n为何选择现在放出来,偶自己认为IE8的发布刺疼了Google的神经,虽然说Google的商业价值并不是IE8中那些伎俩可以打倒的,但是IE8表达的是微软的一个态度,微软使出杀手锏,可见其无奈和无助。\r\n另外一个原因,近几年,firefox的成功让google有足够的信心推出自己的浏览器,firefox靠google的赞助和一些广告点击支付,占到了firefox每年85%的收入,如果google推出自己的浏览器,在性能和界面上可以匹敌firefox的话,在google强大的占用率上,推广肯定不是难事。近年来,马桶或者其他基于IE浏览器的成功都说明一个问题:浏览器只有做好浏览器的本职工作,又足够快速即可,如果google能加强对其浏览器安全性的推广,将其做为一个卖点的话,相信不少深受IE8安全问题的用户会转投其怀抱。\r\n另外一个就是firefox可能会受到影响,因为firefox的用户相对高端,讲求速度和简洁,google的风格肯定是这个方向,肯定会吸引众多firefox的用户前来试水,如果满意的话,也有不少人会转投google怀抱。\r\n至于消息是否准确,应该是差不多了,看其他地方的一些报道:\r\nhttp://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html\r\nhttp://it.sohu.com/20080902/n259325162.shtml\r\nhttp://webleon.org/2008/09/googlechrome.html", "created_at"=>2008-09-02 01:45:09 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    昨天说到“Google手机现身: 值得期待”,然而今天又看到另外一个更让你期待的东西——Chrome,Google推出的浏览器。
    \n
    \n相比GooglePhone,Chrome或许更让人们期待,因为它是免费的,也无需等待,只有发布就可以下载使用的,同样,是整合了大量google应用的。
    \nChrome的诞生肯定不是偶然,按照google的实力,别说搞个浏览器,搞个操作系统出来也不是不可能。相传N年前就流传Google要推出自己的浏览器,但是一直没有下文,按照现在的说法,Chrome已经开发了差不多两年时间,也就是说这么段时间内,Chrome都是在进行中的。
    \n为何选择现在放出来,偶自己认为IE8的发布刺疼了Google的神经,虽然说Google的商业价值并不是IE8中那些伎俩可以打倒的,但是IE8表达的是微软的一个态度,微软使出杀手锏,可见其无奈和无助。
    \n另外一个原因,近几年,firefox的成功让google有足够的信心推出自己的浏览器,firefox靠google的赞助和一些广告点击支付,占到了firefox每年85%的收入,如果google推出自己的浏览器,在性能和界面上可以匹敌firefox的话,在google强大的占用率上,推广肯定不是难事。近年来,马桶或者其他基于IE浏览器的成功都说明一个问题:浏览器只有做好浏览器的本职工作,又足够快速即可,如果google能加强对其浏览器安全性的推广,将其做为一个卖点的话,相信不少深受IE8安全问题的用户会转投其怀抱。
    \n另外一个就是firefox可能会受到影响,因为firefox的用户相对高端,讲求速度和简洁,google的风格肯定是这个方向,肯定会吸引众多firefox的用户前来试水,如果满意的话,也有不少人会转投google怀抱。
    \n至于消息是否准确,应该是差不多了,看其他地方的一些报道:
    \nhttp://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html
    \nhttp://it.sohu.com/20080902/n259325162.shtml
    \nhttp://webleon.org/2008/09/googlechrome.html

    \n", "_id"=>912}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"Download Chrome: 可以开始下载chrome", "body"=>"充满期待的chrome,希望不要让大家失望,仔细的看了他的那本连环画,觉得还不错,最主要功能看点将是其如何整合已有的Google应用。\r\n\r\n按照其发布说法,将在美国时间,周二开始提供下载,也就是中国的9.3号了,现在已经凌晨1点啦啦,貌似2点可以下载,偶是不等了,明天起来再试试。\r\n\r\n推测下载地址:http://gears.google.com/chrome/?hl=en  或者是 http://www.google.com/chrome\r\n\r\nps:网上很多钓鱼的网站已经出来了,冒充chrome的下载,有的是恶作剧,有的是木马,请大家耐心等下下,一定记得从上面这个主页上下,切记!", "created_at"=>2008-09-02 16:58:03 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    充满期待的chrome,希望不要让大家失望,仔细的看了他的那本连环画,觉得还不错,最主要功能看点将是其如何整合已有的Google应用。

    \n\n

    按照其发布说法,将在美国时间,周二开始提供下载,也就是中国的9.3号了,现在已经凌晨1点啦啦,貌似2点可以下载,偶是不等了,明天起来再试试。

    \n\n

    推测下载地址:http://gears.google.com/chrome/?hl=en  或者是 http://www.google.com/chrome

    \n\n

    ps:网上很多钓鱼的网站已经出来了,冒充chrome的下载,有的是恶作剧,有的是木马,请大家耐心等下下,一定记得从上面这个主页上下,切记!

    \n", "_id"=>913}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"喔唷,崩溃啦! Chrome启动异常解决方法", "body"=>"前面说到了,Google的浏览器Chrome在我工作环境下启动不成功,一启动就报告说XXX初始化失败,然后就显示“喔唷,崩溃啦!”,导致不可用。\r\n查了下原因,有如下几个可能:\r\n1、我是内网 ;\r\n2、我使用了一个安全软件SPA;\r\n3、我是windows xp sp3\r\n分析了下原因,很多人的XP SP3可以跑,说明3不是问题,有人是内网可以使用,说明1一哦不是问题,那么就剩下2这个原因了。\r\n经过多方查找,找到原因:\r\n由于采用了sandbox技术,被spa无情的干掉了,即使在SPA被干掉的情况下,chrome也无法正常启动。 \r\n\r\n解决方法:\r\n手工在command界面里面执行 chrome.exe -no-sandbox \r\n或者在你的快捷方式-右键-属性,在“目标”里面最后加上-no-sandbox 类似这样\r\n\"C:\\Documents and Settings\\iceskysl\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe\" -no-sandbox", "created_at"=>2008-09-04 01:32:20 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前面说到了,Google的浏览器Chrome在我工作环境下启动不成功,一启动就报告说XXX初始化失败,然后就显示“喔唷,崩溃啦!”,导致不可用。
    \n查了下原因,有如下几个可能:
    \n1、我是内网 ;
    \n2、我使用了一个安全软件SPA;
    \n3、我是windows xp sp3
    \n分析了下原因,很多人的XP SP3可以跑,说明3不是问题,有人是内网可以使用,说明1一哦不是问题,那么就剩下2这个原因了。
    \n经过多方查找,找到原因:
    \n由于采用了sandbox技术,被spa无情的干掉了,即使在SPA被干掉的情况下,chrome也无法正常启动。

    \n\n

    解决方法:
    \n手工在command界面里面执行 chrome.exe -no-sandbox
    \n或者在你的快捷方式-右键-属性,在“目标”里面最后加上-no-sandbox 类似这样
    \n"C:\\Documents and Settings\\iceskysl\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe" -no-sandbox

    \n", "_id"=>914}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock到底有多快,对比测试说明问题", "body"=>"前面写过一篇《NeverBlock: 非常值得期待的一组类库》,其中说到了采用NeverBlock的non-blocking, concurrent机制,可以很大程度上提高mysql或者PostgreSQL的使用率,很多限度的提高性能。\r\n但是没有给出具体的对比测试数据,今天看到有个哥们已经使用Thin,Rails和PostgreSQL做了一次对比测试,相关环境如下:\r\n
    \r\n
    服务器配置
    \r\n
      \r\n\t
    1. 1 - 1 Thin server, normal postgreSQL Adapter  
    2. \r\n\t
    3. 2 - 2 Thin servers (behind nginx), normal postgreSQL Adapter  
    4. \r\n\t
    5. 3 - 4 Thin servers (behind nginx), normal postgreSQL Adapter  
    6. \r\n\t
    7. 4 - 1 Thin server, neverblock postgreSQL Adapter  
    8. \r\n
    \r\n
    \r\n
    \r\n
    压力配置
    \r\n
      \r\n\t
    1. 1 - Very light  work load,  every 200 requests, one \"select sleep(1)\" would be issued  
    2. \r\n\t
    3. 2 - Light work load,        every 100 requests, one \"select sleep(1)\" would be issued  
    4. \r\n\t
    5. 3 - Moderate work load,     every 50  requests, one \"select sleep(1)\" would be issued  
    6. \r\n\t
    7. 4 - Heavy work load,        every 20  requests, one \"select sleep(1)\" would be issued  
    8. \r\n\t
    9. 5 - Very heavy work load,   every 10  requests, one \"select sleep(1)\" would be issued  
    10. \r\n
    \r\n
    \r\n其结果对比如下:\r\n\"\"\r\n\r\n再来一张并发量的对比测试:\r\n\"\"\r\n\r\n接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。\r\n\r\n参考文档:\r\nhttp://oldmoe.blogspot.com/2008/09/building-never-blocking-rails-making.html\r\nhttp://chinaonrails.com/topic/view/1974.html", "created_at"=>2008-09-04 02:18:08 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前面写过一篇《NeverBlock: 非常值得期待的一组类库》,其中说到了采用NeverBlock的non-blocking, concurrent机制,可以很大程度上提高mysql或者PostgreSQL的使用率,很多限度的提高性能。
    \n但是没有给出具体的对比测试数据,今天看到有个哥们已经使用Thin,Rails和PostgreSQL做了一次对比测试,相关环境如下:
    \n
    \n服务器配置
    \n
    \n 1 - 1 Thin server, normal postgreSQL Adapter  
    \n 2 - 2 Thin servers (behind nginx), normal postgreSQL Adapter  
    \n 3 - 4 Thin servers (behind nginx), normal postgreSQL Adapter  
    \n 4 - 1 Thin server, neverblock postgreSQL Adapter  
    \n
    \n
    \n
    \n压力配置
    \n
    \n 1 - Very light  work load,  every 200 requests, one "select sleep(1)" would be issued  
    \n 2 - Light work load,        every 100 requests, one "select sleep(1)" would be issued  
    \n 3 - Moderate work load,     every 50  requests, one "select sleep(1)" would be issued  
    \n 4 - Heavy work load,        every 20  requests, one "select sleep(1)" would be issued  
    \n 5 - Very heavy work load,   every 10  requests, one "select sleep(1)" would be issued  
    \n
    \n
    \n其结果对比如下:

    \n\n

    再来一张并发量的对比测试:

    \n\n

    接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。

    \n\n

    参考文档:
    \nhttp://oldmoe.blogspot.com/2008/09/building-never-blocking-rails-making.html
    \nhttp://chinaonrails.com/topic/view/1974.html

    \n", "_id"=>915}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Xsstc: 通过CSS跨站运行script", "body"=>"Xsstc: Cross-site scripting through CSS data,看名字就看出来了,通过CSS跨站运行script,使用方法:\r\n
      \r\n\t
    • 导入xsstcx.js(未压缩版xsstc.js)
    • \r\n\t
    • 添加一个id=”Xsstc”的空DIV。
    • \r\n\t
    • 在JS中调用Xsstc.exec(functionURL, callback),使用的内容作为callback的参数传入callback中
    • \r\n
    \r\n其中CSS的定义也有要求,下面是Hello World中CSS的定义\r\n
    \r\n
    CSS代码
    \r\n
    \r\n``````<pre lang=\"css\"> ```\r\nXsstc {\r\n background-image: url('about:blank#Hello%20World');\r\n}```\r\n``````</pre>``````\r\n
    \r\n
    \r\n
    \r\n
    JavaScript代码
    \r\n
      \r\n\t
    1. Xsstc.exec('http://lbs.tralfamadore.com/test.css', showResponse)  
    2. \r\n
    \r\n
    \r\n参考文档:\r\n\r\n原文说明: http://ajaxian.com/archives/xsstc-cross-site-scripting-through-css-data\r\n测试页面:http://www.tralfamadore.com/test-xsstc.html", "created_at"=>2008-09-04 02:50:53 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Xsstc: Cross-site scripting through CSS data,看名字就看出来了,通过CSS跨站运行script,使用方法:
    \n
    \n 导入xsstcx.js(未压缩版xsstc.js)
    \n 添加一个id=”Xsstc”的空DIV。
    \n 在JS中调用Xsstc.exec(functionURL, callback),使用的内容作为callback的参数传入callback中
    \n
    \n其中CSS的定义也有要求,下面是Hello World中CSS的定义
    \n
    \nCSS代码
    \n
    \n&lt;pre lang="css"&gt; ```
    \nXsstc {
    \n background-image: url('about:blank#Hello%20World');
    \n}```
    \n
    </pre>``````
    \n
    \n
    \n
    \nJavaScript代码
    \n
    \n Xsstc.exec('http://lbs.tralfamadore.com/test.css', showResponse)  
    \n
    \n
    \n参考文档:

    \n\n

    原文说明: http://ajaxian.com/archives/xsstc-cross-site-scripting-through-css-data
    \n测试页面:http://www.tralfamadore.com/test-xsstc.html

    \n", "_id"=>916}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]Rails 2.1.1发布,包括众多更新", "body"=>"Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本,按照DHH的说法:Next upcoming release will be Rails 2.2 beta which is quite close.\r\n\r\nRails2.2的一些特性,比如全球化支持,增加线程安全等几个是我们已经知道的,其他还会有哪些改进呢,非常值得期待。", "created_at"=>2008-09-05 17:50:56 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本,按照DHH的说法:Next upcoming release will be Rails 2.2 beta which is quite close.

    \n\n

    Rails2.2的一些特性,比如全球化支持,增加线程安全等几个是我们已经知道的,其他还会有哪些改进呢,非常值得期待。

    \n", "_id"=>917}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NEVERBLOCK支持Ruby1.8,性能对比测试,提升非常显著", "body"=>"前面有篇文章介绍了NeverBlock,其一篇是关于NeverBlock 原理介绍的,另外一篇是在ruby1.9下做的对比测试,当时我们说:接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。现在有个好消息是,NeverBlock支持了Ruby1.8(通过一些手法),这次看到其更新的特性如下:\r\n
      \r\n\t
    •    NeverBlock now supports Ruby1.8.
    • \r\n\t
    •    NeverBlock support for Thin and Mongrel servers.
    • \r\n\t
    •    NeverBlock now supports Ruby on Rails.on
    • \r\n
    \r\n也就是说,现在NeverBlock支持Ruby1.8,支持Thin和mongrel服务器,另外支持Rails,测试方法很简单:\r\n1、安装需要的额外的系统类库\r\n
    \r\n
    Shell代码
    \r\n
      \r\n\t
    1. apt-get install libmysql++-dev\r\n
    2. \r\n
    \r\n
    \r\n2、安装需要的gems\r\n下载这几个包,NeverBlock (zip|tar.gz), Mysqlplus (zip|tar.gz), EventMachine (zip|tar.gz),\r\n然后解压各自包;tar -zxvf (respective file name).tar.gz\r\n然后CD到各自目录中build成gem;gem build (respective file name).gemspec\r\n最后gen install;gem install (generated file name).gem\r\n3、修改environment.rb\r\nrequire 'never_block/frameworks/rails'\r\nrequire 'never_block/servers/thin'(如果是mongrel,则require 'never_block/servers/mongrel')\r\n4、修改database.yml\r\nadapter: neverblock_mysql (如果是postgresql,则为 adapter: neverblock_postgresql )\r\nconnections: 12 # will spawn 12 connections instead of the defualt 4 #连接数\r\n5、重启thin(mongrel即可)\r\n\r\n以上步骤没有问题,我已经测试过了。\r\n\r\n下面附几个别人做的对比测试:\r\n
    \r\n
    测试环境如下:
    \r\n
      \r\n\t
    1. Rails 2.1  
    2. \r\n\t
    3. Thin 0.82  
    4. \r\n\t
    5. Ruby 1.8.6  
    6. \r\n\t
    7. MySQL 5.0  
    8. \r\n\t
    9. A special build of EventMachine 0.12  
    10. \r\n
    \r\n
    \r\n
    \r\n
    系统负载构造:
    \r\n
      \r\n\t
    1. 1 - Moderate work load,    one slow request for every 050 requests  
    2. \r\n\t
    3. 2 - Heavy work load,       one slow request for every 020 requests  
    4. \r\n\t
    5. 3 - Very heavy work load,  one slow request for every 010 requests\r\n
    6. \r\n
    \r\n
    \r\n结果如下:\r\n\r\nRails Performance (Thin Vs.NeverBlock::Thin)\r\n\r\n\"\"\r\n\r\nNeverBlock::Thin scaling\r\n\r\n\"\"\r\n\r\nMemory Consumption (Thin Vs. NeverBlock::Thin)\r\n\r\n\"\"\r\n\r\n \r\n\r\nPS:刚刚发布的时候存在一个find_by_sql的bug,现在已经修复了。\r\n\r\n参考文档:\r\n\r\nhttp://www.espace.com.eg/neverblock/blog/2008/09/04/neverblock-instant-scaling-for-your-rails-apps/\r\n\r\nhttp://chinaonrails.com/topic/view/2123.html", "created_at"=>2008-09-05 18:20:12 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前面有篇文章介绍了NeverBlock,其一篇是关于NeverBlock 原理介绍的,另外一篇是在ruby1.9下做的对比测试,当时我们说:接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。现在有个好消息是,NeverBlock支持了Ruby1.8(通过一些手法),这次看到其更新的特性如下:
    \n
    \n    NeverBlock now supports Ruby1.8.
    \n    NeverBlock support for Thin and Mongrel servers.
    \n    NeverBlock now supports Ruby on Rails.on
    \n
    \n也就是说,现在NeverBlock支持Ruby1.8,支持Thin和mongrel服务器,另外支持Rails,测试方法很简单:
    \n1、安装需要的额外的系统类库
    \n
    \nShell代码
    \n
    \n apt-get install libmysql++-dev
    \n
    \n
    \n
    \n2、安装需要的gems
    \n下载这几个包,NeverBlock (zip|tar.gz), Mysqlplus (zip|tar.gz), EventMachine (zip|tar.gz),
    \n然后解压各自包;tar -zxvf (respective file name).tar.gz
    \n然后CD到各自目录中build成gem;gem build (respective file name).gemspec
    \n最后gen install;gem install (generated file name).gem
    \n3、修改environment.rb
    \nrequire 'never_block/frameworks/rails'
    \nrequire 'never_block/servers/thin'(如果是mongrel,则require 'never_block/servers/mongrel')
    \n4、修改database.yml
    \nadapter: neverblock_mysql (如果是postgresql,则为 adapter: neverblock_postgresql )
    \nconnections: 12 # will spawn 12 connections instead of the defualt 4 #连接数
    \n5、重启thin(mongrel即可)

    \n\n

    以上步骤没有问题,我已经测试过了。

    \n\n

    下面附几个别人做的对比测试:
    \n
    \n测试环境如下:
    \n
    \n Rails 2.1  
    \n Thin 0.82  
    \n Ruby 1.8.6  
    \n MySQL 5.0  
    \n A special build of EventMachine 0.12  
    \n
    \n
    \n
    \n系统负载构造:
    \n
    \n 1 - Moderate work load,    one slow request for every 050 requests  
    \n 2 - Heavy work load,       one slow request for every 020 requests  
    \n 3 - Very heavy work load,  one slow request for every 010 requests
    \n
    \n
    \n
    \n结果如下:

    \n\n

    Rails Performance (Thin Vs.NeverBlock::Thin)

    \n\n\n

    NeverBlock::Thin scaling

    \n\n\n

    Memory Consumption (Thin Vs. NeverBlock::Thin)

    \n\n\n

     

    \n\n

    PS:刚刚发布的时候存在一个find_by_sql的bug,现在已经修复了。

    \n\n

    参考文档:

    \n\n

    http://www.espace.com.eg/neverblock/blog/2008/09/04/neverblock-instant-scaling-for-your-rails-apps/

    \n\n

    http://chinaonrails.com/topic/view/2123.html

    \n", "_id"=>918}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]2.2版本即将来临,新功能提前看(一)", "body"=>"前面一篇文章“Rails 2.1.1发布,包括众多更新”说到“Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本”,今天看到Ryan已经陆续的介绍Rails2.2中的新特性。\r\n1、Shallow Routes\r\n以前在routing里写嵌套的资源为:\r\n
    \r\n
    routing写法
    \r\n
      \r\n\t
    1. map.resources :users do |user|  
    2. \r\n\t
    3.   user.resources :articles do |article|  
    4. \r\n\t
    5.     article.resourcs :comments  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n将使得对articles和comments的引用只能是如下格式 /users/1/articles、/users/1/articles/1/comments这样的URL,如果想直接引用资源,就有问题了,在Rails2.2中奖引入一个新的特性shallow route option,可以增加这个功能,routing写法为:\r\n
    \r\n
    routing写法
    \r\n
      \r\n\t
    1. map.resources :users:shallpow => true do |user|  
    2. \r\n\t
    3.   user.resources :articles do |article|  
    4. \r\n\t
    5.     article.resourcs :comments  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n上面这个写法将保留以前的资源引用格式,同时增加如下的引用方法:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. articles_path #=> '/articles'    
    2. \r\n\t
    3. comments_path #=> '/comments'    
    4. \r\n\t
    5. article_comments_path(@article#=> '/articles/1/comments'    
    6. \r\n
    \r\n
    \r\n详细参考:What's New in Edge Rails: Shallow Routes\r\n\r\n2、Mailer Layouts\r\n在Rails2.2中将加入Mailer布局模板,就像view-template一样,每个mailer可以有一个模板,其默认的是mailer加上_mailer后缀,比如下面:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class UserMailer < ActionMailer::Base  
    2. \r\n\t
    3.   def registration(user)  
    4. \r\n\t
    5.     subject    \"You've registered\"  
    6. \r\n\t
    7.     from       \"system@example.com\"  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n将会自动匹配layouts/user_mailer.html.erb这个布局模板 。当然,你也可以自己手工指定其对应的模板,如下:\r\n
    \r\n
    手工指定模板
    \r\n
      \r\n\t
    1. class UserMailer < ActionMailer::Base  
    2. \r\n\t
    3.   layout 'email'  
    4. \r\n\t
    5.   ...  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n参考:What's New in Edge Rails: Mailer Layouts\r\n\r\n3、Connection Pools\r\n前面说过,在Rails2.2中将会实现线程安全,如此以来,连接池的实现也就不在话下了,在Rails2.2中将增加连接池的特性,使用方法非常简单,直接在database.yml配置即可,如下:\r\n
    \r\n
    database.yml
    \r\n
      \r\n\t
    1. development:  
    2. \r\n\t
    3.   adapter: mysql  
    4. \r\n\t
    5.   username: root  
    6. \r\n\t
    7.   database: myapp_dev  
    8. \r\n\t
    9.   pool: 10  
    10. \r\n
    \r\n
    \r\n这个特性将极大的提高Rails的性能,非常值得期待。另外,还记得前面我们介绍过的“NeverBlock到底有多快,对比测试说明问题 ”么,同样值得期待。更多特性还有待慢慢介绍。\r\n参考: What's New in Edge Rails: Connection Pools", "created_at"=>2008-09-08 01:49:49 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前面一篇文章“Rails 2.1.1发布,包括众多更新”说到“Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本”,今天看到Ryan已经陆续的介绍Rails2.2中的新特性。
    \n1、Shallow Routes
    \n以前在routing里写嵌套的资源为:
    \n
    \nrouting写法
    \n
    \n map.resources :users do |user|  
    \n   user.resources :articles do |article|  
    \n     article.resourcs :comments  
    \n   end  
    \n end  
    \n
    \n
    \n将使得对articles和comments的引用只能是如下格式 /users/1/articles、/users/1/articles/1/comments这样的URL,如果想直接引用资源,就有问题了,在Rails2.2中奖引入一个新的特性shallow route option,可以增加这个功能,routing写法为:
    \n
    \nrouting写法
    \n
    \n map.resources :users, :shallpow => true do |user|  
    \n   user.resources :articles do |article|  
    \n     article.resourcs :comments  
    \n   end  
    \n end  
    \n
    \n
    \n上面这个写法将保留以前的资源引用格式,同时增加如下的引用方法:
    \n
    \nRuby代码
    \n
    \n articles_path #=> '/articles'    
    \n comments_path #=> '/comments'    
    \n article_comments_path(@article) #=> '/articles/1/comments'    
    \n
    \n
    \n详细参考:What's New in Edge Rails: Shallow Routes

    \n\n

    2、Mailer Layouts
    \n在Rails2.2中将加入Mailer布局模板,就像view-template一样,每个mailer可以有一个模板,其默认的是mailer加上_mailer后缀,比如下面:
    \n
    \nRuby代码
    \n
    \n class UserMailer < ActionMailer::Base  
    \n   def registration(user)  
    \n     subject    "You've registered"  
    \n     from       "system@example.com"  
    \n   end  
    \n end  
    \n
    \n
    \n将会自动匹配layouts/user_mailer.html.erb这个布局模板 。当然,你也可以自己手工指定其对应的模板,如下:
    \n
    \n手工指定模板
    \n
    \n class UserMailer < ActionMailer::Base  
    \n   layout 'email'  
    \n   ...  
    \n end  
    \n
    \n
    \n参考:What's New in Edge Rails: Mailer Layouts

    \n\n

    3、Connection Pools
    \n前面说过,在Rails2.2中将会实现线程安全,如此以来,连接池的实现也就不在话下了,在Rails2.2中将增加连接池的特性,使用方法非常简单,直接在database.yml配置即可,如下:
    \n
    \ndatabase.yml
    \n
    \n development:  
    \n   adapter: mysql  
    \n   username: root  
    \n   database: myapp_dev  
    \n   pool: 10  
    \n
    \n
    \n这个特性将极大的提高Rails的性能,非常值得期待。另外,还记得前面我们介绍过的“NeverBlock到底有多快,对比测试说明问题 ”么,同样值得期待。更多特性还有待慢慢介绍。
    \n参考: What's New in Edge Rails: Connection Pools

    \n", "_id"=>919}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"雷击后网络异常分析和处理方法", "body"=>"不久前的一次打雷,把我们住的那里的网络设备全部干坏了,从猫、路由器、网卡,全部干坏了,记录如下,提醒大家以后小心。\r\n\r\n情景重现:\r\n我住的地方有两台电脑,通过一台无线路由,经猫用ADSL上网,一直以来都用的好好的,前不久搬家到7楼(以前住3楼),河隔壁合用一个ADSL,一共四台电脑(两个本本,两个台式机),本本通过无线连接,两个台式机通过有线连接到路由器,用的挺好。\r\n前不久的一个凌晨,深圳暴雨,被一个炸雷惊醒,很响!晚上下班发现网络无法连接,表现为:猫只有一个power灯亮;路由器的WAN和LAN都不亮,两台台式机均显示“网卡被拔出”的红叉叉。\r\n\r\n初步分析:\r\n1、猫的DSL灯不亮,说明信号没进来,看来猫坏了,联系电信的来换了个猫,DSL灯亮了,可以通过本本连接有线上网,猫的问题解除;\r\n2、接下来按照以前的方式走路由器,发现路由器的WAN还是不亮,然后本本有线到路由器上,无法上网,怀疑路由器挂了,幸好买了不久,拿回去换了一个,路由器问题解决;\r\n3、换了路由器后,本本有线连接可以使用,上网正常,但是突然发现两台台式机均无法连接到路由器,还是现实“网线被拔出”的红叉叉,电脑的网卡灯也不亮。\r\n\r\n深入分析:\r\n1、调换本本和台式机的网线,还是老样子,看来不是网线的问题;\r\n2、重装了台式机的网卡驱动,还是老样子,看来不是驱动的问题;\r\n3、两台台式机症状类似,看来是和打雷有关,google了一下,果然,很多人遇到过这样的问题(我还真是第一次遇到),貌似说打雷的时候出现电涌现象,导致网卡损坏。甚至有的会导致主板、显示器都坏掉。\r\n\r\n解决问题:\r\n1、先可以试试是否是主版屏蔽了网卡,在BIOS里面重新加载下板载网卡,是否可以;\r\n2、如果不行,就只能换网卡了,如果用PCI的,得在BIOS里面把板载网卡禁用掉;如果使用USB的,则可以直接使用。\r\n\r\n注意事项:\r\n1、打雷、闪电的时候关闭计算机,拔掉电源,拔掉ADSL线,关掉猫、路由器的电源;\r\n2、晚上睡前,拔掉ADSL,关闭计算机电源。", "created_at"=>2008-09-08 05:36:38 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    不久前的一次打雷,把我们住的那里的网络设备全部干坏了,从猫、路由器、网卡,全部干坏了,记录如下,提醒大家以后小心。
    \n
    \n情景重现:
    \n我住的地方有两台电脑,通过一台无线路由,经猫用ADSL上网,一直以来都用的好好的,前不久搬家到7楼(以前住3楼),河隔壁合用一个ADSL,一共四台电脑(两个本本,两个台式机),本本通过无线连接,两个台式机通过有线连接到路由器,用的挺好。
    \n前不久的一个凌晨,深圳暴雨,被一个炸雷惊醒,很响!晚上下班发现网络无法连接,表现为:猫只有一个power灯亮;路由器的WAN和LAN都不亮,两台台式机均显示“网卡被拔出”的红叉叉。

    \n\n

    初步分析:
    \n1、猫的DSL灯不亮,说明信号没进来,看来猫坏了,联系电信的来换了个猫,DSL灯亮了,可以通过本本连接有线上网,猫的问题解除;
    \n2、接下来按照以前的方式走路由器,发现路由器的WAN还是不亮,然后本本有线到路由器上,无法上网,怀疑路由器挂了,幸好买了不久,拿回去换了一个,路由器问题解决;
    \n3、换了路由器后,本本有线连接可以使用,上网正常,但是突然发现两台台式机均无法连接到路由器,还是现实“网线被拔出”的红叉叉,电脑的网卡灯也不亮。

    \n\n

    深入分析:
    \n1、调换本本和台式机的网线,还是老样子,看来不是网线的问题;
    \n2、重装了台式机的网卡驱动,还是老样子,看来不是驱动的问题;
    \n3、两台台式机症状类似,看来是和打雷有关,google了一下,果然,很多人遇到过这样的问题(我还真是第一次遇到),貌似说打雷的时候出现电涌现象,导致网卡损坏。甚至有的会导致主板、显示器都坏掉。

    \n\n

    解决问题:
    \n1、先可以试试是否是主版屏蔽了网卡,在BIOS里面重新加载下板载网卡,是否可以;
    \n2、如果不行,就只能换网卡了,如果用PCI的,得在BIOS里面把板载网卡禁用掉;如果使用USB的,则可以直接使用。

    \n\n

    注意事项:
    \n1、打雷、闪电的时候关闭计算机,拔掉电源,拔掉ADSL线,关掉猫、路由器的电源;
    \n2、晚上睡前,拔掉ADSL,关闭计算机电源。

    \n", "_id"=>920}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"使用gnuplot配合AB绘制性能测试结果图", "body"=>"Apache的AB可以用来做一些性能测试,使用-g参数其结果可以输出到文件,然后使用gnuplot可以绘制相关图片,以更直观的显示。\r\n
    \r\n
    ab -h
    \r\n
      \r\n\t
    1. $ ab -h  
    2. \r\n\t
    3. Usage: ab [options] [http://]hostname[:port]/path  
    4. \r\n\t
    5. Options are:  
    6. \r\n\t
    7.     -n requests     Number of requests to perform  
    8. \r\n\t
    9.     -c concurrency  Number of multiple requests to make  
    10. \r\n\t
    11.     -t timelimit    Seconds to max. wait for responses  
    12. \r\n\t
    13.     -p postfile     File containing data to POST  
    14. \r\n\t
    15.     -T content-type Content-type header for POSTing  
    16. \r\n\t
    17.     -v verbosity    How much troubleshooting info to print  
    18. \r\n\t
    19.     -w              Print out results in HTML tables  
    20. \r\n\t
    21.     -i              Use HEAD instead of GET  
    22. \r\n\t
    23.     -x attributes   String to insert as table attributes  
    24. \r\n\t
    25.     -y attributes   String to insert as tr attributes  
    26. \r\n\t
    27.     -z attributes   String to insert as td or th attributes  
    28. \r\n\t
    29.     -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)  
    30. \r\n\t
    31.     -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'  
    32. \r\n\t
    33.                     Inserted after all normal header lines. (repeatable)  
    34. \r\n\t
    35.     -A attribute    Add Basic WWW Authentication, the attributes  
    36. \r\n\t
    37.                     are a colon separated username and password.  
    38. \r\n\t
    39.     -P attribute    Add Basic Proxy Authentication, the attributes  
    40. \r\n\t
    41.                     are a colon separated username and password.  
    42. \r\n\t
    43.     -X proxy:port   Proxyserver and port number to use  
    44. \r\n\t
    45.     -V              Print version number and exit  
    46. \r\n\t
    47.     -k              Use HTTP KeepAlive feature  
    48. \r\n\t
    49.     -d              Do not show percentiles served table.  
    50. \r\n\t
    51.     -S              Do not show confidence estimators and warnings.  
    52. \r\n\t
    53.     -g filename     Output collected data to gnuplot format file.  
    54. \r\n\t
    55.     -e filename     Output CSV file with percentages served  
    56. \r\n\t
    57.     -h              Display usage information (this message)  
    58. \r\n
    \r\n
    \r\n \r\n
    $ab -g http_benchmark.txt -n 1000 -c 100 http://1stlog.1sters.com/
    \r\n
    \r\n
    \r\n
    http_benchmark.txt
    \r\n
      \r\n\t
    1. $ more http_benchmark.txt  
    2. \r\n\t
    3. starttime       seconds ctime   dtime   ttime   wait  
    4. \r\n\t
    5. Mon Sep 08 11:15:52 2008        1220843752427648        516     94524   95040   94521  
    6. \r\n\t
    7. Mon Sep 08 11:15:52 2008        1220843752944235        525     94500   95025   93995  
    8. \r\n\t
    9. Mon Sep 08 11:15:53 2008        1220843753469652        520     94491   95011   93475  
    10. \r\n\t
    11. Mon Sep 08 11:15:53 2008        1220843753990129        514     94478   94992   92960  
    12. \r\n\t
    13. Mon Sep 08 11:15:54 2008        1220843754505018        511     94471   94982   92449  
    14. \r\n\t
    15. Mon Sep 08 11:15:55 2008        1220843755016428        523     100439  100962  91925  
    16. \r\n
    \r\n
    \r\n
    \r\n
    \r\n``1sters@iceskysl:~> gnuplotset terminal pngset output \"http_benchmark.png\"set xlabel \"request\"set ylabel \"ms\"plot \"http_benchmark.txt\" using 7 with lines title \"ctime\", \\ \"http_benchmark.txt\" using 8 with lines title \"dtime\", \\ \"http_benchmark.txt\" using 9 with lines title \"ttime\", \\\"http_benchmark.txt\" using 10 with lines title \"wait\"\r\n\r\n结果类似:```\r\n\"\"\r\n
    参考文档:http://www.gnuplot.info/download.htmlhttp://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.htmlhttp://www.lotto-kim.net/eng/blog/using_gnuplot_to_show_results_from_ab```\r\n
    \r\n ", "created_at"=>2008-09-08 05:53:22 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Apache的AB可以用来做一些性能测试,使用-g参数其结果可以输出到文件,然后使用gnuplot可以绘制相关图片,以更直观的显示。
    \n
    \nab -h
    \n
    \n $ ab -h  
    \n Usage: ab [options] [http://]hostname[:port]/path  
    \n Options are:  
    \n     -n requests     Number of requests to perform  
    \n     -c concurrency  Number of multiple requests to make  
    \n     -t timelimit    Seconds to max. wait for responses  
    \n     -p postfile     File containing data to POST  
    \n     -T content-type Content-type header for POSTing  
    \n     -v verbosity    How much troubleshooting info to print  
    \n     -w              Print out results in HTML tables  
    \n     -i              Use HEAD instead of GET  
    \n     -x attributes   String to insert as table attributes  
    \n     -y attributes   String to insert as tr attributes  
    \n     -z attributes   String to insert as td or th attributes  
    \n     -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)  
    \n     -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'  
    \n                     Inserted after all normal header lines. (repeatable)  
    \n     -A attribute    Add Basic WWW Authentication, the attributes  
    \n                     are a colon separated username and password.  
    \n     -P attribute    Add Basic Proxy Authentication, the attributes  
    \n                     are a colon separated username and password.  
    \n     -X proxy:port   Proxyserver and port number to use  
    \n     -V              Print version number and exit  
    \n     -k              Use HTTP KeepAlive feature  
    \n     -d              Do not show percentiles served table.  
    \n     -S              Do not show confidence estimators and warnings.  
    \n     -g filename     Output collected data to gnuplot format file.  
    \n     -e filename     Output CSV file with percentages served  
    \n     -h              Display usage information (this message)  
    \n
    \n
    \n 
    \n$ab -g http_benchmark.txt -n 1000 -c 100 http://1stlog.1sters.com/
    \n
    \n
    \nhttp_benchmark.txt
    \n
    \n $ more http_benchmark.txt  
    \n starttime       seconds ctime   dtime   ttime   wait  
    \n Mon Sep 08 11:15:52 2008        1220843752427648        516     94524   95040   94521  
    \n Mon Sep 08 11:15:52 2008        1220843752944235        525     94500   95025   93995  
    \n Mon Sep 08 11:15:53 2008        1220843753469652        520     94491   95011   93475  
    \n Mon Sep 08 11:15:53 2008        1220843753990129        514     94478   94992   92960  
    \n Mon Sep 08 11:15:54 2008        1220843754505018        511     94471   94982   92449  
    \n Mon Sep 08 11:15:55 2008        1220843755016428        523     100439  100962  91925  
    \n
    \n
    \n
    \n
    \n``1sters@iceskysl:~> gnuplotset terminal pngset output "http_benchmark.png"set xlabel "request"set ylabel "ms"plot "http_benchmark.txt" using 7 with lines title "ctime", \\ "http_benchmark.txt" using 8 with lines title "dtime", \\ "http_benchmark.txt" using 9 with lines title "ttime", \\"http_benchmark.txt" using 10 with lines title "wait"

    \n\n

    结果类似:
    \n<img src="http://www.lotto-kim.net/var/ezwebin_site/storage/images/media/images/http_benchmark/1702-1-eng-GB/http_benchmark.png" alt="" />
    \n<pre id="nj1y"><strong>参考文档:</strong>http://www.gnuplot.info/download.htmlhttp://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.htmlhttp://www.lotto-kim.net/eng/blog/using_gnuplot_to_show_results_from_ab

    \n
    \n 

    \n", "_id"=>921}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞续篇,union查询显威力", "body"=>"6月份的时候写过一篇文章《Rails2.1之前的Injection漏洞:limit,offset过滤不严》,文章中说到“我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。幸好,Mysql默认的是不许一次API调用执行多条SQL”,当时说这个漏洞在MYSQL中无法利用,其实是错误的。\r\n\r\n虽然在mysql中部允许一次执行多条语句,但是我们是可以变相利用这个漏洞的,采取的方法就是构造union查询,爆出敏感信息。下面看例子:\r\n\r\n比如你的程序中写了这么一条语句:User.find(:all, :limit => params[:limit]),那么我们就可以构造这个params[:limit]为: \"1 UNION (select 1,2,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)\",这句话什么意思?放到前面那个find后,就形成这样的语句:\r\n
    \r\n
    SQL代码
    \r\n
      \r\n\t
    1. select * from users limit 1 UNION (select 1,username,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)  
    2. \r\n
    \r\n
    \r\n怎样?很邪恶吧,了解点安全的朋友都能看明白,不了解的我说半天还不如你去google下什么是union注射,呵呵。\r\n\r\n没升级到2.1.1的赶快升级或者按照如下方式修复吧,否则就有危险了。\r\n
      \r\n\t
    • Review your application whether you allow the user to control :limit or :offset
    • \r\n\t
    • If you are on Rails 2.1.0, please apply this patch or get Rails 2.1.1
    • \r\n\t
    • If you are on the Rails 2.0 or 1.2 branch, apply this backport patch
    • \r\n
    \r\n参考文档:http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter/", "created_at"=>2008-09-09 01:48:40 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    6月份的时候写过一篇文章《Rails2.1之前的Injection漏洞:limit,offset过滤不严》,文章中说到“我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。幸好,Mysql默认的是不许一次API调用执行多条SQL”,当时说这个漏洞在MYSQL中无法利用,其实是错误的。

    \n\n

    虽然在mysql中部允许一次执行多条语句,但是我们是可以变相利用这个漏洞的,采取的方法就是构造union查询,爆出敏感信息。下面看例子:

    \n\n

    比如你的程序中写了这么一条语句:User.find(:all, :limit => params[:limit]),那么我们就可以构造这个params[:limit]为: "1 UNION (select 1,2,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)",这句话什么意思?放到前面那个find后,就形成这样的语句:
    \n
    \nSQL代码
    \n
    \n select * from users limit 1 UNION (select 1,username,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)  
    \n
    \n
    \n怎样?很邪恶吧,了解点安全的朋友都能看明白,不了解的我说半天还不如你去google下什么是union注射,呵呵。

    \n\n

    没升级到2.1.1的赶快升级或者按照如下方式修复吧,否则就有危险了。
    \n
    \n Review your application whether you allow the user to control :limit or :offset
    \n If you are on Rails 2.1.0, please apply this patch or get Rails 2.1.1
    \n If you are on the Rails 2.0 or 1.2 branch, apply this backport patch
    \n
    \n参考文档:http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter/

    \n", "_id"=>922}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Tips]自动填充测试需要的随机数据", "body"=>"经常遇到一些新功能开发完了,需要测试一些指标,比如性能测试等等,这个时候如果人工填充数据会非常囧的,你可以写rake来自己构造填充数据,你需要处理随机产生等情况,现在不必费心了,使用Faker Gem和populator可以快速的构造需要的数据。\r\n\r\nFaker\r\nA port of Perl‘s Data::Faker library that generates fake data.\r\n\r\nPopulator\r\nPopulate an Active Record database with mass insert.\r\n\r\n安装需要的gem:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. gem install populator  
    2. \r\n\t
    3. gem install faker  
    4. \r\n\t
    5. rake db:populate  
    6. \r\n
    \r\n
    \r\n写rake代码:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # lib/tasks/populate.rake  
    2. \r\n\t
    3. namespace :db do  
    4. \r\n\t
    5.   desc \"Erase and fill database\"  
    6. \r\n\t
    7.   task :populate => :environment do  
    8. \r\n\t
    9.     require 'populator'  
    10. \r\n\t
    11.     require 'faker'  
    12. \r\n\t
    13.       
    14. \r\n\t
    15.     [Category, Product, Person].each(&:delete_all)  
    16. \r\n\t
    17.       
    18. \r\n\t
    19.     Category.populate 20 do |category|  
    20. \r\n\t
    21.       category.name = Populator.words(1..3).titleize  
    22. \r\n\t
    23.       Product.populate 10..100 do |product|  
    24. \r\n\t
    25.         product.category_id = category.id  
    26. \r\n\t
    27.         product.name = Populator.words(1..5).titleize  
    28. \r\n\t
    29.         product.description = Populator.sentences(2..10)  
    30. \r\n\t
    31.         product.price = [4.99, 19.95, 100]  
    32. \r\n\t
    33.         product.created_at = 2.years.ago..Time.now  
    34. \r\n\t
    35.       end  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39.       
    40. \r\n\t
    41.     Person.populate 100 do |person|  
    42. \r\n\t
    43.       person.name    = Faker::Name.name  
    44. \r\n\t
    45.       person.company = Faker::Company.name  
    46. \r\n\t
    47.       person.email   = Faker::Internet.email  
    48. \r\n\t
    49.       person.phone   = Faker::PhoneNumber.phone_number  
    50. \r\n\t
    51.       person.street  = Faker::Address.street_address  
    52. \r\n\t
    53.       person.city    = Faker::Address.city  
    54. \r\n\t
    55.       person.state   = Faker::Address.us_state_abbr  
    56. \r\n\t
    57.       person.zip     = Faker::Address.zip_code  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.   end  
    62. \r\n\t
    63. end  
    64. \r\n
    \r\n
    \r\n参考:\r\n\r\nhttp://github.com/ryanb/populator/tree/master\r\n\r\nhttp://faker.rubyforge.org/rdoc/\r\n\r\nhttp://railscasts.com/episodes/126-populating-a-database", "created_at"=>2008-09-09 02:25:49 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    经常遇到一些新功能开发完了,需要测试一些指标,比如性能测试等等,这个时候如果人工填充数据会非常囧的,你可以写rake来自己构造填充数据,你需要处理随机产生等情况,现在不必费心了,使用Faker Gem和populator可以快速的构造需要的数据。

    \n\n

    Faker
    \nA port of Perl‘s Data::Faker library that generates fake data.

    \n\n

    Populator
    \nPopulate an Active Record database with mass insert.

    \n\n

    安装需要的gem:
    \n
    \nRuby代码
    \n
    \n gem install populator  
    \n gem install faker  
    \n rake db:populate  
    \n
    \n
    \n写rake代码:
    \n
    \nRuby代码
    \n
    \n # lib/tasks/populate.rake  
    \n namespace :db do  
    \n   desc "Erase and fill database"  
    \n   task :populate => :environment do  
    \n     require 'populator'  
    \n     require 'faker'  
    \n       
    \n     [Category, Product, Person].each(&:delete_all)  
    \n       
    \n     Category.populate 20 do |category|  
    \n       category.name = Populator.words(1..3).titleize  
    \n       Product.populate 10..100 do |product|  
    \n         product.category_id = category.id  
    \n         product.name = Populator.words(1..5).titleize  
    \n         product.description = Populator.sentences(2..10)  
    \n         product.price = [4.99, 19.95, 100]  
    \n         product.created_at = 2.years.ago..Time.now  
    \n       end  
    \n     end  
    \n       
    \n     Person.populate 100 do |person|  
    \n       person.name    = Faker::Name.name  
    \n       person.company = Faker::Company.name  
    \n       person.email   = Faker::Internet.email  
    \n       person.phone   = Faker::PhoneNumber.phone_number  
    \n       person.street  = Faker::Address.street_address  
    \n       person.city    = Faker::Address.city  
    \n       person.state   = Faker::Address.us_state_abbr  
    \n       person.zip     = Faker::Address.zip_code  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n参考:

    \n\n

    http://github.com/ryanb/populator/tree/master

    \n\n

    http://faker.rubyforge.org/rdoc/

    \n\n

    http://railscasts.com/episodes/126-populating-a-database

    \n", "_id"=>923}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"网站安全开发手册 让每个程序员都提高安全意识", "body"=>"大家看我的个人介绍是“不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…”,我职业是程序员,业余时间会关注一些安全方面的东西,给一本安全杂志编辑一个新漏洞挖掘和分析的栏目,我一直想能通过自己的对安全的理解和对程序员的接触把安全意识带给程序员,写出更安全的系统。\r\n\r\n也一直想策划一本书,把时下里常见的漏洞,漏洞的原因和分析,原理等等,用实际的例子讲解出来,站在程序员的角度来讲述这些漏洞的危害和防范,只是一直没找到空闲时间,也就一直搁浅。\r\n\r\n今天看到动易的开发人员写了一本《网站系统安全开发手册》,大概的浏览了一遍,其共有十三大项,30个小项,主要介绍了输入验证、输出编码、SQL注入、跨站脚本攻击、跨站请求伪造、越权操作、IO操作安全、缓存泄漏、系统加密、信息批漏、日志和监测、Web.config的安全配置等方面的内容,并列明具体的防御手段和方法,从而为网站安全开发人员提供了一本极具实操性的工具书。\r\n\r\n内容不算多,介绍的漏洞也都是时下常见的,有心成为安全的程序员的朋友可以下载看看,会有帮助的。我会仔细阅读,并继续策划我心目中的那本安全开发手册。\r\n\r\n网站系统安全开发手册提供在线下载:http://download.csdn.net/source/599604", "created_at"=>2008-09-09 02:38:51 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    大家看我的个人介绍是“不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…”,我职业是程序员,业余时间会关注一些安全方面的东西,给一本安全杂志编辑一个新漏洞挖掘和分析的栏目,我一直想能通过自己的对安全的理解和对程序员的接触把安全意识带给程序员,写出更安全的系统。

    \n\n

    也一直想策划一本书,把时下里常见的漏洞,漏洞的原因和分析,原理等等,用实际的例子讲解出来,站在程序员的角度来讲述这些漏洞的危害和防范,只是一直没找到空闲时间,也就一直搁浅。

    \n\n

    今天看到动易的开发人员写了一本《网站系统安全开发手册》,大概的浏览了一遍,其共有十三大项,30个小项,主要介绍了输入验证、输出编码、SQL注入、跨站脚本攻击、跨站请求伪造、越权操作、IO操作安全、缓存泄漏、系统加密、信息批漏、日志和监测、Web.config的安全配置等方面的内容,并列明具体的防御手段和方法,从而为网站安全开发人员提供了一本极具实操性的工具书。

    \n\n

    内容不算多,介绍的漏洞也都是时下常见的,有心成为安全的程序员的朋友可以下载看看,会有帮助的。我会仔细阅读,并继续策划我心目中的那本安全开发手册。

    \n\n

    网站系统安全开发手册提供在线下载:http://download.csdn.net/source/599604

    \n", "_id"=>924}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调整ubuntu下的netbeans 6.1为英文界面", "body"=>"在Ubuntu下使用netbeans还是挺不错的,但是最近升级后发现界面变成中文的了,还有些小方块的乱码。乱码很早前遇到过,忘记以前是咋处理了,临时找了下,如下处理可以:\r\n\r\n把/usr/share/fonts/truetype/arphic/下的文件copy一份到$JAVE_HOME/jre/lib/fonts/fallback/下即可。\r\n\r\n但是显示的中文真的不好看,也没有找到调的地方,加上其翻译的实在别扭,害得我老找不到菜单,于是找了个办法把界面又换成英文的,win下貌似可以直接修改etc/netbeans.conf中netbeans_default_options,在其后面添加 --locale en_US即可,但是ubuntu下配置文件不一样,在etc下配置看不明白,于是在的快捷启动方式后面加上 --locale en_US就好了。\r\n\r\n看着英文界面,真亲切呀。\r\n\r\n其他类似的解决:\r\n\r\nhttp://www.javaeye.com/post/518296\r\n\r\nhttp://rednaxelafx.javaeye.com/blog/202287", "created_at"=>2008-09-09 15:41:19 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在Ubuntu下使用netbeans还是挺不错的,但是最近升级后发现界面变成中文的了,还有些小方块的乱码。乱码很早前遇到过,忘记以前是咋处理了,临时找了下,如下处理可以:

    \n\n

    把/usr/share/fonts/truetype/arphic/下的文件copy一份到$JAVE_HOME/jre/lib/fonts/fallback/下即可。

    \n\n

    但是显示的中文真的不好看,也没有找到调的地方,加上其翻译的实在别扭,害得我老找不到菜单,于是找了个办法把界面又换成英文的,win下貌似可以直接修改etc/netbeans.conf中netbeans_default_options,在其后面添加 --locale en_US即可,但是ubuntu下配置文件不一样,在etc下配置看不明白,于是在的快捷启动方式后面加上 --locale en_US就好了。

    \n\n

    看着英文界面,真亲切呀。

    \n\n

    其他类似的解决:

    \n\n

    http://www.javaeye.com/post/518296

    \n\n

    http://rednaxelafx.javaeye.com/blog/202287

    \n", "_id"=>925}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Wicd: Ubuntu8.04终于用上无线了", "body"=>"用了这么久的ubuntu,前几天买了个无线路由,在windows下可以连接无线网络,但是在ubuntu下的那个Network-Manager里一直连不上,看那个无线的指示灯是橙色,以为是驱动不对呢。今天看到“Wicd - 一款非常出色的无线管理器”,发现Wicd比较强大,立马卸掉了Network-Manager(否则安装会提示有冲突),然后下载了deb的下来,安装下就可以使用了(我的是Ubuntu8.04+xfce)。\r\n\"\"\r\n立即探测出我的无线,输入密码,连接,拔掉网线,ping了下google,终于OK。\r\n\r\n参考:\r\nhttp://blog.istef.info/2007/08/19/wicd/\r\nhttp://linuxtoy.org/archives/wicd.html\r\nhttp://wicd.sourceforge.net/", "created_at"=>2008-09-09 15:59:14 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    用了这么久的ubuntu,前几天买了个无线路由,在windows下可以连接无线网络,但是在ubuntu下的那个Network-Manager里一直连不上,看那个无线的指示灯是橙色,以为是驱动不对呢。今天看到“Wicd - 一款非常出色的无线管理器”,发现Wicd比较强大,立马卸掉了Network-Manager(否则安装会提示有冲突),然后下载了deb的下来,安装下就可以使用了(我的是Ubuntu8.04+xfce)。
    \n
    \n立即探测出我的无线,输入密码,连接,拔掉网线,ping了下google,终于OK。
    \n
    \n参考:
    \nhttp://blog.istef.info/2007/08/19/wicd/
    \nhttp://linuxtoy.org/archives/wicd.html
    \nhttp://wicd.sourceforge.net/

    \n", "_id"=>926}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Rails部署:Nginx+Haproxy+Thin", "body"=>"Nginx和Thin以前都介绍过,这里主要介绍下Haproxy的安装以及配合使用。\r\n\r\n1、下载\r\nwget  http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.3.tar.gz\r\n\r\n2、编译安装\r\nsudo aptitude install libpcre++-dev\r\ntar -zxvf haproxy-1.3.15.3.tar.gz\r\ncd haproxy-1.3.15.3\r\nsudo make TARGET=linux26 CPU=i386 USE_STATIC_PCRE=2\r\nsudo make install\r\ninstall -d /usr/local/sbin\r\ninstall haproxy /usr/local/sbin\r\ninstall -d /usr/local/man/man1\r\ninstall -m 644 doc/haproxy.1 /usr/local/man/man1\r\ninstall -d /usr/local/doc/haproxy\r\nfor x in configuration architecture haproxy-en haproxy-fr; do \\\r\ninstall -m 644 doc/$x.txt /usr/local/doc/haproxy ; \\\r\ndone\r\n\r\n3、配置文件\r\n1)Haproxy配置(/opt/devroot/itechtag/haproxy.conf)\r\n
    \r\n
    Haproxy配置
    \r\n
      \r\n\t
    1. global  
    2. \r\n\t
    3.   daemon  
    4. \r\n\t
    5.   maxconn       4096      # total max connections (dependent on ulimit)  
    6. \r\n\t
    7.   nbproc        2         # number of processing cores  
    8. \r\n\t
    9.    
    10. \r\n\t
    11. defaults  
    12. \r\n\t
    13.   mode              http  
    14. \r\n\t
    15.   clitimeout        60000       # maximum inactivity time on the client side  
    16. \r\n\t
    17.   srvtimeout        30000       # maximum inactivity time on the server side  
    18. \r\n\t
    19.   timeout connect   4000        # maximum time to wait for a connection attempt to a server to succeed  
    20. \r\n\t
    21.    
    22. \r\n\t
    23.   option            httpclose     # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)  
    24. \r\n\t
    25.   option            abortonclose  # enable early dropping of aborted requests from pending queue  
    26. \r\n\t
    27.   option            httpchk       # enable HTTP protocol to check on servers health  
    28. \r\n\t
    29.   option            forwardfor    # enable insert of X-Forwarded-For headers  
    30. \r\n\t
    31.    
    32. \r\n\t
    33.    
    34. \r\n\t
    35.   balance roundrobin            # each server is used in turns, according to assigned weight  
    36. \r\n\t
    37.    
    38. \r\n\t
    39.   stats enable                  # enable web-stats at /haproxy?stats  
    40. \r\n\t
    41.   stats auth        admin:pass  # force HTTP Auth to view stats  
    42. \r\n\t
    43.   stats refresh     5s        # refresh rate of stats page  
    44. \r\n\t
    45.    
    46. \r\n\t
    47. listen rails_proxy 127.0.0.1:8100  
    48. \r\n\t
    49.   # - equal weights on all servers  
    50. \r\n\t
    51.   # - maxconn will queue requests at HAProxy if limit is reached  
    52. \r\n\t
    53.   # - minconn dynamically scales the connection concurrency (bound my maxconn) depending on size of HAProxy queue  
    54. \r\n\t
    55.   # - check health every 20000 microseconds  
    56. \r\n\t
    57.    
    58. \r\n\t
    59.   server web1 127.0.0.1:8000 weight 1 minconn 3 maxconn 6 check inter 20000  
    60. \r\n\t
    61.    
    62. \r\n\t
    63. listen slow_proxy 127.0.0.1:8200  
    64. \r\n\t
    65.   # cluster for slow requests, lower the queues, check less frequently  
    66. \r\n\t
    67.   server web1 127.0.0.1:8000 weight 3 minconn 30 maxconn 300 check inter 20000  
    68. \r\n\t
    69.   server slow1 127.0.0.1:8001 weight 1 minconn 10 maxconn 300 check inter 40000  
    70. \r\n\t
    71.   server slow2 127.0.0.1:8002 weight 1 minconn 1 maxconn 300 check inter 40000  
    72. \r\n\t
    73.   server slow3 127.0.0.1:8003 weight 1 minconn 1 maxconn 300 check inter 40000  
    74. \r\n
    \r\n
    \r\n2)Nginx配置\r\n
    \r\n
    Nginx配置
    \r\n
      \r\n\t
    1. # File generated on 25 May 08  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. #upstream name has to be unique so add on the port number  
    6. \r\n\t
    7. #generate multiple mongrels  
    8. \r\n\t
    9. upstream thin_9000{  
    10. \r\n\t
    11.     server 127.0.0.1:8200;  
    12. \r\n\t
    13.     }  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. server {  
    18. \r\n\t
    19.             listen   80;  
    20. \r\n\t
    21.             server_name localhost;  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.             access_log /opt/devroot/itechtag/log/access.log;  
    26. \r\n\t
    27.             error_log  /opt/devroot/itechtag/log/error.log;  
    28. \r\n\t
    29.   
    30. \r\n\t
    31.             root   /opt/devroot/itechtag/public/;  
    32. \r\n\t
    33.             index  index.html;  
    34. \r\n\t
    35.              
    36. \r\n\t
    37.             location / {  
    38. \r\n\t
    39.                    proxy_set_header  X-Real-IP  $remote_addr;  
    40. \r\n\t
    41.                    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;  
    42. \r\n\t
    43.                    proxy_set_header Host $http_host;  
    44. \r\n\t
    45.                    proxy_redirect false;  
    46. \r\n\t
    47.   
    48. \r\n\t
    49.                    if (-f $request_filename/index.html) {  
    50. \r\n\t
    51.                                            rewrite (.*) $1/index.html break;  
    52. \r\n\t
    53.                           }  
    54. \r\n\t
    55.                           if (-f $request_filename.html) {  
    56. \r\n\t
    57.                                            rewrite (.*) $1.html break;  
    58. \r\n\t
    59.                           }  
    60. \r\n\t
    61.   
    62. \r\n\t
    63.                           if (!-f $request_filename) {  
    64. \r\n\t
    65.                                            proxy_pass http://thin_9000;  
    66. \r\n\t
    67.                                            break;  
    68. \r\n\t
    69.                           }  
    70. \r\n\t
    71.             }  
    72. \r\n\t
    73.   
    74. \r\n\t
    75. }  
    76. \r\n
    \r\n
    \r\n3)thin配置\r\n
    \r\n
    thin配置
    \r\n
      \r\n\t
    1. ---  
    2. \r\n\t
    3. pid: tmp/pids/thin.pid  
    4. \r\n\t
    5. log: log/thin.log  
    6. \r\n\t
    7. port: 8000  
    8. \r\n\t
    9. max_conns: 1024  
    10. \r\n\t
    11. timeout: 30  
    12. \r\n\t
    13. chdir: /opt/devroot/itechtag  
    14. \r\n\t
    15. max_persistent_conns: 512  
    16. \r\n\t
    17. environment: production  
    18. \r\n\t
    19. address: 0.0.0.0  
    20. \r\n\t
    21. servers: 4  
    22. \r\n\t
    23. daemonize: true  
    24. \r\n
    \r\n
    \r\n4、启动\r\nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -p pidfils.oid\r\n\r\n5、停止\r\nkill  $(cat /home/source/haproxy-1.3.15.3/examples/pidfils.oid)\r\n\r\n6、刷新\r\nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -sf $(cat /opt/devroot/itechtag/pidfils.oid)\r\n\r\n7、监控\r\nhttp://127.0.0.1:8200/haproxy?stats\r\n\"\"\r\n8、测试\r\nab -n 2000 -c 200 http://127.0.0.1/\r\n\r\n附录:Haproxy帮助信息\r\niceskysl@IceskYsl:/home/source/haproxy-1.3.15.3$ haproxy\r\nHA-Proxy version 1.3.15.3 2008/09/02\r\nCopyright 2000-2008 Willy Tarreau <w@1wt.eu>\r\n\r\nUsage : haproxy -f <cfgfile> [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]\r\n[ -p <pidfile> ] [ -m <max megs> ]\r\n-v displays version ; -vv shows known build options.\r\n-d enters debug mode ; -db only disables background mode.\r\n-V enters verbose mode (disables quiet mode)\r\n-D goes daemon ; implies -q\r\n-q quiet mode : don't display messages\r\n-c check mode : only check config file and exit\r\n-n sets the maximum total # of connections (2000)\r\n-m limits the usable amount of memory (in MB)\r\n-N sets the default, per-proxy maximum # of connections (2000)\r\n-p writes pids of all children to this file\r\n-de disables epoll() usage even when available\r\n-ds disables speculative epoll() usage even when available\r\n-dp disables poll() usage even when available\r\n-sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.\r\n\r\n参考资料:\r\nhttp://codesnippets.joyent.com/tag/ubuntu", "created_at"=>2008-09-12 01:18:35 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Nginx和Thin以前都介绍过,这里主要介绍下Haproxy的安装以及配合使用。

    \n\n

    1、下载
    \nwget  http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.3.tar.gz

    \n\n

    2、编译安装
    \nsudo aptitude install libpcre++-dev
    \ntar -zxvf haproxy-1.3.15.3.tar.gz
    \ncd haproxy-1.3.15.3
    \nsudo make TARGET=linux26 CPU=i386 USE_STATIC_PCRE=2
    \nsudo make install
    \ninstall -d /usr/local/sbin
    \ninstall haproxy /usr/local/sbin
    \ninstall -d /usr/local/man/man1
    \ninstall -m 644 doc/haproxy.1 /usr/local/man/man1
    \ninstall -d /usr/local/doc/haproxy
    \nfor x in configuration architecture haproxy-en haproxy-fr; do \\
    \ninstall -m 644 doc/$x.txt /usr/local/doc/haproxy ; \\
    \ndone

    \n\n

    3、配置文件
    \n1)Haproxy配置(/opt/devroot/itechtag/haproxy.conf)
    \n
    \nHaproxy配置
    \n
    \n global  
    \n   daemon  
    \n   maxconn       4096      # total max connections (dependent on ulimit)  
    \n   nbproc        2         # number of processing cores  
    \n    
    \n defaults  
    \n   mode              http  
    \n   clitimeout        60000       # maximum inactivity time on the client side  
    \n   srvtimeout        30000       # maximum inactivity time on the server side  
    \n   timeout connect   4000        # maximum time to wait for a connection attempt to a server to succeed  
    \n    
    \n   option            httpclose     # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)  
    \n   option            abortonclose  # enable early dropping of aborted requests from pending queue  
    \n   option            httpchk       # enable HTTP protocol to check on servers health  
    \n   option            forwardfor    # enable insert of X-Forwarded-For headers  
    \n    
    \n    
    \n   balance roundrobin            # each server is used in turns, according to assigned weight  
    \n    
    \n   stats enable                  # enable web-stats at /haproxy?stats  
    \n   stats auth        admin:pass  # force HTTP Auth to view stats  
    \n   stats refresh     5s        # refresh rate of stats page  
    \n    
    \n listen rails_proxy 127.0.0.1:8100  
    \n   # - equal weights on all servers  
    \n   # - maxconn will queue requests at HAProxy if limit is reached  
    \n   # - minconn dynamically scales the connection concurrency (bound my maxconn) depending on size of HAProxy queue  
    \n   # - check health every 20000 microseconds  
    \n    
    \n   server web1 127.0.0.1:8000 weight 1 minconn 3 maxconn 6 check inter 20000  
    \n    
    \n listen slow_proxy 127.0.0.1:8200  
    \n   # cluster for slow requests, lower the queues, check less frequently  
    \n   server web1 127.0.0.1:8000 weight 3 minconn 30 maxconn 300 check inter 20000  
    \n   server slow1 127.0.0.1:8001 weight 1 minconn 10 maxconn 300 check inter 40000  
    \n   server slow2 127.0.0.1:8002 weight 1 minconn 1 maxconn 300 check inter 40000  
    \n   server slow3 127.0.0.1:8003 weight 1 minconn 1 maxconn 300 check inter 40000  
    \n
    \n
    \n2)Nginx配置
    \n
    \nNginx配置
    \n
    \n # File generated on 25 May 08  
    \n   
    \n #upstream name has to be unique so add on the port number  
    \n #generate multiple mongrels  
    \n upstream thin_9000{  
    \n     server 127.0.0.1:8200;  
    \n     }  
    \n   
    \n server {  
    \n             listen   80;  
    \n             server_name localhost;  
    \n   
    \n             access_log /opt/devroot/itechtag/log/access.log;  
    \n             error_log  /opt/devroot/itechtag/log/error.log;  
    \n   
    \n             root   /opt/devroot/itechtag/public/;  
    \n             index  index.html;  
    \n              
    \n             location / {  
    \n                    proxy_set_header  X-Real-IP  $remote_addr;  
    \n                    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;  
    \n                    proxy_set_header Host $http_host;  
    \n                    proxy_redirect false;  
    \n   
    \n                    if (-f $request_filename/index.html) {  
    \n                                            rewrite (.) $1/index.html break;  
    \n                           }  
    \n                           if (-f $request_filename.html) {  
    \n                                            rewrite (.
    ) $1.html break;  
    \n                           }  
    \n   
    \n                           if (!-f $request_filename) {  
    \n                                            proxy_pass http://thin_9000;  
    \n                                            break;  
    \n                           }  
    \n             }  
    \n   
    \n }  
    \n
    \n
    \n3)thin配置
    \n
    \nthin配置
    \n
    \n ---  
    \n pid: tmp/pids/thin.pid  
    \n log: log/thin.log  
    \n port: 8000  
    \n max_conns: 1024  
    \n timeout: 30  
    \n chdir: /opt/devroot/itechtag  
    \n max_persistent_conns: 512  
    \n environment: production  
    \n address: 0.0.0.0  
    \n servers: 4  
    \n daemonize: true  
    \n
    \n
    \n4、启动
    \nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -p pidfils.oid

    \n\n

    5、停止
    \nkill  $(cat /home/source/haproxy-1.3.15.3/examples/pidfils.oid)

    \n\n

    6、刷新
    \nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -sf $(cat /opt/devroot/itechtag/pidfils.oid)

    \n\n

    7、监控
    \nhttp://127.0.0.1:8200/haproxy?stats
    \n
    \n8、测试
    \nab -n 2000 -c 200 http://127.0.0.1/

    \n\n

    附录:Haproxy帮助信息
    \niceskysl@IceskYsl:/home/source/haproxy-1.3.15.3$ haproxy
    \nHA-Proxy version 1.3.15.3 2008/09/02
    \nCopyright 2000-2008 Willy Tarreau <w@1wt.eu>

    \n\n

    Usage : haproxy -f <cfgfile> [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
    \n[ -p <pidfile> ] [ -m <max megs> ]
    \n-v displays version ; -vv shows known build options.
    \n-d enters debug mode ; -db only disables background mode.
    \n-V enters verbose mode (disables quiet mode)
    \n-D goes daemon ; implies -q
    \n-q quiet mode : don't display messages
    \n-c check mode : only check config file and exit
    \n-n sets the maximum total # of connections (2000)
    \n-m limits the usable amount of memory (in MB)
    \n-N sets the default, per-proxy maximum # of connections (2000)
    \n-p writes pids of all children to this file
    \n-de disables epoll() usage even when available
    \n-ds disables speculative epoll() usage even when available
    \n-dp disables poll() usage even when available
    \n-sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.

    \n\n

    参考资料:
    \nhttp://codesnippets.joyent.com/tag/ubuntu

    \n", "_id"=>927}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"LibFetion: Ubuntu下的飞信", "body"=>"自从用了一段时间的blackberry后,其他都用的不习惯了,更不习惯在上面发短信,于是需要经常开下fetion一些短信,Ubuntu下没有正式的fetion的客户端,今天看到一个叫做LibFetion,试了下,很不错。\r\n
    LibFetion是由邓东东主持开发的飞信应用程序开发库,其大部分代码使用C编写,支持所有POSIX兼容的操作系统。\r\n\r\nLibFetion封装飞信通信协议和功能处理逻辑,给开发者提供简洁、丰富的API接口。使用LibFetion的开发者只需专注于GUI(图形用户界面)的设计开发,就能轻易开发出飞信客户端,能大大提高飞信客户端的开发速度和降低开发难度。 凭借LibFetion的跨平台性,使得飞信在多个操作系统平台上运行,达到“fetion anywhere“。\r\n\r\nLibFetion是针对嵌入式设备系统设计的,它只使用了C库,提供平台线程库接口(缺省使用posix线程库)和网络接口(缺省使用socket)因此具有较强的可移植性。目前 LibFetion已在Linux,Mac OS X,Windows,ucLinux,Ecos操作系统上成功运行。\r\n\r\n如今基于LibFetion开发的PC客户端程序LibFx已经发布 V0.8.1版了,点击下载点击这里更换客户端皮肤资源
    \r\n安装记录如下:\r\niceskysl@IceskYsl:/home/source$ sudo dpkg -i linux_fetion_v0.8.1_8.04_i386.deb\r\n[sudo] password for iceskysl:\r\n选中了曾被取消选择的软件包 linuxfetion。\r\n(正在读取数据库 ... 系统当前总共安装有 207059 个文件和目录。)\r\n正在解压缩 linuxfetion (从 linux_fetion_v0.8.1_8.04_i386.deb) ...\r\n正在设置 linuxfetion (0.8.1) ...\r\niceskysl@IceskYsl:/home/source$", "created_at"=>2008-09-14 16:55:36 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    自从用了一段时间的blackberry后,其他都用的不习惯了,更不习惯在上面发短信,于是需要经常开下fetion一些短信,Ubuntu下没有正式的fetion的客户端,今天看到一个叫做LibFetion,试了下,很不错。
    \nLibFetion是由邓东东主持开发的飞信应用程序开发库,其大部分代码使用C编写,支持所有POSIX兼容的操作系统。

    \n\n

    LibFetion封装飞信通信协议和功能处理逻辑,给开发者提供简洁、丰富的API接口。使用LibFetion的开发者只需专注于GUI(图形用户界面)的设计开发,就能轻易开发出飞信客户端,能大大提高飞信客户端的开发速度和降低开发难度。 凭借LibFetion的跨平台性,使得飞信在多个操作系统平台上运行,达到“fetion anywhere“。

    \n\n

    LibFetion是针对嵌入式设备系统设计的,它只使用了C库,提供平台线程库接口(缺省使用posix线程库)和网络接口(缺省使用socket)因此具有较强的可移植性。目前 LibFetion已在Linux,Mac OS X,Windows,ucLinux,Ecos操作系统上成功运行。

    \n\n

    如今基于LibFetion开发的PC客户端程序LibFx已经发布 V0.8.1版了,点击下载。点击这里更换客户端皮肤资源。
    \n安装记录如下:
    \niceskysl@IceskYsl:/home/source$ sudo dpkg -i linux_fetion_v0.8.1_8.04_i386.deb
    \n[sudo] password for iceskysl:
    \n选中了曾被取消选择的软件包 linuxfetion。
    \n(正在读取数据库 ... 系统当前总共安装有 207059 个文件和目录。)
    \n正在解压缩 linuxfetion (从 linux_fetion_v0.8.1_8.04_i386.deb) ...
    \n正在设置 linuxfetion (0.8.1) ...
    \niceskysl@IceskYsl:/home/source$

    \n", "_id"=>928}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails应用系统的监控规划", "body"=>"每个系统都得有相应的监控措施,你总不想每天都呆在电脑旁,时刻的去刷新页面、检测系统状态,服务器状态,业务状态吧;你总不想天天扛着电脑,时刻准备着上去重启死掉的进程等待吧。\r\n我们需要一套完备的监控措施,针对熟悉的Rails系统,可以把监控划分为如下几个方面的:\r\n1、关键进程监控\r\n该类监控配置监控关键的进程,比如app server的进程,数据库进程等等,配置后可以自动监视相关进程,当某个情况发生时(比如内存耗尽等),自动重启进程,以保证系统正常运行。在Rails应用中,可以做这个事情的有monit,God等。\r\n2、服务器资源监控\r\n该类监控系统的资源使用情况,比如内存或者CPU使用率等等,当出现一些情况的时候(比如内存消耗超过90%,CPU消耗100%等)发出告警信息(Email告警,SMS告警等),可以做这个事情的有很多,比如siteview,Scout等。\r\n3、应用异常告警\r\n当出现500等应用内部异常的时候,发出告警,并附带相关的堆栈信息,以便以开发人员迅速定位问题,解决问题,可以做这个事情的有Exception Notification plugin.等。\r\n\r\n除了这些外,我想还可以做的事一些监控统计信息,比如可以写脚本统计nginx的连接数,Haproxy的统计等。\r\n\r\n参考:\r\nhttp://blog.scoutapp.com/articles/2008/09/09/rails-monitoring-pillars", "created_at"=>2008-09-16 03:53:51 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    每个系统都得有相应的监控措施,你总不想每天都呆在电脑旁,时刻的去刷新页面、检测系统状态,服务器状态,业务状态吧;你总不想天天扛着电脑,时刻准备着上去重启死掉的进程等待吧。
    \n我们需要一套完备的监控措施,针对熟悉的Rails系统,可以把监控划分为如下几个方面的:
    \n1、关键进程监控
    \n该类监控配置监控关键的进程,比如app server的进程,数据库进程等等,配置后可以自动监视相关进程,当某个情况发生时(比如内存耗尽等),自动重启进程,以保证系统正常运行。在Rails应用中,可以做这个事情的有monit,God等。
    \n2、服务器资源监控
    \n该类监控系统的资源使用情况,比如内存或者CPU使用率等等,当出现一些情况的时候(比如内存消耗超过90%,CPU消耗100%等)发出告警信息(Email告警,SMS告警等),可以做这个事情的有很多,比如siteview,Scout等。
    \n3、应用异常告警
    \n当出现500等应用内部异常的时候,发出告警,并附带相关的堆栈信息,以便以开发人员迅速定位问题,解决问题,可以做这个事情的有Exception Notification plugin.等。

    \n\n

    除了这些外,我想还可以做的事一些监控统计信息,比如可以写脚本统计nginx的连接数,Haproxy的统计等。

    \n\n

    参考:
    \nhttp://blog.scoutapp.com/articles/2008/09/09/rails-monitoring-pillars

    \n", "_id"=>929}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"今年我还在期待的两个东西,G1&MacBook", "body"=>"眼看着2008年就要过去了,忙忙碌碌的一年,总的给自己一些奖励,今年剩余时间内还在等待的两个东西,分别如下:\r\n\r\n1、Google手机HTC G1\r\n\r\n自从用了一段时间blackberry以后,再也用不习惯其他的传统手机,但是又被第一个夭折的黑莓搞得后怕,一直没有入手新的,本来打算前几天去买BB8110的,无奈懒得跑路,又耽搁了。看中G1的网络功能,因为我的手机多半是用来上网,看文档,处理mail等等,加上习惯了Google的很多在线服务,我认为G1会把Google的很多服务集成进去的,所以就一直等待。\r\n\r\n\"\"\r\n\r\n有报道说美国运营商T-Mobile将会在今天(9月17日)面向消费者预售这款Google手机,然后会在9月23日在美国纽约正式发布上市。\r\n\r\n值得担心的有两点:不要像iphone一样,被阻挡在门外;不要太贵。\r\n\r\n2、新版的MacBook\r\n\r\n我只是半个mac迷,我买MB是为了更快捷的工作,虽然用了Ubuntu一年多,也还觉得挺满意,但是追求更加高效的工作环境是我梦寐以求的,新版的MB应该会更加轻薄和环保,价格应该不会贵的离谱,可能会比以前的MB更便宜。\r\n\r\n\"\"\r\n\r\n有报道称新一代 MacBook 采用超薄铝制外壳、LED 背光显示屏,并且价格是极具冲击力的“入门级价格”。且在10.14号发布,看看表,时间也没多少了。", "created_at"=>2008-09-17 06:29:50 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    眼看着2008年就要过去了,忙忙碌碌的一年,总的给自己一些奖励,今年剩余时间内还在等待的两个东西,分别如下:

    \n\n

    1、Google手机HTC G1

    \n\n

    自从用了一段时间blackberry以后,再也用不习惯其他的传统手机,但是又被第一个夭折的黑莓搞得后怕,一直没有入手新的,本来打算前几天去买BB8110的,无奈懒得跑路,又耽搁了。看中G1的网络功能,因为我的手机多半是用来上网,看文档,处理mail等等,加上习惯了Google的很多在线服务,我认为G1会把Google的很多服务集成进去的,所以就一直等待。

    \n\n\n

    有报道说美国运营商T-Mobile将会在今天(9月17日)面向消费者预售这款Google手机,然后会在9月23日在美国纽约正式发布上市。

    \n\n

    值得担心的有两点:不要像iphone一样,被阻挡在门外;不要太贵。

    \n\n

    2、新版的MacBook

    \n\n

    我只是半个mac迷,我买MB是为了更快捷的工作,虽然用了Ubuntu一年多,也还觉得挺满意,但是追求更加高效的工作环境是我梦寐以求的,新版的MB应该会更加轻薄和环保,价格应该不会贵的离谱,可能会比以前的MB更便宜。

    \n\n\n

    有报道称新一代 MacBook 采用超薄铝制外壳、LED 背光显示屏,并且价格是极具冲击力的“入门级价格”。且在10.14号发布,看看表,时间也没多少了。

    \n", "_id"=>930}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成SMS功能", "body"=>"大家对于在Rails系统中发送Email或者IM消息都比较熟悉了,接下来还有一个比较有趣的就是直接发送SMS(短信),也就是接收页面上输入的接收者的手机号码和需要发送的消息,以SMS或者WAP的方式发送到用户手机是。\r\n\r\n实现这个功能一般来会所有两个思路,其一是使用ruby-sms这样的类操作移动设备(比如说手机)和网关交互,发送消息。这类一般比较复杂;还有一类是直接调用现成的SMS网关API,按照其API的格式传递参数即可。\r\n\r\n现在这里主要说的是第二类的实现,要实现这个方式的SMS发送,需要找到一家类似的服务商,比如台湾的TWSMS(http://www.twsms.com),然后根据其API或者form格式就可以发送SMS了,这里举两个例子。一个是一个台湾的朋友写的twsms;另外一个是一个老外写的clickatell。其各自的使用方法都很简单,如下\r\n\r\ntwsms:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'twsms'  
    2. \r\n\t
    3. sms = TWSMS.new(\"username\"\"password\")  
    4. \r\n\t
    5. sms.sendSMS(mobile, message)  
    6. \r\n\t
    7. sms.querySMS  
    8. \r\n\t
    9. sms.setMessageId(msgid)  
    10. \r\n\t
    11. sms.querySMS  
    12. \r\n
    \r\n
    \r\nclicktell:\r\n
    \r\n
    ActiveRecord代码
    \r\n
      \r\n\t
    1. require 'clickatell'  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. class SMS  
    6. \r\n\t
    7.   def initialize(config)  
    8. \r\n\t
    9.     @config = config  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13.   
    14. \r\n\t
    15.   def create(recipient, message_text)  
    16. \r\n\t
    17.     api.send_message(recipient, message_text)  
    18. \r\n\t
    19.   end  
    20. \r\n\t
    21.   
    22. \r\n\t
    23.   private  
    24. \r\n\t
    25.     def api  
    26. \r\n\t
    27.       @api ||= Clickatell::API.authenticate(  
    28. \r\n\t
    29.         @config[:api_key],  
    30. \r\n\t
    31.         @config[:username],  
    32. \r\n\t
    33.         @config[:password]  
    34. \r\n\t
    35.       )  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39. end  
    40. \r\n
    \r\n
    \r\n
    \r\n
    YML代码
    \r\n
      \r\n\t
    1. # config/clickatell.yml  
    2. \r\n\t
    3. api_key: abcdefghi123  
    4. \r\n\t
    5. username: joebloggs  
    6. \r\n\t
    7. password: secret  
    8. \r\n
    \r\n
    \r\n
    \r\n
    加载配置文件
    \r\n
      \r\n\t
    1. # config/environments/production.rb  
    2. \r\n\t
    3. CLICKATELL_CONFIG = YAML.load(File.open(File.join(RAILS_ROOT, 'config''clickatell.yml')))  
    4. \r\n
    \r\n
    \r\n
    \r\n
    Routing配置
    \r\n
      \r\n\t
    1. ActionController::Routing::Routes.draw do |map|  
    2. \r\n\t
    3.   map.resource :sms  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n
    \r\n
    app/views/sms/new.rhtml
    \r\n
      \r\n\t
    1. <% form_tag '/sms', :method => :post do -%>  
    2. \r\n\t
    3.   <label>Enter the recipients mobile number:</label>  
    4. \r\n\t
    5.   <%= text_field_tag \"recipient\" %>  
    6. \r\n\t
    7.   <label>Enter your message:</label>  
    8. \r\n\t
    9.   <%= text_area_tag \"message_text\" %>  
    10. \r\n\t
    11.   <%= submit_tag \"Send SMS\" %>  
    12. \r\n\t
    13. <% end %>  
    14. \r\n
    \r\n
    \r\n
    \r\n
    Controller代码
    \r\n
      \r\n\t
    1. class SmsController < ApplicationController  
    2. \r\n\t
    3.   def create  
    4. \r\n\t
    5.     sms = SMS.new(CLICKATELL_CONFIG)  
    6. \r\n\t
    7.     sms.create(params[:recipient], params[:message_text])  
    8. \r\n\t
    9.     flash[:notice] = \"Message sent succesfully!\"   
    10. \r\n\t
    11.     redirect_to :back  
    12. \r\n\t
    13.   rescue Clickatell::API::Error => e  
    14. \r\n\t
    15.     flash[:error] = \"Clickatell API error: \#{e.message}\"   
    16. \r\n\t
    17.     redirect_to :back  
    18. \r\n\t
    19.   end  
    20. \r\n\t
    21. end  
    22. \r\n
    \r\n
    \r\n如上说的都是TW或者其他地方的SMS网关的实现,在国内我貌似没看到有类似的服务的,谁看到过,和我说一下哈。\r\n\r\n参考文档:\r\n\r\nhttp://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application\r\n\r\nhttp://clickatell.rubyforge.org/\r\n\r\nhttp://code.google.com/p/twsms/\r\n\r\n\r\n ", "created_at"=>2008-09-18 08:04:15 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    大家对于在Rails系统中发送Email或者IM消息都比较熟悉了,接下来还有一个比较有趣的就是直接发送SMS(短信),也就是接收页面上输入的接收者的手机号码和需要发送的消息,以SMS或者WAP的方式发送到用户手机是。

    \n\n

    实现这个功能一般来会所有两个思路,其一是使用ruby-sms这样的类操作移动设备(比如说手机)和网关交互,发送消息。这类一般比较复杂;还有一类是直接调用现成的SMS网关API,按照其API的格式传递参数即可。

    \n\n

    现在这里主要说的是第二类的实现,要实现这个方式的SMS发送,需要找到一家类似的服务商,比如台湾的TWSMS(http://www.twsms.com),然后根据其API或者form格式就可以发送SMS了,这里举两个例子。一个是一个台湾的朋友写的twsms;另外一个是一个老外写的clickatell。其各自的使用方法都很简单,如下

    \n\n

    twsms:
    \n
    \nRuby代码
    \n
    \n require 'twsms'  
    \n sms = TWSMS.new("username", "password")  
    \n sms.sendSMS(mobile, message)  
    \n sms.querySMS  
    \n sms.setMessageId(msgid)  
    \n sms.querySMS  
    \n
    \n
    \nclicktell:
    \n
    \nActiveRecord代码
    \n
    \n require 'clickatell'  
    \n   
    \n class SMS  
    \n   def initialize(config)  
    \n     @config = config  
    \n   end  
    \n   
    \n   def create(recipient, message_text)  
    \n     api.send_message(recipient, message_text)  
    \n   end  
    \n   
    \n   private  
    \n     def api  
    \n       @api ||= Clickatell::API.authenticate(  
    \n         @config[:api_key],  
    \n         @config[:username],  
    \n         @config[:password]  
    \n       )  
    \n     end  
    \n end  
    \n
    \n
    \n
    \nYML代码
    \n
    \n # config/clickatell.yml  
    \n api_key: abcdefghi123  
    \n username: joebloggs  
    \n password: secret  
    \n
    \n
    \n
    \n加载配置文件
    \n
    \n # config/environments/production.rb  
    \n CLICKATELL_CONFIG = YAML.load(File.open(File.join(RAILS_ROOT, 'config', 'clickatell.yml')))  
    \n
    \n
    \n
    \nRouting配置
    \n
    \n ActionController::Routing::Routes.draw do |map|  
    \n   map.resource :sms  
    \n end  
    \n
    \n
    \n
    \napp/views/sms/new.rhtml
    \n
    \n <% form_tag '/sms', :method => :post do -%>  
    \n   <label>Enter the recipients mobile number:</label>  
    \n   <%= text_field_tag "recipient" %>  
    \n   <label>Enter your message:</label>  
    \n   <%= text_area_tag "message_text" %>  
    \n   <%= submit_tag "Send SMS" %>  
    \n <% end %>  
    \n
    \n
    \n
    \nController代码
    \n
    \n class SmsController < ApplicationController  
    \n   def create  
    \n     sms = SMS.new(CLICKATELL_CONFIG)  
    \n     sms.create(params[:recipient], params[:message_text])  
    \n     flash[:notice] = "Message sent succesfully!"   
    \n     redirect_to :back  
    \n   rescue Clickatell::API::Error => e  
    \n     flash[:error] = "Clickatell API error: \#{e.message}"   
    \n     redirect_to :back  
    \n   end  
    \n end  
    \n
    \n
    \n如上说的都是TW或者其他地方的SMS网关的实现,在国内我貌似没看到有类似的服务的,谁看到过,和我说一下哈。

    \n\n

    参考文档:

    \n\n

    http://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application

    \n\n

    http://clickatell.rubyforge.org/

    \n\n

    http://code.google.com/p/twsms/

    \n\n

     

    \n", "_id"=>931}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>932}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完成,有问题请反馈", "body"=>"经常来我BLog的同学可能发现了,最近老是发生 500错误,其原因是DH对资源限制的非常死,又有很多莫名其妙的进程占资源,非常不爽的说,今天下午务正好不想干啥,就在另外一个VPS上装了下PHP的环境,把这个blog迁移过来了。\r\n\r\n考虑到压力其实并不是很大,也为了能省点资源,于是使用的是PHP+nginx来跑PHP的,由于之前都是使用apache跑PHP的,今天还真绕了个小圈子,呵呵。。\r\n\r\n不过还好,也没多大会就把环境搭建好了,再把blog程序打包wget过去,再连原库做次备份,然后把备份的SQL导入到本地DB里面,再修改下连接DB的配置文件,非常省事。\r\n\r\n最后把域名指向改下,再nginx里面添加一个配置来服务这个系统。", "created_at"=>2008-09-21 09:17:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    经常来我BLog的同学可能发现了,最近老是发生 500错误,其原因是DH对资源限制的非常死,又有很多莫名其妙的进程占资源,非常不爽的说,今天下午务正好不想干啥,就在另外一个VPS上装了下PHP的环境,把这个blog迁移过来了。

    \n\n

    考虑到压力其实并不是很大,也为了能省点资源,于是使用的是PHP+nginx来跑PHP的,由于之前都是使用apache跑PHP的,今天还真绕了个小圈子,呵呵。。

    \n\n

    不过还好,也没多大会就把环境搭建好了,再把blog程序打包wget过去,再连原库做次备份,然后把备份的SQL导入到本地DB里面,再修改下连接DB的配置文件,非常省事。

    \n\n

    最后把域名指向改下,再nginx里面添加一个配置来服务这个系统。

    \n", "_id"=>933}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Google Android(T-Mobile版)即将揭开神秘面纱", "body"=>"很早前我就说自我的blackberry8100跌坏以后,就一直没买手机,一直在正Google Android的发布,昨天早上(22号)看到chinaeconomicreview上的“T-Mobile’s Google phone on its way”,按照那个里面的图片,觉得非常不爽,整就一黑莓的造型嘛。于是打算入手黑莓8110.\r\n\r\n\"\"\r\n\r\n熬夜到现在,发现假消息满天飞,sohu上放出一篇试用报告“Google Android手机试用报告网上现身(组图)”,消息肯定是假的,但是希望能切中一些功能吧。\r\n\r\n\"\"\r\n\r\n睡一觉,天亮就可以揭晓最终的答案了,如何接近前面一张图,就不等了,直接入手黑莓8110,如果接近后者,我还会动心的。", "created_at"=>2008-09-22 17:33:41 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    很早前我就说自我的blackberry8100跌坏以后,就一直没买手机,一直在正Google Android的发布,昨天早上(22号)看到chinaeconomicreview上的“T-Mobile’s Google phone on its way”,按照那个里面的图片,觉得非常不爽,整就一黑莓的造型嘛。于是打算入手黑莓8110.

    \n\n\n

    熬夜到现在,发现假消息满天飞,sohu上放出一篇试用报告“Google Android手机试用报告网上现身(组图)”,消息肯定是假的,但是希望能切中一些功能吧。

    \n\n\n

    睡一觉,天亮就可以揭晓最终的答案了,如何接近前面一张图,就不等了,直接入手黑莓8110,如果接近后者,我还会动心的。

    \n", "_id"=>934}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"FrontCompiler: 写出更优雅的CSS代码", "body"=>"对于Rails开发者来说,总觉得一大堆的CSS代码非常碍眼,写起来也不是很优雅,有没有更优雅的方法,毫无疑问,是有的。\r\n\r\n先看一段正常的CSS代码:\r\n
    \r\n
    CSS代码
    \r\n
      \r\n\t
    1. div.article div.title {  
    2. \r\n\t
    3.   font-weightbold;  
    4. \r\n\t
    5. }  
    6. \r\n\t
    7. div.article div.title a.author {  
    8. \r\n\t
    9.   padding-left12px;  
    10. \r\n\t
    11.   backgroundurl('user.png'no-repeat left;  
    12. \r\n\t
    13. }  
    14. \r\n\t
    15. div.article div.text {  
    16. \r\n\t
    17.   border1px solid #EEE;  
    18. \r\n\t
    19.   background#FEF;  
    20. \r\n\t
    21. }  
    22. \r\n
    \r\n
    \r\n再看一段有那么点不一样的代码:\r\n
    \r\n
    CSS代码
    \r\n
      \r\n\t
    1. div.article {  
    2. \r\n\t
    3.   div.title {  
    4. \r\n\t
    5.     font-weightbold;  
    6. \r\n\t
    7.       
    8. \r\n\t
    9.     a.author {  
    10. \r\n\t
    11.       padding-left12px;  
    12. \r\n\t
    13.       backgroundurl('user.png'no-repeat left;  
    14. \r\n\t
    15.     }  
    16. \r\n\t
    17.   }  
    18. \r\n\t
    19.   div.text {  
    20. \r\n\t
    21.     border1px solid #EEE;  
    22. \r\n\t
    23.     background#FEF;  
    24. \r\n\t
    25.   }  
    26. \r\n\t
    27. }  
    28. \r\n
    \r\n
    \r\n有啥不一样了么?是否有点发懵呢,呵呵,下面这个写法更清晰和优雅,不是么!但是这样写的话,我们的浏览器是不认识的,怎么办,可以采用第三方的类库来转换即可。现在看到的可以做这个事情的有FrontCompilercss_dryer,除了这个功能外,还有其他的功能,例如FrontCompiler还可以合并多个JS/CSS文件,代码如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. @c = FrontCompiler.new  
    2. \r\n\t
    3. @library_code = @c.compact_files(%w{  
    4. \r\n\t
    5.   src/lib.js  
    6. \r\n\t
    7.   src/lib/something.js  
    8. \r\n\t
    9.   src/lib/another.js  
    10. \r\n\t
    11. })  
    12. \r\n
    \r\n
    \r\n其他的功能请参考其各自的主页。\r\n\r\nhttp://st-on-it.blogspot.com/2008/09/nested-styles-with-ruby-and.html\r\n\r\nhttp://github.com/MadRabbit/frontcompiler/tree/master\r\n\r\nhttp://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css", "created_at"=>2008-09-23 06:27:24 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    对于Rails开发者来说,总觉得一大堆的CSS代码非常碍眼,写起来也不是很优雅,有没有更优雅的方法,毫无疑问,是有的。

    \n\n

    先看一段正常的CSS代码:
    \n
    \nCSS代码
    \n
    \n div.article div.title {  
    \n   font-weight: bold;  
    \n }  
    \n div.article div.title a.author {  
    \n   padding-left: 12px;  
    \n   background: url('user.png') no-repeat left;  
    \n }  
    \n div.article div.text {  
    \n   border: 1px solid #EEE;  
    \n   background: #FEF;  
    \n }  
    \n
    \n
    \n再看一段有那么点不一样的代码:
    \n
    \nCSS代码
    \n
    \n div.article {  
    \n   div.title {  
    \n     font-weight: bold;  
    \n       
    \n     a.author {  
    \n       padding-left: 12px;  
    \n       background: url('user.png') no-repeat left;  
    \n     }  
    \n   }  
    \n   div.text {  
    \n     border: 1px solid #EEE;  
    \n     background: #FEF;  
    \n   }  
    \n }  
    \n
    \n
    \n有啥不一样了么?是否有点发懵呢,呵呵,下面这个写法更清晰和优雅,不是么!但是这样写的话,我们的浏览器是不认识的,怎么办,可以采用第三方的类库来转换即可。现在看到的可以做这个事情的有FrontCompiler和css_dryer,除了这个功能外,还有其他的功能,例如FrontCompiler还可以合并多个JS/CSS文件,代码如下:
    \n
    \nRuby代码
    \n
    \n @c = FrontCompiler.new  
    \n @library_code = @c.compact_files(%w{  
    \n   src/lib.js  
    \n   src/lib/something.js  
    \n   src/lib/another.js  
    \n })  
    \n
    \n
    \n其他的功能请参考其各自的主页。

    \n\n

    http://st-on-it.blogspot.com/2008/09/nested-styles-with-ruby-and.html

    \n\n

    http://github.com/MadRabbit/frontcompiler/tree/master

    \n\n

    http://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css

    \n", "_id"=>935}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"YOBO: 周杰伦《魔杰座》首播《稻香》--附歌词", "body"=>"今天YOBO又一次让我惊喜了一次,晚上突然看到周杰伦的08新专辑《魔杰座》中的主打歌《稻香》发布出来了,于是赶紧在Yobo发帖分享,发完后,发现已经有人上传了上去。实在是大惊喜呀。\r\n\r\n下面嵌入yobo的音乐小精灵,把这首歌曲分享给大家:\r\n\r\n \r\n\r\n\r\n\r\n\"\"\r\n\r\n歌词如下:\r\n\r\n「稻 香」\r\n作词:周杰伦 作曲:周杰伦\r\n\r\n对这个世界如果你有太多的抱怨\r\n跌倒了就不敢继续往前走\r\n为什么人要这么的脆弱 堕落\r\n请你打开电视看看\r\n多少人为生命在努力勇敢的走下去\r\n我们是不是该知足\r\n珍惜一切 就算没有拥有\r\n\r\n还记得你说家是唯一的城堡 随着稻香河流继续奔跑\r\n微微笑 小时候的梦我知道\r\n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠\r\n回家吧 回到最初的美好\r\n\r\n不要这么容易就想放弃 就像我说的\r\n追不到的梦想 换个梦不就得了\r\n为自己的人生鲜艳上色 先把爱涂上喜欢的颜色\r\n笑一个吧 功成名就不是目的\r\n让自己快乐快乐这才叫做意义\r\n童年的纸飞机 现在终于飞回我手里\r\n\r\n所谓的那快乐 赤脚在田里追蜻蜓追到累了\r\n偷摘水果被蜜蜂给叮到怕了 谁在偷笑呢\r\n我靠着稻草人吹着风唱着歌睡着了\r\n哦 哦 午后吉它在虫鸣中更清脆\r\n哦 哦 阳光洒在路上就不怕心碎\r\n珍惜一切 就算没有拥有\r\n\r\n还记得你说家是唯一的城堡 随着稻香河流继续奔跑\r\n微微笑 小时候的梦我知道\r\n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠\r\n回家吧 回到最初的美好", "created_at"=>2008-09-23 14:29:30 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    今天YOBO又一次让我惊喜了一次,晚上突然看到周杰伦的08新专辑《魔杰座》中的主打歌《稻香》发布出来了,于是赶紧在Yobo发帖分享,发完后,发现已经有人上传了上去。实在是大惊喜呀。

    \n\n

    下面嵌入yobo的音乐小精灵,把这首歌曲分享给大家:

    \n\n

     

    \n\n\n\n

    歌词如下:

    \n\n

    「稻 香」
    \n作词:周杰伦 作曲:周杰伦

    \n\n

    对这个世界如果你有太多的抱怨
    \n跌倒了就不敢继续往前走
    \n为什么人要这么的脆弱 堕落
    \n请你打开电视看看
    \n多少人为生命在努力勇敢的走下去
    \n我们是不是该知足
    \n珍惜一切 就算没有拥有

    \n\n

    还记得你说家是唯一的城堡 随着稻香河流继续奔跑
    \n微微笑 小时候的梦我知道
    \n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠
    \n回家吧 回到最初的美好

    \n\n

    不要这么容易就想放弃 就像我说的
    \n追不到的梦想 换个梦不就得了
    \n为自己的人生鲜艳上色 先把爱涂上喜欢的颜色
    \n笑一个吧 功成名就不是目的
    \n让自己快乐快乐这才叫做意义
    \n童年的纸飞机 现在终于飞回我手里

    \n\n

    所谓的那快乐 赤脚在田里追蜻蜓追到累了
    \n偷摘水果被蜜蜂给叮到怕了 谁在偷笑呢
    \n我靠着稻草人吹着风唱着歌睡着了
    \n哦 哦 午后吉它在虫鸣中更清脆
    \n哦 哦 阳光洒在路上就不怕心碎
    \n珍惜一切 就算没有拥有

    \n\n

    还记得你说家是唯一的城堡 随着稻香河流继续奔跑
    \n微微笑 小时候的梦我知道
    \n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠
    \n回家吧 回到最初的美好

    \n", "_id"=>936}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Android G1: 我有一次被震撼了", "body"=>"很早前我就说,我今年还在等的2个东西是G1和新版本macbook,虽然G1尚未发布,但是对G1的期待还是很大的,尤其是用了这么多的Google应用(Doc,Gmail,日历,reader,Gtalk,picasa,chrome等),我自然希望能有一部可以随时带着身边的互联网手机。\r\n\r\niphone虽好,但是毕竟Mac的东西还是让人有点点。。。G的东西更加草根化,从G1的这次发布会就可以感受得到,该有的功能全部都有,晚上看不到视频,只能看apple4.us在twitter上的直播。\r\n\r\n看个图片吧:\r\n\r\n\"\"\r\n\r\n该有的功能都有,没有的还可以自己写,自己下,都是免费的,这个很牛,超过iphone不是不可能。可以看看月光写的对比文章http://www.williamlong.info/archives/1508.html\r\n\r\n唯一比较郁闷的是,何时才能在中国看到,按照发布会的说法,T-mobile签2年的价格是179美刀,换成RMB也就1200多点,但是鉴于中国移动的\"围墙“政策,不晓得正式渠道猴年马月才能进来呀,真是悲哀。\r\n\r\nPS:Reacoo说的twhirl这个twitter的客户端确实不赖,看来AIR也修成正果了。", "created_at"=>2008-09-23 15:28:37 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    很早前我就说,我今年还在等的2个东西是G1和新版本macbook,虽然G1尚未发布,但是对G1的期待还是很大的,尤其是用了这么多的Google应用(Doc,Gmail,日历,reader,Gtalk,picasa,chrome等),我自然希望能有一部可以随时带着身边的互联网手机。

    \n\n

    iphone虽好,但是毕竟Mac的东西还是让人有点点。。。G的东西更加草根化,从G1的这次发布会就可以感受得到,该有的功能全部都有,晚上看不到视频,只能看apple4.us在twitter上的直播。

    \n\n

    看个图片吧:

    \n\n\n

    该有的功能都有,没有的还可以自己写,自己下,都是免费的,这个很牛,超过iphone不是不可能。可以看看月光写的对比文章http://www.williamlong.info/archives/1508.html

    \n\n

    唯一比较郁闷的是,何时才能在中国看到,按照发布会的说法,T-mobile签2年的价格是179美刀,换成RMB也就1200多点,但是鉴于中国移动的"围墙“政策,不晓得正式渠道猴年马月才能进来呀,真是悲哀。

    \n\n

    PS:Reacoo说的twhirl这个twitter的客户端确实不赖,看来AIR也修成正果了。

    \n", "_id"=>937}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android下开发初探,写个网络音乐播放器", "body"=>"很早前就对Android感兴趣了,那时看了点API,觉得比较麻烦,就没深入下去,直到昨天发布G1,才突然觉得这个Android还真强大,翻了下他的API,真牛,今天花了一天时间,把其code上的API和文档大概都过了一遍,虽然还有些具体的不会做,但是整个架构流程和布局模式都很清楚了。\r\n\r\n\"\"\r\n\r\n采用Eclipse导入几个demo看了下,结合文档,非常直观(google的文档和help写的非常到位),晚上就试着自己写个小东西,因为最近对网络音乐比较感兴趣,于是就试着写了一个网络音乐播放器。\r\n\r\nUI就不看了,看段代码\r\n\r\n \r\n
    \r\n
    Java/Android代码
    \r\n
      \r\n\t
    1. private MediaPlayer mMediaPlayer;  
    2. \r\n\t
    3. Uri uri = Uri.parse(\"http://www.jjyyjy.com/wj/he.mp3\");  
    4. \r\n\t
    5. mMediaPlayer = MediaPlayer.create(this, uri);  
    6. \r\n\t
    7. mMediaPlayer.start();  
    8. \r\n
    \r\n
    \r\n然后导入模拟器,可以很顺利的听到歌曲,还很简陋,有时间的话,我会继续开发这个应用。\r\n\r\n ", "created_at"=>2008-09-24 17:30:33 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    很早前就对Android感兴趣了,那时看了点API,觉得比较麻烦,就没深入下去,直到昨天发布G1,才突然觉得这个Android还真强大,翻了下他的API,真牛,今天花了一天时间,把其code上的API和文档大概都过了一遍,虽然还有些具体的不会做,但是整个架构流程和布局模式都很清楚了。

    \n\n\n

    采用Eclipse导入几个demo看了下,结合文档,非常直观(google的文档和help写的非常到位),晚上就试着自己写个小东西,因为最近对网络音乐比较感兴趣,于是就试着写了一个网络音乐播放器。

    \n\n

    UI就不看了,看段代码

    \n\n

     
    \n
    \nJava/Android代码
    \n
    \n private MediaPlayer mMediaPlayer;  
    \n Uri uri = Uri.parse("http://www.jjyyjy.com/wj/he.mp3");  
    \n mMediaPlayer = MediaPlayer.create(this, uri);  
    \n mMediaPlayer.start();  
    \n
    \n
    \n然后导入模拟器,可以很顺利的听到歌曲,还很简陋,有时间的话,我会继续开发这个应用。

    \n\n

     

    \n", "_id"=>938}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"自由行: 阳朔,我来了", "body"=>"都说阳朔是深圳的后花园,我来深圳两年多了,还没去后花园转过,估计在深圳呆不了不久了,再不去又没机会了,匆匆忙忙的梳理了下,准备出发了。\r\n\r\n不想背电脑,手机也坏了,背个包,去散散心吧,都说本命年会多有坎坷,以前还真不信,现在有些相信了,呵呵,没啥大事,散散心就好了。\r\n\r\n没有行程安排,没有工作,没人任务,背包走到哪里是哪里,舒服就找个店住下来,不舒服,去去就回。\r\n\r\n ", "created_at"=>2008-09-27 12:05:09 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    都说阳朔是深圳的后花园,我来深圳两年多了,还没去后花园转过,估计在深圳呆不了不久了,再不去又没机会了,匆匆忙忙的梳理了下,准备出发了。

    \n\n

    不想背电脑,手机也坏了,背个包,去散散心吧,都说本命年会多有坎坷,以前还真不信,现在有些相信了,呵呵,没啥大事,散散心就好了。

    \n\n

    没有行程安排,没有工作,没人任务,背包走到哪里是哪里,舒服就找个店住下来,不舒服,去去就回。

    \n\n

     

    \n", "_id"=>939}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"序列化数据的速度对比: Marshal vs. JSON vs. Eval vs. YAML .ZAML", "body"=>"有的时候,需要序列化一些数据,这个时候,我们可以选择的很多,比如Ruby常用的YAML,以及一些不常用的EVAL等,有人针对其Serializing的速度做了对比测试,结果显示如下:\r\n
    \r\n
    对比结果
    \r\n
      \r\n\t
    1. user system total real  
    2. \r\n\t
    3. array marshal 0.210000 0.010000 0.220000 ( 0.220701)  
    4. \r\n\t
    5. array json 2.180000 0.050000 2.230000 ( 2.288489)  
    6. \r\n\t
    7. array eval 2.090000 0.060000 2.150000 ( 2.240443)  
    8. \r\n\t
    9. array yaml 26.650000 0.350000 27.000000 ( 27.810609)  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. hash marshal 2.000000 0.050000 2.050000 ( 2.114950)  
    14. \r\n\t
    15. hash json 3.700000 0.060000 3.760000 ( 3.881716)  
    16. \r\n\t
    17. hash eval 5.370000 0.140000 5.510000 ( 6.117947)  
    18. \r\n\t
    19. hash yaml 68.220000 0.870000 69.090000 ( 72.370784)  
    20. \r\n
    \r\n
    \r\n毫无疑问,Marshal 是最快的,YAML不是一般的慢。\r\n\r\n但是看到有人写了zaml,其描述为”Fast yaml serialization for Ruby“,号称可以”YAML.dump, 1600% faster“,感兴趣的可以看看。\r\n\r\n参考文档:\r\nhttp://github.com/hallettj/zaml/tree/master\r\nhttp://chinaonrails.com/topic/view/2091.html\r\nhttp://gnomecoder.wordpress.com/2008/09/27/yaml-dump-1600-percent-faster/\r\nhttp://www.pauldix.net/2008/08/serializing-dat.html", "created_at"=>2008-10-05 12:47:54 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    有的时候,需要序列化一些数据,这个时候,我们可以选择的很多,比如Ruby常用的YAML,以及一些不常用的EVAL等,有人针对其Serializing的速度做了对比测试,结果显示如下:
    \n
    \n对比结果
    \n
    \n user system total real  
    \n array marshal 0.210000 0.010000 0.220000 ( 0.220701)  
    \n array json 2.180000 0.050000 2.230000 ( 2.288489)  
    \n array eval 2.090000 0.060000 2.150000 ( 2.240443)  
    \n array yaml 26.650000 0.350000 27.000000 ( 27.810609)  
    \n   
    \n hash marshal 2.000000 0.050000 2.050000 ( 2.114950)  
    \n hash json 3.700000 0.060000 3.760000 ( 3.881716)  
    \n hash eval 5.370000 0.140000 5.510000 ( 6.117947)  
    \n hash yaml 68.220000 0.870000 69.090000 ( 72.370784)  
    \n
    \n
    \n毫无疑问,Marshal 是最快的,YAML不是一般的慢。

    \n\n

    但是看到有人写了zaml,其描述为”Fast yaml serialization for Ruby“,号称可以”YAML.dump, 1600% faster“,感兴趣的可以看看。

    \n\n

    参考文档:
    \nhttp://github.com/hallettj/zaml/tree/master
    \nhttp://chinaonrails.com/topic/view/2091.html
    \nhttp://gnomecoder.wordpress.com/2008/09/27/yaml-dump-1600-percent-faster/
    \nhttp://www.pauldix.net/2008/08/serializing-dat.html

    \n", "_id"=>940}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"采用Ruby提取MP3的metadata信息", "body"=>"昨天有幸认识了terry,看到其blog上有篇文章”消费者对音乐内容Metadata的需求“,其中写到”音乐Metadata是所有数字音乐服务的根基,它的完备性也将直接影响服务的可扩展性。“,最基础也是应用最普遍的是”2.音乐目录元数据,例如歌曲名、专辑名、词曲作者等直接描述音乐作品的信息。这些信息通常会直接体现在各种数字音乐服务上。“。其给出一份消费者对metadata需求的调查研究,如下:\r\n\"\"\r\n今天突然来了兴趣,分析一首歌曲,找到其对应的metadata信息,经过资料查找和分析,目前已经基本完成,主要是读取MP3文件的ID3信息(ID3v1,ID3v1.1以及ID3v2),ID3v1的信息比较好读取,下面会给出一段ruby代码,ID3v2比较复杂,也有比较成熟的开源库,这里就不详细说了,我写在GoogleDoc里了,有感兴趣的可以自行研究或者找我要。\r\n下面是一段读取MP3歌曲的ID3v1.1信息的代码和运算结果:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class ID3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. #初始化genre列表信息  
    6. \r\n\t
    7.   genre_list = <<-GENRES  
    8. \r\n\t
    9. Blues  
    10. \r\n\t
    11. Classic Rock  
    12. \r\n\t
    13. ...省略其他的genre...  
    14. \r\n\t
    15.   GENRES  
    16. \r\n\t
    17.   
    18. \r\n\t
    19.   GENRE_LIST = genre_list.split(\"\\n\")  
    20. \r\n\t
    21.   TAGS = [ :title:artist:album:year:comment:track:genre ]  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.   attr_accessor *TAGS  
    26. \r\n\t
    27.   
    28. \r\n\t
    29.   def initialize(filename)  
    30. \r\n\t
    31.     id3 = File.open(filename) do |mp3|  
    32. \r\n\t
    33.       mp3.seek(-128, IO::SEEK_END)  
    34. \r\n\t
    35.       mp3.read  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39.   
    40. \r\n\t
    41.     raise \"No ID3 tags\" if (id3 !~ /^TAG/ || id3 ~= /^TAG0{125}/)  
    42. \r\n\t
    43.   
    44. \r\n\t
    45.     @title@artist@album@year@comment@genre = id3.unpack('xxxA30A30A30A4A30C1')  
    46. \r\n\t
    47.     @comment@track = @comment.unpack('Z*@28C1'if @comment =~ /\\0.$/  
    48. \r\n\t
    49.   
    50. \r\n\t
    51.     @genre = GENRE_LIST[@genre]  
    52. \r\n\t
    53.   end  
    54. \r\n\t
    55. end  
    56. \r\n\t
    57.   
    58. \r\n\t
    59. if __FILE__ == $0  
    60. \r\n\t
    61.   id3 = ID3.new(ARGV.shift)  
    62. \r\n\t
    63.   ID3::TAGS.each do |tag|  
    64. \r\n\t
    65.     puts \"\#{tag.to_s.capitalize.rjust(8)}: \#{id3.send(tag)}\"  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69. end  
    70. \r\n
    \r\n
    \r\n其运算的结果差不多是这样的:\r\n
    \r\n
    算的结果
    \r\n
      \r\n\t
    1. F:\\IceskYsl>ruby id3_tags.rb ../06.mp3  
    2. \r\n\t
    3.    Title: What I've Done  
    4. \r\n\t
    5.   Artist: Linkin Park  
    6. \r\n\t
    7.    Album: Minutes To Midnight  
    8. \r\n\t
    9.     Year: 2007  
    10. \r\n\t
    11.  Comment: http://www.HiHiCD.com  
    12. \r\n\t
    13.    Track: 0  
    14. \r\n\t
    15.    Genre: Metal  
    16. \r\n
    \r\n
    \r\n发现这是个有意思的事情,呵呵。\r\n\r\n参考文章:\r\nhttp://www.trb.cn/wordpress/index.php/2008/08/28/661/", "created_at"=>2008-10-05 13:15:12 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    昨天有幸认识了terry,看到其blog上有篇文章”消费者对音乐内容Metadata的需求“,其中写到”音乐Metadata是所有数字音乐服务的根基,它的完备性也将直接影响服务的可扩展性。“,最基础也是应用最普遍的是”2.音乐目录元数据,例如歌曲名、专辑名、词曲作者等直接描述音乐作品的信息。这些信息通常会直接体现在各种数字音乐服务上。“。其给出一份消费者对metadata需求的调查研究,如下:
    \n
    \n今天突然来了兴趣,分析一首歌曲,找到其对应的metadata信息,经过资料查找和分析,目前已经基本完成,主要是读取MP3文件的ID3信息(ID3v1,ID3v1.1以及ID3v2),ID3v1的信息比较好读取,下面会给出一段ruby代码,ID3v2比较复杂,也有比较成熟的开源库,这里就不详细说了,我写在GoogleDoc里了,有感兴趣的可以自行研究或者找我要。
    \n下面是一段读取MP3歌曲的ID3v1.1信息的代码和运算结果:
    \n
    \nRuby代码
    \n
    \n class ID3  
    \n   
    \n #初始化genre列表信息  
    \n   genrelist = <<-GENRES  
    \n Blues  
    \n Classic Rock  
    \n ...省略其他的genre...  
    \n   GENRES  
    \n   
    \n   GENRE_LIST = genre_list.split("\\n")  
    \n   TAGS = [ :title, :artist, :album, :year, :comment, :track, :genre ]  
    \n   
    \n   attr_accessor TAGS  
    \n   
    \n   def initialize(filename)  
    \n     id3 = File.open(filename) do |mp3|  
    \n       mp3.seek(-128, IO::SEEK_END)  
    \n       mp3.read  
    \n     end  
    \n   
    \n     raise "No ID3 tags" if (id3 !~ /^TAG/ || id3 ~= /^TAG0{125}/)  
    \n   
    \n     @title, @artist, @album, @year, @comment, @genre = id3.unpack('xxxA30A30A30A4A30C1')  
    \n     @comment, @track = @comment.unpack('Z
    @28C1') if @comment =~ /\\0.$/  
    \n   
    \n     @genre = GENRE_LIST[@genre]  
    \n   end  
    \n end  
    \n   
    \n if 
    FILE_ == $0  
    \n   id3 = ID3.new(ARGV.shift)  
    \n   ID3::TAGS.each do |tag|  
    \n     puts "\#{tag.to_s.capitalize.rjust(8)}: \#{id3.send(tag)}"  
    \n   end  
    \n end  
    \n
    \n
    \n其运算的结果差不多是这样的:
    \n
    \n算的结果
    \n
    \n F:\\IceskYsl>ruby id3_tags.rb ../06.mp3  
    \n    Title: What I've Done  
    \n   Artist: Linkin Park  
    \n    Album: Minutes To Midnight  
    \n     Year: 2007  
    \n  Comment: http://www.HiHiCD.com  
    \n    Track: 0  
    \n    Genre: Metal  
    \n
    \n
    \n发现这是个有意思的事情,呵呵。

    \n\n

    参考文章:
    \nhttp://www.trb.cn/wordpress/index.php/2008/08/28/661/

    \n", "_id"=>941}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"添加一个分类“架构设计 | Architecture”", "body"=>"由于越来越多的关注Architecture方面的东西,而这类内容和以往的“技术归总 | Technic”有些不同,于是增加了一个“架构设计 | Architecture”分类。\r\n该分类主要收纳关于Architecture,Scalability,Load balance, throughput, HA, Performance等方面的理论,模式,以及对其他成熟的Architecture的分析和理解。\r\n希望和大家多交流,分享。", "created_at"=>2008-10-07 02:10:51 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    由于越来越多的关注Architecture方面的东西,而这类内容和以往的“技术归总 | Technic”有些不同,于是增加了一个“架构设计 | Architecture”分类。
    \n该分类主要收纳关于Architecture,Scalability,Load balance, throughput, HA, Performance等方面的理论,模式,以及对其他成熟的Architecture的分析和理解。
    \n希望和大家多交流,分享。

    \n", "_id"=>942}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"在Startups时就考虑Scalability", "body"=>"一般说来,项目初期的时候考虑更多的是功能的实现和可用性,而对Scalability考虑的并不是很多,从很多人的Scalability经验分享来看,大家比较认同的一条Scalability路线是基本上类似于:先DB和web server在一台机器上,再分割DB和web server,再集群,再cache,再系统分割,再水平、垂直扩展这样的路线。\r\n\r\n我一直不是很同意这个模式,因为当你有志把系统做大道一定规模的时候,为什么不先做一些Scalability的基础呢,比如功能的切割、子系统的划分等等,为什么非要等到系统压力上来了,再手忙脚乱的去重新规划呢。\r\n\r\n之所以这么说,是因为我做的项目预先会考虑好系统划分,做好接口定义,把不同的功能分割在封装成不同的子系统,子系统和子系统之间通过接口传递消息,而后期的Scalability则可以针对不同的子系统需要灵活选择,比如有的子系统需要较多的内存,而有的子系统CPU吃紧等等。\r\n\r\n今天看到Frank Mashraqi(Director of Business Operations & Technical Strategy for a top 50 website that delivers billions of page views per month.)写了一篇文章“Scalability for Startups: How to Grow Up without Blowing Up”,其“12 Tips for Building a Scalable Startup”列举了一些在Startups时就应该考虑的Scalability因素,值得阅读。其还有一个Doc版本,更加生动的说明了一些东西。\r\n\r\n如果你有类似的经验,欢迎和我讨论和分享。", "created_at"=>2008-10-07 02:28:16 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    一般说来,项目初期的时候考虑更多的是功能的实现和可用性,而对Scalability考虑的并不是很多,从很多人的Scalability经验分享来看,大家比较认同的一条Scalability路线是基本上类似于:先DB和web server在一台机器上,再分割DB和web server,再集群,再cache,再系统分割,再水平、垂直扩展这样的路线。

    \n\n

    我一直不是很同意这个模式,因为当你有志把系统做大道一定规模的时候,为什么不先做一些Scalability的基础呢,比如功能的切割、子系统的划分等等,为什么非要等到系统压力上来了,再手忙脚乱的去重新规划呢。

    \n\n

    之所以这么说,是因为我做的项目预先会考虑好系统划分,做好接口定义,把不同的功能分割在封装成不同的子系统,子系统和子系统之间通过接口传递消息,而后期的Scalability则可以针对不同的子系统需要灵活选择,比如有的子系统需要较多的内存,而有的子系统CPU吃紧等等。

    \n\n

    今天看到Frank Mashraqi(Director of Business Operations & Technical Strategy for a top 50 website that delivers billions of page views per month.)写了一篇文章“Scalability for Startups: How to Grow Up without Blowing Up”,其“12 Tips for Building a Scalable Startup”列举了一些在Startups时就应该考虑的Scalability因素,值得阅读。其还有一个Doc版本,更加生动的说明了一些东西。

    \n\n

    如果你有类似的经验,欢迎和我讨论和分享。

    \n", "_id"=>943}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"为Mysql选择更加合适的硬件环境", "body"=>"记得前段时间,博文的一个朋友做一本Mysql技术书籍时,将其策划的大纲给我看,我提出让他增加一章关于Mysql硬件选择的内容,因为Mysql的性能受硬件影响很大,如何选择一套比较合适的硬件环境相当重要,自然,他接受了我的建议。\r\n只是不知道他策划的这本书何时才能编写完成,不过在2008 MySQL Conference & Expo上,确实看到一篇“Scaling Out MySQL: Hardware Today and Tomorrow”,其Doc已经可以在scribd上看到了,嵌到这里。\r\n\r\n\r\n\r\n其内容大致涉及到CPU,Mem,vendor,storage等方面的选择,摘取几条如下:\r\n
      \r\n\t
    • CPU还是选64位的吧(为了支持更大的内存),Mysql在多核CPU上有些问题;
    • \r\n\t
    • 内存越大越好,反正很便宜,但是关于内存的配置使用还是很有学问的;
    • \r\n\t
    • 硬盘最后是选择15K而不是10K的,在这上面多花点钱是非常值得的;
    • \r\n
    \r\n其他的大家看Doc里面的总结吧,总结好了别忘记share给我哈。\r\n\r\n参考:http://www.dbanotes.net/database/mysql_hardware.html", "created_at"=>2008-10-07 03:18:16 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    记得前段时间,博文的一个朋友做一本Mysql技术书籍时,将其策划的大纲给我看,我提出让他增加一章关于Mysql硬件选择的内容,因为Mysql的性能受硬件影响很大,如何选择一套比较合适的硬件环境相当重要,自然,他接受了我的建议。
    \n只是不知道他策划的这本书何时才能编写完成,不过在2008 MySQL Conference & Expo上,确实看到一篇“Scaling Out MySQL: Hardware Today and Tomorrow”,其Doc已经可以在scribd上看到了,嵌到这里。

    \n\n

    Scaling out MySQL - Hardware today and tomorrow - Upload a Document to Scribd
    \n其内容大致涉及到CPU,Mem,vendor,storage等方面的选择,摘取几条如下:
    \n
    \n CPU还是选64位的吧(为了支持更大的内存),Mysql在多核CPU上有些问题;
    \n 内存越大越好,反正很便宜,但是关于内存的配置使用还是很有学问的;
    \n 硬盘最后是选择15K而不是10K的,在这上面多花点钱是非常值得的;
    \n
    \n其他的大家看Doc里面的总结吧,总结好了别忘记share给我哈。

    \n\n

    参考:http://www.dbanotes.net/database/mysql_hardware.html

    \n", "_id"=>944}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>945}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"7 Top Tips for Coding With Currency", "body"=>"As anyone who’s ever made an e-commerce system knows, money is everything. No, really if you don’t get your financial sums right then you can’t hope to build a successful online business (and may find yourself creating potential legal issues with the tax man).\r\n\r\nSo here’s a rundown of the top tips I can give for making your financial calculations that bit easier.\r\n\r\nhttp://www.setfiremedia.com/blog/7-top-tips-for-coding-with-currency", "created_at"=>2008-10-08 09:05:08 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    As anyone who’s ever made an e-commerce system knows, money is everything. No, really if you don’t get your financial sums right then you can’t hope to build a successful online business (and may find yourself creating potential legal issues with the tax man).

    \n\n

    So here’s a rundown of the top tips I can give for making your financial calculations that bit easier.

    \n\n

    http://www.setfiremedia.com/blog/7-top-tips-for-coding-with-currency

    \n", "_id"=>946}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>947}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>948}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>949}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>950}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>951}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>952}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>953}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>954}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"一个终点会是另外一个新起点", "body"=>"我最终还是离职了,从考虑到最终决定,花了好几个月的时间,期间很多事情、很多人给我很深的影响。\r\n清晰的记得2006年秋天,我拿到Aspire的offer时的欢呼雀跃,还没出酒店就开始电话比尔告诉我被录用了,那个时候,哪里想到会离职,时间真快,可以改变很多东西。\r\n\r\n很多人需要感谢,我Aspire的同事,朋友,在我的第一份工作中给我莫大的鼓励和支持、帮助,关心。能很多程度的包容、理解和鼓励。好多人、好多事,都历历在目。\r\n\r\n工作是老板的,朋友是自己的,我在Aspire匆匆走过,却没有留下什么,真有愧意。有幸认识很多很好的同事、朋友,非常舍不得。\r\n\r\n已经没有回头。一个终点会是另外一个新起点!\r\n\r\n准备启航,请多给我点鼓励和祝福,谢谢!", "created_at"=>2008-10-20 03:27:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    我最终还是离职了,从考虑到最终决定,花了好几个月的时间,期间很多事情、很多人给我很深的影响。
    \n清晰的记得2006年秋天,我拿到Aspire的offer时的欢呼雀跃,还没出酒店就开始电话比尔告诉我被录用了,那个时候,哪里想到会离职,时间真快,可以改变很多东西。

    \n\n

    很多人需要感谢,我Aspire的同事,朋友,在我的第一份工作中给我莫大的鼓励和支持、帮助,关心。能很多程度的包容、理解和鼓励。好多人、好多事,都历历在目。

    \n\n

    工作是老板的,朋友是自己的,我在Aspire匆匆走过,却没有留下什么,真有愧意。有幸认识很多很好的同事、朋友,非常舍不得。

    \n\n

    已经没有回头。一个终点会是另外一个新起点!

    \n\n

    准备启航,请多给我点鼓励和祝福,谢谢!

    \n", "_id"=>955}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>956}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"新起点,来到北京", "body"=>"早上9:10分飞机,深圳-北京,一大早起来,托起行李就去机场了,一路都很顺利,只是登机后出了些状况,一直不起飞,被告知“航空管制”,一问原因,回答竟然是“XX地方在搞军事演习!”寒,这个理由真囧。\r\n\r\n9:10分的飞机一直到10:40才起飞,还好飞起来以后没啥耽误,2小时50分钟到达北京机场,领了行李,按照之前看的路线去找“机场快线”,25元,不贵,比打车便宜多了,很快就到三元桥,比打车快很多。\r\n\r\n车上接到蔡望琴同学的电话,开始没反应过来,就觉得这个名字好熟悉,呵呵,真是惊讶!怎么会有人知道我刚到北京呢?后来知晓是我在twitter上发的消息被raecoo看到了,呵呵。\r\n\r\n然后拖着行李(一个箱子,一个背包,一本电脑包,还有一个袋子装了一双球鞋和运动鞋)换乘10号线到国贸,找到SOHO小区,找到落脚点。\r\n\r\n一路下来还算顺利。\r\n\r\n晚上同事带去吃饺子,北京的饺子真大呀,比深圳的三个还大,赞。\r\n\r\n接下来就要尽快进入状态了,还有几个朋友要见,还有些事情要处理,终于来到北京了,一个新起点。", "created_at"=>2008-10-21 16:29:40 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    早上9:10分飞机,深圳-北京,一大早起来,托起行李就去机场了,一路都很顺利,只是登机后出了些状况,一直不起飞,被告知“航空管制”,一问原因,回答竟然是“XX地方在搞军事演习!”寒,这个理由真囧。

    \n\n

    9:10分的飞机一直到10:40才起飞,还好飞起来以后没啥耽误,2小时50分钟到达北京机场,领了行李,按照之前看的路线去找“机场快线”,25元,不贵,比打车便宜多了,很快就到三元桥,比打车快很多。

    \n\n

    车上接到蔡望琴同学的电话,开始没反应过来,就觉得这个名字好熟悉,呵呵,真是惊讶!怎么会有人知道我刚到北京呢?后来知晓是我在twitter上发的消息被raecoo看到了,呵呵。

    \n\n

    然后拖着行李(一个箱子,一个背包,一本电脑包,还有一个袋子装了一双球鞋和运动鞋)换乘10号线到国贸,找到SOHO小区,找到落脚点。

    \n\n

    一路下来还算顺利。

    \n\n

    晚上同事带去吃饺子,北京的饺子真大呀,比深圳的三个还大,赞。

    \n\n

    接下来就要尽快进入状态了,还有几个朋友要见,还有些事情要处理,终于来到北京了,一个新起点。

    \n", "_id"=>957}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在crontab中调用rake task定时跑job", "body"=>"在Rails中可以使用很大插件来实现后台定时JOB,但是最环保的应该是使用crontab来调用rake,也很简单,基本上分成如下几步:\r\n\r\nin the root of my app i have notify_answerers.sh\r\n``#!/bin/shexport PATH='/usr/local/ruby/bin':$PATH cd /opt/dev/Monier/usr/local/ruby/bin/rake nginx:fetch_status RAILS_ENV=production```\r\nin myapp/lib/tasks i have myapp.rake\r\n``namespace :nginx do desc \"Notify answerers of new questions\" task :fetch_status => :environment do Nginx.find(:all).each do |nginx| puts \"nginx=\#{nginx.name}\" nginx.do_fetch_nginx_status_job nginx.update_attribute(:updated_at,Time.now) end endend```\r\nIn my cron file i have:\r\n``*/2 * * * * /bin/sh /opt/dev/Monier/lib/crontabs/fetch_nginx_status.sh```\r\n(use \"crotab -e\" on the server to edit this file)", "created_at"=>2008-10-24 16:51:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在Rails中可以使用很大插件来实现后台定时JOB,但是最环保的应该是使用crontab来调用rake,也很简单,基本上分成如下几步:

    \n\n

    in the root of my app i have notify_answerers.sh
    \n#!/bin/shexport PATH='/usr/local/ruby/bin':$PATH cd /opt/dev/Monier/usr/local/ruby/bin/rake nginx:fetch_status RAILS_ENV=production
    \nin myapp/lib/tasks i have myapp.rake
    \n
    namespace :nginx do desc "Notify answerers of new questions" task :fetch_status =&gt; :environment do Nginx.find(:all).each do |nginx| puts "nginx=\#{nginx.name}" nginx.do_fetch_nginx_status_job nginx.update_attribute(:updated_at,Time.now) end endend
    \nIn my cron file i have:
    \n
    */2 * * * * /bin/sh /opt/dev/Monier/lib/crontabs/fetch_nginx_status.sh```
    \n(use "crotab -e" on the server to edit this file)

    \n", "_id"=>958}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.2快来了,期待", "body"=>"

    Rails 2.2中将会有大量值得期待的功能,今天看到其weblog上发布“Rails 2.2 RC1: i18n, thread safety, docs, etag/last-modified, JRuby/1.9 compatibility”,从其标题可以看到,其包含了 i18n,thread safety,docs,etag,JRuby/1.9 compatibility等值得期待的功能。

    \n

    另外看到“Ruby on Rails 2.2 Release Notes”,其比较详细了列举了2.2版本中的新特性,非常棒!

    \n

    马上就要来了,继续期待,期待其线程安全,连接池等特性到底有多牛。

    \n

    等不及的可以先下载下来试试了:

    \n

    ````gem install rails -s http://gems.rubyonrails.org -v 2.2.0```

    \n

     

    ", "created_at"=>2008-10-24 17:57:35 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails 2.2中将会有大量值得期待的功能,今天看到其weblog上发布“Rails 2.2 RC1: i18n, thread safety, docs, etag/last-modified, JRuby/1.9 compatibility”,从其标题可以看到,其包含了 i18n,thread safety,docs,etag,JRuby/1.9 compatibility等值得期待的功能。
    \n另外看到“Ruby on Rails 2.2 Release Notes”,其比较详细了列举了2.2版本中的新特性,非常棒!
    \n马上就要来了,继续期待,期待其线程安全,连接池等特性到底有多牛。
    \n等不及的可以先下载下来试试了:
    \n`gem install rails -s http://gems.rubyonrails.org -v 2.2.0
    \n 

    \n", "_id"=>959}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在attachment_fu中通过URL上传文件", "body"=>"

    attachment_fu很多人都使用过吧,使用其上传文件非常方便(super easy),但是有没有想过通过URL来上传文件呢,比如网上的一张图片,一首歌曲等。

    \n

    按照平时的思路,我们需要下载到本地,保存到硬盘上,打开上传页面,浏览硬盘找到要上传的文件,点击上传,看,多麻烦,是吧!如果可以实现通过URL上传,那么其过程就异常简单了,输入URL,点击上传即可。

    \n

    已经有人提供了思路,也非常简单,多加个url属性即可,C的代码不用修改,举例如下:

    \n

     

    \n
    \n
    # app/models/upload.rb
    \n
      \n
    1. # app/models/upload.rb  
    2. \n
    3.    
    4. \n
    5. class Upload < ActiveRecord::Base  
    6. \n
    7.    
    8. \n
    9.   # ...normal attachment_fu code (has_attachment, etc)...  
    10. \n
    11.    
    12. \n
    13.   # allow uploads via URL  
    14. \n
    15.   require 'open-uri'  
    16. \n
    17.   attr_reader :url  
    18. \n
    19.   def url=(uri)  
    20. \n
    21.     return nil if uri.blank?  
    22. \n
    23.     io = (open(URI.parse(uri)) rescue return nil)  
    24. \n
    25.     (class << io; selfend;).class_eval do  
    26. \n
    27.       define_method(:original_filename) { base_uri.path.split('/').last }  
    28. \n
    29.     end  
    30. \n
    31.     self.uploaded_data = io  
    32. \n
    33.   end  
    34. \n
    35. end  
    36. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. # app/controllers/uploads_controller.rb  
    2. \n
    3.    
    4. \n
    5. class UploadsController < ApplicationController  
    6. \n
    7.    
    8. \n
    9.   # avoid raising exceptions for common errors (e.g. file not found)  
    10. \n
    11.   rescue_from Errno::ENOENT, :with => :url_upload_not_found  
    12. \n
    13.   rescue_from Errno::ETIMEDOUT, :with => :url_upload_not_found  
    14. \n
    15.   rescue_from OpenURI::HTTPError, :with => :url_upload_not_found  
    16. \n
    17.   rescue_from Timeout::Error, :with => :url_upload_not_found  
    18. \n
    19.    
    20. \n
    21.   def new  
    22. \n
    23.     @upload = Upload.new  
    24. \n
    25.   end  
    26. \n
    27.    
    28. \n
    29.   def create  
    30. \n
    31.     @upload = current_user.uploads.build(params[:upload])  
    32. \n
    33.     if @upload.save  
    34. \n
    35.       redirect_to files_path  
    36. \n
    37.     else  
    38. \n
    39.       render :action => "new"  
    40. \n
    41.     end  
    42. \n
    43.   end  
    44. \n
    45.    
    46. \n
    47.   def url_upload_not_found  
    48. \n
    49.     flash[:notice] = "Sorry, the URL you provided was not valid."  
    50. \n
    51.     redirect_to new_upload_path  
    52. \n
    53.   end  
    54. \n
    55. end  
    56. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. # app/views/uploads/new.html.erb  
    2. \n
    3.    
    4. \n
    5. <%= error_messages_for :upload %>  
    6. \n
    7. <% form_for @upload:html => { :multipart => true } do |f| -%>  
    8. \n
    9.   <%= f.file_field :uploaded_data # normal upload, or... %>  
    10. \n
    11.   <%= f.text_field :url # upload via url %>  
    12. \n
    13.   <%= submit_tag "Upload":disable_with => "Upload" %>  
    14. \n
    15. <% end %>  
    16. \n
    \n
    \n

    发现这个人还真勤快,写了代码El Dorado.还做了视频演示;

    \n

     

    \n

    \t\t\t\t
    \nEasy Upload via URL with attachment_fu from Trevor Turk on Vimeo.

    ", "created_at"=>2008-10-25 15:34:50 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    attachment_fu很多人都使用过吧,使用其上传文件非常方便(super easy),但是有没有想过通过URL来上传文件呢,比如网上的一张图片,一首歌曲等。
    \n按照平时的思路,我们需要下载到本地,保存到硬盘上,打开上传页面,浏览硬盘找到要上传的文件,点击上传,看,多麻烦,是吧!如果可以实现通过URL上传,那么其过程就异常简单了,输入URL,点击上传即可。
    \n已经有人提供了思路,也非常简单,多加个url属性即可,C的代码不用修改,举例如下:
    \n 
    \n
    \n# app/models/upload.rb
    \n
    \n # app/models/upload.rb  
    \n    
    \n class Upload < ActiveRecord::Base  
    \n    
    \n   # ...normal attachment_fu code (has_attachment, etc)...  
    \n    
    \n   # allow uploads via URL  
    \n   require 'open-uri'  
    \n   attr_reader :url  
    \n   def url=(uri)  
    \n     return nil if uri.blank?  
    \n     io = (open(URI.parse(uri)) rescue return nil)  
    \n     (class << io; self; end;).class_eval do  
    \n       define_method(:original_filename) { base_uri.path.split('/').last }  
    \n     end  
    \n     self.uploaded_data = io  
    \n   end  
    \n end  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n # app/controllers/uploads_controller.rb  
    \n    
    \n class UploadsController < ApplicationController  
    \n    
    \n   # avoid raising exceptions for common errors (e.g. file not found)  
    \n   rescue_from Errno::ENOENT, :with => :url_upload_not_found  
    \n   rescue_from Errno::ETIMEDOUT, :with => :url_upload_not_found  
    \n   rescue_from OpenURI::HTTPError, :with => :url_upload_not_found  
    \n   rescue_from Timeout::Error, :with => :url_upload_not_found  
    \n    
    \n   def new  
    \n     @upload = Upload.new  
    \n   end  
    \n    
    \n   def create  
    \n     @upload = current_user.uploads.build(params[:upload])  
    \n     if @upload.save  
    \n       redirect_to files_path  
    \n     else  
    \n       render :action => "new"  
    \n     end  
    \n   end  
    \n    
    \n   def url_upload_not_found  
    \n     flash[:notice] = "Sorry, the URL you provided was not valid."  
    \n     redirect_to new_upload_path  
    \n   end  
    \n end  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n # app/views/uploads/new.html.erb  
    \n    
    \n <%= error_messages_for :upload %>  
    \n <% form_for @upload, :html => { :multipart => true } do |f| -%>  
    \n   <%= f.file_field :uploaded_data # normal upload, or... %>  
    \n   <%= f.text_field :url # upload via url %>  
    \n   <%= submit_tag "Upload", :disable_with => "Upload" %>  
    \n <% end %>  
    \n
    \n
    \n发现这个人还真勤快,写了代码El Dorado.还做了视频演示;
    \n 
    \n
    \nEasy Upload via URL with attachment_fu from Trevor Turk on Vimeo.

    \n", "_id"=>960}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MYSQL的MERGE存储引擎", "body"=>"

    MYSQL的引擎不是一般的多,这次说到的是MERGE,这个引擎有很多特殊的地方:

    \n

    MERGE引擎类型允许你把许多结构相同的表合并为一个表。然后,你可以执行查询,从多个表返回的结果就像从一个表返回的结果一样。每一个合并的表必须有同样的表定义。
    \n
    \nMERGE存储引擎在下面这种使用场合会最为有用,如果需要把日志纪录不停的录入MySQL数据库,并且每天、每周或者每个月都创建一个单一的表,而且要制作来自多个表的合计查询,MERGE表这时会非常有效。然而,这项功能有局限性。你只能合并MyISAM表而且必须严格遵守相同的表定义的限制。虽然这看起来好像是一个大问题,但是,如果你使用另外一种表类型(例如InnoDB),这种合并可能就不需要了。

    \n

    其创建方法如下:

    \n

    他将多个表在逻辑上当作一个表来查询。他建立后有两个文件,
    \n.frm 表结构定义
    \n.mrg union表的名字清单
    \n
    \n两个基本表:
    \nCREATE TABLE TEST_MERGE_1(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \nCREATE TABLE TEST_MERGE_2(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \n
    \nMERGE表的建立:
    \nCREATE TABLE TEST_MERGE(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(TEST_MERGE_1,TEST_MERGE_2) ;

    \n


    \n1. 此表类似于SQL中的union机制。
    \n2. 此表结构必须与基本表完全一致,包括列名、顺序。UNION表必须同属一个DATABASE。
    \n3. 基本表类型必须是MyISAM。
    \n4. 可以通过修改.mrg文件来修改MERGE表,每个基本表的名字占一行。注意:修改后要通过FLUSH TABLES刷新表缓存。
    \n5. 对基本表的更改可以直接反映在此表上。
    \n6. INSERT_METHOD的取值可以是: 0 不允许插入 FIRST 插入到UNION中的第一个表 LAST 插入到UNION中的最后一个表。(4.0之后可用)
    \n7. 定义在它上面的约束没有任何作用,约束是由基本表控制的,例如两个基本表中存在着同样的一个Key值,那么在MERGE表中会有两个一样的Key值。

    \n

     

    \n

    参考资料:

    \n

    http://biz.chinabyte.com/220/2230720.shtml

    \n

    http://info.codepub.com/2008/09/info-21832.html

    ", "created_at"=>2008-11-04 10:31:58 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    MYSQL的引擎不是一般的多,这次说到的是MERGE,这个引擎有很多特殊的地方:
    \nMERGE引擎类型允许你把许多结构相同的表合并为一个表。然后,你可以执行查询,从多个表返回的结果就像从一个表返回的结果一样。每一个合并的表必须有同样的表定义。
    \n
    \nMERGE存储引擎在下面这种使用场合会最为有用,如果需要把日志纪录不停的录入MySQL数据库,并且每天、每周或者每个月都创建一个单一的表,而且要制作来自多个表的合计查询,MERGE表这时会非常有效。然而,这项功能有局限性。你只能合并MyISAM表而且必须严格遵守相同的表定义的限制。虽然这看起来好像是一个大问题,但是,如果你使用另外一种表类型(例如InnoDB),这种合并可能就不需要了。
    \n其创建方法如下:
    \n他将多个表在逻辑上当作一个表来查询。他建立后有两个文件,
    \n.frm 表结构定义
    \n.mrg union表的名字清单
    \n
    \n两个基本表:
    \nCREATE TABLE TEST_MERGE_1(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \nCREATE TABLE TEST_MERGE_2(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \n
    \nMERGE表的建立:
    \nCREATE TABLE TEST_MERGE(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(TEST_MERGE_1,TEST_MERGE_2) ;
    \n
    \n1. 此表类似于SQL中的union机制。
    \n2. 此表结构必须与基本表完全一致,包括列名、顺序。UNION表必须同属一个DATABASE。
    \n3. 基本表类型必须是MyISAM。
    \n4. 可以通过修改.mrg文件来修改MERGE表,每个基本表的名字占一行。注意:修改后要通过FLUSH TABLES刷新表缓存。
    \n5. 对基本表的更改可以直接反映在此表上。
    \n6. INSERT_METHOD的取值可以是: 0 不允许插入 FIRST 插入到UNION中的第一个表 LAST 插入到UNION中的最后一个表。(4.0之后可用)
    \n7. 定义在它上面的约束没有任何作用,约束是由基本表控制的,例如两个基本表中存在着同样的一个Key值,那么在MERGE表中会有两个一样的Key值。
    \n 
    \n参考资料:
    \nhttp://biz.chinabyte.com/220/2230720.shtml
    \nhttp://info.codepub.com/2008/09/info-21832.html

    \n", "_id"=>961}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Merb 1.0 Released", "body"=>"

    \"\"
    \nmerb的1.0终于出来了,等的实在不易,1.0版的merb已经足够完善了,可以拿来做一些production的东西了,例如以前说到的代替rails做上传文件等等。
    \nrubyinsite已经发了一篇参考资源文件,感兴趣的可以过去瞧瞧,地址如下:Merb 1.0 Released So Here’s 44 Links and Resources To Get You Going

    ", "created_at"=>2008-11-09 04:17:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    merb的1.0终于出来了,等的实在不易,1.0版的merb已经足够完善了,可以拿来做一些production的东西了,例如以前说到的代替rails做上传文件等等。
    \nrubyinsite已经发了一篇参考资源文件,感兴趣的可以过去瞧瞧,地址如下:Merb 1.0 Released So Here’s 44 Links and Resources To Get You Going。

    \n", "_id"=>962}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"升级ubuntu8.10未果", "body"=>"

    ubuntu8.10发布好几天了,最近一直很忙,没时间升级,今天得闲升级,却遇到一些问题,开始是找速度不错的源,后来是遇到/boot下空间 不足的问题,但是我的 /boot是 100M,按常理,应该足够了,其哦已经清理掉每次升级版本留下来的grup,现在只保留了最新一个版本的image,查看/boot下的文件,发现没啥 是大文件,却占了70多M的空间,奇怪,如下:

    \n

    iceskysl@IceskYsl:~$ cd /boot/
    \niceskysl@IceskYsl:/boot$ du sk *
    \ndu: 无法访问“sk”: 没有该文件或目录
    \n416    abi-2.6.24-21-generic
    \n80    config-2.6.24-21-generic
    \n179    grub
    \n7488    initrd.img-2.6.24-21-generic
    \ndu: 无法创建目录“lost+found”: Permission denied
    \n12    lost+found
    \n102    memtest86+.bin
    \n890    System.map-2.6.24-21-generic
    \n1885    vmlinuz-2.6.24-21-generic
    \niceskysl@IceskYsl:/boot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   7409400   2376680  76% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     39780    733172   6% /lib/modules/2.6.24-21-generic/volatile
    \n/dev/sda7                93307     73608     14882  84% /boot
    \n/dev/sda9              9614116   5299748   3825996  59% /home
    \n/dev/sda1             14195576  11835000   2360576  84% /media/sda1
    \n/dev/sda5             15366140  13796572   1569568  90% /media/sda5
    \n可以看到,占了77M的空间,但是du看到的却最大的也只有 8M,其他空间哪里去了?

    ", "created_at"=>2008-11-09 17:31:38 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    ubuntu8.10发布好几天了,最近一直很忙,没时间升级,今天得闲升级,却遇到一些问题,开始是找速度不错的源,后来是遇到/boot下空间 不足的问题,但是我的 /boot是 100M,按常理,应该足够了,其哦已经清理掉每次升级版本留下来的grup,现在只保留了最新一个版本的image,查看/boot下的文件,发现没啥 是大文件,却占了70多M的空间,奇怪,如下:
    \niceskysl@IceskYsl:~$ cd /boot/
    \niceskysl@IceskYsl:/boot$ du sk *
    \ndu: 无法访问“sk”: 没有该文件或目录
    \n416    abi-2.6.24-21-generic
    \n80    config-2.6.24-21-generic
    \n179    grub
    \n7488    initrd.img-2.6.24-21-generic
    \ndu: 无法创建目录“lost+found”: Permission denied
    \n12    lost+found
    \n102    memtest86+.bin
    \n890    System.map-2.6.24-21-generic
    \n1885    vmlinuz-2.6.24-21-generic
    \niceskysl@IceskYsl:/boot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   7409400   2376680  76% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     39780    733172   6% /lib/modules/2.6.24-21-generic/volatile
    \n/dev/sda7                93307     73608     14882  84% /boot
    \n/dev/sda9              9614116   5299748   3825996  59% /home
    \n/dev/sda1             14195576  11835000   2360576  84% /media/sda1
    \n/dev/sda5             15366140  13796572   1569568  90% /media/sda5
    \n可以看到,占了77M的空间,但是du看到的却最大的也只有 8M,其他空间哪里去了?

    \n", "_id"=>963}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"memcached维护及其数据遍历实现", "body"=>"

    需要时不时的看看memcached的状态,其自身只提供了get、set等方法啊我们需要使用其提供的方法遍历一下其缓存的内容,其原理请参考《如何对memcache的数据(key-value)进行遍历操作 》和《贴一段遍历memcached缓存对象的小脚本》。

    \n

    memcache的stats命令包括:
    \n
    \n1.        stats 
    \n2.        stats reset 
    \n3.        stats malloc 
    \n4.        stats maps 
    \n5.        stats sizes 
    \n6.        stats slabs 
    \n7.        stats items 
    \n8.        stats cachedump slab_id limit_num 
    \n9.        stats detail [on|off|dump]
    \n

    \n

    说说其实现遍历的原理:

    \n
      \n
    1. telnet到192.168.15.225(局域网测试机器)的memcache服务器;
    2. \n
    3. 执行stats items命令,可以看到出现 很多的items行。
    4. \n
    5. 执行stats cachedump 3 0命令。这里的3表示上面图中items后面的数字,0标示显示全部的数据,如果是1就标示只显示1条。
      \n 下图为执行后的结果,item后面的字符串为key
    6. \n
    7.  通过上面列出的key我们就可以遍历所有的数据了,下面我们取出某一条数据,key为Uc!uLh的数据。
    8. \n
    \n

    来两个遍历的代码:
    \n1、PHP版

    \n

    1.        <?php

    \n

    2.        $host='192.168.15.225';

    \n

    3.        $port=11211;

    \n

    4.        $mem=new Memcache();

    \n

    5.        $mem->connect($host,$port);

    \n

    6.        $items=$mem->getExtendedStats (‘items’);

    \n

    7.        $items=$items["$host:$port"]['items'];

    \n

    8.        for($i=0,$len=count($items);$i<$len;$i++){

    \n

    9.            $number=$items[$i]['number'];

    \n

    10.         $str=$mem->getExtendedStats ("cachedump",$number,0);

    \n

    11.         $line=$str["$host:$port"];

    \n

    12.         if( is_array($line) && count($line)>0){

    \n

    13.             foreach($line as $key=>$value){

    \n

    14.                 echo $key.'=>';

    \n

    15.                 print_r($mem->get($key));

    \n

    16.                 echo "\\r\\n";

    \n

    17.             }

    \n

    18.         }

    \n

    19.     }

    \n

    20.     ?>
    \n
    \n2、RUby版
    \n

    \n
      \n
    1. #!/usr/bin/env ruby  
    2. \n
    3. require 'socket'  
    4. \n
    5.   
    6. \n
    7. # stats  
    8. \n
    9. # stats reset  
    10. \n
    11. # stats malloc  
    12. \n
    13. # stats maps  
    14. \n
    15. # stats sizes  
    16. \n
    17. # stats slabs  
    18. \n
    19. # stats items  
    20. \n
    21. # stats cachedump slab_id limit_num  
    22. \n
    23. # stats detail [on|off|dump]  
    24. \n
    25.   
    26. \n
    27. class Memcache  
    28. \n
    29.   class << self  
    30. \n
    31.     def open(host, port)  
    32. \n
    33.       s = TCPSocket.open(host, port)  
    34. \n
    35.       yield s if block_given?  
    36. \n
    37.     ensure  
    38. \n
    39.       s.close if s  
    40. \n
    41.     end  
    42. \n
    43.     
    44. \n
    45.     def command(command_string, s)  
    46. \n
    47.       s.send(command_string + "\\r\\n", 0)  
    48. \n
    49.       buff = []  
    50. \n
    51.       until ["END""OK""DELETE""ERROR"].include?(line = s.gets.strip) do  
    52. \n
    53.         buff << line   
    54. \n
    55.       end  
    56. \n
    57.       buff  
    58. \n
    59.     end  
    60. \n
    61.     
    62. \n
    63.     def exec(command_string, host = "javaeye", port = 11211)  
    64. \n
    65.       open(host, port) { |socket| command(command_string, socket).each {|line| puts line } }  
    66. \n
    67.     end  
    68. \n
    69.       
    70. \n
    71.     def cache_stats(host = "javaeye", port = 11211)  
    72. \n
    73.       cache_objects = {}  
    74. \n
    75.       open(host, port) do |socket|  
    76. \n
    77.         slabs = []  
    78. \n
    79.         command("stats items", socket).each do |line|  
    80. \n
    81.           slab_id = line.split[1].split(":")[1].to_i  
    82. \n
    83.           slabs << slab_id unless slabs.include?(slab_id)  
    84. \n
    85.         end  
    86. \n
    87.         slabs.each do |slab_id|  
    88. \n
    89.           puts "browse slab \#{slab_id}..."  
    90. \n
    91.           command("stats cachedump \#{slab_id} 0", socket).each do |item|  
    92. \n
    93.             key = item.split[1].split("/")[0].to_s  
    94. \n
    95.             cache_objects.include?(key) ? cache_objects[key] += 1 : cache_objects[key] = 1  
    96. \n
    97.           end  
    98. \n
    99.         end  
    100. \n
    101.       end  
    102. \n
    103.       cache_objects.each_pair {|key, value| puts "\#{key} : \#{value}"}  
    104. \n
    105.     end  
    106. \n
    107.   end  
    108. \n
    109. end  
    110. \n
    111.   
    112. \n
    113. if ARGV.size == 0  
    114. \n
    115.   Memcache.cache_stats  
    116. \n
    117. else  
    118. \n
    119.   Memcache.exec(ARGV.join(" "))  
    120. \n
    121. end 
      \n
    122. \n
    ", "created_at"=>2008-11-09 18:52:03 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    需要时不时的看看memcached的状态,其自身只提供了get、set等方法啊我们需要使用其提供的方法遍历一下其缓存的内容,其原理请参考《如何对memcache的数据(key-value)进行遍历操作 》和《贴一段遍历memcached缓存对象的小脚本》。
    \nmemcache的stats命令包括:
    \n
    \n1.        stats 
    \n2.        stats reset 
    \n3.        stats malloc 
    \n4.        stats maps 
    \n5.        stats sizes 
    \n6.        stats slabs 
    \n7.        stats items 
    \n8.        stats cachedump slab_id limit_num 
    \n9.        stats detail [on|off|dump]
    \n
    \n说说其实现遍历的原理:
    \n
    \n telnet到192.168.15.225(局域网测试机器)的memcache服务器;
    \n 执行stats items命令,可以看到出现 很多的items行。
    \n 执行stats cachedump 3 0命令。这里的3表示上面图中items后面的数字,0标示显示全部的数据,如果是1就标示只显示1条。
    \n 下图为执行后的结果,item后面的字符串为key
    \n  通过上面列出的key我们就可以遍历所有的数据了,下面我们取出某一条数据,key为Uc!uLh的数据。
    \n
    \n来两个遍历的代码:
    \n1、PHP版
    \n1.        <?php/o:p
    \n2.        $host='192.168.15.225';/o:p
    \n3.        $port=11211;/o:p
    \n4.        $mem=new Memcache();/o:p
    \n5.        $mem->connect($host,$port);/o:p
    \n6.        $items=$mem->getExtendedStats (‘items’);/o:p
    \n7.        $items=$items["$host:$port"]['items'];/o:p
    \n8.        for($i=0,$len=count($items);$i<$len;$i++){/o:p
    \n9.            $number=$items[$i]['number'];/o:p
    \n10.         $str=$mem->getExtendedStats ("cachedump",$number,0);/o:p
    \n11.         $line=$str["$host:$port"];/o:p
    \n12.         if( is_array($line) && count($line)>0){/o:p
    \n13.             foreach($line as $key=>$value){/o:p
    \n14.                 echo $key.'=>';/o:p
    \n15.                 print_r($mem->get($key));/o:p
    \n16.                 echo "\\r\\n";/o:p
    \n17.             }/o:p
    \n18.         }/o:p
    \n19.     }/o:p
    \n20.     ?>
    \n
    \n2、RUby版
    \n
    \n
    \n #!/usr/bin/env ruby  
    \n require 'socket'  
    \n   
    \n # stats  
    \n # stats reset  
    \n # stats malloc  
    \n # stats maps  
    \n # stats sizes  
    \n # stats slabs  
    \n # stats items  
    \n # stats cachedump slab_id limit_num  
    \n # stats detail [on|off|dump]  
    \n   
    \n class Memcache  
    \n   class << self  
    \n     def open(host, port)  
    \n       s = TCPSocket.open(host, port)  
    \n       yield s if block_given?  
    \n     ensure  
    \n       s.close if s  
    \n     end  
    \n     
    \n     def command(command_string, s)  
    \n       s.send(command_string + "\\r\\n", 0)  
    \n       buff = []  
    \n       until ["END", "OK", "DELETE", "ERROR"].include?(line = s.gets.strip) do  
    \n         buff << line   
    \n       end  
    \n       buff  
    \n     end  
    \n     
    \n     def exec(command_string, host = "javaeye", port = 11211)  
    \n       open(host, port) { |socket| command(command_string, socket).each {|line| puts line } }  
    \n     end  
    \n       
    \n     def cache_stats(host = "javaeye", port = 11211)  
    \n       cache_objects = {}  
    \n       open(host, port) do |socket|  
    \n         slabs = []  
    \n         command("stats items", socket).each do |line|  
    \n           slab_id = line.split[1].split(":")[1].to_i  
    \n           slabs << slab_id unless slabs.include?(slab_id)  
    \n         end  
    \n         slabs.each do |slab_id|  
    \n           puts "browse slab \#{slab_id}..."  
    \n           command("stats cachedump \#{slab_id} 0", socket).each do |item|  
    \n             key = item.split[1].split("/")[0].to_s  
    \n             cache_objects.include?(key) ? cache_objects[key] += 1 : cache_objects[key] = 1  
    \n           end  
    \n         end  
    \n       end  
    \n       cache_objects.each_pair {|key, value| puts "\#{key} : \#{value}"}  
    \n     end  
    \n   end  
    \n end  
    \n   
    \n if ARGV.size == 0  
    \n   Memcache.cache_stats  
    \n else  
    \n   Memcache.exec(ARGV.join(" "))  
    \n end 
    \n

    \n", "_id"=>964}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"超越深夜宕机,有感机房服务质量", "body"=>"

    深夜,开始升级,突然办公室断网,然后发现WEB服务器SSH不进去,Ping可以ping通,这个机器装了全站的nginx,导致全站都无法访问,非常紧急。

    \n

    打电话让机房重启,打了几十遍都没人接,幸好是在深夜,要不还不被投诉死,无奈,打车去中关村那边的机房,Y的看到三个值班的都在睡觉,FT。

    \n

    找到机柜,找到机器,没找到重启按钮,无奈,扯下电源线,再连接上,OK,重启,,重启后SSH进去,恢复。

    \n

    想那机房也算有口碑的,客服dianhu

    ", "created_at"=>2008-11-14 21:25:18 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    深夜,开始升级,突然办公室断网,然后发现WEB服务器SSH不进去,Ping可以ping通,这个机器装了全站的nginx,导致全站都无法访问,非常紧急。
    \n打电话让机房重启,打了几十遍都没人接,幸好是在深夜,要不还不被投诉死,无奈,打车去中关村那边的机房,Y的看到三个值班的都在睡觉,FT。
    \n找到机柜,找到机器,没找到重启按钮,无奈,扯下电源线,再连接上,OK,重启,,重启后SSH进去,恢复。
    \n想那机房也算有口碑的,客服dianhu

    \n", "_id"=>965}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成Nginx upload module解决上传大文件难题", "body"=>"

    做web开发的都知道用户上传大文件(比如照片,MP3等)需求有如下难题:
    \n1、文件的存储 -这个不难,买个NAS,规划好目录结构,在mount下就可以了;

    \n

    2、上传速度  --这个问题受限与用户带宽、服务器带宽以及服务器的处理时间,用户带宽无法控制,服务器端的带宽需要监控下,只要未达到上限,也不存在问题;还存在的一个问题就是服务器的处理。

    \n

    3、服务端处理 --这个处理包括请求的接收,文件的校验、存放等,如果文件比较大,在Rails中或许就存在一些问题,请求到web服务器,如Nginx后,达到其设定的缓存大小就发给后端的Rails,这样就会占一个链接直到处理完毕,而后端的thin或者其他的app服务器一共就那么点并发,导致上传比较频繁的时候,压力很大。

    \n

    一个比较不错的解决方案是使用Nginx的upload module,其用C编写的,其处理完上传后,将文件存在在设定的临时目录中,然后将文件路径和你设定的一次哦参数透传给后端的Rails;再用Rails处理一些基本的信息,返回处理结果就可以了,如此一个请求的处理时间也就10ms的样子,开2个thin就可以承受很大的压力了。

    \n

    这个实现还是挺简单,需要注意的upload module非默认的Nginx的module,需要另外下载和编译进去,另外还要注意文件存放的临时文件名可能出现同名的现象,在存取的时候需要留意下。

    \n

    \n

    \n
    Example configuration
    \n
      \n
    1. server {  
    2. \n
    3.     client_max_body_size 100m;  
    4. \n
    5.     listen       80;  
    6. \n
    7.   
    8. \n
    9.     # Upload form should be submitted to this location  
    10. \n
    11.     location /upload {  
    12. \n
    13.         # Pass altered request body to this location  
    14. \n
    15.         upload_pass   /test;  
    16. \n
    17.   
    18. \n
    19.         # Store files to this directory  
    20. \n
    21.         # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist  
    22. \n
    23.         upload_store /tmp 1;  
    24. \n
    25.           
    26. \n
    27.         # Allow uploaded files to be read only by user  
    28. \n
    29.         upload_store_access user:r;  
    30. \n
    31.   
    32. \n
    33.         # Set specified fields in request body  
    34. \n
    35.         upload_set_form_field $upload_field_name.name "$upload_file_name";  
    36. \n
    37.         upload_set_form_field $upload_field_name.content_type "$upload_content_type";  
    38. \n
    39.         upload_set_form_field $upload_field_name.path "$upload_tmp_path";  
    40. \n
    41.   
    42. \n
    43.         # Inform backend about hash and size of a file  
    44. \n
    45.         upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";  
    46. \n
    47.         upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";  
    48. \n
    49.   
    50. \n
    51.         upload_pass_form_field "^submit$|^description$";  
    52. \n
    53.   
    54. \n
    55.         upload_cleanup 400 404 499 500-505;  
    56. \n
    57.     }  
    58. \n
    59.   
    60. \n
    61.     # Pass altered request body to a backend  
    62. \n
    63.     location /test {  
    64. \n
    65.         internal;  
    66. \n
    67.         proxy_pass   http://localhost:8080;  
    68. \n
    69.     }  
    70. \n
    71. }  
    72. \n
    73.           
    74. \n
    \n
    \n有类型需求的可以留意下,我们现在用的很爽。

    ", "created_at"=>2008-11-29 06:00:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    做web开发的都知道用户上传大文件(比如照片,MP3等)需求有如下难题:
    \n1、文件的存储 -这个不难,买个NAS,规划好目录结构,在mount下就可以了;
    \n2、上传速度  --这个问题受限与用户带宽、服务器带宽以及服务器的处理时间,用户带宽无法控制,服务器端的带宽需要监控下,只要未达到上限,也不存在问题;还存在的一个问题就是服务器的处理。
    \n3、服务端处理 --这个处理包括请求的接收,文件的校验、存放等,如果文件比较大,在Rails中或许就存在一些问题,请求到web服务器,如Nginx后,达到其设定的缓存大小就发给后端的Rails,这样就会占一个链接直到处理完毕,而后端的thin或者其他的app服务器一共就那么点并发,导致上传比较频繁的时候,压力很大。
    \n一个比较不错的解决方案是使用Nginx的upload module,其用C编写的,其处理完上传后,将文件存在在设定的临时目录中,然后将文件路径和你设定的一次哦参数透传给后端的Rails;再用Rails处理一些基本的信息,返回处理结果就可以了,如此一个请求的处理时间也就10ms的样子,开2个thin就可以承受很大的压力了。
    \n这个实现还是挺简单,需要注意的upload module非默认的Nginx的module,需要另外下载和编译进去,另外还要注意文件存放的临时文件名可能出现同名的现象,在存取的时候需要留意下。
    \n
    \n
    \nExample configuration
    \n
    \n server {  
    \n     client_max_body_size 100m;  
    \n     listen       80;  
    \n   
    \n     # Upload form should be submitted to this location  
    \n     location /upload {  
    \n         # Pass altered request body to this location  
    \n         upload_pass   /test;  
    \n   
    \n         # Store files to this directory  
    \n         # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist  
    \n         upload_store /tmp 1;  
    \n           
    \n         # Allow uploaded files to be read only by user  
    \n         upload_store_access user:r;  
    \n   
    \n         # Set specified fields in request body  
    \n         upload_set_form_field $upload_field_name.name "$upload_file_name";  
    \n         upload_set_form_field $upload_field_name.content_type "$upload_content_type";  
    \n         upload_set_form_field $upload_field_name.path "$upload_tmp_path";  
    \n   
    \n         # Inform backend about hash and size of a file  
    \n         upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";  
    \n         upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";  
    \n   
    \n         upload_pass_form_field "^submit$|^description$";  
    \n   
    \n         upload_cleanup 400 404 499 500-505;  
    \n     }  
    \n   
    \n     # Pass altered request body to a backend  
    \n     location /test {  
    \n         internal;  
    \n         proxy_pass   http://localhost:8080;  
    \n     }  
    \n }  
    \n           
    \n
    \n
    \n有类型需求的可以留意下,我们现在用的很爽。

    \n", "_id"=>966}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.2风潮来临,资源大列表", "body"=>"

    \"\"

    \n

    Rails的发展速度真的不赖,从上次rails2.1发布到现在不过5个月的时间而已,现在Rails2.2已经发布了,速度不可谓不快,而这次更新涉及到的东西更多,更牛XX。

    \n

    以前已经说过一些Rails2.2的功能,比如线程安全,Etag等,就不说了,网上资源多的是,需要了解的自己链过去看吧,如下列举几个:

    \n

    http://weblog.rubyonrails.org/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs

    \n

    http://railscasts.com/episodes/137-memoization

    \n

    http://media.rubyonrails.org/video/rails_blog_2.mov

    ", "created_at"=>2008-11-29 07:38:32 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails的发展速度真的不赖,从上次rails2.1发布到现在不过5个月的时间而已,现在Rails2.2已经发布了,速度不可谓不快,而这次更新涉及到的东西更多,更牛XX。
    \n以前已经说过一些Rails2.2的功能,比如线程安全,Etag等,就不说了,网上资源多的是,需要了解的自己链过去看吧,如下列举几个:
    \nhttp://weblog.rubyonrails.org/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs
    \nhttp://railscasts.com/episodes/137-memoization
    \nhttp://media.rubyonrails.org/video/rails_blog_2.mov

    \n", "_id"=>967}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rsay: ruby interface to the google translation api", "body"=>"

    有的时候,需要对一些词语做转换(翻译),这个实现方式有两种,一种是使用Ruby或者其他语言做一些语言转换;一种是利用其它平台的接口API,翻译成目标语言。
    \n第二种方式实现起来比较方便,目前比较成熟的是Google translation ,但是其没有REST的接口,一般的做法是直接调用页面,用正则表达式抓取相关内容。
    \n在Ruby中已经有人写出了gem,比较方便,大概步骤如下:
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires json (>= 1.1.3, runtime)
    \ntaojer ~/softback: gem install json
    \nERROR:  While executing gem ... (Errno::EACCES)
    \n    Permission denied - /usr/lib/ruby/gems/1.8/cache/json-1.1.3.gem
    \ntaojer ~/softback: sudo gem install json
    \nBuilding native extensions.  This could take a while...
    \nSuccessfully installed json-1.1.3
    \n1 gem installed
    \nInstalling ri documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \nInstalling RDoc documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires htmlentities (>= 4.0.0, runtime)
    \ntaojer ~/softback: sudo gem install htmlentities
    \nSuccessfully installed htmlentities-4.0.0
    \n1 gem installed
    \nInstalling ri documentation for htmlentities-4.0.0...
    \nInstalling RDoc documentation for htmlentities-4.0.0...
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  While executing gem ... (Gem::FilePermissionError)
    \n    You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.
    \ntaojer ~/softback: sudo gem install  rsay-1.0.0.gem  --local
    \nSuccessfully installed rsay-1.0.0
    \n1 gem installed
    \n
    \n再看个例子,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. require "rubygems"  
    2. \n
    3. require "rsay"  
    4. \n
    5. result = Translate.t("Hello my Friend", Language::ENGLISH, Language::ITALIAN)  
    6. \n
    7. puts result  
    8. \n
    9. ------  
    10. \n
    11. taojer ~/tmpfiles: ruby t_c.rb  
    12. \n
    13. Ciao amico mio  
    14. \n
    \n
    \n

    参考:
    \nhttp://code.google.com/p/rsay/

    ", "created_at"=>2008-12-08 14:41:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    有的时候,需要对一些词语做转换(翻译),这个实现方式有两种,一种是使用Ruby或者其他语言做一些语言转换;一种是利用其它平台的接口API,翻译成目标语言。
    \n第二种方式实现起来比较方便,目前比较成熟的是Google translation ,但是其没有REST的接口,一般的做法是直接调用页面,用正则表达式抓取相关内容。
    \n在Ruby中已经有人写出了gem,比较方便,大概步骤如下:
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires json (>= 1.1.3, runtime)
    \ntaojer ~/softback: gem install json
    \nERROR:  While executing gem ... (Errno::EACCES)
    \n    Permission denied - /usr/lib/ruby/gems/1.8/cache/json-1.1.3.gem
    \ntaojer ~/softback: sudo gem install json
    \nBuilding native extensions.  This could take a while...
    \nSuccessfully installed json-1.1.3
    \n1 gem installed
    \nInstalling ri documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \nInstalling RDoc documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires htmlentities (>= 4.0.0, runtime)
    \ntaojer ~/softback: sudo gem install htmlentities
    \nSuccessfully installed htmlentities-4.0.0
    \n1 gem installed
    \nInstalling ri documentation for htmlentities-4.0.0...
    \nInstalling RDoc documentation for htmlentities-4.0.0...
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  While executing gem ... (Gem::FilePermissionError)
    \n    You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.
    \ntaojer ~/softback: sudo gem install  rsay-1.0.0.gem  --local
    \nSuccessfully installed rsay-1.0.0
    \n1 gem installed
    \n
    \n再看个例子,如下:
    \n
    \nRuby代码
    \n
    \n require "rubygems"  
    \n require "rsay"  
    \n result = Translate.t("Hello my Friend", Language::ENGLISH, Language::ITALIAN)  
    \n puts result  
    \n ------  
    \n taojer ~/tmpfiles: ruby t_c.rb  
    \n Ciao amico mio  
    \n
    \n
    \n参考:
    \nhttp://code.google.com/p/rsay/

    \n", "_id"=>968}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rake: uninitialized constant ActiveRecord", "body"=>"

    写了一个task,执行的时候一直报:

    \n``rake aborted!
    uninitialized constant ActiveRecord
    迷糊了半天,发现task中忘记加“=> :environment”了。
    参考:http://www.ruby-forum.com/topic/143124```", "created_at"=>2008-12-15 06:59:33 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    写了一个task,执行的时候一直报:
    \nrake aborted!<br />uninitialized constant ActiveRecord<br />迷糊了半天,发现task中忘记加&ldquo;=&gt; :environment&rdquo;了。<br />参考:http://www.ruby-forum.com/topic/143124`

    \n", "_id"=>969}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Music Fingerprint: 音乐指纹认知篇", "body"=>"

    音乐指纹,是采用特定的算法对音乐文件的声波进行分析得到的唯一码,主要用于自动分类和标识音乐文件。
    \n当前国外拥有此项技术专利的公司有GracenoteMusicIP等,其基本原理是通过对音乐文件的全部或部分声波(通常是音乐文件的前几分钟)进行分析产生音乐指纹数据,这部分技术难度并不太大,关键的问题是对音乐指纹进行比对,当前Gracenote已经支持对一首音乐文件的任意部分(至少需要10秒的数据)进行指纹识别。
    \n由MusicIP开发的一个叫libofa的开源音乐指纹生成软件可以从MusicDNS得到,它是通过对音乐文件的前135秒进行分析产生音乐指纹,为了提高匹配的准确性,通常在提交音乐指纹的同时也提取音乐文件的其他信息如MP3文件的ID3信息等。

    \n

    PS:部分播放器号称利用音乐指纹技术来做的歌词同步实际上是通过音乐文件的相关信息(如MP3的ID3信息)来确定该文件,并非真正意义上的音乐指纹技术。

    \n

    这项技术在国内尚未有实际的使用,国内对音频文件分析的时候,一般是采用ID3信息,而对音乐指纹的使用目前还是空白的。不过这个空白很快就被填补了。

    \n

    参考资料:

    \n

    http://code.google.com/p/musicip-libofa/

    \n

    http://blog.jooit.com/?p=1352

    ", "created_at"=>2008-12-21 12:50:56 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    音乐指纹,是采用特定的算法对音乐文件的声波进行分析得到的唯一码,主要用于自动分类和标识音乐文件。
    \n当前国外拥有此项技术专利的公司有Gracenote和MusicIP等,其基本原理是通过对音乐文件的全部或部分声波(通常是音乐文件的前几分钟)进行分析产生音乐指纹数据,这部分技术难度并不太大,关键的问题是对音乐指纹进行比对,当前Gracenote已经支持对一首音乐文件的任意部分(至少需要10秒的数据)进行指纹识别。
    \n由MusicIP开发的一个叫libofa的开源音乐指纹生成软件可以从MusicDNS得到,它是通过对音乐文件的前135秒进行分析产生音乐指纹,为了提高匹配的准确性,通常在提交音乐指纹的同时也提取音乐文件的其他信息如MP3文件的ID3信息等。
    \nPS:部分播放器号称利用音乐指纹技术来做的歌词同步实际上是通过音乐文件的相关信息(如MP3的ID3信息)来确定该文件,并非真正意义上的音乐指纹技术。
    \n这项技术在国内尚未有实际的使用,国内对音频文件分析的时候,一般是采用ID3信息,而对音乐指纹的使用目前还是空白的。不过这个空白很快就被填补了。
    \n参考资料:
    \nhttp://code.google.com/p/musicip-libofa/
    \nhttp://blog.jooit.com/?p=1352

    \n", "_id"=>970}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的圣诞大餐: Merb&Rails合作了", "body"=>"

    Ruby的来两大主流框架都挺不错的,至少我做Ruby,也时常使用merb写东西,在我看来,两者上午有点非常鲜明,但是从来不曾想到raila和merb会合作。个人感觉DHH和Ezra两个领军人物性格差异非常大,DHH看上去更hacker一点,有时会有点偏执和自以为是,有时会和zed就raills缺点炒得热火朝天;而Ezra则显得内敛的多,内敛低调,虚心接受很多建议,自身也非常牛。Ezra更像一个程序员。

    \n

    但是,真的,Merb和rails会在下个版本开始合作,按照merb官方的说法,会将merb很多好的经验带给rails,而merb依然是存在的。很多人对这个消息绝对的感兴趣,一些天天吵着是merb好还是rails好的问题的人也终于可以歇歇了。

    \n

    rails又将迎来哪些大的变革,AR难道也会成插件,会引入merb多少东西,非常值得期待;rails到目前这个版本(2.2.2),明显感觉到发展的瓶颈,这次rails2.2.2的发布,并没有带来想象中的异常强大的东西,国际化和线程安全在ruby1.8上效果不甚理想,国际化也被人口水了一把,再不搞出点花样,估计又有人急了,而这次动作还算大,也算是圣诞的大餐吧,但是应该需要等到明年5月才会发布版本。

    \n

    回头再想想,merb的如意算盘应该是借助rails推广自己的engineyard,也很不错。

    \n

    PS:手指被菜刀划破了,打字真鬼速,囧。。

    \n

    参考信息:

    \n

    http://yehudakatz.com/2008/12/23/rails-and-merb-merge/

    \n

    http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3

    ", "created_at"=>2008-12-24 14:59:44 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Ruby的来两大主流框架都挺不错的,至少我做Ruby,也时常使用merb写东西,在我看来,两者上午有点非常鲜明,但是从来不曾想到raila和merb会合作。个人感觉DHH和Ezra两个领军人物性格差异非常大,DHH看上去更hacker一点,有时会有点偏执和自以为是,有时会和zed就raills缺点炒得热火朝天;而Ezra则显得内敛的多,内敛低调,虚心接受很多建议,自身也非常牛。Ezra更像一个程序员。
    \n但是,真的,Merb和rails会在下个版本开始合作,按照merb官方的说法,会将merb很多好的经验带给rails,而merb依然是存在的。很多人对这个消息绝对的感兴趣,一些天天吵着是merb好还是rails好的问题的人也终于可以歇歇了。
    \nrails又将迎来哪些大的变革,AR难道也会成插件,会引入merb多少东西,非常值得期待;rails到目前这个版本(2.2.2),明显感觉到发展的瓶颈,这次rails2.2.2的发布,并没有带来想象中的异常强大的东西,国际化和线程安全在ruby1.8上效果不甚理想,国际化也被人口水了一把,再不搞出点花样,估计又有人急了,而这次动作还算大,也算是圣诞的大餐吧,但是应该需要等到明年5月才会发布版本。
    \n回头再想想,merb的如意算盘应该是借助rails推广自己的engineyard,也很不错。
    \nPS:手指被菜刀划破了,打字真鬼速,囧。。
    \n参考信息:
    \nhttp://yehudakatz.com/2008/12/23/rails-and-merb-merge/
    \nhttp://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3

    \n", "_id"=>971}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Android: 好东西终究是要爆发的", "body"=>"我不是专业的手机软件开发者,但是和古老的程序员的hacker精神一样,每个合格的程序员都想出品一款让自己足够骄傲的程序,在PC或者server上已经发展到团队作战的模式,散兵已经没有足够的精力做出多牛X的东西;而Android的的出现又给大家一个不错的平台。\n\n就我个人而言,Android上的开发还是很优雅的,虽然XML的layout还是有点点的简陋,但是相比于在java中写UI要舒服的多,2009年,注定会是移动互联网爆发和充满无限期待的一年,我看好的多媒体应用也终将走上移动设备,3G、wifi的顺利实施会让我们有更多的选择和期待,唯一希望的就是大家都遵守游戏的规则,不要把整个产业链都霸占了,只给自己吃肉,不让他人的喝粥的做法是无法长久的。\n\n想把什么都攥在自己手里的人最后会发现,围墙里的只有他自己一个人。\n\n平安夜,外面会有多热闹,北京的街头被各种彩灯装饰的非常绚丽,然而我却很不习惯如此的面子工程,热闹的街头也很大的风,我还是习惯躲回屋子,冲上一杯咖啡,写写代码,看看书。\n\n写着写着,发现跑题了,平安夜,但愿人人平安。", "created_at"=>2008-12-24 15:17:29 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    我不是专业的手机软件开发者,但是和古老的程序员的hacker精神一样,每个合格的程序员都想出品一款让自己足够骄傲的程序,在PC或者server上已经发展到团队作战的模式,散兵已经没有足够的精力做出多牛X的东西;而Android的的出现又给大家一个不错的平台。

    \n\n

    就我个人而言,Android上的开发还是很优雅的,虽然XML的layout还是有点点的简陋,但是相比于在java中写UI要舒服的多,2009年,注定会是移动互联网爆发和充满无限期待的一年,我看好的多媒体应用也终将走上移动设备,3G、wifi的顺利实施会让我们有更多的选择和期待,唯一希望的就是大家都遵守游戏的规则,不要把整个产业链都霸占了,只给自己吃肉,不让他人的喝粥的做法是无法长久的。

    \n\n

    想把什么都攥在自己手里的人最后会发现,围墙里的只有他自己一个人。

    \n\n

    平安夜,外面会有多热闹,北京的街头被各种彩灯装饰的非常绚丽,然而我却很不习惯如此的面子工程,热闹的街头也很大的风,我还是习惯躲回屋子,冲上一杯咖啡,写写代码,看看书。

    \n\n

    写着写着,发现跑题了,平安夜,但愿人人平安。

    \n", "_id"=>972}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"休假养伤,期间安排", "body"=>"

    大悲大喜的2008年也是我的本命年,中国发生了很多大大小小的或喜或悲的事情,我也发生了很多那些传说会在本命年发生的事情,囧~总之还好,2008年已经过去了。

    \n

    上次去滑雪,无奈的是手腕摔伤了,非常无奈还是右手手腕,现在就是用一个左手打字的,右手还打折石膏呢,医生说了差不多要1-2月才能恢复,算算时间,才过去10天,还要慢慢恢复了,幸好年关了,公司事情不是很多了,主要做产品讨论和技术预研,加上一个手生活多有不便,于是就请假呆在家好好养伤。

    \n

    由于受伤的是右手,不方便IM,有事情的给我发mail吧。。

    \n

    接下来一段时间,一来好好养伤,二来需要接触些新东西,大概列举一下吧:

    \n
      \n
    • 熟悉android,完成预定的目标(可能会让你大吃一惊的)
    • \n
    • 熟悉Erlang,在年后项目中将会使用,今天大概了解了下,语法够怪异的,但是机制是我梦寐的;
    • \n
    • 还要一本《构建可扩展的web站点》需要慢慢体会
    • \n
    • 还有一本中医枕边书,自学自用
    • \n
    • 如果时间允许,还有一半Flex。
    • \n
    \n

    哇,好多,抓紧看书。。

    ", "created_at"=>2009-01-09 02:31:49 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    大悲大喜的2008年也是我的本命年,中国发生了很多大大小小的或喜或悲的事情,我也发生了很多那些传说会在本命年发生的事情,囧~总之还好,2008年已经过去了。
    \n上次去滑雪,无奈的是手腕摔伤了,非常无奈还是右手手腕,现在就是用一个左手打字的,右手还打折石膏呢,医生说了差不多要1-2月才能恢复,算算时间,才过去10天,还要慢慢恢复了,幸好年关了,公司事情不是很多了,主要做产品讨论和技术预研,加上一个手生活多有不便,于是就请假呆在家好好养伤。
    \n由于受伤的是右手,不方便IM,有事情的给我发mail吧。。
    \n接下来一段时间,一来好好养伤,二来需要接触些新东西,大概列举一下吧:
    \n
    \n 熟悉android,完成预定的目标(可能会让你大吃一惊的)
    \n 熟悉Erlang,在年后项目中将会使用,今天大概了解了下,语法够怪异的,但是机制是我梦寐的;
    \n 还要一本《构建可扩展的web站点》需要慢慢体会
    \n 还有一本中医枕边书,自学自用
    \n 如果时间允许,还有一半Flex。
    \n
    \n哇,好多,抓紧看书。。

    \n", "_id"=>973}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"进程&消息: 开始Erlang之旅", "body"=>"

    知道Erlang很久了,在我接触Ruby不久之后就了解了Erlang,但是一直没静下心好好看,恰巧利用这段时间开始我的Erlang之旅吧。

    \n

    说句题外话,Erlang这个名字我很有亲切感,要是熟悉我的人肯定不会奇怪,呵呵。

    \n

    Erlang概述
    \n
    \nErlang不但是一种编程语言,而且它具有比编程语言更加贴近操作系统的一些特性:并发线程、作业调度、内存管理、分布式、网络化等。据说使用Erlang编写的Yaws Web服务器,其并发性能是apache的15倍!(这个没啥好炫耀的吧~)
    \n
    \n这个Erlang初始开源版本包含了Erlang的实现,同时它也是用于构建分布式高可用性系统的Ericsson中间件的最大组成部分。
    \n
    \nErlang具有以下特性:
    \n
    \n并发性 - Erlang具有超强的轻量级进程,这种进程对内存的需求是动态变化的,并且它没有共享内存和通过异步消息传送的通讯。Erlang支持超大量级的并发线程,并且不需要操作系统具有并发机制。
    \n
    \n分布式 - Erlang被设计用于运行在分布式环境下。一个Erlang虚拟机被成为Erlang节点。一个分布式Erlang系统是多个Erlang节点组成的网络(通常每个处理器被作为一个节点)。一个Erlang节点能够创建运行在其它节点上的并行线程,而其它节点可以使用其它操作系统。线程依赖不同节点之间的通讯,这完全和它依赖于单一节点一样。
    \n
    \n健壮性 - Erlang具有多种基本的错误检测能力,它们能够用于构建容错系统。例如,进程能够监控其它进程的状态和活动,甚至这些进程是在其它节点上执行。在分布式系统中的线程能够配置为在其它节点故障的情况下自动进行故障恢复,并在故障节点恢复时自动迁移回到恢复节点。
    \n
    \n软实时性 - Erlang支持可编程的“软”实时系统,这种系统需要反应时间在毫秒级。而在这种系统中,长时间的垃圾收集(garbage collection)延迟是无法接受的,因此Erlang使用了递增式垃圾收集技术。
    \n
    \n热代码升级 - 一些系统不能够由于软件维护而停止运行。Erlang允许程序代码在运行系统中被修改。旧代码能被逐步淘汰而后被新代码替换。在此过渡期间,新旧代码是共存的。这也使得安装bug补丁、在运行系统上升级而不干扰系统操作成为了可能。
    \n
    \n递增式代码装载 - 用户能够控制代码如何被装载的细节。在嵌入式系统中,所有代码通常是在启动时就被完全装载。而在开发系统中,代码是按需装载的,甚至在系统运行时被装载的。如果测试到了未覆盖的bug,那么只有具有bug的代码需要被替换。
    \n
    \n外部接口 - Erlang进程与外部世界之间的通讯使用和在Erlang进程之间相同的消息传送机制。这种机制被用于和操作系统通讯、与其它语言编写的程序交互。如果出于高效率的需要,这种机制的一个特殊版本也允许例如C程序这样的代码直接链接到Erlang运行时系统中来。

    \n

    入门参考文档:

    \n", "created_at"=>2009-01-09 02:44:43 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    知道Erlang很久了,在我接触Ruby不久之后就了解了Erlang,但是一直没静下心好好看,恰巧利用这段时间开始我的Erlang之旅吧。
    \n说句题外话,Erlang这个名字我很有亲切感,要是熟悉我的人肯定不会奇怪,呵呵。
    \nErlang概述
    \n
    \nErlang不但是一种编程语言,而且它具有比编程语言更加贴近操作系统的一些特性:并发线程、作业调度、内存管理、分布式、网络化等。据说使用Erlang编写的Yaws Web服务器,其并发性能是apache的15倍!(这个没啥好炫耀的吧~)
    \n
    \n这个Erlang初始开源版本包含了Erlang的实现,同时它也是用于构建分布式高可用性系统的Ericsson中间件的最大组成部分。
    \n
    \nErlang具有以下特性:
    \n
    \n并发性 - Erlang具有超强的轻量级进程,这种进程对内存的需求是动态变化的,并且它没有共享内存和通过异步消息传送的通讯。Erlang支持超大量级的并发线程,并且不需要操作系统具有并发机制。
    \n
    \n分布式 - Erlang被设计用于运行在分布式环境下。一个Erlang虚拟机被成为Erlang节点。一个分布式Erlang系统是多个Erlang节点组成的网络(通常每个处理器被作为一个节点)。一个Erlang节点能够创建运行在其它节点上的并行线程,而其它节点可以使用其它操作系统。线程依赖不同节点之间的通讯,这完全和它依赖于单一节点一样。
    \n
    \n健壮性 - Erlang具有多种基本的错误检测能力,它们能够用于构建容错系统。例如,进程能够监控其它进程的状态和活动,甚至这些进程是在其它节点上执行。在分布式系统中的线程能够配置为在其它节点故障的情况下自动进行故障恢复,并在故障节点恢复时自动迁移回到恢复节点。
    \n
    \n软实时性 - Erlang支持可编程的“软”实时系统,这种系统需要反应时间在毫秒级。而在这种系统中,长时间的垃圾收集(garbage collection)延迟是无法接受的,因此Erlang使用了递增式垃圾收集技术。
    \n
    \n热代码升级 - 一些系统不能够由于软件维护而停止运行。Erlang允许程序代码在运行系统中被修改。旧代码能被逐步淘汰而后被新代码替换。在此过渡期间,新旧代码是共存的。这也使得安装bug补丁、在运行系统上升级而不干扰系统操作成为了可能。
    \n
    \n递增式代码装载 - 用户能够控制代码如何被装载的细节。在嵌入式系统中,所有代码通常是在启动时就被完全装载。而在开发系统中,代码是按需装载的,甚至在系统运行时被装载的。如果测试到了未覆盖的bug,那么只有具有bug的代码需要被替换。
    \n
    \n外部接口 - Erlang进程与外部世界之间的通讯使用和在Erlang进程之间相同的消息传送机制。这种机制被用于和操作系统通讯、与其它语言编写的程序交互。如果出于高效率的需要,这种机制的一个特殊版本也允许例如C程序这样的代码直接链接到Erlang运行时系统中来。
    \n入门参考文档:
    \n
    \n http://erlang.org/about.html
    \n http://www.matrix.org.cn/resource/article/2007-09-04/2948b459-5ac5-11dc-af81-f34262335978.html
    \n http://erlang-china.org/misc/simplified_erlang.html
    \n http://www.douban.com/subject/3260311/

    \n", "_id"=>974}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"Android的Orientation Sensor三个坐标的含义", "body"=>"

    以前在黑莓手机里面有个GPS跟踪软件非常有趣,可以显示目前的方向,在Android中使用其提供的Sensor非常方便,如下是强制Landscape时候的情况:
    \n
    \nvalues[0]:方位角(水平旋转角),简单的说就是手机的头现在朝向哪个方位,0=北、90=东、180=南、270=西(可是好像不太准)
    \nvalues[1]:纵向旋转角,0=面朝上平置、-90=垂直向上、-180/180=面朝下平置、90=垂直向下
    \nvalues[2]:橫向旋转角,0=朝前、90=往右倒、-90=往左倒

    ", "created_at"=>2009-01-18 06:39:42 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    以前在黑莓手机里面有个GPS跟踪软件非常有趣,可以显示目前的方向,在Android中使用其提供的Sensor非常方便,如下是强制Landscape时候的情况:
    \n
    \nvalues[0]:方位角(水平旋转角),简单的说就是手机的头现在朝向哪个方位,0=北、90=东、180=南、270=西(可是好像不太准)
    \nvalues[1]:纵向旋转角,0=面朝上平置、-90=垂直向上、-180/180=面朝下平置、90=垂直向下
    \nvalues[2]:橫向旋转角,0=朝前、90=往右倒、-90=往左倒

    \n", "_id"=>975}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"在Android中计算GPS两点间的距离/速度", "body"=>"

    Q:how to get distance between two GeoPoints in sdk 1.0 ? MapPoint.distanceSquared(MapPoint) is gone \"Sad\"
    \nthaks!!
    \n

    \n

    A:you'll need to brush up on your trigonometry, and first compute the Haversine function (this is the standard way of doing it). In order to use the Java trig functions, you'll have to first convert all your angles from degrees to radians.
    \nGiven two longitude/latitude pairs, and the earth's average radius (assume 6356.78km for your calculations),
    \nyou can calculate the distance between the 2 points via this Java code:
    \n
    \n \tdouble EarthRad = 6356.78;\t// in km !
    \n// first convert to radians...
    \ndouble geo1_lat = geo1.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo1_lng = geo1.getLongitude()*java.lang.Math.PI/360;
    \ndouble geo2_lat = geo2.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo2_lng = geo2.getLongitude()*java.lang.Math.PI/360;
    \n
    \ndouble deltaLat = java.lang.Math.abs(java.lang.Math.abs(geo2_lat) - java.lang.Math.abs(geo1_lat));
    \ndouble deltaLng = java.lang.Math.abs(java.lang.Math.abs(geo2_lng) - java.lang.Math.abs(geo1_lng));
    \n
    \ndouble dist = 2*EarthRad*java.lang.Math.asin(java.lang.Math.sqrt(haversine(deltaLat)
    \n+ java.lang.Math.cos(pair1_lat)
    \n*java.lang.Math.cos(pair1_lng)*haversine(deltaLng)));
    \n
    \nWhere "dist" now contains the distance between along the earth's surface.
    \nYou can find the Haversine function trig equation by Googling it, then construct a method that returns the appropriate value.

    \n

    Computing the speed is straightforward: you know your sampling frequency, and you now know the distance between the most recent two points, so, employee speed = distance / sampling interval

    \n

    参考:http://www.anddev.org/distance_between_two_geopoints_in_sdk10-t4195.html

    \n

    http://www.anddev.org/calculating_distance_between_two_gps_points-t3708.html

    \n


    \n

    ", "created_at"=>2009-01-18 07:02:07 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Q:how to get distance between two GeoPoints in sdk 1.0 ? MapPoint.distanceSquared(MapPoint) is gone
    \nthaks!!
    \n
    \nA:you'll need to brush up on your trigonometry, and first compute the Haversine function (this is the standard way of doing it). In order to use the Java trig functions, you'll have to first convert all your angles from degrees to radians.
    \nGiven two longitude/latitude pairs, and the earth's average radius (assume 6356.78km for your calculations),
    \nyou can calculate the distance between the 2 points via this Java code:
    \n
    \n double EarthRad = 6356.78; // in km !
    \n// first convert to radians...
    \ndouble geo1_lat = geo1.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo1_lng = geo1.getLongitude()*java.lang.Math.PI/360;
    \ndouble geo2_lat = geo2.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo2_lng = geo2.getLongitude()*java.lang.Math.PI/360;
    \n
    \ndouble deltaLat = java.lang.Math.abs(java.lang.Math.abs(geo2_lat) - java.lang.Math.abs(geo1_lat));
    \ndouble deltaLng = java.lang.Math.abs(java.lang.Math.abs(geo2_lng) - java.lang.Math.abs(geo1_lng));
    \n
    \ndouble dist = 2*EarthRad*java.lang.Math.asin(java.lang.Math.sqrt(haversine(deltaLat)
    \n+ java.lang.Math.cos(pair1_lat)
    \n*java.lang.Math.cos(pair1_lng)*haversine(deltaLng)));
    \n
    \nWhere "dist" now contains the distance between along the earth's surface.
    \nYou can find the Haversine function trig equation by Googling it, then construct a method that returns the appropriate value.
    \nComputing the speed is straightforward: you know your sampling frequency, and you now know the distance between the most recent two points, so, employee speed = distance / sampling interval
    \n参考:http://www.anddev.org/distance_between_two_geopoints_in_sdk10-t4195.html
    \nhttp://www.anddev.org/calculating_distance_between_two_gps_points-t3708.html
    \n

    \n", "_id"=>976}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>977}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>978}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>979}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>980}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>981}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>982}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>983}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>984}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>985}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>986}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>987}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>988}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>989}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>990}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>991}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>992}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>993}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>994}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>995}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>996}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>997}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>998}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>999}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>1000}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>1001}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>1002}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>1003}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>1004}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>1005}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>1006}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>1007}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>1008}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"遭遇爬虫,关闭所有文章的评论", "body"=>"遭遇万恶的爬虫和网络灌水机,奇怪的是我的验证码无法挡住,每篇文章都被垃圾灌了几百给回复,我懒得改这套blog系统的代码,早上把DB里的垃圾回复都删掉了,同时将所有文章的回复都关闭了,望周知。\r\n\r\n如果您需要和我交流,可以通过右侧方式联系到我。", "created_at"=>2009-06-18 03:04:22 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    遭遇万恶的爬虫和网络灌水机,奇怪的是我的验证码无法挡住,每篇文章都被垃圾灌了几百给回复,我懒得改这套blog系统的代码,早上把DB里的垃圾回复都删掉了,同时将所有文章的回复都关闭了,望周知。

    \n\n

    如果您需要和我交流,可以通过右侧方式联系到我。

    \n", "_id"=>1009}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Get POSSIBLE BREAK-IN ATTEMPT msg when i ssh to s server", "body"=>"

    when i ssh to a server,i get some message like this:

    \n

    Address 192.168.5.12 maps to localhost, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!

    \n

    Solution:

    \n

    Modify the "/etc/ssh/ssh_config" file at localhost

    \n

     GSSAPIAuthentication no

    \n

    exp:

    \n

    ssh 192.168.1.110时报错上述错,本地是192.168.1.20 ,则修改本地192.168.1.20中的/etc/ssh/ssh_config,把参数GSSAPIAuthentication no修改就可以了。。或者修改服务器端192.168.1.110上的/etc/ssh/sshd_config ,把参数GSSAPIAuthentication no改了也可以。要注意的是/etc/ssh/ssh_config和/etc/ssh/sshd_confg的区别。

    ", "created_at"=>2009-06-19 02:17:03 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    when i ssh to a server,i get some message like this:
    \nAddress 192.168.5.12 maps to localhost, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!
    \nSolution:
    \nModify the "/etc/ssh/ssh_config" file at localhost
    \n GSSAPIAuthentication no
    \nexp:
    \nssh 192.168.1.110时报错上述错,本地是192.168.1.20 ,则修改本地192.168.1.20中的/etc/ssh/ssh_config,把参数GSSAPIAuthentication no修改就可以了。。或者修改服务器端192.168.1.110上的/etc/ssh/sshd_config ,把参数GSSAPIAuthentication no改了也可以。要注意的是/etc/ssh/ssh_config和/etc/ssh/sshd_confg的区别。

    \n", "_id"=>1010}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>1011}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>1012}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>1013}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"回到深圳,安静的体会生活...", "body"=>"时隔几个月之后,我再次回到深圳,一切都还是那么熟悉,前两天去办理护照,坐在公交车上,快速的浏览深圳的感觉,很好,这是个充满活力的城市,和北京的感觉截然不同。\n深圳是年轻的,跳动的,每个人都在演绎着自己的角色~这次回来要呆上很长一段时间,在10月中旬,会去一次马来西亚,然后到合肥举办婚礼,再就要回老家呆上几天。\n在深圳,安静的体会生活...", "created_at"=>2009-09-22 02:38:50 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    时隔几个月之后,我再次回到深圳,一切都还是那么熟悉,前两天去办理护照,坐在公交车上,快速的浏览深圳的感觉,很好,这是个充满活力的城市,和北京的感觉截然不同。
    \n深圳是年轻的,跳动的,每个人都在演绎着自己的角色~这次回来要呆上很长一段时间,在10月中旬,会去一次马来西亚,然后到合肥举办婚礼,再就要回老家呆上几天。
    \n在深圳,安静的体会生活...

    \n", "_id"=>1014}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android market的通信协议还是比较安全的", "body"=>"今天起了大大早,搬出十八般武器研究起android market的数据通讯,想看看是数据传输的方式以加以借鉴和参考。\n最终结果是Sniffer到数据通信了,但是无法破解其使用的协议,最终很多内容无法还原,如此看来其走的肯定是一套私有的协议,那么下一步就是,有时间的话反编译android market客户端的源代码,看看其协议是怎么样的。\n截图一张:\n\"TM截图未命名\"", "created_at"=>2009-09-24 02:00:39 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    今天起了大大早,搬出十八般武器研究起android market的数据通讯,想看看是数据传输的方式以加以借鉴和参考。
    \n最终结果是Sniffer到数据通信了,但是无法破解其使用的协议,最终很多内容无法还原,如此看来其走的肯定是一套私有的协议,那么下一步就是,有时间的话反编译android market客户端的源代码,看看其协议是怎么样的。
    \n截图一张:

    \n", "_id"=>1015}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>1016}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>1017}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMobile实习生计划", "body"=>"开始招实习生了,有兴趣的帮忙留意和推荐下。\n\neoeMobile是一支立足于移动互联网,平均年龄大概在25岁左右的创业公司,在eoeMobile里你会天天享受和eoeMobile一起实现目标的兴奋和快乐,这里没有死板而无趣没用的制度,也没有如履薄冰的分层级的感觉,在这里我们平等,互助,尊重,高效,这里就是你实现梦想的起点。\n\n不同阶段我们会有不同的实习生计划,目前需要的实习生如下:\n\n【网站前端 (front end) 实习工程师, 设计师】\n1,CS/EE或相关专业本科\n2,必须熟悉HTML, CSS,JS\n3,对界面设计极为敏感,关注细节的完美主义者优先\n4,关注WEB2.0应用和移动平台技术发展\n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感\n\nP.S. 加入eoeMobile,你将成为国内顶级移动互联网开发团队一员,在高速发展的最新移动平台上做创新应用\n\n【Android实习工程师】 \n1,CS/EE或相关专业本科或研究生;本科成绩优秀,或有实习工作经验\n2,必须熟悉Java语言,可以使用linux工作环境\n3,熟悉MySQL, Rails, HTML,CSS, subversion(svn)者优先\n4,有移动平台开发经验者优先\n5,关注WEB2.0应用和移动平台技术(Android, iphone, webkit)发展\n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感。\n7. 喜欢做有挑战的事情,不服输,不达目标誓不罢休。\n8. 有幽默感者优先。\n加入eoeMobile你就会和大量优秀而又有趣的人并肩工作,你就可以看到大量Android商战的源码,你可以以更快的速度成长。\n\neoeMobile正在快速发展中,我们相信eoeMobile在我们的努力下会有很大的发展舞台(请有兴趣应聘的工程师将中文或英文简历发至 iceskysl@eoemobile.com )", "created_at"=>2009-10-09 23:54:14 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    开始招实习生了,有兴趣的帮忙留意和推荐下。

    \n\n

    eoeMobile是一支立足于移动互联网,平均年龄大概在25岁左右的创业公司,在eoeMobile里你会天天享受和eoeMobile一起实现目标的兴奋和快乐,这里没有死板而无趣没用的制度,也没有如履薄冰的分层级的感觉,在这里我们平等,互助,尊重,高效,这里就是你实现梦想的起点。

    \n\n

    不同阶段我们会有不同的实习生计划,目前需要的实习生如下:

    \n\n

    【网站前端 (front end) 实习工程师, 设计师】
    \n1,CS/EE或相关专业本科
    \n2,必须熟悉HTML, CSS,JS
    \n3,对界面设计极为敏感,关注细节的完美主义者优先
    \n4,关注WEB2.0应用和移动平台技术发展
    \n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感

    \n\n

    P.S. 加入eoeMobile,你将成为国内顶级移动互联网开发团队一员,在高速发展的最新移动平台上做创新应用

    \n\n

    【Android实习工程师】
    \n1,CS/EE或相关专业本科或研究生;本科成绩优秀,或有实习工作经验
    \n2,必须熟悉Java语言,可以使用linux工作环境
    \n3,熟悉MySQL, Rails, HTML,CSS, subversion(svn)者优先
    \n4,有移动平台开发经验者优先
    \n5,关注WEB2.0应用和移动平台技术(Android, iphone, webkit)发展
    \n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感。
    \n7. 喜欢做有挑战的事情,不服输,不达目标誓不罢休。
    \n8. 有幽默感者优先。
    \n加入eoeMobile你就会和大量优秀而又有趣的人并肩工作,你就可以看到大量Android商战的源码,你可以以更快的速度成长。

    \n\n

    eoeMobile正在快速发展中,我们相信eoeMobile在我们的努力下会有很大的发展舞台(请有兴趣应聘的工程师将中文或英文简历发至 iceskysl@eoemobile.com )

    \n", "_id"=>1018}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Unicorn: Rack HTTP server for fast clients and Unix", "body"=>"\"\"\n\nUnicorn是一个几乎使用纯Ruby编写的HTTP server,主要用于Rack应用。Unicon的创建作者是Eric Wong,它基于Mongrel(包括Ragel/C HTTP分析器),采用同样的许可-Ruby license和GPL2,但对Mongrel进行了改良。\n
      \n\t
    • Unicorn设计的初衷是为了Rack,Unix,更快的客户端,易于调试等;
    • \n\t
    • 很好的兼容了Ruby 1.8和Ruby 1.9,并且对Rubinius的支持也在计划之内;
    • \n\t
    • 流程管理: Unicorn会重新启动出错的应用。你无需管理多个进程或端口,Unicorn可以管理任意数量的进程;
    • \n\t
    • 负载平衡:完全使用操作系统内核;
    • \n\t
    • 支持所有Rack应用;
    • \n\t
    • 简单方面的Ruby DSL配置;
    • \n\t
    • ……
    • \n
    \n

    点击阅读详情:\n\n\n\n

    \n", "created_at"=>2009-10-11 00:52:20 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Unicorn是一个几乎使用纯Ruby编写的HTTP server,主要用于Rack应用。Unicon的创建作者是Eric Wong,它基于Mongrel(包括Ragel/C HTTP分析器),采用同样的许可-Ruby license和GPL2,但对Mongrel进行了改良。
    \n
    \n Unicorn设计的初衷是为了Rack,Unix,更快的客户端,易于调试等;
    \n 很好的兼容了Ruby 1.8和Ruby 1.9,并且对Rubinius的支持也在计划之内;
    \n 流程管理: Unicorn会重新启动出错的应用。你无需管理多个进程或端口,Unicorn可以管理任意数量的进程;
    \n 负载平衡:完全使用操作系统内核;
    \n 支持所有Rack应用;
    \n 简单方面的Ruby DSL配置;
    \n ……
    \n
    \n点击阅读详情:

    \n\n

    I like Unicorn because it's Unix
    \n RailsConf 2009: powered by OMG UNICORNS!!!!
    \n

    \n", "_id"=>1019}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>1020}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"第一次去香港随笔", "body"=>"在深圳呆了3年了,一直没去过香港,前段时间办护照的时候,顺带把港澳通行证也办了下,找了个时间去那边转了下,总体来说,和我想象中的还有些不一样。\n\n深圳去香港比较方便,在我住的不远的地方,就没半个小时一趟直通香港的大巴车,到佐敦下车,票价也不是很贵,单程60,来回90,非常方便。\n\n8点爬起来,拿着信用卡就去车站了,买票,上车,8点半出发,途径深圳湾大桥,在海关排了一会队,都比较顺利,也熟悉了过关的手续。到达香港佐敦10点半不到,由于第一次来,也没仔细查地图,下了车还是有点小晕,幸好在不远处发现一个7-11,闪进去买了点早餐,换了点港币(亏了),然后就一边吃东西,一遍瞎逛,满街卖珠宝和银行,真不愧是金融中心。\n\n吃完早餐,路过一个书局,跑进去找了地图研究了一把,把地铁搞清楚差不多就不晕了,出来直奔地铁,买票去旺角,电影里经常看到这个地方,2站,香港地铁很完善,但是里面的设计也不是很清晰,我拿了卡,试了几次才晓得要塞进去,再从另外一个地冒出来,和北京的直接刷,深圳的地铁笔还是很不一样的。\n\n出了旺角地铁,迎面而来的就是熙熙攘攘的街道和人了,数码产品,衣服,银行,珠宝等等非常多,眼花缭乱,不多停留,凭感觉找到主干道,办事!\n\n办完事,在街上瞎逛,竟然遇到了轮子的宣传,狂汗!买了些化妆品,买了些特产,去找回来的车,6点半回来,过关,也没人检查,8点半到我住的地方。\n\n由于时间不多,加上第一次不是很熟悉,另外几个地方诸如中环,铜锣湾,湾仔这些地方都还没去,下次去的时候再去。\n\n总体感受,还没看到非常现代化的大楼,见到的是比较原始面貌的,这也许就是以前的香港吧。", "created_at"=>2009-10-15 04:51:32 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在深圳呆了3年了,一直没去过香港,前段时间办护照的时候,顺带把港澳通行证也办了下,找了个时间去那边转了下,总体来说,和我想象中的还有些不一样。

    \n\n

    深圳去香港比较方便,在我住的不远的地方,就没半个小时一趟直通香港的大巴车,到佐敦下车,票价也不是很贵,单程60,来回90,非常方便。

    \n\n

    8点爬起来,拿着信用卡就去车站了,买票,上车,8点半出发,途径深圳湾大桥,在海关排了一会队,都比较顺利,也熟悉了过关的手续。到达香港佐敦10点半不到,由于第一次来,也没仔细查地图,下了车还是有点小晕,幸好在不远处发现一个7-11,闪进去买了点早餐,换了点港币(亏了),然后就一边吃东西,一遍瞎逛,满街卖珠宝和银行,真不愧是金融中心。

    \n\n

    吃完早餐,路过一个书局,跑进去找了地图研究了一把,把地铁搞清楚差不多就不晕了,出来直奔地铁,买票去旺角,电影里经常看到这个地方,2站,香港地铁很完善,但是里面的设计也不是很清晰,我拿了卡,试了几次才晓得要塞进去,再从另外一个地冒出来,和北京的直接刷,深圳的地铁笔还是很不一样的。

    \n\n

    出了旺角地铁,迎面而来的就是熙熙攘攘的街道和人了,数码产品,衣服,银行,珠宝等等非常多,眼花缭乱,不多停留,凭感觉找到主干道,办事!

    \n\n

    办完事,在街上瞎逛,竟然遇到了轮子的宣传,狂汗!买了些化妆品,买了些特产,去找回来的车,6点半回来,过关,也没人检查,8点半到我住的地方。

    \n\n

    由于时间不多,加上第一次不是很熟悉,另外几个地方诸如中环,铜锣湾,湾仔这些地方都还没去,下次去的时候再去。

    \n\n

    总体感受,还没看到非常现代化的大楼,见到的是比较原始面貌的,这也许就是以前的香港吧。

    \n", "_id"=>1021}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"笔记本要罢工了。", "body"=>"结婚后,还没来得及整理下生活,最近几日都在路上,酒席一场接着一场,赶的很。\n不幸的是跟随我3年多的笔记本罢工了,开始是电池无法使用了,接着是系统在一次断电后崩溃了,然后硬盘好像也有点不对劲,加上早就罢工被我拆除的光驱,现在剩下的部件好像不多了。\n真要换本了,好像。", "created_at"=>2009-10-30 09:00:38 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    结婚后,还没来得及整理下生活,最近几日都在路上,酒席一场接着一场,赶的很。
    \n不幸的是跟随我3年多的笔记本罢工了,开始是电池无法使用了,接着是系统在一次断电后崩溃了,然后硬盘好像也有点不对劲,加上早就罢工被我拆除的光驱,现在剩下的部件好像不多了。
    \n真要换本了,好像。

    \n", "_id"=>1022}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"开始使用mac pro", "body"=>"前面说道,我用了3年多的本本终于再办完他最后一件重要的事情后罢工了,在tina的坚持下,我终于败家了一把,使用上了mac pro,机器是自己去香港买的,价格比大陆行货便宜不少,由于之对mac系统了解不是很多,所以使用起来还不是非常的顺手。\n\n自我感觉mac非常适合懒人,因为其帮你做了很多事情,不需要你自己再去折腾,但是对我这种比较爱折腾的人,还是有些不适应,win xp倒是被我折腾的很顺手。\n\n偶也算加入mac一族了,但是感觉没有我想象中的那么激动~\n\nps:昨天去村子里买了一个键膜,发现很不好用,搞得我手指超级疲劳,就丢一边去了,还是原始的键盘敲着舒服。", "created_at"=>2009-11-08 03:01:52 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前面说道,我用了3年多的本本终于再办完他最后一件重要的事情后罢工了,在tina的坚持下,我终于败家了一把,使用上了mac pro,机器是自己去香港买的,价格比大陆行货便宜不少,由于之对mac系统了解不是很多,所以使用起来还不是非常的顺手。

    \n\n

    自我感觉mac非常适合懒人,因为其帮你做了很多事情,不需要你自己再去折腾,但是对我这种比较爱折腾的人,还是有些不适应,win xp倒是被我折腾的很顺手。

    \n\n

    偶也算加入mac一族了,但是感觉没有我想象中的那么激动~

    \n\n

    ps:昨天去村子里买了一个键膜,发现很不好用,搞得我手指超级疲劳,就丢一边去了,还是原始的键盘敲着舒服。

    \n", "_id"=>1023}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"如何让 Safari 默认使用新标签打开链接", "body"=>"xi喜欢chorme而不喜欢safari的原因之一就是safari每次打开链接都是新窗口,除非你按着Command,很不习惯,然后我找了半天也没再其设置中找到可以设置的地方,搞得我桌面上经常一大堆的safari窗口。\n\n于是开始寻找如何修改可以似的safari默认打开的链接是在信标签中的,于是找到如下方法:\n\n方法:\n\n1、打开 Terminal,Finder -> Applications -> Utilitys -> Terminal。。\n\n2、粘贴下面这段代码到 Terminal 中并回车,进行执行,即完成了激活。\n\ndefaults write com.apple.Safari TargetedClicksCreateTabs -bool true\n\n3、要撤销这个设置,你只需在 Terminal 中执行下面这条命令就行。\n\ndefaults delete com.apple.Safari TargetedClicksCreateTabs\n\n注意,在执行这两个命令后,重启 Safari 浏览器就ok了。", "created_at"=>2009-11-08 03:06:48 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    xi喜欢chorme而不喜欢safari的原因之一就是safari每次打开链接都是新窗口,除非你按着Command,很不习惯,然后我找了半天也没再其设置中找到可以设置的地方,搞得我桌面上经常一大堆的safari窗口。

    \n\n

    于是开始寻找如何修改可以似的safari默认打开的链接是在信标签中的,于是找到如下方法:

    \n\n

    方法:

    \n\n

    1、打开 Terminal,Finder -> Applications -> Utilitys -> Terminal。。

    \n\n

    2、粘贴下面这段代码到 Terminal 中并回车,进行执行,即完成了激活。

    \n\n

    defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

    \n\n

    3、要撤销这个设置,你只需在 Terminal 中执行下面这条命令就行。

    \n\n

    defaults delete com.apple.Safari TargetedClicksCreateTabs

    \n\n

    注意,在执行这两个命令后,重启 Safari 浏览器就ok了。

    \n", "_id"=>1024}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"install mercurial and Go Programming Language", "body"=>"Having installed mercurial via easy_install,\n
    eoe:~ IceskYsl$ sudo easy_install mercurial\nPassword:\nSearching for mercurial\nReading http://pypi.python.org/simple/mercurial/\nReading http://www.selenic.com/mercurial\nBest match: mercurial 1.3.1
    \nany hg command fails with:\nValueError: unknown locale: UTF-8\n\nThis is mercurial 1.3.1and Python 2.6.1, but its seem that its caused by Leopard’s Term.app not setting the local encoding correctly. To resolve this, add the following to .profile:\n
    export LC_ALL=en_US.UTF-8\nexport LANG=en_US.UTF-8
    \nthen i clone the code for Go Programming Language\n
    eoe:system IceskYsl$ printenv LANG\neoe:system IceskYsl$ export LC_ALL=en_US.UTF-8\neoe:system IceskYsl$ export LANG=en_US.UTF-8\neoe:system IceskYsl$ hg clone -r release https://go.googlecode.com/hg/ go\nrequesting all changes\nadding changesets\nadding manifests\nadding file changes\nadded 3976 changesets with 16799 changes to 2931 files\nupdating working directory\n1640 files updated, 0 files merged, 0 files removed, 0 files unresolved
    \nhttp://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/", "created_at"=>2009-11-12 17:53:55 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Having installed mercurial via easy_install,
    \neoe:~ IceskYsl$ sudo easy_install mercurial
    \nPassword:
    \nSearching for mercurial
    \nReading http://pypi.python.org/simple/mercurial/
    \nReading http://www.selenic.com/mercurial
    \nBest match: mercurial 1.3.1
    \nany hg command fails with:
    \nValueError: unknown locale: UTF-8

    \n\n

    This is mercurial 1.3.1and Python 2.6.1, but its seem that its caused by Leopard’s Term.app not setting the local encoding correctly. To resolve this, add the following to .profile:
    \nexport LC_ALL=en_US.UTF-8
    \nexport LANG=en_US.UTF-8
    \nthen i clone the code for Go Programming Language
    \neoe:system IceskYsl$ printenv LANG
    \neoe:system IceskYsl$ export LC_ALL=en_US.UTF-8
    \neoe:system IceskYsl$ export LANG=en_US.UTF-8
    \neoe:system IceskYsl$ hg clone -r release https://go.googlecode.com/hg/ go
    \nrequesting all changes
    \nadding changesets
    \nadding manifests
    \nadding file changes
    \nadded 3976 changesets with 16799 changes to 2931 files
    \nupdating working directory
    \n1640 files updated, 0 files merged, 0 files removed, 0 files unresolved
    \nhttp://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/

    \n", "_id"=>1025}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"how to avoid Net::SMTPFatalError (555 5.5.2 Syntax error.", "body"=>"i can not get notify email from my ExceptionNotifier in rails project,i notice some useful msg in the production logs:\n
    Net::SMTPFatalError (555 5.5.2 Syntax error. b17sm72261fka.43
    \n\n google....\n
    @from = \"\#{sender}\"\n If I submit an email id, It is giving error as\n (Net::SMTPFatalError) \"555 5.5.2 Syntax error. d29sm1994943and.38\\n\"\n\nThe from line is the problem. The Net::SMTP library was recently changed\nso it adds angle brackets to your sender, so you cannot have any in your\nstring. Try this as a workaround:\n@from = \"a...@xxxxxxx\"
    \n\nso,just fix it like this:\nExceptionNotifier.sender_address = %(\"iceskysl\" )\nto\nExceptionNotifier.sender_address = %(iceskysl@eoemobile.com)", "created_at"=>2009-11-12 19:58:54 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    i can not get notify email from my ExceptionNotifier in rails project,i notice some useful msg in the production logs:
    \nNet::SMTPFatalError (555 5.5.2 Syntax error. b17sm72261fka.43

    \n\n

    google....
    \n@from = "\#{sender}a...@xxxxxxx"
    \n If I submit an email id, It is giving error as
    \n (Net::SMTPFatalError) "555 5.5.2 Syntax error. d29sm1994943and.38\\n"

    \n\n

    The from line is the problem. The Net::SMTP library was recently changed
    \nso it adds angle brackets to your sender, so you cannot have any in your
    \nstring. Try this as a workaround:
    \n@from = "a...@xxxxxxx"

    \n\n

    so,just fix it like this:
    \nExceptionNotifier.sender_address = %("iceskysl" iceskysl@eoemobile.com)
    \nto
    \nExceptionNotifier.sender_address = %(iceskysl@eoemobile.com)

    \n", "_id"=>1026}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>1027}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>1028}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>1029}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>1030}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Facebooker error UnableToLoadAdapter", "body"=>"If you see an error that looks like\n
    /home/brickfactor/facebooker_tutorial/vendor/plugins/facebooker/lib/facebooker\n/adapters/adapter_base.rb:43:in `load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)\n/RAILS_APP/vendor/plugins/facebooker/lib/facebooker/adapters/adapter_base.rb:43:in `load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:121:in `load_adapter'\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:65:in `apply_configuration'\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:45:in `load_configuration'\nfrom /RAILS_APP/vendor/plugins/facebooker/rails/../init.rb:6
    \nIts because you haven’t configured config/facebooker.yml file correctly, or at all. (Most tutorials etc. have you creating and editing this file after you install facebooker)", "created_at"=>2009-11-26 13:31:29 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    If you see an error that looks like
    \n/home/brickfactor/facebooker_tutorial/vendor/plugins/facebooker/lib/facebooker
    \n/adapters/adapter_base.rb:43:in load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)
    \n/RAILS_APP/vendor/plugins/facebooker/lib/facebooker/adapters/adapter_base.rb:43:in
    load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:121:in load_adapter'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:65:in
    apply_configuration'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:45:in `load_configuration'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/rails/../init.rb:6
    \nIts because you haven’t configured config/facebooker.yml file correctly, or at all. (Most tutorials etc. have you creating and editing this file after you install facebooker)

    \n", "_id"=>1031}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完,继续写", "body"=>"前段时间原来用的slicehost的VPS不想用了,其速度越来越慢,特别是SSH的时候超级慢,导致我每次SSH都是煎熬,终于下定决心抛弃。\n后来购买了linode,说实在的,linode比slicehost要好用,特别是数据migrate的时候,真是一件幸福的事情,本来linode的VPS早就买了,只是这些天从北京到深圳,一直有很多事情在折腾,也没来得及将之前的blog内容恢复。\n昨天夜里看到闲逛到一个朋友的地盘,其记录了4年的广州生活,旅游,点点滴滴,很不错,今天得闲就把自己的blog恢复了~\n还好,数据我全部都备份了,导入导出还算顺利,折腾了一会PHP,倒是顺利,这个blog还是主要记录我的技术话题,生活blog内容不在这里写很多。\n回头看下,我这个blog貌似从2007年5月就开始写了,到现在也差不多2年多了~", "created_at"=>2010-01-13 00:42:39 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前段时间原来用的slicehost的VPS不想用了,其速度越来越慢,特别是SSH的时候超级慢,导致我每次SSH都是煎熬,终于下定决心抛弃。
    \n后来购买了linode,说实在的,linode比slicehost要好用,特别是数据migrate的时候,真是一件幸福的事情,本来linode的VPS早就买了,只是这些天从北京到深圳,一直有很多事情在折腾,也没来得及将之前的blog内容恢复。
    \n昨天夜里看到闲逛到一个朋友的地盘,其记录了4年的广州生活,旅游,点点滴滴,很不错,今天得闲就把自己的blog恢复了~
    \n还好,数据我全部都备份了,导入导出还算顺利,折腾了一会PHP,倒是顺利,这个blog还是主要记录我的技术话题,生活blog内容不在这里写很多。
    \n回头看下,我这个blog貌似从2007年5月就开始写了,到现在也差不多2年多了~

    \n", "_id"=>1032}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>1033}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>1034}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>1035}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Fixing Ruby no such file to load readline error in centOS", "body"=>"Does this error message look familar when you script/console?\n````[iceskysl@li1248 current]$ ./script/console production\nLoading production environment (Rails 2.3.5)\n/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)\n from /usr/local/lib/ruby/1.8/irb/completion.rb:10\n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'\n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'\n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'\n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'\n from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'\n from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'\n from /usr/local/bin/irb:13```\nthis happens when readline is somehow different than your current version of ruby or corrupted. The quick fix is to recompile readline. To do it in CentOS with yum:\n````$> yum install readline-devel -y\n$> cd /root/src/ruby-1.8.6-p114/ext/readline/\n$> ruby extconf.rb\n$> make\n$> sudo make install ```\nNow you should have script/console working.", "created_at"=>2010-01-19 21:46:28 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Does this error message look familar when you script/console?
    \n[iceskysl@li1248 current]$ ./script/console production
    \nLoading production environment (Rails 2.3.5)
    \n/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
    \n from /usr/local/lib/ruby/1.8/irb/completion.rb:10
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
    \n from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
    \n from /usr/local/bin/irb:13```
    \nthis happens when readline is somehow different than your current version of ruby or corrupted. The quick fix is to recompile readline. To do it in CentOS with yum:
    \n
    $> yum install readline-devel -y
    \n$> cd /root/src/ruby-1.8.6-p114/ext/readline/
    \n$> ruby extconf.rb
    \n$> make
    \n$> sudo make install ```
    \nNow you should have script/console working.

    \n", "_id"=>1036}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>1037}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>1038}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>1039}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>1040}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Make a short link with Bit.ly", "body"=>"link = 'http://www.wired.com'\nshort_link = open('http://bit.ly/api?url=' + link, \"UserAgent\" => \"Ruby-ShortLinkCreator\").read\n# => \"http://bit.ly/AvxfY\"\n参考资料:\nhttp://code.google.com/p/bitly-api/wiki/ApiDocumentation\nhttp://j.mp/\nhttp://code.google.com/p/bitlyj/\nhttp://github.com/philnash/bitly", "created_at"=>2010-01-25 05:49:36 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    link = 'http://www.wired.com'
    \nshort_link = open('http://bit.ly/api?url=' + link, "UserAgent" => "Ruby-ShortLinkCreator").read

    \n\n

    => "http://bit.ly/AvxfY"

    \n\n

    参考资料:
    \nhttp://code.google.com/p/bitly-api/wiki/ApiDocumentation
    \nhttp://j.mp/
    \nhttp://code.google.com/p/bitlyj/
    \nhttp://github.com/philnash/bitly

    \n", "_id"=>1041}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>1042}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>1043}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>1044}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>1045}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>1046}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>1047}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>1048}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>1049}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>1050}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>1051}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>1052}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>1053}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>1054}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>1055}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>1056}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>1057}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>1058}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>1059}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>1060}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>1061}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>1062}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>1063}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:47:03 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>1064}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>1065}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>1066}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>1067}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>1068}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>1069}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Nginx的X-Accel-Redirect在Rails中发送文件", "body"=>"很多时候,我们会遇到需要一些业务逻辑(例如鉴权)后才将文件发送给客户端,那么如果将附件保存在public目录下将是非常不合适的,为了安全起见,你最好是将其保存在客户端无法直接访问的到的目录下,在处理完业务逻辑后,在将文件发送给客户端,Rails中提供了 send_XXXX来发送文件;\n\n但是使用Rails的app server(thin,mongrel,passenger etc.)来发送文件(特别是大文件)一直都不是一个靠谱的方案,rails提供的send_file和send_data在理论上是可以工作的,但是其会阻塞进程,消耗内存,等等系列的弊端,而诸如apache,Lighttpd,Nginx等web server在处理静态文件上有着得天独厚的优势。\n\n于是聪明的人们就想,可以使用app server处理业务逻辑,然后再让web server来接管处理剩下的文件发送,所以就有了mod_xsendfile for Apache2Lighttp中提供的X-Sendfile功能,Nginx自然也有类似的功能,只是其名字不叫X-Sendfile,而是叫X-Accel-Redirect(这个名字好像更容易理解)。 这里主要说Nginx,Apache的自行查阅资料,先了解下原理:\n
      \n\t
    1. The header must contain a URI
    2. \n\t
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n定义一段配置:\n``location /protected/ {\n internal;\n root /some/path;\n}```\n``然后在你的应用中:```\n``\n``add_header(\"X-Accel-Redirect: /protected/iso.img\");```\n``然后Nginx就接管了你的请求,发送/some/path/protected/iso.img这个文件。```\n``原理了解了,看看如何使用更快捷,自然是用插件,有人写出了一个插件:X-Accel-Redirect```\n``\n
    \n
    = X-Accel-Redirect
    \nThis Rails plugin allows users to take advantage of nginx's X-Accel-Redirect header, similar to X-Send-File.```\n
    == Install\nYou should install it as a plugin, running this command on your projects root directory:\n     $ script/plugin install git://github.com/goncalossilva/X-Accel-Redirect.git```\n
    == Usage\nX-Accel-Redirect has an equivalent method to Rails <i>send_file</i>, called <b>x_accel_redirect</b>. Using is as easy as:\n     x_accel_redirect \"/path/to/file\", :filename => \"filename\"\nAll <i>send_file</i> options are available using this method. Now you can even let your old <b>:x_sendfile</b> option since the plugin will discard it.```\n
    ```\n
    参考:
    ```\n``\n``wiki.nginx.org/NginxXSendfile```\n``\n

    USING NGINX TO SEND FILES WITH X-ACCEL-REDIRECT

    \n
    ```\nThe complete nginx solution to sending flowers and files with rails ```\n``[译]利用Nginx的X-Accel-Redirect头实现下载控制(附带php和rails实例)```", "created_at"=>2010-04-17 18:06:38 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    很多时候,我们会遇到需要一些业务逻辑(例如鉴权)后才将文件发送给客户端,那么如果将附件保存在public目录下将是非常不合适的,为了安全起见,你最好是将其保存在客户端无法直接访问的到的目录下,在处理完业务逻辑后,在将文件发送给客户端,Rails中提供了 send_XXXX来发送文件;

    \n\n

    但是使用Rails的app server(thin,mongrel,passenger etc.)来发送文件(特别是大文件)一直都不是一个靠谱的方案,rails提供的send_file和send_data在理论上是可以工作的,但是其会阻塞进程,消耗内存,等等系列的弊端,而诸如apache,Lighttpd,Nginx等web server在处理静态文件上有着得天独厚的优势。

    \n\n

    于是聪明的人们就想,可以使用app server处理业务逻辑,然后再让web server来接管处理剩下的文件发送,所以就有了mod_xsendfile for Apache2和Lighttp中提供的X-Sendfile功能,Nginx自然也有类似的功能,只是其名字不叫X-Sendfile,而是叫X-Accel-Redirect(这个名字好像更容易理解)。 这里主要说Nginx,Apache的自行查阅资料,先了解下原理:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n定义一段配置:
    \n<a href="/NginxHttpCoreModule#location">location</a> /protected/ {
    \n <a href="/NginxHttpCoreModule#internal">internal</a>;
    \n <a href="/NginxHttpCoreModule#root">root</a> /some/path;
    \n}

    \n
    然后在你的应用中:
    \n

    \nadd_header("X-Accel-Redirect: /protected/iso.img");
    \n
    然后Nginx就接管了你的请求,发送<strong>/some/path/protected/iso.img</strong>这个文件。
    \n
    原理了解了,看看如何使用更快捷,自然是用插件,有人写出了一个插件:X-Accel-Redirect
    \n``
    \n<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">
    \n<div id="_mcePaste">= X-Accel-Redirect</div>
    \nThis Rails plugin allows users to take advantage of nginx's X-Accel-Redirect header, similar to X-Send-File.

    \n== Install
    \nYou should install it as a plugin, running this command on your projects root directory:
    \n $ script/plugin install git://github.com/goncalossilva/X-Accel-Redirect.git
    \n<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">== Usage
    \nX-Accel-Redirect has an equivalent method to Rails &lt;i&gt;send_file&lt;/i&gt;, called &lt;b&gt;x_accel_redirect&lt;/b&gt;. Using is as easy as:
    \n x_accel_redirect "/path/to/file", :filename =&gt; "filename"
    \nAll &lt;i&gt;send_file&lt;/i&gt; options are available using this method. Now you can even let your old &lt;b&gt;:x_sendfile&lt;/b&gt; option since the plugin will discard it.

    \n
    \n<div id="_mcePaste"><strong>参考:</strong></div>

    \n
    \n
    wiki.nginx.org/NginxXSendfile
    \n``<span style="font-family: Georgia, Times, 'Times New Roman', serif; line-height: 21px; white-space: normal; color: #21211e; font-size: 13px;">
    \n<h1 class="entry-title" style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; font-weight: bold; clear: both; text-transform: uppercase; letter-spacing: 2px; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a href="http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/">USING NGINX TO SEND FILES WITH X-ACCEL-REDIRECT</a></h1>
    \n</span>

    \nThe complete nginx solution to sending flowers and files with rails
    \n``<a href="http://bianbian.org/technology/linux/154.html">[译]利用Nginx的X-Accel-Redirect头实现下载控制(附带php和rails实例)</a>

    \n", "_id"=>1070}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"publish a rails plugin:Nginx-X-Accel-Redirect", "body"=>"前面2个文章说到了在Rails中使用send_file实现断点续传《在rails下实现多线程下载和断点续传》和利用Nginx的X-Accel-Redirect实现发送大文件《使用Nginx的X-Accel-Redirect在Rails中发送文件》,项目中需要两个功能,就把他整合起来,同时发布到github上了,Nginx-X-Accel-Redirect。\n\n简介:\nThis Rails plugin allows users to take advantage of nginx’s X-Accel-Redirect header, similar to X-Send-File and Content-Range.\n\n安装:\n$ script/plugin install git://github.com/IceskYsl/Nginx-X-Accel-Redirect.git\n\n使用:\nx_accel_redirect \"/path/to/file\", :filename => \"filename\",:root=>\"/path/to/root\"\n\n详细信息:github.com/IceskYsl/Nginx-X-Accel-Redirect", "created_at"=>2010-04-17 21:37:59 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    前面2个文章说到了在Rails中使用send_file实现断点续传《在rails下实现多线程下载和断点续传》和利用Nginx的X-Accel-Redirect实现发送大文件《使用Nginx的X-Accel-Redirect在Rails中发送文件》,项目中需要两个功能,就把他整合起来,同时发布到github上了,Nginx-X-Accel-Redirect。

    \n\n

    简介:
    \nThis Rails plugin allows users to take advantage of nginx’s X-Accel-Redirect header, similar to X-Send-File and Content-Range.

    \n\n

    安装:
    \n$ script/plugin install git://github.com/IceskYsl/Nginx-X-Accel-Redirect.git

    \n\n

    使用:
    \nx_accel_redirect "/path/to/file", :filename => "filename",:root=>"/path/to/root"

    \n\n

    详细信息:github.com/IceskYsl/Nginx-X-Accel-Redirect

    \n", "_id"=>1071}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"restful_authentication的加密真复杂", "body"=>"以前一个项目中直接使用了restful_authentication,耶没怎么管生成的密码是啥样的,最近有几个系统要对接,需要统一用户,于是看了下restful_authentication的密码加密原则,发现其真是负责,一共分成下面几个部分:\n\n1.定义了一个40位的REST_AUTH_SITE_KEY和一样我常量10的REST_AUTH_DIGEST_STRETCHES;\n\n2.随机生成一个salt,其salt生成的规则是secure_digest(Time.now, (1..10).map{ rand.to_s }),而secure_digest是Digest::SHA1.hexdigest来生成的,也是40位。\n\n3.将salt和原始密码,混合前面定义的REST_AUTH_SITE_KEY,反复加密REST_AUTH_DIGEST_STRETCHES次,得到最终的一个digest就是密码了。\n\n够复杂~ 为啥搞这么负责呢,直接随机salt加双MD5不可逆加密也应该够用了吧。", "created_at"=>2010-04-18 10:29:06 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    以前一个项目中直接使用了restful_authentication,耶没怎么管生成的密码是啥样的,最近有几个系统要对接,需要统一用户,于是看了下restful_authentication的密码加密原则,发现其真是负责,一共分成下面几个部分:

    \n\n

    1.定义了一个40位的REST_AUTH_SITE_KEY和一样我常量10的REST_AUTH_DIGEST_STRETCHES;

    \n\n

    2.随机生成一个salt,其salt生成的规则是secure_digest(Time.now, (1..10).map{ rand.to_s }),而secure_digest是Digest::SHA1.hexdigest来生成的,也是40位。

    \n\n

    3.将salt和原始密码,混合前面定义的REST_AUTH_SITE_KEY,反复加密REST_AUTH_DIGEST_STRETCHES次,得到最终的一个digest就是密码了。

    \n\n

    够复杂~ 为啥搞这么负责呢,直接随机salt加双MD5不可逆加密也应该够用了吧。

    \n", "_id"=>1072}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Paperclip,按日期划分目录方法", "body"=>"一个项目用到了图片上传,不想自己写处理过程了,于是就找找可以使用的插件,看到了Paperclip,大概了看了下代码和使用介绍,比较简洁。\n\n装上测试了下,整个过程比较顺利,很快就集成了需要的功能,但是具体到我的需求 上,花了点时间,我的需求也比较常见,就是大量的图片不能就存在一个文件夹下(否则这么多的小文件会带来很多的隐患),于是看代码找找其是否支持分目录的方案,我直接基本上都是按时间来分成诸如\"2010/0428/\"这样的目录,但是找了一圈,发现其提供了timestamp的一个变量,但是其结果比较糟糕,文件夹中还会根据当代的locale出现一些等下,不太合适;\n\n然后看到其提供了一个:id_partition的参数,其意思是:\n
    # Returns the id of the instance in a split path form. e.g. returns\n\n# 000/001/234 for an id of 1234.
    \n
    和我预期的差不多,如果决定这个数字还不够,可以修改其代码,如下:
    \n
    \n
    def id_partition attachment, style_name
    \n
    (\"%09d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    你可以再加3位(这下应该足够了,千亿级别的了),分成四个等级
    \n
    \n
    def id_partition attachment, style_name
    \n
    (\"%12d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    \n
    \n
    然后我们可以按照这个方式专辑实现安装日期类分目录的,代码如下:
    \n
    \n
    # Returns the timestamp of the instance in a split path form. e.g. returns
    \n
    # 2010/0428 for an id of 2010.04.28
    \n
    def timestamp_partition attachment, style_name
    \n
    attachment.instance_read(:updated_at).strftime(\"%Y/%m%d/\")
    \n
    # (\"%09d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    \n
    然后给model加上:
    \n
    \n
    has_attached_file :logo, :styles => {:thumb => '64x64>', :small => \"150x150>\" },
    \n
    :url => \"/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension\",
    \n
    :path => \":rails_root/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension\"
    \n
    \n
    \n
    其得到的结果类似:
    \n
    \n
    [paperclip] Saving attachments.
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg
    \n[paperclip] Saving attachments.[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg\n\n参考:\n\nhttp://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/\n\nhttp://cn.asciicasts.com/episodes/134-paperclip\n\nhttp://github.com/thoughtbot/paperclip\n\nhttp://gist.github.com/165072", "created_at"=>2010-04-27 11:11:25 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    一个项目用到了图片上传,不想自己写处理过程了,于是就找找可以使用的插件,看到了Paperclip,大概了看了下代码和使用介绍,比较简洁。

    \n\n

    装上测试了下,整个过程比较顺利,很快就集成了需要的功能,但是具体到我的需求 上,花了点时间,我的需求也比较常见,就是大量的图片不能就存在一个文件夹下(否则这么多的小文件会带来很多的隐患),于是看代码找找其是否支持分目录的方案,我直接基本上都是按时间来分成诸如"2010/0428/"这样的目录,但是找了一圈,发现其提供了timestamp的一个变量,但是其结果比较糟糕,文件夹中还会根据当代的locale出现一些等下,不太合适;

    \n\n

    然后看到其提供了一个:id_partition的参数,其意思是:
    \n# Returns the id of the instance in a split path form. e.g. returns

    \n\n

    000/001/234 for an id of 1234.

    \n\n

    和我预期的差不多,如果决定这个数字还不够,可以修改其代码,如下:
    \n
    \ndef id_partition attachment, style_name
    \n("%09d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n你可以再加3位(这下应该足够了,千亿级别的了),分成四个等级
    \n
    \ndef id_partition attachment, style_name
    \n("%12d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n
    \n
    \n然后我们可以按照这个方式专辑实现安装日期类分目录的,代码如下:
    \n
    \n# Returns the timestamp of the instance in a split path form. e.g. returns
    \n# 2010/0428 for an id of 2010.04.28
    \ndef timestamp_partition attachment, style_name
    \nattachment.instance_read(:updated_at).strftime("%Y/%m%d/")
    \n# ("%09d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n
    \n然后给model加上:
    \n
    \nhas_attached_file :logo, :styles => {:thumb => '64x64>', :small => "150x150>" },
    \n:url => "/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension",
    \n:path => ":rails_root/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension"
    \n
    \n
    \n其得到的结果类似:
    \n
    \n[paperclip] Saving attachments.
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg
    \n[paperclip] Saving attachments.[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg

    \n\n

    参考:

    \n\n

    http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/

    \n\n

    http://cn.asciicasts.com/episodes/134-paperclip

    \n\n

    http://github.com/thoughtbot/paperclip

    \n\n

    http://gist.github.com/165072

    \n", "_id"=>1073}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>1074}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Encrypt & Decrypt in ruby", "body"=>"``require 'openssl'\nrequire 'digest/sha1'\nc = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\nc.encrypt\n# your pass is what is used to encrypt/decrypt\nc.key = key = Digest::SHA1.hexdigest(\"yourpass\")\nc.iv = iv = c.random_iv\ne = c.update(\"crypt this\")\ne << c.final\nputs \"encrypted: \#{e}\\n\"\nc = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\nc.decrypt\nc.key = key\nc.iv = iv\nd = c.update(e)\nd << c.final\nputs \"decrypted: \#{d}\\n\"```\n`````\n``\n``require 'openssl'\n\nkeyfile = 'test.key'\ncertfile = 'test.crt'\ndata = \"this is a test\"\n\ncert = OpenSSL::X509::Certificate.new(File.read(certfile))\nkey = OpenSSL::PKey::RSA.new(File.read(keyfile))\ncipher = OpenSSL::Cipher::AES.new(\"128-CBC\")\n\ntmp = OpenSSL::PKCS7.encrypt([cert], data, cipher,\nOpenSSL::PKCS7::BINARY)\np7 = OpenSSL::PKCS7::PKCS7.new(tmp.to_der)\n\n## Data will be stored as string so emulate that here\np7s = p7.to_s\n\n## Create pkcs7 object out of pkcs7 data\np7 = OpenSSL::PKCS7::PKCS7.new(p7s)\ndec = p7.decrypt(key,cert)\nprint dec```\n```\nhttp://nunojob.wordpress.com/2008/12/08/rsa-encrypt-decrypt-in-ruby/\n\nhttp://www.ruby-forum.com/topic/79319", "created_at"=>2010-05-14 21:58:00 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    ``require 'openssl'
    \nrequire 'digest/sha1'
    \nc = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
    \nc.encrypt

    \n\n

    your pass is what is used to encrypt/decrypt

    \n\n

    c.key = key = Digest::SHA1.hexdigest("yourpass")
    \nc.iv = iv = c.random_iv
    \ne = c.update("crypt this")
    \ne << c.final
    \nputs "encrypted: \#{e}\\n"
    \nc = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
    \nc.decrypt
    \nc.key = key
    \nc.iv = iv
    \nd = c.update(e)
    \nd << c.final
    \nputs "decrypted: \#{d}\\n"
    \n

    \n

    \n``require 'openssl'

    \n\n

    keyfile = 'test.key'
    \ncertfile = 'test.crt'
    \ndata = "this is a test"

    \n\n

    cert = OpenSSL::X509::Certificate.new(File.read(certfile))
    \nkey = OpenSSL::PKey::RSA.new(File.read(keyfile))
    \ncipher = OpenSSL::Cipher::AES.new("128-CBC")

    \n\n

    tmp = OpenSSL::PKCS7.encrypt([cert], data, cipher,
    \nOpenSSL::PKCS7::BINARY)
    \np7 = OpenSSL::PKCS7::PKCS7.new(tmp.to_der)

    \n\n

    Data will be stored as string so emulate that here

    \n\n

    p7s = p7.to_s

    \n\n

    Create pkcs7 object out of pkcs7 data

    \n\n

    p7 = OpenSSL::PKCS7::PKCS7.new(p7s)
    \ndec = p7.decrypt(key,cert)
    \nprint dec
    \n

    \nhttp://nunojob.wordpress.com/2008/12/08/rsa-encrypt-decrypt-in-ruby/

    \n\n

    http://www.ruby-forum.com/topic/79319

    \n", "_id"=>1075}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ruby中使用des aes rsa 加密解密等安全技术", "body"=>"终结下来三大类\n\n1,md5 sha1等消息摘要\n\n用的很多,比较熟悉,只是用于验证消息的完整性,而消息本省的传递确是明码的,除非想登录密码md5,那要服务器客户端两边都有。如果需要传输数据给另一方,而这段数据又不希望明文发就得使用密钥了。\n\n2,des等 ,私有密钥加密数据\n\n只要约定密钥,然后在通过这个密钥对信息加密然后传送,另一方通过密钥对加密信息解密。\n\n3,rsa , 公钥和密钥结合的高级货\n\n公钥不是大家都使用的,而是可以公开的,我开始误会错了搞不懂。通过rsa生成一对密钥,公钥和私钥,通过公钥加密的数据,只有私钥才能解开。那在网络中可以随便告诉客户端公钥,然后对方通过公钥加密后传加密信息,即使地球人都知道公钥也不要紧,因为私钥是保密的,解不开得到了加密信息也没办法。当然私钥加密后信息,公钥也可以解开,但速度上差成百上千倍。\n\nruby中通过openssl这个自带的标准库来实现。举了几个例子,des和rsa的\n\n#!/usr/bin/ruby\n\nrequire \"openssl\"\n#doc see http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html\n\nclass Encrypt\n KEY = \"aaaabbbb\"\n IV = \"aaaavvvv\"\n def des_encrypt(plaintext)\n c = OpenSSL::Cipher::Cipher.new(\"DES-CBC\")\n c.encrypt\n c.key = KEY\n c.iv = IV\n ret = c.update(plaintext)\n ret << c.final\n end\n\n def des_decrypt(encrypt_value)\n c = OpenSSL::Cipher::Cipher.new(\"DES-CBC\")\n c.decrypt\n c.key = KEY\n c.iv = IV\n ret = c.update(encrypt_value)\n ret << c.final\n end\n\n def get_rsa_key\n rsa = OpenSSL::PKey::RSA.new(1024)\n # public_key only can public_encrypt or public_decrypt no private_encrypt nor private_decrypt\n #rsa.public_key.to_pem the class of return value is String\n [rsa.public_key.to_pem , rsa.to_pem]\n end\n\n def rsa_private_encrypt(value , rsakey)\n rsa = OpenSSL::PKey::RSA.new(rsakey)\n rsa.private_encrypt(value)\n end\n\n def rsa_private_decrypt(value , rsakey)\n rsa = OpenSSL::PKey::RSA.new(rsakey)\n rsa.private_decrypt(value)\n end\n\n def rsa_public_encrypt(value , publickey)\n rsa = OpenSSL::PKey::RSA.new(publickey)\n rsa.public_encrypt(value)\n end\n\n def rsa_public_decrypt(value , publickey)\n rsa = OpenSSL::PKey::RSA.new(publickey)\n rsa.public_decrypt(value)\n end\nend\n\ndef testrun\n e = Encrypt.new\n text = \"a secret message\"\n puts \"text:\#{text}\"\n value = e.des_encrypt(text)\n puts \"des_encrypt:\#{value}\"\n des_decrypt = e.des_decrypt(value)\n puts \"des_decrypt:\#{des_decrypt}\"\n\n puts \"-------------------------\"\n publickey , privatekey = e.get_rsa_key\n puts \"publickey:\\n\#{publickey} \\n privatekey=\\n\#{privatekey}\"\n\n value1 = e.rsa_private_encrypt(text , privatekey)\n puts \"rsa_private_encrypt:\#{value1}\"\n rsa_public_decrypt = e.rsa_public_decrypt(value1 , publickey)\n puts \"rsa_public_decrypt:\#{rsa_public_decrypt}\"\n\n value2 = e.rsa_public_encrypt(\"another message\" , publickey)\n puts \"rsa_public_encrypt:\#{value2}\"\n rsa_private_decrypt = e.rsa_private_decrypt(value2 , privatekey)\n puts \"rsa_private_decrypt:\#{rsa_private_decrypt}\"\n\n puts \"----------------------------\"\n rsa = OpenSSL::PKey::RSA.new(1024 , 7)\n value3 = rsa.private_encrypt(\"myself key\")\n puts rsa.public_decrypt(value3)\nend\n\ntestrun\n\n测试结果:\nIceskYsl@eoe ~/Desktop $ ruby encrypt.rb\ntext:a secret message\ndes_encrypt:羻\"j}####9\"q###A##\ndes_decrypt:a secret message\n-------------------------\npublickey:\n-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBALrAGpm39jexyrrkYuM6kyP0z+pBlY/i3WnIYHrR3PDk9af2GsuIUwqg\nvhKRMxv5EZh1CShec++DfRAaBHwM2zCcHA1rDqrzqoSMdyCav+wbVwkSblqGb6gz\nQ4Zk/nM73mF1PaOkZvlpKN7B5H7BsUN2ngpaz4u9MxMm0Tn1guIVAgMBAAE=\n-----END RSA PUBLIC KEY-----\n\n privatekey=\n-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQC6wBqZt/Y3scq65GLjOpMj9M/qQZWP4t1pyGB60dzw5PWn9hrL\niFMKoL4SkTMb+RGYdQkoXnPvg30QGgR8DNswnBwNaw6q86qEjHcgmr/sG1cJEm5a\nhm+oM0OGZP5zO95hdT2jpGb5aSjeweR+wbFDdp4KWs+LvTMTJtE59YLiFQIDAQAB\nAoGBAKbgsSR5yfBc1J8LJP6OQhvYUM6xCngILvivEN/PltJAlvAfMDR+Pk558z9e\nNsChYcLNmoBTXuBBrEjuJuG/D0GpOmLadoZYDjlciJxj3Y9w85EvfRssdYGsBvIY\nksHVfsYEKJXp41ORux1jZgJXsnxn9276F7Unam65mPyUleiFAkEA8LMpAfgc3y4f\niHiDSon0AcgoIyH4eiiyxGPQEavIVgD2njRCM2pg3Z2uS3c/Et+EAaLjy9N1Cfy6\nplZRwHuXqwJBAMafCjgUQaqFisJNSUWWsENVzjmfk2pnGK1TJot3BtpN67rX1dcC\nQ3cNWbVhoF6zp6y+Kn/Lrdx1N+eNvhLOrT8CQQCl09jZuXUysVUaMWTKkrZgD+TP\nJ5VHnAhlUxrDQeU4k1tU7U36nDx2Ei9FYLc8qm8IrY9hGqLUqaBx/qA+CygXAkAu\nsAGp7vEEkUFtrNcVWXdzTH8eQmlXcIZ3b302+TKOLBTGJafpU2niWSwGG72jpR07\n2LOKuKjUkmUis8nDB/vnAkAxTVKBDYhfInF1/8/bhDAeqrWLifJUmxLEmO9WSRWm\nI5ZodXZIaNOBRCSZToQSdfPbhWtQ68sWGNbI0YYwm3OZ\n-----END RSA PRIVATE KEY-----\nrsa_private_encrypt:#k4#e|########\u0557#F#####0 ###3\n ## õë######o#####\u007F')\nc###########m##7e¼####u $>#######hU\u007FKc(#ۯ#####Us0T#######\n rsa_public_decrypt:a secret message\nrsa_public_encrypt:t####H\n \"#########'#H7############O#j####H###v#]Q`TR###Hs#U%####L###Z#####rѽ##\n ###F##(#X##˵#3####rsa_private_decrypt:another message\n----------------------------\nmyself key", "created_at"=>2010-05-14 23:02:22 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    终结下来三大类

    \n\n

    1,md5 sha1等消息摘要

    \n\n

    用的很多,比较熟悉,只是用于验证消息的完整性,而消息本省的传递确是明码的,除非想登录密码md5,那要服务器客户端两边都有。如果需要传输数据给另一方,而这段数据又不希望明文发就得使用密钥了。

    \n\n

    2,des等 ,私有密钥加密数据

    \n\n

    只要约定密钥,然后在通过这个密钥对信息加密然后传送,另一方通过密钥对加密信息解密。

    \n\n

    3,rsa , 公钥和密钥结合的高级货

    \n\n

    公钥不是大家都使用的,而是可以公开的,我开始误会错了搞不懂。通过rsa生成一对密钥,公钥和私钥,通过公钥加密的数据,只有私钥才能解开。那在网络中可以随便告诉客户端公钥,然后对方通过公钥加密后传加密信息,即使地球人都知道公钥也不要紧,因为私钥是保密的,解不开得到了加密信息也没办法。当然私钥加密后信息,公钥也可以解开,但速度上差成百上千倍。

    \n\n

    ruby中通过openssl这个自带的标准库来实现。举了几个例子,des和rsa的

    \n\n

    !/usr/bin/ruby

    \n\n

    require "openssl"

    \n\n

    doc see http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html

    \n\n

    class Encrypt
    \n KEY = "aaaabbbb"
    \n IV = "aaaavvvv"
    \n def des_encrypt(plaintext)
    \n c = OpenSSL::Cipher::Cipher.new("DES-CBC")
    \n c.encrypt
    \n c.key = KEY
    \n c.iv = IV
    \n ret = c.update(plaintext)
    \n ret << c.final
    \n end

    \n
    def des_decrypt(encrypt_value)\n    c = OpenSSL::Cipher::Cipher.new("DES-CBC")\n    c.decrypt\n    c.key = KEY\n    c.iv = IV\n    ret = c.update(encrypt_value)\n    ret << c.final\nend\n\ndef get_rsa_key\n    rsa = OpenSSL::PKey::RSA.new(1024)\n    # public_key only can public_encrypt or public_decrypt no private_encrypt nor private_decrypt\n    #rsa.public_key.to_pem the class of return value is String\n    [rsa.public_key.to_pem , rsa.to_pem]\nend\n\ndef rsa_private_encrypt(value , rsakey)\n    rsa = OpenSSL::PKey::RSA.new(rsakey)\n    rsa.private_encrypt(value)\nend\n\ndef rsa_private_decrypt(value , rsakey)\n    rsa = OpenSSL::PKey::RSA.new(rsakey)\n    rsa.private_decrypt(value)\nend\n\ndef rsa_public_encrypt(value , publickey)\n    rsa = OpenSSL::PKey::RSA.new(publickey)\n    rsa.public_encrypt(value)\nend\n\ndef rsa_public_decrypt(value , publickey)\n   rsa = OpenSSL::PKey::RSA.new(publickey)\n   rsa.public_decrypt(value)\nend\n
    \n
    \n\n

    end

    \n\n

    def testrun
    \n e = Encrypt.new
    \n text = "a secret message"
    \n puts "text:\#{text}"
    \n value = e.des_encrypt(text)
    \n puts "des_encrypt:\#{value}"
    \n des_decrypt = e.des_decrypt(value)
    \n puts "des_decrypt:\#{des_decrypt}"

    \n
    puts "-------------------------"\npublickey , privatekey = e.get_rsa_key\nputs "publickey:\\n\#{publickey} \\n privatekey=\\n\#{privatekey}"\n\nvalue1 = e.rsa_private_encrypt(text , privatekey)\nputs "rsa_private_encrypt:\#{value1}"\nrsa_public_decrypt = e.rsa_public_decrypt(value1 , publickey)\nputs "rsa_public_decrypt:\#{rsa_public_decrypt}"\n\nvalue2 = e.rsa_public_encrypt("another message" , publickey)\nputs "rsa_public_encrypt:\#{value2}"\nrsa_private_decrypt =  e.rsa_private_decrypt(value2 , privatekey)\nputs "rsa_private_decrypt:\#{rsa_private_decrypt}"\n\nputs "----------------------------"\nrsa = OpenSSL::PKey::RSA.new(1024 , 7)\nvalue3 = rsa.private_encrypt("myself key")\nputs rsa.public_decrypt(value3)\n
    \n
    \n\n

    end

    \n\n

    testrun

    \n\n

    测试结果:
    \nIceskYsl@eoe ~/Desktop $ ruby encrypt.rb
    \ntext:a secret message
    \ndes_encrypt:羻"j}####9"q###A##

    \n\n

    des_decrypt:a secret message

    \n\n

    publickey:
    \n-----BEGIN RSA PUBLIC KEY-----
    \nMIGJAoGBALrAGpm39jexyrrkYuM6kyP0z+pBlY/i3WnIYHrR3PDk9af2GsuIUwqg
    \nvhKRMxv5EZh1CShec++DfRAaBHwM2zCcHA1rDqrzqoSMdyCav+wbVwkSblqGb6gz
    \nQ4Zk/nM73mF1PaOkZvlpKN7B5H7BsUN2ngpaz4u9MxMm0Tn1guIVAgMBAAE=
    \n-----END RSA PUBLIC KEY-----

    \n\n

    privatekey=
    \n-----BEGIN RSA PRIVATE KEY-----
    \nMIICXQIBAAKBgQC6wBqZt/Y3scq65GLjOpMj9M/qQZWP4t1pyGB60dzw5PWn9hrL
    \niFMKoL4SkTMb+RGYdQkoXnPvg30QGgR8DNswnBwNaw6q86qEjHcgmr/sG1cJEm5a
    \nhm+oM0OGZP5zO95hdT2jpGb5aSjeweR+wbFDdp4KWs+LvTMTJtE59YLiFQIDAQAB
    \nAoGBAKbgsSR5yfBc1J8LJP6OQhvYUM6xCngILvivEN/PltJAlvAfMDR+Pk558z9e
    \nNsChYcLNmoBTXuBBrEjuJuG/D0GpOmLadoZYDjlciJxj3Y9w85EvfRssdYGsBvIY
    \nksHVfsYEKJXp41ORux1jZgJXsnxn9276F7Unam65mPyUleiFAkEA8LMpAfgc3y4f
    \niHiDSon0AcgoIyH4eiiyxGPQEavIVgD2njRCM2pg3Z2uS3c/Et+EAaLjy9N1Cfy6
    \nplZRwHuXqwJBAMafCjgUQaqFisJNSUWWsENVzjmfk2pnGK1TJot3BtpN67rX1dcC
    \nQ3cNWbVhoF6zp6y+Kn/Lrdx1N+eNvhLOrT8CQQCl09jZuXUysVUaMWTKkrZgD+TP
    \nJ5VHnAhlUxrDQeU4k1tU7U36nDx2Ei9FYLc8qm8IrY9hGqLUqaBx/qA+CygXAkAu
    \nsAGp7vEEkUFtrNcVWXdzTH8eQmlXcIZ3b302+TKOLBTGJafpU2niWSwGG72jpR07
    \n2LOKuKjUkmUis8nDB/vnAkAxTVKBDYhfInF1/8/bhDAeqrWLifJUmxLEmO9WSRWm
    \nI5ZodXZIaNOBRCSZToQSdfPbhWtQ68sWGNbI0YYwm3OZ
    \n-----END RSA PRIVATE KEY-----
    \nrsa_private_encrypt:#k4#e|########\u0557#F#####0 ###3
    \n ## õë######o#####\u007F')
    \nc###########m##7e¼####u $>#######hU\u007FKc(#ۯ#####Us0T#######
    \n rsa_public_decrypt:a secret message
    \nrsa_public_encrypt:t####H
    \n "#########'#H7############O#j####H###v#]Q`TR###Hs#U%####L###Z#####rѽ##

    \n\n

    ###F##(#X##˵#3####rsa_private_decrypt:another message

    \n\n

    myself key

    \n", "_id"=>1076}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>1077}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"md5sum", "body"=>"MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5 全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相同的报文摘要的可能性是非常非常之小的。\n在linux或Unix上,md5sum是用来计算和校验文件报文摘要的工具程序。一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行。\n1、使用md5sum来产生指纹(报文摘要)命令如下:\nmd5sum filename > filename.md5\n或者\nmd5sum filename >>filename.md5\n\n示例:\n[www@iceskysl 20100527]$ md5sum update.zip.1\ncd32d060d5e4d1891dfa4d6552cc57bb update.zip.1\n\n也可以把多个文件的报文摘要输出到一个md5文件中,这要使用通配符*,比如某目录下有几个iso文件,要把这几个iso文件的摘要输出到iso.md5文件中,命令如下:\nmd5sum *.iso > iso.md5\n\n2、使用md5报文摘要验证文件,方法有二:\n把下载的文件file和该文件的file.md5报文摘要文件放在同一个目录下,然后用如下命令进行验证:\nmd5sum -c file.md5\n然后如果验证成功,则会输出:正确", "created_at"=>2010-06-01 22:11:30 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5 全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相同的报文摘要的可能性是非常非常之小的。
    \n在linux或Unix上,md5sum是用来计算和校验文件报文摘要的工具程序。一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行。
    \n1、使用md5sum来产生指纹(报文摘要)命令如下:
    \nmd5sum filename > filename.md5
    \n或者
    \nmd5sum filename >>filename.md5

    \n\n

    示例:
    \n[www@iceskysl 20100527]$ md5sum update.zip.1
    \ncd32d060d5e4d1891dfa4d6552cc57bb update.zip.1

    \n\n

    也可以把多个文件的报文摘要输出到一个md5文件中,这要使用通配符*,比如某目录下有几个iso文件,要把这几个iso文件的摘要输出到iso.md5文件中,命令如下:
    \nmd5sum *.iso > iso.md5

    \n\n

    2、使用md5报文摘要验证文件,方法有二:
    \n把下载的文件file和该文件的file.md5报文摘要文件放在同一个目录下,然后用如下命令进行验证:
    \nmd5sum -c file.md5
    \n然后如果验证成功,则会输出:正确

    \n", "_id"=>1078}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>1079}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"TEXT fields in MySQL", "body"=>"MySQL TEXT fields have a limit of 65,000 bytes. If you insert anything larger than that in to a normal TEXT field mySQL will silently truncate your data without telling you (meaning software checks are probably a good idea). MEDIUMTEXT will store 16 million characters and LONGTEXT can handle over 4 trillion, but this information does not appear to be readily available in the online mySQL manual (although it is hinted at in this table). Something to bare in mind when designing database applications.\n\nMyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).\n\nref::http://www.electrictoolbox.com/maximum-length-mysql-text-field-types/\nTEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.\n\nThe maximum amount of data that can be stored in each data type is as follows:\n\nTINYTEXT\t256 bytes\nTEXT\t65,535 bytes\t~64kb\nMEDIUMTEXT\t 16,777,215 bytes\t~16MB\nBIGTEXT\t4,294,967,295 bytes\t~4GB\nIn most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.", "created_at"=>2010-06-27 20:56:02 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    MySQL TEXT fields have a limit of 65,000 bytes. If you insert anything larger than that in to a normal TEXT field mySQL will silently truncate your data without telling you (meaning software checks are probably a good idea). MEDIUMTEXT will store 16 million characters and LONGTEXT can handle over 4 trillion, but this information does not appear to be readily available in the online mySQL manual (although it is hinted at in this table). Something to bare in mind when designing database applications.

    \n\n

    MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).

    \n\n

    ref::http://www.electrictoolbox.com/maximum-length-mysql-text-field-types/
    \nTEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.

    \n\n

    The maximum amount of data that can be stored in each data type is as follows:

    \n\n

    TINYTEXT 256 bytes
    \nTEXT 65,535 bytes ~64kb
    \nMEDIUMTEXT 16,777,215 bytes ~16MB
    \nBIGTEXT 4,294,967,295 bytes ~4GB
    \nIn most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.

    \n", "_id"=>1080}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>1081}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>1082}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>1083}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"参加“Orange开发者日“活动", "body"=>"\"\"\n参加了7月6日在法电参加“Orange开发者日“活动,此次活动的重点是寻找Android应用程序,分享Android应用开发的经验,参与活动的有Orange AppShop的总部和北京的成员、联通应用商城的负责人员、摩托罗拉应用商店的负责人员、和参加活动的应用开发者。我在会上有个主题,主要介绍了优亿市场(eoemarket)这个产品,于会的差不多有200多人,认识一些很熟悉但未见面的老朋友。参加了会后的商务一对一,orange的工作人员对我们的产品提了不少好的建议。", "created_at"=>2010-07-17 21:04:05 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    参加了7月6日在法电参加“Orange开发者日“活动,此次活动的重点是寻找Android应用程序,分享Android应用开发的经验,参与活动的有Orange AppShop的总部和北京的成员、联通应用商城的负责人员、摩托罗拉应用商店的负责人员、和参加活动的应用开发者。我在会上有个主题,主要介绍了优亿市场(eoemarket)这个产品,于会的差不多有200多人,认识一些很熟悉但未见面的老朋友。参加了会后的商务一对一,orange的工作人员对我们的产品提了不少好的建议。

    \n", "_id"=>1084}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>1085}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>1086}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>1087}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>1088}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>1089}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>1090}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"malformed format string on rails~", "body"=>"在rails中使用find进行模糊查询时,出现了malformed format string输入为字符)或非法字符(输入为数字)的提示。\n(1) @vendors  = Vendor.find(:all,:conditions=>[@sql])\n(2) @vendors = Vendor.find_by_sql(\"select * from vendor where \"+@sql)\n错误发生在按(1)方式查询过程中,采用(2)方式可以避免这个错误,这间接说明了find_by_sql确实相当不安全。\n查阅了一下资料,对于这个问题的说法如下:Rails uses sprintf (%) on the inside. So, Escape your % with %,因此只要将模糊查询的地方一个百分号全部换成两个便可以解决问题。", "created_at"=>2010-09-03 16:39:58 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    在rails中使用find进行模糊查询时,出现了malformed format string(输入为字符)或非法字符(输入为数字)的提示。
    \n(1) @vendors  = Vendor.find(:all,:conditions=>[@sql])
    \n(2) @vendors = Vendor.find_by_sql("select * from vendor where "+@sql)
    \n错误发生在按(1)方式查询过程中,采用(2)方式可以避免这个错误,这间接说明了find_by_sql确实相当不安全。
    \n查阅了一下资料,对于这个问题的说法如下:Rails uses sprintf (%) on the inside. So, Escape your % with %,因此只要将模糊查询的地方一个百分号全部换成两个便可以解决问题。

    \n", "_id"=>1091}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>1092}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>1093}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>1094}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>1095}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Using the Rails logger outside of models and controllers", "body"=>"You can use the Rails logger outside of Rails models in at least version 2.3.X and up of Rails. You might be used to doing the following in your models or controllers:\n\nlogger.info \"Some debugging info I want to see in my development log.\"\n\nIf you make a regular model that doesn’t inherit from ActiveRecord, though, you may see the following error:\n\nundefined local variable or method `logger' for #<Class:0x42fd77c>\n\nThe solution is to call Rails.logger.info (or debug, or warn) as follows:\n\nRails.logger.info \"Some debugging info I want to see in my development log.\"\n\nI hope that helps someone.", "created_at"=>2010-09-17 01:50:49 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    <!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} -->You can use the Rails logger outside of Rails models in at least version 2.3.X and up of Rails. You might be used to doing the following in your models or controllers:

    \n\n

    logger.info "Some debugging info I want to see in my development log."

    \n\n

    If you make a regular model that doesn’t inherit from ActiveRecord, though, you may see the following error:

    \n\n

    undefined local variable or method `logger' for #<Class:0x42fd77c>

    \n\n

    The solution is to call Rails.logger.info (or debug, or warn) as follows:

    \n\n

    Rails.logger.info "Some debugging info I want to see in my development log."

    \n\n

    I hope that helps someone.

    \n", "_id"=>1096}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Creating Small Unique Tokens In Ruby", "body"=>"
    require \"rubygems\"
    \n
    require 'active_support'
    \n
    require 'digest'
    \n
    #http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby
    \n
    puts \"rand=> \" + rand(36**8).to_s(36)
    \n
    puts \"Digest::SHA1=> \"+Digest::SHA1.hexdigest(\"some-random-string\")[8..16]
    \n
    puts \"ActiveSupport::SecureRandom=>    \"+ ActiveSupport::SecureRandom.base64(8).gsub(\"/\",\"_\").gsub(/=+$/,\"\")
    \n
    puts ActiveSupport::SecureRandom::hex(8)
    \n
    puts Array.new(4) { rand(256) }.pack('C*').unpack('H*').first
    \nrequire \"rubygems\"require 'active_support'require 'digest'\n#http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-rubyputs \"rand=> \" + rand(36**8).to_s(36)\nputs \"Digest::SHA1=> \"+Digest::SHA1.hexdigest(\"some-random-string\")[8..16]puts \"ActiveSupport::SecureRandom=>    \"+ ActiveSupport::SecureRandom.base64(8).gsub(\"/\",\"_\").gsub(/=+$/,\"\")\nputs ActiveSupport::SecureRandom::hex(8)\nputs Array.new(4) { rand(256) }.pack('C*').unpack('H*').first", "created_at"=>2010-09-19 22:36:01 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    require "rubygems"
    \nrequire 'activesupport'
    \nrequire 'digest'
    \n#http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby
    \nputs "rand=> " + rand(36**8).to_s(36)
    \nputs "Digest::SHA1=> "+Digest::SHA1.hexdigest("some-random-string")[8..16]
    \nputs "ActiveSupport::SecureRandom=>    "+ ActiveSupport::SecureRandom.base64(8).gsub("/","
    ").gsub(/=+$/,"")
    \nputs ActiveSupport::SecureRandom::hex(8)
    \nputs Array.new(4) { rand(256) }.pack('C').unpack('H').first
    \nrequire "rubygems"require 'active_support'require 'digest'

    \n\n

    http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-rubyputs "rand=> " + rand(36**8).to_s(36)

    \n\n

    puts "Digest::SHA1=> "+Digest::SHA1.hexdigest("some-random-string")[8..16]puts "ActiveSupport::SecureRandom=>    "+ ActiveSupport::SecureRandom.base64(8).gsub("/","_").gsub(/=+$/,"")
    \nputs ActiveSupport::SecureRandom::hex(8)
    \nputs Array.new(4) { rand(256) }.pack('C').unpack('H').first

    \n", "_id"=>1097}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Configure SVN for your rails app.", "body"=>"http://gist.github.com/609762\n\n#!/bin/sh\nsvn remove log/*\nsvn commit -m\"removing log files\"\nsvn propset svn:ignore \"*.log\" log/\nsvn update log/\nsvn commit -m 'Ignoring all files in /log/ ending in .log'\nsvn move config/database.yml config/database.example\nsvn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'\nsvn propset svn:ignore \"database.yml\" config/\nsvn update config/\nsvn commit -m 'Ignoring database.yml'\nsvn remove tmp/*\nsvn propset svn:ignore \"*\" tmp/\nsvn update tmp/\nsvn commit -m \"ignore tmp/ content from now\"\nsvn propset svn:ignore \".htaccess\" config/\nsvn update config/\nsvn commit -m 'Ignoring .htaccess'\nsvn propset svn:ignore \"dispatch.fcgi\" config/\nsvn update config/\nsvn commit -m 'Ignoring dispatch.fcgi'", "created_at"=>2010-10-04 06:24:06 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    http://gist.github.com/609762

    \n\n

    !/bin/sh

    \n\n

    svn remove log/*
    \nsvn commit -m"removing log files"
    \nsvn propset svn:ignore ".log" log/
    \nsvn update log/
    \nsvn commit -m 'Ignoring all files in /log/ ending in .log'
    \nsvn move config/database.yml config/database.example
    \nsvn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
    \nsvn propset svn:ignore "database.yml" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring database.yml'
    \nsvn remove tmp/

    \nsvn propset svn:ignore "*" tmp/
    \nsvn update tmp/
    \nsvn commit -m "ignore tmp/ content from now"
    \nsvn propset svn:ignore ".htaccess" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring .htaccess'
    \nsvn propset svn:ignore "dispatch.fcgi" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring dispatch.fcgi'

    \n", "_id"=>1098}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"delete & not exists in Mysql", "body"=>"This works\n\nselect * from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);\n\nHowever, this does NOT work\n\ndelete from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);\n\nwhy? Because of the alias p!!! Table alias is not allowed in not exists subquery!! Instead, you have to use the full table name~~~~ faint!\n\nCorrect code\n delete from tb_patient where not exists (select col_patient_id from tb_payment where col_patient_id = tb_patient.col_unid);", "created_at"=>2010-10-04 06:49:42 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    This works

    \n\n

    select * from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);

    \n\n

    However, this does NOT work

    \n\n

    delete from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);

    \n\n

    why? Because of the alias p!!! Table alias is not allowed in not exists subquery!! Instead, you have to use the full table name~~~~ faint!

    \n\n

    Correct code
    \n delete from tb_patient where not exists (select col_patient_id from tb_payment where col_patient_id = tb_patient.col_unid);

    \n", "_id"=>1099}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决ssh_exchange_identification: Connection closed by remote host,", "body"=>"用的好好的ssh突然链不上去了,查到说修改/etc/hosts.deny 和 /etc/hosts.allow\n\n然后发现/etc/ssh下的文件不能设为777的权限,要将权限设为600。\n\n于是偶chmod 600 /etc/ssh/*,然后再次重启了ssh。\n
    root@e:/home/iceskysl# /etc/init.d/ssh restart
    \n
    /var/run/sshd must be owned by root and not group or world-writable.
    \n
    root@e:/home/iceskysl#  chmod 600  /var/run/sshd
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart/var/run/sshd must be owned by root and not group or world-writable.root@li84-64:/home/iceskysl#  chmod 600  /var/run/sshd", "created_at"=>2010-10-18 18:45:27 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    用的好好的ssh突然链不上去了,查到说修改/etc/hosts.deny 和 /etc/hosts.allow

    \n\n

    然后发现/etc/ssh下的文件不能设为777的权限,要将权限设为600。

    \n\n

    于是偶chmod 600 /etc/ssh/*,然后再次重启了ssh。
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart
    \n/var/run/sshd must be owned by root and not group or world-writable.
    \nroot@e:/home/iceskysl#  chmod 600  /var/run/sshd
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart/var/run/sshd must be owned by root and not group or world-writable.root@li84-64:/home/iceskysl#  chmod 600  /var/run/sshd

    \n", "_id"=>1100}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>1101}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"2010年总结,2011年展望", "body"=>"时间飞快,2010年悄然流逝,该坐下来总结下刚刚过去的2010年,也有必要想想2011年的目标和期待了~刚刚过去的2010年是改变最大的一年,不光是我,我身边的人也是,谢谢那些帮助过,支持过,关注过我们的人,谢谢你们;\n\n1. 工作方面\n\n今年一整年都贡献了了eoe,eoe从2008年10月开始撰写第一本android的书《google android开发入门和实战》开始,2009年7月份注册公司,2010年整整一年的发展,我们度过了几个关键的时间点,曾经的挣扎和迷茫都已经过去了,我清晰的记得2009年年尾的时候,和一起奋斗的几个哥们在吃火锅的时候定下的目标,如今想想还非常的清晰。\n\n2010年,和大家伙们闷头奋斗的一年,我们的第一本书《google android开发入门和实战》重印了8次,销量突破15000册,出版了第二本android技术书籍《it's android time:Google android创赢路线和产品开发实战》发布并迅速加印;eoe从当初的6人发展到30+的团队,从全部技术人员到有产品,有运营,有市场和商务区域完善的团队;我们拿到了投资,有了自己的顾问,和国内大多数的投资商们建立了良好的关系;从当初的吃住,工作一起的小黑屋搬到了明亮的办公室,从之前的迷茫到找到我们的方向;我们拥有了众多且知名的合作伙伴,我们的产品一步一步的完善,从当初的拿不出手到现在由衷的自豪。\n\n2010年,我参加了上海paypal的开发者日做了主题演讲;参加了北京csdn第一期TUP活动做了主题演讲;参加了成都天翼空间的“能力开发”活动做了主题演讲;给台湾的开发者做了一次主题topic;和google 一到在全国7个城市路演(上海,北京,广州,深圳,成都,重庆,杭州);和联想合办了联想开发者大会;也举办了我们自己的eoe首届移动开发者峰会,与会400+多人,非常成功!\n\n我们推出eoemarket的新版本优亿市场,得到市场和用户的认可;eoeadnroid转型为开发者门户,推出了开发者服务平台(eoeSDK);还有一些正在开发中的产品!\n\n个人在2010年是非常忙碌的一年:技术,商务,活动,演讲,战略,团队很多的事情,也有了长足的提升。认识了很多人,有些是新朋友,有些则是老朋友。\n\n2. 生活方面\n\n2010年是生活较为稳定的一年,太太tina辞了不错的工作,从深圳来到北京和我一起生活了,虽然每日工作在一起的时间比较有限,但确实也体会了家的温馨;买了一套90+平的房子算是一个圆了去年许下的一个目标,虽然何时才能住进去还是个未知数,但那确实有一个属于自己的空间;哥哥结婚了,了却了父母的一番心事,最近听说要生小孩了,真是速度的很,爸妈应该要高兴了,希望别来催我生小孩啦,呵呵。奶奶,姥姥姥爷,父母亲人都很健康,无病无灾!tina的奶奶去了天堂,在那边享受快乐的生活.\n\n2010年过的很忙碌,也有一些尚未完成的心愿,也错过了一些事情,留下了些许遗憾,那些由于种种原因没能一路走下来的兄弟们,希望我们还有机会并肩作战!那些没能经常联系的朋友们,我时刻想念大家,希望大家都好!\n\n希望2011年能完成,列举一二,权当自勉!\n\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\n\n2. 能做一个有可能改变世界的产品;\n\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\n\n4. 在技术,英语,管理,交际方面有着长足的提高;\n\n5. 能找到一个合适的定居的地方为安定下来做些准备;\n\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\n\n7.能拿到驾照,顺便也有个属于自己的交通工具;\n\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\n\n9. 亲戚,朋友包括我和tina都健康快乐!\n\n10. 世界太平,和谐迎接2012!", "created_at"=>2011-01-02 23:46:24 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    时间飞快,2010年悄然流逝,该坐下来总结下刚刚过去的2010年,也有必要想想2011年的目标和期待了~刚刚过去的2010年是改变最大的一年,不光是我,我身边的人也是,谢谢那些帮助过,支持过,关注过我们的人,谢谢你们;

    \n\n

    1. 工作方面

    \n\n

    今年一整年都贡献了了eoe,eoe从2008年10月开始撰写第一本android的书《google android开发入门和实战》开始,2009年7月份注册公司,2010年整整一年的发展,我们度过了几个关键的时间点,曾经的挣扎和迷茫都已经过去了,我清晰的记得2009年年尾的时候,和一起奋斗的几个哥们在吃火锅的时候定下的目标,如今想想还非常的清晰。

    \n\n

    2010年,和大家伙们闷头奋斗的一年,我们的第一本书《google android开发入门和实战》重印了8次,销量突破15000册,出版了第二本android技术书籍《it's android time:Google android创赢路线和产品开发实战》发布并迅速加印;eoe从当初的6人发展到30+的团队,从全部技术人员到有产品,有运营,有市场和商务区域完善的团队;我们拿到了投资,有了自己的顾问,和国内大多数的投资商们建立了良好的关系;从当初的吃住,工作一起的小黑屋搬到了明亮的办公室,从之前的迷茫到找到我们的方向;我们拥有了众多且知名的合作伙伴,我们的产品一步一步的完善,从当初的拿不出手到现在由衷的自豪。

    \n\n

    2010年,我参加了上海paypal的开发者日做了主题演讲;参加了北京csdn第一期TUP活动做了主题演讲;参加了成都天翼空间的“能力开发”活动做了主题演讲;给台湾的开发者做了一次主题topic;和google 一到在全国7个城市路演(上海,北京,广州,深圳,成都,重庆,杭州);和联想合办了联想开发者大会;也举办了我们自己的eoe首届移动开发者峰会,与会400+多人,非常成功!

    \n\n

    我们推出eoemarket的新版本优亿市场,得到市场和用户的认可;eoeadnroid转型为开发者门户,推出了开发者服务平台(eoeSDK);还有一些正在开发中的产品!

    \n\n

    个人在2010年是非常忙碌的一年:技术,商务,活动,演讲,战略,团队很多的事情,也有了长足的提升。认识了很多人,有些是新朋友,有些则是老朋友。

    \n\n

    2. 生活方面

    \n\n

    2010年是生活较为稳定的一年,太太tina辞了不错的工作,从深圳来到北京和我一起生活了,虽然每日工作在一起的时间比较有限,但确实也体会了家的温馨;买了一套90+平的房子算是一个圆了去年许下的一个目标,虽然何时才能住进去还是个未知数,但那确实有一个属于自己的空间;哥哥结婚了,了却了父母的一番心事,最近听说要生小孩了,真是速度的很,爸妈应该要高兴了,希望别来催我生小孩啦,呵呵。奶奶,姥姥姥爷,父母亲人都很健康,无病无灾!tina的奶奶去了天堂,在那边享受快乐的生活.

    \n\n

    2010年过的很忙碌,也有一些尚未完成的心愿,也错过了一些事情,留下了些许遗憾,那些由于种种原因没能一路走下来的兄弟们,希望我们还有机会并肩作战!那些没能经常联系的朋友们,我时刻想念大家,希望大家都好!

    \n\n

    希望2011年能完成,列举一二,权当自勉!

    \n\n
      \n
    1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!

    2. \n
    3. 能做一个有可能改变世界的产品;

    4. \n
    5. tina能找到自己真正喜欢的工作,做自己喜欢的事情;

    6. \n
    7. 在技术,英语,管理,交际方面有着长足的提高;

    8. \n
    9. 能找到一个合适的定居的地方为安定下来做些准备;

    10. \n
    11. 能和tina一起去一次远途旅行,欧洲?也许吧;

    12. \n
    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;

    \n\n
      \n
    1. 多些空闲,多看看书,多些思考,多些时间写写东西!

    2. \n
    3. 亲戚,朋友包括我和tina都健康快乐!

    4. \n
    5. 世界太平,和谐迎接2012!

    6. \n
    \n", "_id"=>1102}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"mtr命令使用", "body"=>"这里说的mtr是一个网络工具,结合了\"traceroute\"和\"ping\"功能于一身,非常好用的一个工具,别和我说\"traceroute\"和\"ping\"这两个命令不知道哟!~~\n\ndebian的apt中,只需要安装“mtr-tiny ”即可使用mtr命令。\n\nlinux下面的mtr输出大概如下面所列:\n\n~$ mtr -r -n -c 100 www.163.com\nHOST: hz**-** Loss% Snt Last Avg Best Wrst StDev\n1. **.**.**.** 0.0% 100 1.9 3.6 1.8 23.0 3.3\n2. 61.164.42.69 0.0% 100 0.6 0.8 0.5 7.1 0.6\n3. 61.153.8.230 0.0% 100 0.6 0.6 0.4 2.2 0.2\n4. 220.191.129.129 0.0% 100 0.5 0.5 0.4 4.3 0.5\n5. 202.97.41.245 0.0% 100 7.8 16.7 7.7 182.6 30.0\n6. 202.97.34.65 0.0% 100 33.7 43.3 33.7 228.4 34.7\n7. 220.181.16.149 0.0% 100 31.6 32.2 31.4 44.1 2.4\n8. 220.181.16.10 0.0% 100 46.5 42.9 32.7 55.6 5.8\n9. 220.181.17.54 0.0% 100 42.4 41.5 36.1 49.7 3.0\n10. 220.181.28.50 0.0% 100 30.4 30.3 30.2 30.5 0.1\n\n输出各项的意思如下:\n\nLoss% --很明显是丢包率,单位是\"%\";\nSnt -- sent包的数量,如果是winmtr的话,还有一个\"recv\"表示收到回复包的数量,不过既然有\"Loss\"和\"Snt\",其实\"recv\"也很容易算出来,个人感觉winmtr有点画蛇添足了;\nLast -- 最后一个包的延时;\nAvg -- 所有包的平均延时,同\"ping\"的\"Avg\";\nBest -- 延时最小的包,同\"ping\"的\"Min\";\nWrst -- Worst,延时最大的包,同\"ping\"的\"Max\";\nStDev -- Standard Deviation,标准差,winmtr无该项。\nStDev的概念和计算方法参见这里(请自备爬墙工具)\n\n个人认为,如果StDev很大,表示各个包的延时的差别很大,网络不太稳定。不过由于中间点是路由器,一般路由器可能会对icmp包做限制或者优先丢弃,所以中间节点的StDev可以忽略不看。", "created_at"=>2011-01-14 00:04:42 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    这里说的mtr是一个网络工具,结合了"traceroute"和"ping"功能于一身,非常好用的一个工具,别和我说"traceroute"和"ping"这两个命令不知道哟!~~

    \n\n

    debian的apt中,只需要安装“mtr-tiny ”即可使用mtr命令。

    \n\n

    linux下面的mtr输出大概如下面所列:

    \n\n

    ~$ mtr -r -n -c 100 www.163.com
    \nHOST: hz- Loss% Snt Last Avg Best Wrst StDev
    \n1. ... 0.0% 100 1.9 3.6 1.8 23.0 3.3
    \n2. 61.164.42.69 0.0% 100 0.6 0.8 0.5 7.1 0.6
    \n3. 61.153.8.230 0.0% 100 0.6 0.6 0.4 2.2 0.2
    \n4. 220.191.129.129 0.0% 100 0.5 0.5 0.4 4.3 0.5
    \n5. 202.97.41.245 0.0% 100 7.8 16.7 7.7 182.6 30.0
    \n6. 202.97.34.65 0.0% 100 33.7 43.3 33.7 228.4 34.7
    \n7. 220.181.16.149 0.0% 100 31.6 32.2 31.4 44.1 2.4
    \n8. 220.181.16.10 0.0% 100 46.5 42.9 32.7 55.6 5.8
    \n9. 220.181.17.54 0.0% 100 42.4 41.5 36.1 49.7 3.0
    \n10. 220.181.28.50 0.0% 100 30.4 30.3 30.2 30.5 0.1

    \n\n

    输出各项的意思如下:

    \n\n

    Loss% --很明显是丢包率,单位是"%";
    \nSnt -- sent包的数量,如果是winmtr的话,还有一个"recv"表示收到回复包的数量,不过既然有"Loss"和"Snt",其实"recv"也很容易算出来,个人感觉winmtr有点画蛇添足了;
    \nLast -- 最后一个包的延时;
    \nAvg -- 所有包的平均延时,同"ping"的"Avg";
    \nBest -- 延时最小的包,同"ping"的"Min";
    \nWrst -- Worst,延时最大的包,同"ping"的"Max";
    \nStDev -- Standard Deviation,标准差,winmtr无该项。
    \nStDev的概念和计算方法参见这里(请自备爬墙工具)

    \n\n

    个人认为,如果StDev很大,表示各个包的延时的差别很大,网络不太稳定。不过由于中间点是路由器,一般路由器可能会对icmp包做限制或者优先丢弃,所以中间节点的StDev可以忽略不看。

    \n", "_id"=>1103}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"那些时间点们", "body"=>"
    \n\n2002.9 武汉,开始大学\n\n2003.5  武汉,第二学位\n\n2006.7 深圳,大学毕业开始工作\n\n2008.10 北京,离开深圳,来到北京,参与别人创业\n\n2009.5 北京,开始和朋友一起自主创业\n\n2009.10 合肥,和tina步入婚姻殿堂\n\n2010.4 北京,创业走过第一个阶段,有了真正的办公室\n\n2010.7 北京,tina来到北京,终于不分居两地\n\n2011.4 北京,创业走过第二个阶段\n\n精彩还将继续...\n\n
    ", "created_at"=>2011-03-25 21:29:19 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    2002.9 武汉,开始大学

    \n\n

    2003.5  武汉,第二学位

    \n\n

    2006.7 深圳,大学毕业开始工作

    \n\n

    2008.10 北京,离开深圳,来到北京,参与别人创业

    \n\n

    2009.5 北京,开始和朋友一起自主创业

    \n\n

    2009.10 合肥,和tina步入婚姻殿堂

    \n\n

    2010.4 北京,创业走过第一个阶段,有了真正的办公室

    \n\n

    2010.7 北京,tina来到北京,终于不分居两地

    \n\n

    2011.4 北京,创业走过第二个阶段

    \n\n

    精彩还将继续...

    \n\n", "_id"=>1104}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Mac OS X(lion)软件推荐", "body"=>"Mac OS X(lion)软件推荐\n\nIceskysl@gmail.com At 2011.09.03\n\nhttp://iceskysl.1sters.com/?p=841\n\n最近身边好多朋友都加入Mac阵营,对Mac OS X 的软件不是太熟悉,要我写个推荐软件清单,原本觉得网上类似的推荐应该很多,大致查了下,发现好多都比较陈旧了。\n\n我08年开始使Mac,经过这三年多的使用,这里大致列出了一些自己使用过并且感觉比较不错的软件,供大家参考;需要说明的是每个人接触的软件有限,我的选择未必就是最好的,如果您有更好的软件推荐,还请告诉我;这个清单我会不定期更新,希望对大家有用。\n\n这个清单被我分成上篇(大众用户篇)和下篇(技术人员篇),有的软件连接我就不加了,大家自己Google下应该不难找,实在找不到的可以给我留言,我找给你。\n\n \n\n上篇:大众用户篇\n\n \n
      \n\t
    • 网页浏览器 \n
        \n\t
      • Chrome(推荐):自从用了chrome,就没有其他浏览器再能吸引我了,强烈推荐这个(我更喜欢dev版的)
      • \n\t
      • Safari: 系统自带的浏览器,我会留着,但是使用的次数和时间都不长;
      • \n\t
      • Firefox:没有Chrome前的首选,但是有了Chrome,就越发觉得FF好臃肿,现基本不用;
      • \n
      \n
    • \n\t
    • 即时通讯\n
        \n\t
      • Adium :兼容多种聊天账户,我用来开MSN,Google Talk 和 Google App Talk;
      • \n\t
      • QQ for Mac:随着QQ的不断升级,现在的已经很棒了,算一款合格的mac软件了;
      • \n\t
      • Skype:视屏聊天,需求不是很大,但是个不错的软件,需要skype的人肯定需要;
      • \n
      \n
    • \n\t
    • 视频播放\n
        \n\t
      • MPlayerX: 之前用的比较多的是VLC,后来发现了Mplayerx就几本不使VLC了,非常强大的视屏播放器;
      • \n\t
      • VLC:这个其实也不错,估计有人会喜欢
      • \n
      \n
    • \n\t
    • 音频播放\n
        \n\t
      • iTunes:没啥好介绍的,功能强大,但是我不习惯听本地的歌,基本都是听在线的;
      • \n
      \n
    • \n\t
    • 图片处理\n
        \n\t
      • Xee: 图片浏览用的,还不错的说;
      • \n\t
      • Picasa:google picasa用来整理照片;
      • \n\t
      • Pixelmator:是个画图工具
      • \n
      \n
    • \n\t
    • 压缩软件\n
        \n\t
      • 7zX:非常强大的压缩软件,压缩出来的中文兼容windows
      • \n\t
      • BetterZip:解压缩软件,支持zip、rar、7z等常见格式。
      • \n
      \n
    • \n\t
    • 上传下载软件\n
        \n\t
      • FileZilla: FTP工具,在使windows的时候就使的FTP软件,尤其喜欢其支持sftp方式的连接和传输
      • \n\t
      • uTorrent:BT工具,用的不多,但是一直装着了,还有个Xtorrent
      • \n
      \n
    • \n\t
    • 办公软件\n
        \n\t
      • Adobe Reader 9:看PDF还是需要这个的,效果还不错
      • \n\t
      • Evernote :文字纪录,非常强大可以同步的记事本软件,比记事本强大好多倍,有了这个其他的文字纪录类的软件就不需要了(配合ios或者android客户端使用更棒),这个文章就是在Evernote里写的;
      • \n\t
      • dropbox:资料同步软件,也非常强大,把自己的文件同步一份,走到哪里都是主场,非常好用(国内部分区域被墙,自己想办法);
      • \n\t
      • iWork '09: 文档处理工具
      • \n
      \n
    • \n\t
    • 输入法\n
        \n\t
      • IMKQIM:比较老牌的输入法,很不错,FIT就用的比较少了;
      • \n\t
      • 搜狗拼音:出了不久,还不怎么稳定,如果持续改进,应该是个很不错的输入法;
      • \n
      \n
    • \n\t
    • 系统软件\n
        \n\t
      • Quicksilver:非常棒的软件,快速启动,不用苦哈哈手工去找;
      • \n\t
      • CleanApp:清洁系统的,基本不用;
      • \n\t
      • Mobile Partner:无线上网用的,连3g网卡的
      • \n\t
      • VMware Fusion:虚拟机
      • \n
      \n
    • \n
    \n \n\n下篇:技术人员篇\n\n这列举了一些技术人员估计会感兴趣的工具,供参考!\n
      \n\t
    • 编程工具\n
        \n\t
      • TextMate:号称是编程人员的神器,其实无论哪个工具用熟了都很好,TextMate确实很优秀,优秀到尽管其中文字体支持的不好,还是必须的装;
      • \n\t
      • MacVim:这个也是神器,把Vim用好到走到哪里都不怕;
      • \n\t
      • iTerm:必备软件,管理SSH链接
      • \n\t
      • MongoHub:管理MongoDB的工具
      • \n\t
      • Sequel Pro:mysql管理工具,很强大;
      • \n\t
      • MySQLWorkbench:mysql管理,用来做表结构设计的;
      • \n
      \n
    • \n\t
    • 专业工具\n
        \n\t
      • GitHub:用github的同学必备,很好用
      • \n\t
      • GitX:可视化的git工具,你没有理由不用他
      • \n\t
      • Balsamiq Mockups:原型图工具,非常棒
      • \n\t
      • OmniGraffle Professional: 专业画图工具,其他的都不需要了;
      • \n\t
      • OmniPlan:做计划的工具,也是Omni出的;
      • \n\t
      • Mindjet MindManager:脑图工具
      • \n
      \n
    • \n\t
    • 其他\n
        \n\t
      • RESTClient:REST测试工具
      • \n\t
      • JD-GUI:反编译工具
      • \n\t
      • KeyCastr:显示快捷键工具
      • \n\t
      • iShowU:录制视频用的
      • \n\t
      • keycue:显示软件的快捷键
      • \n
      \n
    • \n
    \n ", "created_at"=>2011-09-02 20:31:57 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    Mac OS X(lion)软件推荐

    \n\n

    Iceskysl@gmail.com At 2011.09.03

    \n\n

    http://iceskysl.1sters.com/?p=841

    \n\n

    最近身边好多朋友都加入Mac阵营,对Mac OS X 的软件不是太熟悉,要我写个推荐软件清单,原本觉得网上类似的推荐应该很多,大致查了下,发现好多都比较陈旧了。

    \n\n

    我08年开始使Mac,经过这三年多的使用,这里大致列出了一些自己使用过并且感觉比较不错的软件,供大家参考;需要说明的是每个人接触的软件有限,我的选择未必就是最好的,如果您有更好的软件推荐,还请告诉我;这个清单我会不定期更新,希望对大家有用。

    \n\n

    这个清单被我分成上篇(大众用户篇)和下篇(技术人员篇),有的软件连接我就不加了,大家自己Google下应该不难找,实在找不到的可以给我留言,我找给你。

    \n\n\n

    上篇:大众用户篇

    \n\n

    网页浏览器
    \n
    \n Chrome(推荐):自从用了chrome,就没有其他浏览器再能吸引我了,强烈推荐这个(我更喜欢dev版的)
    \n Safari: 系统自带的浏览器,我会留着,但是使用的次数和时间都不长;
    \n Firefox:没有Chrome前的首选,但是有了Chrome,就越发觉得FF好臃肿,现基本不用;
    \n
    \n
    \n 即时通讯
    \n
    \n Adium :兼容多种聊天账户,我用来开MSN,Google Talk 和 Google App Talk;
    \n QQ for Mac:随着QQ的不断升级,现在的已经很棒了,算一款合格的mac软件了;
    \n Skype:视屏聊天,需求不是很大,但是个不错的软件,需要skype的人肯定需要;
    \n
    \n
    \n 视频播放
    \n
    \n MPlayerX: 之前用的比较多的是VLC,后来发现了Mplayerx就几本不使VLC了,非常强大的视屏播放器;
    \n VLC:这个其实也不错,估计有人会喜欢
    \n
    \n
    \n 音频播放
    \n
    \n iTunes:没啥好介绍的,功能强大,但是我不习惯听本地的歌,基本都是听在线的;
    \n
    \n
    \n 图片处理
    \n
    \n Xee: 图片浏览用的,还不错的说;
    \n Picasa:google picasa用来整理照片;
    \n Pixelmator:是个画图工具
    \n
    \n
    \n 压缩软件
    \n
    \n 7zX:非常强大的压缩软件,压缩出来的中文兼容windows
    \n BetterZip:解压缩软件,支持zip、rar、7z等常见格式。
    \n
    \n
    \n 上传下载软件
    \n
    \n FileZilla: FTP工具,在使windows的时候就使的FTP软件,尤其喜欢其支持sftp方式的连接和传输
    \n uTorrent:BT工具,用的不多,但是一直装着了,还有个Xtorrent
    \n
    \n
    \n 办公软件
    \n
    \n Adobe Reader 9:看PDF还是需要这个的,效果还不错
    \n Evernote :文字纪录,非常强大可以同步的记事本软件,比记事本强大好多倍,有了这个其他的文字纪录类的软件就不需要了(配合ios或者android客户端使用更棒),这个文章就是在Evernote里写的;
    \n dropbox:资料同步软件,也非常强大,把自己的文件同步一份,走到哪里都是主场,非常好用(国内部分区域被墙,自己想办法);
    \n iWork '09: 文档处理工具
    \n
    \n
    \n 输入法
    \n
    \n IMKQIM:比较老牌的输入法,很不错,FIT就用的比较少了;
    \n 搜狗拼音:出了不久,还不怎么稳定,如果持续改进,应该是个很不错的输入法;
    \n
    \n
    \n 系统软件
    \n
    \n Quicksilver:非常棒的软件,快速启动,不用苦哈哈手工去找;
    \n CleanApp:清洁系统的,基本不用;
    \n Mobile Partner:无线上网用的,连3g网卡的
    \n VMware Fusion:虚拟机
    \n
    \n
    \n
    \n

    \n\n

    下篇:技术人员篇

    \n\n

    这列举了一些技术人员估计会感兴趣的工具,供参考!
    \n
    \n 编程工具
    \n
    \n TextMate:号称是编程人员的神器,其实无论哪个工具用熟了都很好,TextMate确实很优秀,优秀到尽管其中文字体支持的不好,还是必须的装;
    \n MacVim:这个也是神器,把Vim用好到走到哪里都不怕;
    \n iTerm:必备软件,管理SSH链接
    \n MongoHub:管理MongoDB的工具
    \n Sequel Pro:mysql管理工具,很强大;
    \n MySQLWorkbench:mysql管理,用来做表结构设计的;
    \n
    \n
    \n 专业工具
    \n
    \n GitHub:用github的同学必备,很好用
    \n GitX:可视化的git工具,你没有理由不用他
    \n Balsamiq Mockups:原型图工具,非常棒
    \n OmniGraffle Professional: 专业画图工具,其他的都不需要了;
    \n OmniPlan:做计划的工具,也是Omni出的;
    \n Mindjet MindManager:脑图工具
    \n
    \n
    \n 其他
    \n
    \n RESTClient:REST测试工具
    \n JD-GUI:反编译工具
    \n KeyCastr:显示快捷键工具
    \n iShowU:录制视频用的
    \n keycue:显示软件的快捷键
    \n
    \n
    \n
    \n

    \n", "_id"=>1105}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx开启 stub_status 模块", "body"=>"Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.\n本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定:\n./configure –with-http_stub_status_module\n\n一、查看已安装的 Nginx 是否包含 stub_status 模块\n#/usr/local/nginx/sbin/nginx -V\n\n [root@ice ~]# /opt/nginx/sbin/nginx -V\nnginx version: nginx/0.8.53\nbuilt by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)\nTLS SNI support disabled\nconfigure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-pcre=/tmp/root-passenger-1719/pcre-8.10 --add-module=/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx\n\n如果包含 stub_status 模块,那么就可以进行下面的步骤了:\n\n二、修改 Nginx 配置文件\n``location /nginx_status {\n # copied from http://iceskysl.1sters.com\n stub_status on;\n access_log off;\n allow SOME.IP.ADD.RESS;\n deny all;\n}```\n``三、重启 Nginx\n#/usr/local/nginx/sbin/nginx -s reload\n\n四、相关数据说明\nActive connections: 对后端发起的活动连接数.\nServer accepts handled requests: Nginx总共处理了38810620个连接,成功创建38810620次握手(证明中间没有失败的),总共处理了298655730个请求.\nReading: Nginx 读取到客户端的Header信息数.\nWriting: Nginx 返回给客户端的Header信息数.\nWaiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是Nginx已经处理完成,正在等候下一次请求指令的驻留连接.\n所以,在访问效率高,请求很快被处理完毕的情况下,Waiting数比较多是正常的.如果reading +writing数较多,则说明并发访问量非常大,正在处理过程中.```", "created_at"=>2011-09-03 08:05:33 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.
    \n本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定:
    \n./configure –with-http_stub_status_module

    \n\n

    一、查看已安装的 Nginx 是否包含 stub_status 模块

    \n\n

    /usr/local/nginx/sbin/nginx -V

    \n\n

    [root@ice ~]# /opt/nginx/sbin/nginx -V
    \nnginx version: nginx/0.8.53
    \nbuilt by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
    \nTLS SNI support disabled
    \nconfigure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-pcre=/tmp/root-passenger-1719/pcre-8.10 --add-module=/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx

    \n\n

    如果包含 stub_status 模块,那么就可以进行下面的步骤了:

    \n\n

    二、修改 Nginx 配置文件
    \nlocation /nginx_status {
    \n # copied from http://iceskysl.1sters.com
    \n stub_status on;
    \n access_log off;
    \n allow SOME.IP.ADD.RESS;
    \n deny all;
    \n}

    \n
    `三、重启 Nginx

    \n\n

    /usr/local/nginx/sbin/nginx -s reload

    \n\n

    四、相关数据说明
    \nActive connections: 对后端发起的活动连接数.
    \nServer accepts handled requests: Nginx总共处理了38810620个连接,成功创建38810620次握手(证明中间没有失败的),总共处理了298655730个请求.
    \nReading: Nginx 读取到客户端的Header信息数.
    \nWriting: Nginx 返回给客户端的Header信息数.
    \nWaiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是Nginx已经处理完成,正在等候下一次请求指令的驻留连接.
    \n所以,在访问效率高,请求很快被处理完毕的情况下,Waiting数比较多是正常的.如果reading +writing数较多,则说明并发访问量非常大,正在处理过程中.```

    \n", "_id"=>1106}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>1107}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机发的文章", "body"=>"好久没写文章了,装了个客户端,没事的时候可以写点随笔,时间好快,不记录以后全部都会忘记的..", "created_at"=>2011-11-22 06:02:19 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    好久没写文章了,装了个客户端,没事的时候可以写点随笔,时间好快,不记录以后全部都会忘记的..

    \n", "_id"=>1108}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>1109}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"防范垃圾利器Akismet使用体验和原理分析", "body"=>"博客不经常更新的原因是垃圾太猛烈,每次来要删除一批垃圾评论,而且wp后台的那个未审核评论变成垃圾评论还真是麻烦,每次都直接跑去查数据库\r\n````\r\nselect count(*),comment_approved from ice_comments group by comment_approved;\r\n+----------+------------------+\r\n| count(*) | comment_approved |\r\n+----------+------------------+\r\n| 5709 | 0 | \r\n| 579 | 1 | \r\n| 71 | spam | \r\n+----------+------------------+\r\n```\r\n\r\n看到那个comment_approved是0 的就是还没审核的,一个一个审核实在是麻烦的不行~~\r\n找到一个很多人不错的插件 Akismet(Automattic Kismet)是应用广泛的一个垃圾留言过滤系统,其作者是大名鼎鼎的WordPress创始人Matt Mullenweg,Akismet也是WordPress默认安装的插件,其使用非常广泛,设计目标便是帮助博客网站来过滤留言spam。\r\n开启后回自动把comment_approved是0的检查一遍,看看我的\r\n```` \r\nmysql> select count(*),comment_approved from ice_comments group by comment_approved;\r\n+----------+------------------+\r\n| count(*) | comment_approved |\r\n+----------+------------------+\r\n| 5214 | 0 | \r\n| 579 | 1 | \r\n| 566 | spam | \r\n+----------+------------------+\r\n3 rows in set (0.00 sec)\r\n```\r\n慢慢自动检查去吧,希望这个能把垃圾评论都找出来~~~\r\n\r\n说到这里,对Akismet的工作原理有了更多兴趣,顺手查了下:当一名用户把一条评论列为垃圾评论时,该数据会自动上传到Akismet的服务器上,以方便其他用户的Akismet自动拦截垃圾评论,因此Akismet可以说是广大Akismet用户共同维护的评论防火墙。\r\n大概的流程估计是这样的:\r\n\r\n
    1、所有评论首先都会传送一份到akismet服务器进行判断。\r\n2、akismet收集到了名字,网址,邮箱,和内容,ip,5个数据,其中名字应该不可能用作判断依据。\r\n3、akismet有一个信任名单,中立名单,黑名单几个级别。\r\n4、每当博主对评论手动通过一次,该评论的网址,邮箱,ip就获得一次加权。当积累到一定量之后进入信任白名单,所发评论能自动通过。\r\n5、当博主对评论进行一次垃圾标记,该评论的网址,邮箱,和内容,ip就获得一次负加权,当积累到一定量之后进入黑名单。
    \r\n\r\n\r\n如上过程应该有个机器学习的过程~加上一些算法和挖掘的原理,应该是可以实现的,其压力应该在服务器负载上,想全球那么多的wp程序(还有些其他网站接入Akismet的),每次评论的时候一个请求,这个量不得了呀~ 所以我估计Akismet的处理逻辑应该也是分层级的,比如说一个ip已经进入黑名单了,那么他的处理应该很简单了,如果不是黑名单,估计还回根据内容等其他信息判断~~\r\n\r\n于是乎,我想到eoeandroid的管理员和版主每天和spam抗争的惨烈情景,不晓得Discuz论坛是否有Akismet插件,如果没有,谁有兴趣可以开发一个,大体思路如下:\r\n
    \r\n1.使用Akismet提供的API对信息进行检测,地址 http://akismet.com/development/api/;\r\n2.对信息的检测只针对特定的用户组,比如“新手上路”、分低于200或者发贴量少于50个帖子的用户,做此限制主要是为了不影响论坛的忠实支持者的操作;\r\n3.用户提交的内容检测为Span时,阻止发贴、回复的操作,并提示用户,并记录用户提交垃圾信息的数次,当达到一定程序时将此用户禁言一定时间;\r\n4.相关参数在后台实现设置接口。\r\n5.在Discuz管理后台设置API Key,并检测API Key的有效性。\r\n
    \r\n查了下,好像没看到Discuz有这个插件,谁有兴趣开发一个~~", "created_at"=>2012-01-01 18:32:52 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    博客不经常更新的原因是垃圾太猛烈,每次来要删除一批垃圾评论,而且wp后台的那个未审核评论变成垃圾评论还真是麻烦,每次都直接跑去查数据库
    \n`
    \nselect count(*),comment_approved from ice_comments group by comment_approved;
    \n+----------+------------------+
    \n| count(*) | comment_approved |
    \n+----------+------------------+
    \n| 5709 | 0 |
    \n| 579 | 1 |
    \n| 71 | spam |
    \n+----------+------------------+
    \n

    \n\n

    看到那个comment_approved是0 的就是还没审核的,一个一个审核实在是麻烦的不行~~
    \n找到一个很多人不错的插件 Akismet(Automattic Kismet)是应用广泛的一个垃圾留言过滤系统,其作者是大名鼎鼎的WordPress创始人Matt Mullenweg,Akismet也是WordPress默认安装的插件,其使用非常广泛,设计目标便是帮助博客网站来过滤留言spam。
    \n开启后回自动把comment_approved是0的检查一遍,看看我的
    \n`
    \nmysql> select count(*),comment_approved from ice_comments group by comment_approved;
    \n+----------+------------------+
    \n| count(*) | comment_approved |
    \n+----------+------------------+
    \n| 5214 | 0 |
    \n| 579 | 1 |
    \n| 566 | spam |
    \n+----------+------------------+
    \n3 rows in set (0.00 sec)
    \n

    \n慢慢自动检查去吧,希望这个能把垃圾评论都找出来~~~

    \n\n

    说到这里,对Akismet的工作原理有了更多兴趣,顺手查了下:当一名用户把一条评论列为垃圾评论时,该数据会自动上传到Akismet的服务器上,以方便其他用户的Akismet自动拦截垃圾评论,因此Akismet可以说是广大Akismet用户共同维护的评论防火墙。
    \n大概的流程估计是这样的:

    \n\n

    1、所有评论首先都会传送一份到akismet服务器进行判断。
    \n2、akismet收集到了名字,网址,邮箱,和内容,ip,5个数据,其中名字应该不可能用作判断依据。
    \n3、akismet有一个信任名单,中立名单,黑名单几个级别。
    \n4、每当博主对评论手动通过一次,该评论的网址,邮箱,ip就获得一次加权。当积累到一定量之后进入信任白名单,所发评论能自动通过。
    \n5、当博主对评论进行一次垃圾标记,该评论的网址,邮箱,和内容,ip就获得一次负加权,当积累到一定量之后进入黑名单。

    \n\n

    如上过程应该有个机器学习的过程~加上一些算法和挖掘的原理,应该是可以实现的,其压力应该在服务器负载上,想全球那么多的wp程序(还有些其他网站接入Akismet的),每次评论的时候一个请求,这个量不得了呀~ 所以我估计Akismet的处理逻辑应该也是分层级的,比如说一个ip已经进入黑名单了,那么他的处理应该很简单了,如果不是黑名单,估计还回根据内容等其他信息判断~~

    \n\n

    于是乎,我想到eoeandroid的管理员和版主每天和spam抗争的惨烈情景,不晓得Discuz论坛是否有Akismet插件,如果没有,谁有兴趣可以开发一个,大体思路如下:
    \n
    \n1.使用Akismet提供的API对信息进行检测,地址 http://akismet.com/development/api/
    \n2.对信息的检测只针对特定的用户组,比如“新手上路”、分低于200或者发贴量少于50个帖子的用户,做此限制主要是为了不影响论坛的忠实支持者的操作;
    \n3.用户提交的内容检测为Span时,阻止发贴、回复的操作,并提示用户,并记录用户提交垃圾信息的数次,当达到一定程序时将此用户禁言一定时间;
    \n4.相关参数在后台实现设置接口。
    \n5.在Discuz管理后台设置API Key,并检测API Key的有效性。
    \n
    \n查了下,好像没看到Discuz有这个插件,谁有兴趣开发一个~~

    \n", "_id"=>1110}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails项目android-group中集成Akismet", "body"=>"前面一篇文章《防范垃圾利器Akismet使用体验和原理分析》讲到Akismet的原理,其中说到看谁有兴趣给dz加个类似的功能,我是懒得写php的code,写写rails的还有点兴趣,于是在android-group这个项目里添加了下,android-group是直接fork的ruby-china,把大概过程说下:\r\n\r\n1. 加插件ruby-akismet\r\n已经有人写了akismet的ruby插件https://github.com/joshfrench/rakismet,有有人封装了一次https://github.com/ysbaddaden/ruby-akismet,就很好使用了。\r\n
    \r\n#Add this gem to your Gemfile:\r\ngem 'ruby-akismet', :require => 'akismet'\r\n```\r\n\r\n\r\n#Create an initializer file like config/initializers/akismet.rb with your configuration:\r\n
    \r\nAkismet.key = '123456789'\r\nAkismet.blog = 'http://example.com'\r\nAkismet.logger = Rails.logger\r\n```\r\n\r\n2. 修改代码\r\n#修改Reply.rb,添加\r\n
    \r\nfield :spam, :type => Boolean, :default => false\r\n```\r\n#修改RepliesController\r\n
    \r\n# coding: utf-8\r\nclass RepliesController < ApplicationController```\r\n\r\nload_and_authorize_resource :reply\r\n\r\nbefore_filter :find_topic\r\ndef create\r\n\r\n@reply = @topic.replies.build(params[:reply])\r\n\r\n@reply.user_id = current_user.id\r\n@reply.spam = Akismet.spam?(akismet_attributes, request)\r\nlogger.info(\"akismet_attributes:\#{akismet_attributes}\")\r\nlogger.info(\"@reply.spam:\#{@reply.spam}\")\r\nif @reply.save\r\ncurrent_user.read_topic(@topic)\r\n@msg = t(\"topics.reply_success\")\r\nelse\r\n@msg = @reply.errors.full_messages.join(\"\r\n\")\r\nend\r\nend\r\n\r\ndef edit\r\n@reply = current_user.replies.find(params[:id])\r\ndrop_breadcrumb(t(\"menu.topics\"), topics_path)\r\ndrop_breadcrumb t(\"reply.edit_reply\")\r\nend\r\n\r\ndef update\r\n@reply = current_user.replies.find(params[:id])\r\n\r\nif @reply.update_attributes(params[:reply])\r\nredirect_to(topic_path(@reply.topic_id), :notice => '回帖更新成功.')\r\nelse\r\nrender :action => \"edit\"\r\nend\r\nend\r\n\r\nprotected\r\n\r\ndef akismet_attributes\r\n{\r\n:comment_author => @reply.user.login,\r\n:comment_author_url => user_url(@reply.user.login),\r\n:comment_author_email => @reply.user.email,\r\n:comment_content => @reply.body,\r\n:permalink => topic_url(@reply.topic_id)\r\n}\r\nend\r\n\r\ndef find_topic\r\n@topic = Topic.find(params[:topic_id])\r\nend\r\n\r\nend\r\n\r\n```\r\n\r\n#修改Cpanel::RepliesController,增加如下两个方法\r\n
    \r\ndef spam\r\n@reply = Reply.find(params[:id])\r\n@reply.update_attribute(:spam, true)\r\nAkismet.submit_spam(akismet_attributes)\r\nredirect_to(cpanel_replies_path)\r\nend\r\n\r\ndef ham\r\n@reply = Reply.find(params[:id])\r\n@reply.update_attribute(:spam, true)\r\nAkismet.submit_ham(akismet_attributes)\r\nredirect_to(cpanel_replies_path)\r\nend\r\n```\r\n\r\n#修改routes文件\r\n
    \r\nresources :replies do\r\nmember do\r\npost :spam\r\npost :ham\r\nend\r\nend\r\n```\r\n\r\n#再修改下view和locales文件就可以了,具体的就不贴了,可以在github上看到\r\nhttps://github.com/IceskYsl/android-group/commit/79fabb06b12fd776b301fed2c7c10aee744c5974\r\n\r\n也可以参考:\r\nhttp://rubydoc.info/github/ysbaddaden/ruby-akismet/master/frames\r\n\r\n项目地址:\r\nhttps://github.com/huacnlee/ruby-china\r\nhttps://github.com/IceskYsl/android-group", "created_at"=>2012-01-01 20:42:41 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    前面一篇文章《防范垃圾利器Akismet使用体验和原理分析》讲到Akismet的原理,其中说到看谁有兴趣给dz加个类似的功能,我是懒得写php的code,写写rails的还有点兴趣,于是在android-group这个项目里添加了下,android-group是直接fork的ruby-china,把大概过程说下:

    \n\n

    1. 加插件ruby-akismet
    \n已经有人写了akismet的ruby插件https://github.com/joshfrench/rakismet,有有人封装了一次https://github.com/ysbaddaden/ruby-akismet,就很好使用了。
    \n
    \n#Add this gem to your Gemfile:
    \ngem 'ruby-akismet', :require => 'akismet'
    \n```

    \n\n

    #Create an initializer file like config/initializers/akismet.rb with your configuration:
    \n
    \nAkismet.key = '123456789'
    \nAkismet.blog = 'http://example.com'
    \nAkismet.logger = Rails.logger
    \n
    \n<!--more-->
    \n<strong>2. 修改代码</strong>
    \n<strong>#修改Reply.rb,添加</strong>
    \n<pre lang="ruby" line="1">
    \nfield :spam, :type =&gt; Boolean, :default =&gt; false
    \n

    \n#修改RepliesController

    \n\n

    coding: utf-8

    \n\n

    class RepliesController < ApplicationController```

    \n\n

    load_and_authorize_resource :reply

    \n\n

    before_filter :find_topic
    \ndef create

    \n\n

    @reply = @topic.replies.build(params[:reply])

    \n\n

    @reply.user_id = current_user.id
    \n@reply.spam = Akismet.spam?(akismet_attributes, request)
    \nlogger.info("akismet_attributes:\#{akismet_attributes}")
    \nlogger.info("@reply.spam:\#{@reply.spam}")
    \nif @reply.save
    \ncurrent_user.read_topic(@topic)
    \n@msg = t("topics.reply_success")
    \nelse
    \n@msg = @reply.errors.full_messages.join("
    \n")
    \nend
    \nend

    \n\n

    def edit
    \n@reply = current_user.replies.find(params[:id])
    \ndrop_breadcrumb(t("menu.topics"), topics_path)
    \ndrop_breadcrumb t("reply.edit_reply")
    \nend

    \n\n

    def update
    \n@reply = current_user.replies.find(params[:id])

    \n\n

    if @reply.update_attributes(params[:reply])
    \nredirect_to(topic_path(@reply.topic_id), :notice => '回帖更新成功.')
    \nelse
    \nrender :action => "edit"
    \nend
    \nend

    \n\n

    protected

    \n\n

    def akismet_attributes
    \n{
    \n:comment_author => @reply.user.login,
    \n:comment_author_url => user_url(@reply.user.login),
    \n:comment_author_email => @reply.user.email,
    \n:comment_content => @reply.body,
    \n:permalink => topic_url(@reply.topic_id)
    \n}
    \nend

    \n\n

    def find_topic
    \n@topic = Topic.find(params[:topic_id])
    \nend

    \n\n

    end

    \n
    #修改Cpanel::RepliesController,增加如下两个方法\n<pre lang="ruby" line="1">\ndef spam\n@reply = Reply.find(params[:id])\n@reply.update_attribute(:spam, true)\nAkismet.submit_spam(akismet_attributes)\nredirect_to(cpanel_replies_path)\nend\n\ndef ham\n@reply = Reply.find(params[:id])\n@reply.update_attribute(:spam, true)\nAkismet.submit_ham(akismet_attributes)\nredirect_to(cpanel_replies_path)\nend\n
    \n
    \n\n

    #修改routes文件
    \n
    \nresources :replies do
    \nmember do
    \npost :spam
    \npost :ham
    \nend
    \nend
    \n```

    \n\n

    再修改下view和locales文件就可以了,具体的就不贴了,可以在github上看到

    \n\n

    https://github.com/IceskYsl/android-group/commit/79fabb06b12fd776b301fed2c7c10aee744c5974

    \n\n

    也可以参考:
    \nhttp://rubydoc.info/github/ysbaddaden/ruby-akismet/master/frames

    \n\n

    项目地址:
    \nhttps://github.com/huacnlee/ruby-china
    \nhttps://github.com/IceskYsl/android-group

    \n", "_id"=>1111}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"nginx upstream的5种配置方式", "body"=>"nginx的upstream目前支持5种方式的分配\r\n\r\n1、轮询(默认)\r\n每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。\r\n\r\n2、weight\r\n指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。\r\n例如:\r\n````upstream bakend {\r\nserver 192.168.0.14 weight=10;\r\nserver 192.168.0.15 weight=10;\r\n}```\r\n\r\n3、ip_hash \r\n每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。\r\n例如:\r\nupstream bakend {\r\nip_hash;\r\nserver 192.168.0.14:88;\r\nserver 192.168.0.15:80;\r\n}\r\n\r\n4、fair(第三方)\r\n按后端服务器的响应时间来分配请求,响应时间短的优先分配。\r\n````upstream backend {\r\nserver server1;\r\nserver server2;\r\nfair;\r\n}```\r\n\r\n5、url_hash(第三方)\r\n按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。\r\n例:在upstream中加入hash语句,server语句中不能写入weight等其他的参数,hash_method是使用的hash算法\r\n\r\n````upstream backend {\r\nserver squid1:3128;\r\nserver squid2:3128;\r\nhash $request_uri;\r\nhash_method crc32;\r\n}```\r\n\r\ntips:\r\n````upstream bakend{#定义负载均衡设备的Ip及设备状态\r\nip_hash;\r\nserver 127.0.0.1:9090 down;\r\nserver 127.0.0.1:8080 weight=2;\r\nserver 127.0.0.1:6060;\r\nserver 127.0.0.1:7070 backup;\r\n}```\r\n在需要使用负载均衡的server中增加\r\nproxy_pass http://bakend/;\r\n\r\n每个设备的状态设置为:\r\n
    1.down 表示单前的server暂时不参与负载\r\n2.weight 默认为1.weight越大,负载的权重就越大。\r\n3.max_fails :允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream 模块定义的错误\r\n4.fail_timeout:max_fails次失败后,暂停的时间。\r\n5.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
    \r\nnginx支持同时设置多组的负载均衡,用来给不用的server来使用。\r\n\r\nclient_body_in_file_only 设置为On 可以讲client post过来的数据记录到文件中用来做debug\r\nclient_body_temp_path 设置记录文件的目录 可以设置最多3层目录\r\nlocation 对URL进行匹配.可以进行重定向或者进行新的代理 负载均衡\r\n\r\n参考:\r\nhttp://wiki.nginx.org/HttpUpstreamModule\r\nhttp://www.pagefault.info/?p=251", "created_at"=>2012-01-03 04:00:53 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    nginx的upstream目前支持5种方式的分配

    \n\n

    1、轮询(默认)
    \n每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。

    \n\n

    2、weight
    \n指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。
    \n例如:
    \n`upstream bakend {
    \nserver 192.168.0.14 weight=10;
    \nserver 192.168.0.15 weight=10;
    \n}

    \n\n

    3、ip_hash
    \n每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。
    \n例如:
    \nupstream bakend {
    \nip_hash;
    \nserver 192.168.0.14:88;
    \nserver 192.168.0.15:80;
    \n}

    \n\n

    4、fair(第三方)
    \n按后端服务器的响应时间来分配请求,响应时间短的优先分配。
    \n`upstream backend {
    \nserver server1;
    \nserver server2;
    \nfair;
    \n}

    \n\n

    5、url_hash(第三方)
    \n按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。
    \n例:在upstream中加入hash语句,server语句中不能写入weight等其他的参数,hash_method是使用的hash算法<!--more-->

    \n\n

    `upstream backend {
    \nserver squid1:3128;
    \nserver squid2:3128;
    \nhash $request_uri;
    \nhash_method crc32;
    \n}

    \n\n

    tips:
    \n`upstream bakend{#定义负载均衡设备的Ip及设备状态
    \nip_hash;
    \nserver 127.0.0.1:9090 down;
    \nserver 127.0.0.1:8080 weight=2;
    \nserver 127.0.0.1:6060;
    \nserver 127.0.0.1:7070 backup;
    \n}

    \n在需要使用负载均衡的server中增加
    \nproxy_pass http://bakend/;

    \n\n

    每个设备的状态设置为:
    \n1.down 表示单前的server暂时不参与负载
    \n2.weight 默认为1.weight越大,负载的权重就越大。
    \n3.max_fails :允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream 模块定义的错误
    \n4.fail_timeout:max_fails次失败后,暂停的时间。
    \n5.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
    \nnginx支持同时设置多组的负载均衡,用来给不用的server来使用。

    \n\n

    client_body_in_file_only 设置为On 可以讲client post过来的数据记录到文件中用来做debug
    \nclient_body_temp_path 设置记录文件的目录 可以设置最多3层目录
    \nlocation 对URL进行匹配.可以进行重定向或者进行新的代理 负载均衡

    \n\n

    参考:
    \nhttp://wiki.nginx.org/HttpUpstreamModule
    \nhttp://www.pagefault.info/?p=251

    \n", "_id"=>1112}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>1113}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客记忆:2007年-2011年的博客汇总", "body"=>"晚上心血来潮整理起自己的博客,从2007年开始到现在,快900篇文章,慢慢的整理,记忆一点点的浮现(工作,深圳,北京,创业,成长),发现博客的记忆是片段的有思想的,微博则是零碎的不成体系的废话,为了记忆,以后还是多写点博客~\r\n\r\n1.文章分类汇总\r\n\r\n\"\" \"\"\r\n\r\n从分类上看,过去几年更多的积累还是在技术上,ruby,mac,android和security还是比较多(杂七杂八的分类是中间迁移的时候分类信息丢了的缘故,里面也基本上技术的文字),产品分类是才加上的,现在技术做的比较少了,产品关注的多一些,以后会有更多关于产品相关的~\r\n\r\n2. 按月归档\r\n\r\n\"\"\r\n\r\n看看之前写的纪录,2007到2010年都还算蛮规律的,基本上每个月都会有数量不等的文章~而2011年开始看到写的急剧减少,一个是因为weibo的出现,平日的只言片语都丢weibo上了;二是懒了,写不出大段的文字~\r\n\r\n\r\n\r\n\r\n今天晚上仔细把模板修葺了一下,以后会多三个方面的内容,一个是前面说到的产品,产品是现在看的比较多的;另外一个是和创业相关的文字,创业两年来,我想是有些东西可以分享的;第三个是旅行相关的,本来这个博客是定位技术的,生活会少一些的,后面会写一些和自己的旅行,成长相关的内容~", "created_at"=>2012-01-03 08:56:18 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    晚上心血来潮整理起自己的博客,从2007年开始到现在,快900篇文章,慢慢的整理,记忆一点点的浮现(工作,深圳,北京,创业,成长),发现博客的记忆是片段的有思想的,微博则是零碎的不成体系的废话,为了记忆,以后还是多写点博客~

    \n\n

    1.文章分类汇总

    \n\n

     

    \n\n

    从分类上看,过去几年更多的积累还是在技术上,ruby,mac,android和security还是比较多(杂七杂八的分类是中间迁移的时候分类信息丢了的缘故,里面也基本上技术的文字),产品分类是才加上的,现在技术做的比较少了,产品关注的多一些,以后会有更多关于产品相关的~<!--more-->

    \n\n

    2. 按月归档

    \n\n\n

    看看之前写的纪录,2007到2010年都还算蛮规律的,基本上每个月都会有数量不等的文章~而2011年开始看到写的急剧减少,一个是因为weibo的出现,平日的只言片语都丢weibo上了;二是懒了,写不出大段的文字~

    \n\n\n

    今天晚上仔细把模板修葺了一下,以后会多三个方面的内容,一个是前面说到的产品,产品是现在看的比较多的;另外一个是和创业相关的文字,创业两年来,我想是有些东西可以分享的;第三个是旅行相关的,本来这个博客是定位技术的,生活会少一些的,后面会写一些和自己的旅行,成长相关的内容~

    \n", "_id"=>1114}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"奶奶离开了我们,永远的", "body"=>"时间很快,转眼间走完了2011年,正在感谢2011年亲戚朋友都健康的时候,奶奶即将迎来90高寿。\n然前天晚上家里电话说奶奶住院,有点不舒服,应该无大碍。夜里睡觉不能安心,几次惊醒,就觉得不对劲了。\n果不其然,昨天早上家里来电,奶奶病危,出院回家了,让我们准备回来,准备归的时候又接电话说奶奶回到家了,状况好转。昨天是奶奶90岁生日,我们都觉得挺过这个坎应该就好了,默默祈祷,快到夜里12点的时候,我们都觉得应该过去了。\n但是,最后10多分钟还是没能走完,奶奶离开了我们,在她90岁生日的时候,奶奶没有受苦,是安详的离去的,千里奔袭,一路走一路默默流泪,回去送奶奶最后一程。", "created_at"=>2012-01-06 15:06:33 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    时间很快,转眼间走完了2011年,正在感谢2011年亲戚朋友都健康的时候,奶奶即将迎来90高寿。
    \n然前天晚上家里电话说奶奶住院,有点不舒服,应该无大碍。夜里睡觉不能安心,几次惊醒,就觉得不对劲了。
    \n果不其然,昨天早上家里来电,奶奶病危,出院回家了,让我们准备回来,准备归的时候又接电话说奶奶回到家了,状况好转。昨天是奶奶90岁生日,我们都觉得挺过这个坎应该就好了,默默祈祷,快到夜里12点的时候,我们都觉得应该过去了。
    \n但是,最后10多分钟还是没能走完,奶奶离开了我们,在她90岁生日的时候,奶奶没有受苦,是安详的离去的,千里奔袭,一路走一路默默流泪,回去送奶奶最后一程。

    \n", "_id"=>1115}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"小心ruby中Array的include?方法", "body"=>"前几天遇到一个很诡异的情况,昨天终于找到根本原因并解决了,我觉得有必要把这个过程纪录下,应该会有人遇到类似的问题。\r\n\r\n前几天在一个坛子里问“每天500w条log如何入mysql库比较靠谱”,需求是\r\n
    我们有个产品,每天差不多500w的业务量,需要对500w做相关的分析,就需要入库~\r\n目前用的是mysql 按月切表定期老化数据,但是导入数据情况比较糟糕~每天导入数据差不多需要20个小时,和MySQL 5000 records/second差距巨大~\r\n尝试过三个方案:\r\n1. 定期解析日志,直接入库;\r\n2. 定期解析日志,生成sql,再直接sql入库;\r\n3. 生成data文件,load到库里\r\n但是效果都不理想~ 没什么大数据处理的经验,大家支招~~~
    \r\n其中第一种方案基本上被抛弃了,采用第二种方案,但是还是很糟糕,500w的数据差不多需要10来个小时,还是无法接受,于是仔细剖析了下过程:\r\n
    1. 准备sql文件\r\nsqlFileName = RAILS_ROOT + \"/log/insert.sql.\" + LOG_POSTFIX_FOR_YESTERDAY\r\nsqlfile = File.open(sqlFileName, \"w\")\r\n2. 打开日志文件\r\nFile.open(\"../log/apps.log.\#{LOG_POSTFIX_FOR_YESTERDAY}\").each do |line|\r\n3.提取需要的数据\r\nid, apk_id, ip, client_id, channel_id, uniquely_code ,track = line.split(\" : \")[1].split(\",\")\r\n4. 生成sql串\r\nsqlInsert = \"INSERT logs_downloads.....balalaalala\r\n5. 写到sql文件里\r\nsqlfile.puts( sqlInsert )\r\n6. 调mysql直接导入sql\r\n里面还有一些数据的清洗和排重工作~\r\n每天的日志文件差不多500w行,解析生成sql的过程不理想(其中没用数据库操作)~ 难道是我磁盘性能很糟糕~~
    \r\n过程看到基本上都没问题,无外乎解析文件,写文件的操作,不应该慢成这样的,最后把目光放在了数据的清洗和排重工作种,这个过程是想在入库的时候就把一些虚假的量排除掉,于是我们自己设计了一个算法来过滤,算法的逻辑很简单,根据一些参赛md5出一个key,然后把这个key丢在Array中,然后用include?来判断这个key是否已经存在,问题就出在这里!\r\n\r\nruby的Array中的include?是需要很小心的,我之前想当然的认为这个方法应该很快,也没仔细看就用了,结果发现问题就在这个方法上,直接上下源码看看:\r\n\"\"\r\n当看到:\r\n````\r\nfor (i=0; i #blalalal\r\n}\r\n```\r\n\r\n这个的时候我就明白了,果然,这个方法直接遍历Array,然后你可以想想当我有个500w大小的Array的时候,再用include?是何等的情景啦~\r\n修改方案很容易了,改用hash就好了,不多说~~", "created_at"=>2012-01-17 07:18:18 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    前几天遇到一个很诡异的情况,昨天终于找到根本原因并解决了,我觉得有必要把这个过程纪录下,应该会有人遇到类似的问题。

    \n\n

    前几天在一个坛子里问“每天500w条log如何入mysql库比较靠谱”,需求是
    \n我们有个产品,每天差不多500w的业务量,需要对500w做相关的分析,就需要入库~
    \n目前用的是mysql 按月切表定期老化数据,但是导入数据情况比较糟糕~每天导入数据差不多需要20个小时,和MySQL 5000 records/second差距巨大~
    \n尝试过三个方案:
    \n1. 定期解析日志,直接入库;
    \n2. 定期解析日志,生成sql,再直接sql入库;
    \n3. 生成data文件,load到库里
    \n但是效果都不理想~ 没什么大数据处理的经验,大家支招~~~
    \n其中第一种方案基本上被抛弃了,采用第二种方案,但是还是很糟糕,500w的数据差不多需要10来个小时,还是无法接受,于是仔细剖析了下过程:<!--more-->
    \n1. 准备sql文件
    \nsqlFileName = RAILS_ROOT + "/log/insert.sql." + LOG_POSTFIX_FOR_YESTERDAY
    \nsqlfile = File.open(sqlFileName, "w")
    \n2. 打开日志文件
    \nFile.open("../log/apps.log.\#{LOG_POSTFIX_FOR_YESTERDAY}").each do |line|
    \n3.提取需要的数据
    \nid, apk_id, ip, client_id, channel_id, uniquely_code ,track = line.split(" : ")[1].split(",")
    \n4. 生成sql串
    \nsqlInsert = "INSERT logs_downloads.....balalaalala
    \n5. 写到sql文件里
    \nsqlfile.puts( sqlInsert )
    \n6. 调mysql直接导入sql
    \n里面还有一些数据的清洗和排重工作~
    \n每天的日志文件差不多500w行,解析生成sql的过程不理想(其中没用数据库操作)~ 难道是我磁盘性能很糟糕~~
    \n过程看到基本上都没问题,无外乎解析文件,写文件的操作,不应该慢成这样的,最后把目光放在了数据的清洗和排重工作种,这个过程是想在入库的时候就把一些虚假的量排除掉,于是我们自己设计了一个算法来过滤,算法的逻辑很简单,根据一些参赛md5出一个key,然后把这个key丢在Array中,然后用include?来判断这个key是否已经存在,问题就出在这里!

    \n\n

    ruby的Array中的include?是需要很小心的,我之前想当然的认为这个方法应该很快,也没仔细看就用了,结果发现问题就在这个方法上,直接上下源码看看:
    \n
    \n当看到:
    \n`
    \nfor (i=0; i #blalalal
    \n}
    \n

    \n\n

    这个的时候我就明白了,果然,这个方法直接遍历Array,然后你可以想想当我有个500w大小的Array的时候,再用include?是何等的情景啦~
    \n修改方案很容易了,改用hash就好了,不多说~~

    \n", "_id"=>1116}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"不常用但很有用的linux命令", "body"=>"这里纪录一些不常用但很有用的linux命令\r\n\r\n#通过端口号找到进程(13543这个就是进程号)\r\n[root@ lab]# netstat -lnp | grep 9000\r\ntcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 13543/unicorn.rb -D ", "created_at"=>2012-01-18 00:18:12 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    这里纪录一些不常用但很有用的linux命令

    \n\n

    通过端口号找到进程(13543这个就是进程号)

    \n\n

    [root@ lab]# netstat -lnp | grep 9000
    \ntcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 13543/unicorn.rb -D

    \n", "_id"=>1117}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>1118}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客功能修葺完毕,多写文字", "body"=>"年后回到北京,趁着还有一天稍微宽裕的时间,把博客又修葺了下,现在的结构是我很满意的,大致罗列下~\r\n\r\n1.导航区\r\n\"\"\r\n\r\n导航上是我的主要分类,目前有博客文章,旅行,书,音乐,电影,工具箱,团队以及我个人的信息,以后还会添加的有“我的订阅”,“我的项目”,“我的应用”等~\r\n\r\n2. 旅行\r\n\"\"\r\n我爱旅行,喜欢背着包到处跑,这个页面纪录我曾到过的地方,以后会把照片整理放上来的~\r\n\r\n3. 书\r\n\"\"\r\n“要么旅行要么读书,身体或者是心灵,总有一个需要在路上.”\r\n\r\n4. 音乐\r\n\"\"\r\n\r\n5. 电影\r\n\"\"\r\n\r\n另外,把n年前注册的个人域名启用了,大家以后可以通过: http://www.iceskysl.com/ 访问到这个网站~", "created_at"=>2012-01-27 22:47:29 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    年后回到北京,趁着还有一天稍微宽裕的时间,把博客又修葺了下,现在的结构是我很满意的,大致罗列下~

    \n\n

    1.导航区

    \n\n

    导航上是我的主要分类,目前有博客文章,旅行,书,音乐,电影,工具箱,团队以及我个人的信息,以后还会添加的有“我的订阅”,“我的项目”,“我的应用”等~<!--more-->

    \n\n
      \n
    1. 旅行
      \n
      \n我爱旅行,喜欢背着包到处跑,这个页面纪录我曾到过的地方,以后会把照片整理放上来的~

    2. \n

    3. \n
      \n“要么旅行要么读书,身体或者是心灵,总有一个需要在路上.”

    4. \n
    5. 音乐

    6. \n
    7. 电影

    8. \n
    \n\n

    另外,把n年前注册的个人域名启用了,大家以后可以通过: http://www.iceskysl.com/ 访问到这个网站~

    \n", "_id"=>1119}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"排斥WYSIWYG编辑器", "body"=>"这个blog从2007年开始写,到现在差不多有4-5年了,最开始是用的php的Sablog-X,后来用了自己写的一套rails的1stlog,后来用转到wordpress上一直至今~\r\n\r\n做为大众博客引擎,wordpress是合适的,但是做为技术人员,wordpress太傻瓜了,最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~\r\n\r\n别哪天手痒,又写一套blog引擎吧~ balala~", "created_at"=>2012-01-28 00:45:52 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    这个blog从2007年开始写,到现在差不多有4-5年了,最开始是用的php的Sablog-X,后来用了自己写的一套rails的1stlog,后来用转到wordpress上一直至今~

    \n\n

    做为大众博客引擎,wordpress是合适的,但是做为技术人员,wordpress太傻瓜了,最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~

    \n\n

    别哪天手痒,又写一套blog引擎吧~ balala~

    \n", "_id"=>1120}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>1121}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>1122}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>1123}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>1124}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"入手kindle 4初体验", "body"=>"kindle刚出那会就想着能买一台读书,不知道什么原因没买成,年前又想起,在weibo上问过一次,大家反馈都还不错,过完年回来的一个周末突然想起,就跑到网上查,慢慢才搞明白kindle 4,kindle 3,还有kindle touch,kindle fire都啥区别,于是选了kindle 4,因为只用来读书,应该足够,于是就买了~\r\n\"\"\r\n\r\n在taobao上买的,发的顺风,第二天下午就送到,还是蛮速度的,拆箱子,开机,开始体验传说中的kindle 4~倒腾了一晚上,终于可以写点初体验,就不上图了,说几点我的体验。\r\n\r\n1. 价格真便宜,价格才79刀,taobao上也就600多块钱,应该不算贵吧,相比ipad之类的便宜的不是一点半点;\r\n2. 待机时间超长,重量很轻,加上一个皮套也很轻,轻的你可以躺在床上看也不觉得受累;\r\n3. 书籍蛮多,对中文支持不错,我的买回来的好像给我刷了多看系统,没搞明白啥玩意,直接被我恢复到原版了,对中文支持也很好,可以插上usb直接往里面拷书,也可以通过给username@free.kindle.com发邮件来推送;\r\n4. 推送到kindle的功能相当好用,虽然有所延迟,但是体验还是很好的,方便快捷;\r\n5. 显示效果真好,很柔和很自然(当然有的pdf排版不好的看着还是比较痛苦的)\r\n6. 打字很不方便,需要做读书笔记的要注意了,我连调出键盘输入wifi密码都觉得痛苦~\r\n\r\n如上是几点感受,我用了也还不久,如果你想了解更多,可以给我留言;如果你有更多好书,也可以分享给我,我不看小说,不要分享给我咯~", "created_at"=>2012-02-13 06:03:36 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    kindle刚出那会就想着能买一台读书,不知道什么原因没买成,年前又想起,在weibo上问过一次,大家反馈都还不错,过完年回来的一个周末突然想起,就跑到网上查,慢慢才搞明白kindle 4,kindle 3,还有kindle touch,kindle fire都啥区别,于是选了kindle 4,因为只用来读书,应该足够,于是就买了~

    \n\n

    在taobao上买的,发的顺风,第二天下午就送到,还是蛮速度的,拆箱子,开机,开始体验传说中的kindle 4~倒腾了一晚上,终于可以写点初体验,就不上图了,说几点我的体验。

    \n\n
      \n
    1. 价格真便宜,价格才79刀,taobao上也就600多块钱,应该不算贵吧,相比ipad之类的便宜的不是一点半点;
    2. \n
    3. 待机时间超长,重量很轻,加上一个皮套也很轻,轻的你可以躺在床上看也不觉得受累;
    4. \n
    5. 书籍蛮多,对中文支持不错,我的买回来的好像给我刷了多看系统,没搞明白啥玩意,直接被我恢复到原版了,对中文支持也很好,可以插上usb直接往里面拷书,也可以通过给username@free.kindle.com发邮件来推送;
    6. \n
    7. 推送到kindle的功能相当好用,虽然有所延迟,但是体验还是很好的,方便快捷;
    8. \n
    9. 显示效果真好,很柔和很自然(当然有的pdf排版不好的看着还是比较痛苦的)
    10. \n
    11. 打字很不方便,需要做读书笔记的要注意了,我连调出键盘输入wifi密码都觉得痛苦~
    12. \n
    \n\n

    如上是几点感受,我用了也还不久,如果你想了解更多,可以给我留言;如果你有更多好书,也可以分享给我,我不看小说,不要分享给我咯~

    \n", "_id"=>1125}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"源于内心,回归更纯粹的技术 -记eoeAndroid社区新版上线", "body"=>"eoeAndroid社区是我于[b]2009年4月7日[/b]创办的,转眼间已经来到2012年的2月中旬,不知不觉过去快三个年头,三年来eoeAndroid一直在不停的探索前进,目的是力求让更多人在这能安家落户,学有所成。\r\n\r\n记忆中我们的eoeAndroid已经经过了这么几个阶段\r\n\r\n第一阶段:这是个大家庭(2009年)\r\n社区创建之初,android在国内还很不活跃,社区人数不多,仅有几个好朋友开始活跃,开始摸索android是个什么,可以做什么,社区人不多,但是大家都蛮熟悉,社区象一个大家庭,大家经常熬夜研究文档,代码,试验。\r\n\r\n第二阶段:曲折的发展之路(2010年)\r\n到了2010年前后,有了第二批做android的人,社区得到大家的认可和口碑相传,很快服务器就开始吃紧,开始不稳定,那会服务器还托管在上海一个机房,而后就遭受其他网站的牵连,机房被封,服务器被拔线,几经折腾,后来索性搬迁到国外,虽然一些地方速度慢一些,但是终于稳定了;这段时间很曲折,在国内换从上海换到成都,又换到北京,险些万劫不复,幸好那会备份转移做的比较勤,只丢了一点点数据,万幸!\r\n\r\n第三阶段:蓬勃发展,开拓思路(2011年)\r\n迁往国外后的一段日子,android终于爆发了,开发者数量也开始爆发了,越来越多的人加入android技术阵营,社区一次一次的加带宽,加内存,加磁盘,一次一次的升级,优化,最后我们再次迁回国内,有了自己的机房和专属服务器;社区也做过一次大的升级成开发者门户,想给大家提供更多的内容。\r\n\r\n第四阶段:新起点,新目标\r\n2011底,我们酝酿新的改版,我们一直在思考如何把eoeAndroid社区做好,让更多的人得到帮助,让更多的人踏入android行业的大门;我们设计和讨论过n多方案,最终我们选择的方向是“[color=Red]源于内心,回归更纯粹的技术[/color]”,或许是因为技术出身,对技术有着特殊的感情,我们觉得eoeAndroid一直都有这么一些精神:专业 专注 自由 开放 分享 。我们大家都专注android技术领域,都是专业的人才,我们会积累沉淀好的资源和文章,用心运营;我们也崇尚自由的氛围,开放的态度,乐于分享我们的经验和知识。\r\n新的2012年,我们重新启航,新版今天正式上线,详细的公告在这里 http://www.eoeandroid.com/thread-156623-1-1.html,如果您觉得改的不错,请告诉你的朋友回来瞅瞅,如果你觉得还有可以完善的地方,非常感谢您来这给我捉虫子 http://www.eoeandroid.com/thread-156622-1-1.html\r\n\r\n新的2012年里,我们将秉承:专业 专注 自由 开放 分享。寻觅更多的合作伙伴,为广大开发者解决实际问题,力求把eoeAndroid做成大家都喜欢的eoeAndroid。您如果有任何建议和意见,都非常欢迎得到您的反馈~\r\n\r\n-by iceskysl at 2012.02.16凌晨2点 北京", "created_at"=>2012-02-15 10:08:16 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    eoeAndroid社区是我于[b]2009年4月7日[/b]创办的,转眼间已经来到2012年的2月中旬,不知不觉过去快三个年头,三年来eoeAndroid一直在不停的探索前进,目的是力求让更多人在这能安家落户,学有所成。

    \n\n

    记忆中我们的eoeAndroid已经经过了这么几个阶段

    \n\n

    第一阶段:这是个大家庭(2009年)
    \n社区创建之初,android在国内还很不活跃,社区人数不多,仅有几个好朋友开始活跃,开始摸索android是个什么,可以做什么,社区人不多,但是大家都蛮熟悉,社区象一个大家庭,大家经常熬夜研究文档,代码,试验。

    \n\n

    第二阶段:曲折的发展之路(2010年)
    \n到了2010年前后,有了第二批做android的人,社区得到大家的认可和口碑相传,很快服务器就开始吃紧,开始不稳定,那会服务器还托管在上海一个机房,而后就遭受其他网站的牵连,机房被封,服务器被拔线,几经折腾,后来索性搬迁到国外,虽然一些地方速度慢一些,但是终于稳定了;这段时间很曲折,在国内换从上海换到成都,又换到北京,险些万劫不复,幸好那会备份转移做的比较勤,只丢了一点点数据,万幸!

    \n\n

    第三阶段:蓬勃发展,开拓思路(2011年)
    \n迁往国外后的一段日子,android终于爆发了,开发者数量也开始爆发了,越来越多的人加入android技术阵营,社区一次一次的加带宽,加内存,加磁盘,一次一次的升级,优化,最后我们再次迁回国内,有了自己的机房和专属服务器;社区也做过一次大的升级成开发者门户,想给大家提供更多的内容。

    \n\n

    第四阶段:新起点,新目标
    \n2011底,我们酝酿新的改版,我们一直在思考如何把eoeAndroid社区做好,让更多的人得到帮助,让更多的人踏入android行业的大门;我们设计和讨论过n多方案,最终我们选择的方向是“[color=Red]源于内心,回归更纯粹的技术[/color]”,或许是因为技术出身,对技术有着特殊的感情,我们觉得eoeAndroid一直都有这么一些精神:专业 专注 自由 开放 分享 。我们大家都专注android技术领域,都是专业的人才,我们会积累沉淀好的资源和文章,用心运营;我们也崇尚自由的氛围,开放的态度,乐于分享我们的经验和知识。
    \n新的2012年,我们重新启航,新版今天正式上线,详细的公告在这里 http://www.eoeandroid.com/thread-156623-1-1.html,如果您觉得改的不错,请告诉你的朋友回来瞅瞅,如果你觉得还有可以完善的地方,非常感谢您来这给我捉虫子 http://www.eoeandroid.com/thread-156622-1-1.html

    \n\n

    新的2012年里,我们将秉承:专业 专注 自由 开放 分享。寻觅更多的合作伙伴,为广大开发者解决实际问题,力求把eoeAndroid做成大家都喜欢的eoeAndroid。您如果有任何建议和意见,都非常欢迎得到您的反馈~

    \n\n

    -by iceskysl at 2012.02.16凌晨2点 北京

    \n", "_id"=>1126}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决用ruby生成大xml文件的性能问题", "body"=>"近日遇到一个需求是定期生成一个很大的xml文件,可能会10多w个item,过程中需要查询数据库,需要一些运算,遇到了性能问题,开始使用nokogiri,但是很慢很慢,大概的代码如下:\r\n````\r\nrequire 'rubygems'\r\nrequire 'nokogiri'\r\na = Time.now\r\nbuilder = Nokogiri::XML::Builder.new do |xml|\r\n xml.root {\r\n (1..500000).each do |k|\r\n xml.products {\r\n xml.widget {\r\n xml.id_ k\r\n xml.name \"Awesome iceskysl widget\"\r\n }\r\n }\r\n end\r\n }\r\nend\r\no = File.new(\"test_noko.xml\", \"w\")\r\no.write(builder.to_xml)\r\no.close\r\nputs (Time.now-a).to_s\r\n```\r\n\r\n这个代码有2个主要的问题:\r\n1. 慢\r\n2. 耗内存\r\n\r\n于是我们有两个解决方案,分别是:\r\n\r\n\r\n1.用libxml-ruby替代nokogiri,因为nokogiri优势是读取的快,写的花一般,用libxml-ruby可以这样\r\n````\r\nrequire 'rubygems'\r\nrequire 'xml'\r\ndoc = XML::Document.new()\r\ndoc.root = XML::Node.new('root_node')\r\nroot = doc.root\r\n\r\n500000.times do |k|\r\n root << elem1 = XML::Node.new('products')\r\n elem1 << elem2 = XML::Node.new('widget')\r\n elem2['id'] = k.to_s\r\n elem2['name'] = 'Awesome widget'\r\nend\r\n\r\ndoc.save('foo.xml', :indent => false, :encoding => XML::Encoding::UTF_8)\r\n```\r\n执行的结构类似\r\nice@mac:/source/labs/xml > time ruby test_xml2.rb \r\nreal\t0m50.065s\r\nuser\t0m4.594s\r\nsys\t0m0.509s\r\n\r\n2. 直接写,示范代码如下\r\nf = File.open(\"foo.xml\", \"w\")\r\nf.puts(\"\")\r\nf.puts('')\r\n500000.times do |k|\r\n f.puts \"\"\r\nend\r\nf.puts('')\r\nf.close\r\n\r\n运行结构类似这样的:\r\nice@mac:/source/labs/xml > time ruby test_xml.rb \r\nreal\t0m0.974s\r\nuser\t0m0.813s\r\nsys\t0m0.063s\r\n\r\n从上面可以看到,效率差别还是蛮大的,回到我自己的case里来,原来需要6个小时的job现在不要30分钟就搞定了(自然还有一些其他的优化,就不细说了)~~", "created_at"=>2012-02-24 03:28:51 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    近日遇到一个需求是定期生成一个很大的xml文件,可能会10多w个item,过程中需要查询数据库,需要一些运算,遇到了性能问题,开始使用nokogiri,但是很慢很慢,大概的代码如下:
    \n`
    \nrequire 'rubygems'
    \nrequire 'nokogiri'
    \na = Time.now
    \nbuilder = Nokogiri::XML::Builder.new do |xml|
    \n xml.root {
    \n (1..500000).each do |k|
    \n xml.products {
    \n xml.widget {
    \n xml.id_ k
    \n xml.name "Awesome iceskysl widget"
    \n }
    \n }
    \n end
    \n }
    \nend
    \no = File.new("test_noko.xml", "w")
    \no.write(builder.to_xml)
    \no.close
    \nputs (Time.now-a).to_s
    \n

    \n\n

    这个代码有2个主要的问题:
    \n1. 慢
    \n2. 耗内存

    \n\n

    于是我们有两个解决方案,分别是:
    \n<!--more-->

    \n\n

    1.用libxml-ruby替代nokogiri,因为nokogiri优势是读取的快,写的花一般,用libxml-ruby可以这样
    \n````
    \nrequire 'rubygems'
    \nrequire 'xml'
    \ndoc = XML::Document.new()
    \ndoc.root = XML::Node.new('root_node')
    \nroot = doc.root

    \n\n

    500000.times do |k|
    \n root << elem1 = XML::Node.new('products')
    \n elem1 << elem2 = XML::Node.new('widget')
    \n elem2['id'] = k.to_s
    \n elem2['name'] = 'Awesome widget'
    \nend

    \n\n

    doc.save('foo.xml', :indent => false, :encoding => XML::Encoding::UTF_8)
    \n```
    \n执行的结构类似
    \nice@mac:/source/labs/xml > time ruby test_xml2.rb
    \nreal 0m50.065s
    \nuser 0m4.594s
    \nsys 0m0.509s

    \n\n

    2. 直接写,示范代码如下
    \nf = File.open("foo.xml", "w")
    \nf.puts("<?xml version=\\"1.0\\" encoding=\\"gbk\\"?>")
    \nf.puts('')
    \n500000.times do |k|
    \n f.puts ""
    \nend
    \nf.puts('')
    \nf.close

    \n\n

    运行结构类似这样的:
    \nice@mac:/source/labs/xml > time ruby test_xml.rb
    \nreal 0m0.974s
    \nuser 0m0.813s
    \nsys 0m0.063s

    \n\n

    从上面可以看到,效率差别还是蛮大的,回到我自己的case里来,原来需要6个小时的job现在不要30分钟就搞定了(自然还有一些其他的优化,就不细说了)~~

    \n", "_id"=>1127}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>1128}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>1129}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"说说我招聘android技术人员的思路", "body"=>"事情源于在eoe android社区看到一个同学写了《android面试全跟踪——看到天涯失业7个月,有感而发写下此文》,文章中详细纪录了自己寻找android工作的过程,其中个中辛酸,我想只有体验过这个过程的人才有体会;我把那个帖子转到weibo上,很多人也反馈说看着心酸,我觉得我可以写点东西分享下企业怎么看android技术人员的招聘。\r\n\r\n有些人可能对我多少有些了解,应该算国内第一批开始搞android相关的人,09年创办的android开发社区(eoeandroid.com)现在也是国内android开发人员最活跃的社区,我写过一些代码,也写过一些技术的文章,也做过android应用,也见过很多android的技术,也给公司(eoe)招了不少android技术人员,也给不少朋友奇特推荐过android技术的人,我下面会分享我对android技术人员招聘的一些看法。\r\n\r\n1. 首先看为人:品性很重要\r\n\r\n或许是因为我们是创业公司,会严格选择每一个进来的人,特别是技术的人。技术很重要,但是在我这边不是第一位的,人品和性格是第一的,创业公司唯一不变的就是变化,如果人品不过关的人肯定待不住,如果性格合不来的人肯定待不久。有人说这个很虚,见一面怎么可能看出品性,其实不难,一举一动,言语措辞都很简单就可以看出一个人的内在(因为技术的人为人真的很简单),所以,如果你去面熟,表现真实的自己,对公司,对个人都是有好处的,合得来就是合得来,合不来强求也没用,这本是个双向选择的事情,不存在谁强势谁弱势。积极,主动,自信,阳光是比较好的品格~\r\n\r\n2. 接着看技术:基本功需要有体系,够扎实,思维要跳跃\r\n\r\n如果来eoe面试过的人应该知道,我们面android有一套笔试题,但是java的,很多人不理解可能会问我来面android的为啥让我做java的题?其实很简单,java是基础,我们的笔试题会涉及到基础的,算法的,开放性的试题,我们需要全面的了解一个人。每个题目都很重要,所以,如果去面试,如果对方是精心设计的题,请认真一点回答,记住认真不是死板,答题看的是基础和思维,细节无所谓,因为有真正干活的时候有google,有api~\r\n\r\n3. 然后看经验:经验很重要,你必须对你做过的项目了如指掌\r\n\r\n做完题目,我们一般就正式面试了,会问问笔试题目上你的感觉和具体一个问题的思路,然后才开始问之前的经验,我们的要求是必须真正做过项目,如果没项目,应用也行,其实需要的就是一个关键点:你真正操作过一个应用,对你做过的模块必须了如指掌,我们不会问太多项目,让你一个最熟悉的或者最喜欢的项目,问的很细节,细节到你证明这个项目自己之前是用心做的,或者证明你在这个项目就是个打酱油的。\r\n\r\n然后会问点和android相关的东西,一般容易的,中等的和比较刁钻的问题都会问一些,刁钻的比如会问你现场保护的机制,方式,为什么要现场保护等等问题,如果你是个做技术爱思考的人,这些问题应该不难,如果你虽然做过1-2年android,但是每个方面都很泛泛,那你肯定会被问的傻傻的。\r\n\r\n最后会问一些开放性的问题,都是很随机的题目,比如桌子上的一个杯子等等都可能会被问~~这个地方主要看整体的思维和分析问题的能力。\r\n\r\n4. 做决定:合适还是不合适,或者留题目,做个小测试\r\n\r\n如此过程,我们基本上就能判断一个人是否符合我们要求,如果不满足,我们基本会很直接告诉原因是什么,哪个地方我们觉得不合适,你以后应该注意什么?如果我们觉得满足预期,可能就收了;如果我们拿不准,但是觉得你潜力很好,可能会留个题目,做个小东西,不会很难,做的时候请注意自己的编码风格,整体项目结构等等,这些是关键因素~\r\n\r\n如上过程,就是我在招android技术人员的一些思路和过程,我们是创业公司,相对看的更全面的能力,但是我个人觉得企业的思维或许都差不多,如果你要找android相关的工作,请参考~\r\n\r\n另外,android开发社区 里有很多企业招聘android技术人员,大家可以多关注,希望大家能找到自己满意android工作~记得经常来android开发社区活动~\r\n\r\n再顺便提一下,我们(eoe)长期招合适的android技术,如果你有兴趣,可以联系我~", "created_at"=>2012-03-16 05:42:16 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    事情源于在eoe android社区看到一个同学写了《android面试全跟踪——看到天涯失业7个月,有感而发写下此文》,文章中详细纪录了自己寻找android工作的过程,其中个中辛酸,我想只有体验过这个过程的人才有体会;我把那个帖子转到weibo上,很多人也反馈说看着心酸,我觉得我可以写点东西分享下企业怎么看android技术人员的招聘。

    \n\n

    有些人可能对我多少有些了解,应该算国内第一批开始搞android相关的人,09年创办的android开发社区(eoeandroid.com)现在也是国内android开发人员最活跃的社区,我写过一些代码,也写过一些技术的文章,也做过android应用,也见过很多android的技术,也给公司(eoe)招了不少android技术人员,也给不少朋友奇特推荐过android技术的人,我下面会分享我对android技术人员招聘的一些看法。

    \n\n

    1. 首先看为人:品性很重要

    \n\n

    或许是因为我们是创业公司,会严格选择每一个进来的人,特别是技术的人。技术很重要,但是在我这边不是第一位的,人品和性格是第一的,创业公司唯一不变的就是变化,如果人品不过关的人肯定待不住,如果性格合不来的人肯定待不久。有人说这个很虚,见一面怎么可能看出品性,其实不难,一举一动,言语措辞都很简单就可以看出一个人的内在(因为技术的人为人真的很简单),所以,如果你去面熟,表现真实的自己,对公司,对个人都是有好处的,合得来就是合得来,合不来强求也没用,这本是个双向选择的事情,不存在谁强势谁弱势。积极,主动,自信,阳光是比较好的品格~

    \n\n

    2. 接着看技术:基本功需要有体系,够扎实,思维要跳跃

    \n\n

    如果来eoe面试过的人应该知道,我们面android有一套笔试题,但是java的,很多人不理解可能会问我来面android的为啥让我做java的题?其实很简单,java是基础,我们的笔试题会涉及到基础的,算法的,开放性的试题,我们需要全面的了解一个人。每个题目都很重要,所以,如果去面试,如果对方是精心设计的题,请认真一点回答,记住认真不是死板,答题看的是基础和思维,细节无所谓,因为有真正干活的时候有google,有api~

    \n\n

    3. 然后看经验:经验很重要,你必须对你做过的项目了如指掌

    \n\n

    做完题目,我们一般就正式面试了,会问问笔试题目上你的感觉和具体一个问题的思路,然后才开始问之前的经验,我们的要求是必须真正做过项目,如果没项目,应用也行,其实需要的就是一个关键点:你真正操作过一个应用,对你做过的模块必须了如指掌,我们不会问太多项目,让你一个最熟悉的或者最喜欢的项目,问的很细节,细节到你证明这个项目自己之前是用心做的,或者证明你在这个项目就是个打酱油的。

    \n\n

    然后会问点和android相关的东西,一般容易的,中等的和比较刁钻的问题都会问一些,刁钻的比如会问你现场保护的机制,方式,为什么要现场保护等等问题,如果你是个做技术爱思考的人,这些问题应该不难,如果你虽然做过1-2年android,但是每个方面都很泛泛,那你肯定会被问的傻傻的。

    \n\n

    最后会问一些开放性的问题,都是很随机的题目,比如桌子上的一个杯子等等都可能会被问~~这个地方主要看整体的思维和分析问题的能力。

    \n\n

    4. 做决定:合适还是不合适,或者留题目,做个小测试

    \n\n

    如此过程,我们基本上就能判断一个人是否符合我们要求,如果不满足,我们基本会很直接告诉原因是什么,哪个地方我们觉得不合适,你以后应该注意什么?如果我们觉得满足预期,可能就收了;如果我们拿不准,但是觉得你潜力很好,可能会留个题目,做个小东西,不会很难,做的时候请注意自己的编码风格,整体项目结构等等,这些是关键因素~

    \n\n

    如上过程,就是我在招android技术人员的一些思路和过程,我们是创业公司,相对看的更全面的能力,但是我个人觉得企业的思维或许都差不多,如果你要找android相关的工作,请参考~

    \n\n

    另外,android开发社区 里有很多企业招聘android技术人员,大家可以多关注,希望大家能找到自己满意android工作~记得经常来android开发社区活动~

    \n\n

    再顺便提一下,我们(eoe)长期招合适的android技术,如果你有兴趣,可以联系我~

    \n", "_id"=>1130}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>1131}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>1132}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"关于Markdown和Mou", "body"=>"开年的时候写过一篇文章《排斥WYSIWYG编辑器》,其中说到:\r\n
    最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~
    \r\n其实比较成熟的标记语言还是有不少的,比如wiki format,又比如今天要讲的Markdown,甚至还有国内bbs喜欢用的bbcode都还是不错的标记语言,这里主要讲的是Markdown和Mou。\r\n\r\nhttp://apple4.us/上有篇文章写的不错《为什么作家应该用 Markdown 保存自己的文稿》,其中说了为什么作家需要用Markdown保存自己的文稿,其实对技术人员也一样有用,大家可以仔细看看~同时被介绍的还有Mou(Mou The missing Markdown editor for web developers)。\r\n\r\nMou真是个不错的东西,让不会编程的人也很快接收其用法,当你已经熟练掌握其语法后,其实也可以不用Mou,比如技术人员一般直接在textmate里写或者直接写都还蛮不错的。\r\n\r\n大概汇总下用 Markdown 有如下好处:\r\n
      \r\n\t
    1. 干净,只写你需要的文字和标记,没一堆乱七八糟的html
    2. \r\n\t
    3. 简单,真简单,就那么些标记,不需要10分钟你就学会了;
    4. \r\n\t
    5. 纯文本,占的空间小,打开块,记得空doc还有11k;
    6. \r\n\t
    7. 兼容性好,就是文本,文本编辑器都可以打开编辑,最不喜欢的就是.doc或者.gage,那个兼容性呀,简直是噩梦;
    8. \r\n\t
    9. 显示可控,无论是转html,还是又mou这样的工具,还是直接处理,都非常简便;
    10. \r\n\t
    11. 其他
    12. \r\n
    \r\n技术人员如果能坚持写技术blog都能用Markdown保存下来,其实是一个不错的宣传,wordpress会不会又被我废弃,直接写个轻量级的日志引擎,难说~\r\n\r\n \r\n\r\n参考:\r\n\r\nhttp://kramdown.rubyforge.org/documentation.html\r\n\r\nhttps://github.com/tanoku/redcarpet\r\n\r\nhttp://zh.wikipedia.org/wiki/Markdown", "created_at"=>2012-04-06 15:26:48 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    开年的时候写过一篇文章《排斥WYSIWYG编辑器》,其中说到:
    \n最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~
    \n其实比较成熟的标记语言还是有不少的,比如wiki format,又比如今天要讲的Markdown,甚至还有国内bbs喜欢用的bbcode都还是不错的标记语言,这里主要讲的是Markdown和Mou。

    \n\n

    http://apple4.us/上有篇文章写的不错《为什么作家应该用 Markdown 保存自己的文稿》,其中说了为什么作家需要用Markdown保存自己的文稿,其实对技术人员也一样有用,大家可以仔细看看~同时被介绍的还有Mou(Mou The missing Markdown editor for web developers)。

    \n\n

    Mou真是个不错的东西,让不会编程的人也很快接收其用法,当你已经熟练掌握其语法后,其实也可以不用Mou,比如技术人员一般直接在textmate里写或者直接写都还蛮不错的。

    \n\n

    大概汇总下用 Markdown 有如下好处:
    \n
    \n 干净,只写你需要的文字和标记,没一堆乱七八糟的html
    \n 简单,真简单,就那么些标记,不需要10分钟你就学会了;
    \n 纯文本,占的空间小,打开块,记得空doc还有11k;
    \n 兼容性好,就是文本,文本编辑器都可以打开编辑,最不喜欢的就是.doc或者.gage,那个兼容性呀,简直是噩梦;
    \n 显示可控,无论是转html,还是又mou这样的工具,还是直接处理,都非常简便;
    \n 其他
    \n
    \n技术人员如果能坚持写技术blog都能用Markdown保存下来,其实是一个不错的宣传,wordpress会不会又被我废弃,直接写个轻量级的日志引擎,难说~

    \n\n

     

    \n\n

    参考:

    \n\n

    http://kramdown.rubyforge.org/documentation.html

    \n\n

    https://github.com/tanoku/redcarpet

    \n\n

    http://zh.wikipedia.org/wiki/Markdown

    \n", "_id"=>1133}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>1134}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>1135}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:47:04 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>1136}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"site_configs"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"mongoid.auto_increment_ids"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"categories"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"pages"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"posts"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"sites"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"site_configs"}).limit(-1) +MONGODB iceylog_development['site_configs'].find({:key=>"site_title"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_title"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_title", "value"=>"Iceylog", "_id"=>1}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_slogan"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_slogan"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_slogan", "value"=>"Focus on Android,iPhone,Web,Business,Architecture,Agile,Technic and beyond…", "_id"=>2}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author", "value"=>"Icey", "_id"=>3}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_username"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_username"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_username", "value"=>"iceylog", "_id"=>4}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_password"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_password"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_password", "value"=>"password", "_id"=>5}]) +MONGODB iceylog_development['site_configs'].find({:key=>"about_me_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"about_me_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"about_me_html", "value"=>"
    \n

    IceskYsl, 简称Ice, 80后, 典型巨蟹男, 移动互联网创业者; Google产品重度依赖者, Mac, Android, iPhone, BB 非典型用户;关注创新,技术,产品和一切新奇的玩意儿;
    求学武汉, 毕业南下深圳, 尔后北漂在京, 至今数年有余; 追寻内心的想法, 不随波逐流, 爱折腾, 爱旅行, 孩子气, 享受工作, 安静的做喜欢的事情...

    \n
    \n", "_id"=>6}]) +MONGODB iceylog_development['site_configs'].find({:key=>"menu_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"menu_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"menu_html", "value"=>" \t\n", "_id"=>7}]) +MONGODB iceylog_development['site_configs'].find({:key=>"footer_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"footer_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"footer_html", "value"=>"

    Copyright ©2007-2012 - Lovingly authored by IceskYsl - All my work is MIT licensed, Open and Free.

    \n

    \n Powered by Iceylog - Theme by IceskYsl@1.s.t \n - Build by Markdown,\n GitHub, \n Disqus\n

    \t\n", "_id"=>8}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"categories"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"默认分类"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"默认分类", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>1}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"pages"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"about"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"about", "title"=>"About", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>1}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"book"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"book", "title"=>"Book", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>2}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"movie"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"movie", "title"=>"Movie", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>3}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"music"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"music", "title"=>"Music", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>4}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"team"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"team", "title"=>"Team", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>5}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"travel"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"travel", "title"=>"travel", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>6}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"toolkit"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"toolkit", "title"=>"Toolkit", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>7}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"posts"}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["demo", "tag"], "comments_count"=>0, "category_id"=>1, "title"=>"blog post title", "body"=>"This is a new post body,support **Markdown** format..", "updated_at"=>2012-06-24 15:48:46 UTC, "body_html"=>"

    This is a new post body,support Markdown format..

    \n", "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>1}]) +MONGODB iceylog_development['categories'].find({:_id=>1}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>1}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"sites"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{"$or"=>[{:url=>"http://www.iceskysl.com"}]}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"sites"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['sites'].insert([{"name"=>"Iceskysl Blog", "url"=>"http://www.iceskysl.com", "favicon"=>"http://www.google.com/profiles/c/favicons?domain=www.iceskysl.com", "updated_at"=>2012-06-24 15:48:46 UTC, "created_at"=>2012-06-24 15:48:46 UTC, "_id"=>1}]) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Ruby & Rails"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Ruby & Rails", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>2}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Database"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Database", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>3}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Tips"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Tips", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>4}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"04. 无心呢喃 | Buzz"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"04. 无心呢喃 | Buzz", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>5}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"01. 视觉观察 | Observe"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"01. 视觉观察 | Observe", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>6}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Mac & *UNIX"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Mac & *UNIX", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>7}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Security"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Security", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>8}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Architecture"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Architecture", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>9}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Html/css/js"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Html/css/js", "updated_at"=>2012-06-24 15:49:22 UTC, "created_at"=>2012-06-24 15:49:22 UTC, "_id"=>10}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"03. 技术归总 | Technic"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"03. 技术归总 | Technic", "updated_at"=>2012-06-24 15:49:23 UTC, "created_at"=>2012-06-24 15:49:23 UTC, "_id"=>11}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Android & Java"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Android & Java", "updated_at"=>2012-06-24 15:49:23 UTC, "created_at"=>2012-06-24 15:49:23 UTC, "_id"=>12}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"02. 产品设计 | PM"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"02. 产品设计 | PM", "updated_at"=>2012-06-24 15:49:23 UTC, "created_at"=>2012-06-24 15:49:23 UTC, "_id"=>13}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:40 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (90.8ms) +Completed 200 OK in 242ms (Views: 159.9ms | Mongo: 3.1ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:42 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (4.3ms) +Completed 200 OK in 10ms (Views: 6.6ms | Mongo: 1.6ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:43 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (3.5ms) +Completed 200 OK in 9ms (Views: 6.2ms | Mongo: 1.1ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:44 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (4.2ms) +Completed 200 OK in 9ms (Views: 6.9ms | Mongo: 1.2ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:44 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (3.7ms) +Completed 200 OK in 9ms (Views: 6.5ms | Mongo: 1.3ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:49:45 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (32.2ms) +Completed 200 OK in 37ms (Views: 34.7ms | Mongo: 1.3ms) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:49:48 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (1.7ms) +Completed 200 OK in 9ms (Views: 6.2ms | Mongo: 0.6ms) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:49:50 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (0.9ms) +Completed 200 OK in 7ms (Views: 4.9ms | Mongo: 0.5ms) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Making rhtml better", "body"=>"content", "created_at"=>2007-05-19 01:37:13 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>2}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Quick add slashes filter for Rails", "body"=>"content", "created_at"=>2007-05-19 01:34:51 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>3}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>"content", "created_at"=>2007-05-19 01:32:26 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>4}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Counting Distinct Records In Rails", "body"=>"content", "created_at"=>2007-05-19 01:30:32 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>5}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Appending to a string(ROR中的+=和<<操作符的比较)", "body"=>"content", "created_at"=>2007-05-19 01:29:16 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>6}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"content", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>7}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"在WP中实现代码高亮", "body"=>"content", "created_at"=>2010-04-17 04:43:44 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>8}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>".NFClass red links chrome", "body"=>"content", "created_at"=>2012-01-28 01:37:59 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>9}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"有感史诗般对决的澳网决赛", "body"=>"content", "created_at"=>2012-01-29 07:09:37 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>10}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"CodeGear公司准备发布Ruby", "body"=>"content", "created_at"=>2007-05-19 23:05:07 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>11}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails view部分学习笔记", "body"=>"content", "created_at"=>2007-05-19 22:30:36 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>12}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"取各个板块的最近发帖方法", "body"=>"content", "created_at"=>2007-05-19 22:29:27 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>13}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ROR与MySQL的中文显示", "body"=>"content", "created_at"=>2007-05-19 22:26:33 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>14}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在防火墙后安装Rails", "body"=>"content", "created_at"=>2007-05-19 22:25:12 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>15}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"纯CSS实现圆角效果", "body"=>"content", "created_at"=>2007-05-19 22:23:05 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>16}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"去掉CSS中的链接图片的外边框", "body"=>"content", "created_at"=>2007-05-19 22:21:02 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>17}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"CSS控制整个框架居中显示", "body"=>"content", "created_at"=>2007-05-19 22:19:39 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>18}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby操作时间对象", "body"=>"content", "created_at"=>2007-05-19 22:18:11 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>19}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给当前链接加上class属性", "body"=>"content", "created_at"=>2007-05-19 22:16:18 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>20}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏最后四位字符", "body"=>"content", "created_at"=>2007-05-19 22:14:54 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>21}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随机产生密码.", "body"=>"content", "created_at"=>2007-05-19 22:13:03 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>22}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保证上传文件名字的唯一性", "body"=>"content", "created_at"=>2007-05-19 22:11:32 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>23}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"聚焦你的页面上的第一个输入框", "body"=>"content", "created_at"=>2007-05-19 22:06:30 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>24}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"把Google等Spider挡在门外", "body"=>"content", "created_at"=>2007-05-19 22:04:43 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>25}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"按时间归档的Routes写法", "body"=>"content", "created_at"=>2007-05-19 22:00:07 UTC, "updated_at"=>2012-06-24 15:50:51 UTC, "body_html"=>"

    content

    \n", "_id"=>26}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"find out the current url / uri in *.rhtml file", "body"=>"content", "created_at"=>2007-05-19 21:58:09 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>27}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"content", "created_at"=>2007-05-19 21:56:35 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>28}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"特别留意XSS攻击", "body"=>"content", "created_at"=>2007-05-19 21:54:46 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>29}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"神奇好用的find_or_create_by", "body"=>"content", "created_at"=>2007-05-19 21:52:24 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>30}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby对RSS(XML)的实例解析", "body"=>"content", "created_at"=>2007-06-01 23:25:45 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>31}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"How to Transfer Files using SSH and Ruby", "body"=>"content", "created_at"=>2007-05-31 07:55:46 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>32}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introduction to ActiveMessaging for Rails", "body"=>"content", "created_at"=>2007-05-30 21:12:54 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>33}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"清除HTML标签中的危险字符", "body"=>"content", "created_at"=>2007-05-29 21:24:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>34}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"理解REST软件架构", "body"=>"content", "created_at"=>2007-05-28 08:34:03 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>35}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"日期上的迭代问题", "body"=>"content", "created_at"=>2007-05-27 05:09:33 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>36}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Textile Editor Helper", "body"=>"content", "created_at"=>2007-05-24 21:08:58 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>37}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装mongrel服务器", "body"=>"content", "created_at"=>2007-05-23 22:27:14 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>38}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"如何再虚拟主机上安装gem", "body"=>"content", "created_at"=>2007-05-23 19:03:10 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>39}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"初始化数据库", "body"=>"content", "created_at"=>2007-05-22 21:32:41 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>40}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"15步创建一个测试驱动(TDD)的Rails应用~", "body"=>"content", "created_at"=>2007-05-22 21:30:02 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>41}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"拟出的一些ROR的题目~", "body"=>"content", "created_at"=>2007-05-22 08:27:43 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>42}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"SuperRedCloth介绍~", "body"=>"content", "created_at"=>2007-05-21 21:20:43 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>43}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"calendar_helper.rb", "body"=>"content", "created_at"=>2007-05-21 21:13:27 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>44}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Get XML or YAML output of your data quickly", "body"=>"content", "created_at"=>2007-05-21 07:27:24 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>45}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给你的ROR配置一些通用的常量", "body"=>"content", "created_at"=>2007-05-21 06:41:49 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>46}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"说说Blog中的Trackback(引用)功能", "body"=>"content", "created_at"=>2007-05-21 05:54:26 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>47}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"witter发布Gem包提供witter主要功能", "body"=>"content", "created_at"=>2007-05-20 21:17:49 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>48}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"简单的require写法", "body"=>"content", "created_at"=>2007-05-20 20:58:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>49}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现防垃圾的Trackback思路", "body"=>"content", "created_at"=>2007-05-20 18:37:36 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>50}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog插件开发指南", "body"=>"content", "created_at"=>2007-06-17 08:14:03 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>51}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog演示环境搭建好了", "body"=>"content", "created_at"=>2007-06-15 16:46:54 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>52}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在bluehost上部署ROR应用1stlog.", "body"=>"content", "created_at"=>2007-06-15 16:40:29 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>53}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby版的YouTube库接口", "body"=>"content", "created_at"=>2007-06-15 00:52:05 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>54}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.0发布啦!", "body"=>"content", "created_at"=>2007-06-13 07:59:51 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>55}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog Version1.0.0安装部署文档", "body"=>"content", "created_at"=>2007-06-13 00:00:58 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>56}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version: 1.0.0即将发布!", "body"=>"content", "created_at"=>2007-06-11 21:43:15 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>57}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"选取随机的记录的几个方法汇总", "body"=>"content", "created_at"=>2007-06-10 21:09:11 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>58}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails实现下载文件的小技巧", "body"=>"content", "created_at"=>2007-06-10 09:19:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>59}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails4Days中文翻译版", "body"=>"content", "created_at"=>2007-06-10 09:01:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>60}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现验证码需要注意的地方", "body"=>"content", "created_at"=>2007-06-09 09:55:40 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>61}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"完善你的URL显示信息", "body"=>"content", "created_at"=>2007-06-07 19:43:51 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>62}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Layout in Rails(三种方法)", "body"=>"content", "created_at"=>2007-06-07 17:35:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>63}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用check_box_tag时需要注意的", "body"=>"content", "created_at"=>2007-06-07 09:41:03 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>64}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dir.glob基本操作", "body"=>"content", "created_at"=>2007-06-05 23:17:36 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>65}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"自动备份数据库的脚本", "body"=>"content", "created_at"=>2007-06-05 20:50:05 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>66}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在windows上安装RMagick", "body"=>"content", "created_at"=>2007-06-04 22:06:54 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>67}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"mini_magick 1.2.2 Released", "body"=>"content", "created_at"=>2007-06-03 00:01:12 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>68}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"days_in_month函数介绍", "body"=>"content", "created_at"=>2007-06-02 00:29:03 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>69}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装SSH库的时候出现问题的修复", "body"=>"content", "created_at"=>2007-06-01 23:57:42 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>70}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Jsonifier在rails中生成json", "body"=>"content", "created_at"=>2007-07-12 01:14:11 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>71}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"敏捷软件开发宣言", "body"=>"content", "created_at"=>2007-07-11 17:44:44 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>72}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何快速统计RoR网站的访问量", "body"=>"content", "created_at"=>2007-07-10 16:58:48 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>73}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"话题广告测试~", "body"=>"content", "created_at"=>2007-07-04 00:52:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>74}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用图片代替link_to中的文字", "body"=>"content", "created_at"=>2007-07-03 16:52:41 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>75}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中实现跟踪记录每个用户的最近十条记录", "body"=>"content", "created_at"=>2007-07-03 16:47:31 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>76}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中一个方法返回多个结果的实例", "body"=>"content", "created_at"=>2007-07-03 16:30:06 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>77}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用POP3接收邮件", "body"=>"content", "created_at"=>2007-07-03 16:24:28 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>78}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"本站可以订阅啦~", "body"=>"content", "created_at"=>2007-07-01 09:24:21 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>79}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提交多个check_box的写法-check_box_tag.", "body"=>"content", "created_at"=>2007-06-30 01:28:06 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>80}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用ActionMaile发送邮件实例", "body"=>"content", "created_at"=>2007-06-29 16:12:18 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>81}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中的方法调用", "body"=>"content", "created_at"=>2007-06-25 21:00:54 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>82}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"来,Rubyize你的代码~", "body"=>"content", "created_at"=>2007-06-25 17:12:19 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>83}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1可以下载了!", "body"=>"content", "created_at"=>2007-06-24 08:50:02 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>84}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1即将发布~", "body"=>"content", "created_at"=>2007-06-23 08:29:01 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>85}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很棒的Find方法!", "body"=>"content", "created_at"=>2007-06-22 04:47:16 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>86}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"乱码,警惕编辑器的编码~", "body"=>"content", "created_at"=>2007-06-22 02:37:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>87}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"关于HAML的一点点想法~", "body"=>"content", "created_at"=>2007-06-21 17:32:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>88}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于rails启动报500错误的可能问题点", "body"=>"content", "created_at"=>2007-06-19 19:24:55 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>89}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"content", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>90}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)二期功能收集整理", "body"=>"content", "created_at"=>2007-09-05 06:19:00 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>91}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"为技能云的绽放贡献自己的力量!", "body"=>"content", "created_at"=>2007-09-05 07:08:32 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>92}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没通宵了,偶尔来下还行!", "body"=>"content", "created_at"=>2007-09-05 20:20:11 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>93}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新注册了一个NET域名~", "body"=>"content", "created_at"=>2007-09-05 21:00:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>94}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"有惊无险,玩心跳~", "body"=>"content", "created_at"=>2007-09-06 08:01:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>95}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"最近好多事情~", "body"=>"content", "created_at"=>2007-09-10 11:59:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>96}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PS命令查看进程详细参数~", "body"=>"content", "created_at"=>2007-09-11 02:13:51 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>97}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)下一步需要实现的功能!", "body"=>"content", "created_at"=>2007-09-11 03:21:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>98}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)的简历功能已经完成.", "body"=>"content", "created_at"=>2007-09-13 03:15:43 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>99}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(一):tar和gzip及其压缩相关~", "body"=>"content", "created_at"=>2007-09-15 02:05:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>100}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决ubuntu下的rails开发时mysql的问题!", "body"=>"content", "created_at"=>2007-07-30 19:47:59 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>101}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails笔记 active controller", "body"=>"content", "created_at"=>2007-07-30 19:45:51 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>102}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Magick操作数据库blog字段的图像!", "body"=>"content", "created_at"=>2007-07-30 19:43:53 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>103}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"10 Great New Ruby / Rails Screencasts from July 2007", "body"=>"content", "created_at"=>2007-07-29 17:32:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>104}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"mongrel启动时报错的解决", "body"=>"content", "created_at"=>2007-07-20 16:55:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>105}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"警惕rails中的保留字带来的问题~", "body"=>"content", "created_at"=>2007-07-12 05:10:19 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>106}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"服务器坏掉了~", "body"=>"content", "created_at"=>2007-08-23 16:31:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>107}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)上线了~", "body"=>"content", "created_at"=>2007-08-28 01:25:49 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>108}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Blog换服务器了!", "body"=>"content", "created_at"=>2007-09-04 15:21:07 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>109}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转透明:iTechTag:声望创造价值", "body"=>"content", "created_at"=>2007-09-04 15:45:01 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>110}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails上使用ruby来发Jabber消息~", "body"=>"content", "created_at"=>2007-09-15 08:05:20 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>111}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"How do I install my own Gems?", "body"=>"content", "created_at"=>2007-09-17 07:39:53 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>112}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"郁闷的事情,Blue上的XMPP4R竟然连不出来..", "body"=>"content", "created_at"=>2007-09-17 15:46:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>113}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"weblogic性能调优", "body"=>"content", "created_at"=>2007-09-18 02:58:44 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>114}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"*UNIX学习之系统调优篇", "body"=>"content", "created_at"=>2007-09-18 06:28:05 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>115}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"gtalk表情符号,纯粹吹水~", "body"=>"content", "created_at"=>2007-09-20 11:51:30 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>116}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转:To技能云:还请耐住寂寞 ——送给IceskYsl的“困惑”", "body"=>"content", "created_at"=>2007-09-21 04:16:32 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>117}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"content", "created_at"=>2007-09-21 07:15:38 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>118}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"content", "created_at"=>2007-09-23 06:19:40 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>119}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails Security Guide", "body"=>"content", "created_at"=>2007-09-24 08:06:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>120}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中两种\"多对多\"关系的建立的方法 !", "body"=>"content", "created_at"=>2007-09-24 08:27:13 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>121}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails项目管理之SubVersion(SVN)", "body"=>"content", "created_at"=>2007-09-24 09:09:39 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>122}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"让你的Rails远离SQL Injection", "body"=>"content", "created_at"=>2007-09-24 09:26:08 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>123}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随意指定Layouts~", "body"=>"content", "created_at"=>2007-09-25 02:18:33 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>124}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"content_for:动态改变您的Layouts", "body"=>"content", "created_at"=>2007-09-25 03:19:53 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>125}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏你log中的敏感信息~", "body"=>"content", "created_at"=>2007-09-25 05:20:22 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>126}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中取得REFERER!", "body"=>"content", "created_at"=>2007-09-26 09:22:48 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>127}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"warning: already initialized constant OPTIONS", "body"=>"content", "created_at"=>2007-09-27 03:52:41 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>128}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)最新功能及其来源~", "body"=>"content", "created_at"=>2007-09-29 08:52:24 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>129}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取到了展示“技能云”的页面URL了", "body"=>"content", "created_at"=>2007-09-29 15:15:13 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>130}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"(x)HTML解析利器:Hpricot", "body"=>"content", "created_at"=>2007-09-30 03:20:33 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>131}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云上又一个令人兴奋的功能:智能抓取", "body"=>"content", "created_at"=>2007-09-30 12:13:32 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>132}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Win下安装Rmagick!", "body"=>"content", "created_at"=>2007-10-01 12:29:15 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>133}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复一个关于自动登录的BUG!", "body"=>"content", "created_at"=>2007-10-02 05:13:40 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>134}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的音乐DNA测评报告~", "body"=>"content", "created_at"=>2007-10-02 06:52:02 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>135}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Migration把 MySQL的表引擎修改为InnoDB", "body"=>"content", "created_at"=>2007-10-02 07:26:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>136}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正在筹备给技能云进行一次大改版~", "body"=>"content", "created_at"=>2007-10-08 04:18:03 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>137}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate :分页不可或缺的插件", "body"=>"content", "created_at"=>2007-10-10 07:08:55 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>138}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取在线网页图像的方法~", "body"=>"content", "created_at"=>2007-10-12 09:39:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>139}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)功能需求归纳", "body"=>"content", "created_at"=>2007-10-12 09:44:22 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>140}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate的扩充使用~", "body"=>"content", "created_at"=>2007-10-13 02:04:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>141}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>"content", "created_at"=>2007-10-14 02:55:28 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>142}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随笔有用的Ruby的函数~", "body"=>"content", "created_at"=>2007-10-14 15:28:36 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>143}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 1.2.5: Security and maintenance release", "body"=>"content", "created_at"=>2007-10-15 03:23:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>144}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails URL Validation", "body"=>"content", "created_at"=>2007-10-16 05:31:31 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>145}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"content", "created_at"=>2007-10-16 05:39:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>146}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"软件架构的十大错误", "body"=>"content", "created_at"=>2007-10-19 01:22:23 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>147}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云:两人两周的Web 2.0网站", "body"=>"content", "created_at"=>2007-10-19 02:06:21 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>148}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu下出现缺少openssl的解决", "body"=>"content", "created_at"=>2007-10-21 13:11:55 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>149}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"请freeze你的Rails!", "body"=>"content", "created_at"=>2007-10-22 03:31:32 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>150}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留神你的session文件~", "body"=>"content", "created_at"=>2007-10-25 01:59:53 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>151}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的一个域名丢了", "body"=>"content", "created_at"=>2007-10-29 14:04:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>152}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby GB2312和UTF-8编码转换", "body"=>"content", "created_at"=>2007-10-30 02:33:37 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>153}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"导回以前的blog内容~", "body"=>"content", "created_at"=>2007-10-30 05:00:48 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>154}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用oracle", "body"=>"content", "created_at"=>2007-11-07 01:26:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>155}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"准备搬迁技能云,麻烦各地的朋友测试下速度~", "body"=>"content", "created_at"=>2007-11-08 02:56:38 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>156}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(二):系统负载情况估算相关", "body"=>"content", "created_at"=>2007-11-09 07:13:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>157}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云迁移时遇到一点意外", "body"=>"content", "created_at"=>2007-11-09 17:43:48 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>158}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)服务器迁移顺利完成", "body"=>"content", "created_at"=>2007-11-11 09:29:56 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>159}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"unix定时JOB随笔", "body"=>"content", "created_at"=>2007-11-11 10:56:38 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>160}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby的Hash和Array的遍历", "body"=>"content", "created_at"=>2007-11-12 08:25:59 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>161}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Hpricot解析XML示例~", "body"=>"content", "created_at"=>2007-11-13 05:53:29 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>162}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"统计本星期~", "body"=>"content", "created_at"=>2007-11-14 05:09:06 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>163}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"查看Linux版本命令", "body"=>"content", "created_at"=>2007-11-14 09:29:08 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>164}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RoR中操作时间和日期", "body"=>"content", "created_at"=>2007-11-16 07:34:21 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>165}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"理解.bash_profile和.bashrc", "body"=>"content", "created_at"=>2007-11-22 06:26:29 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>166}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"自动FTP下载多个文件", "body"=>"content", "created_at"=>2007-11-22 09:41:10 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>167}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"删除所有.svn目录", "body"=>"content", "created_at"=>2007-11-27 13:19:59 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>168}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加Feeds抓起功能", "body"=>"content", "created_at"=>2007-12-04 15:58:36 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>169}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RSS和ATOM的版本和规范", "body"=>"content", "created_at"=>2007-12-06 01:37:54 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>170}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Ruby实现抓取ATOM格式的feed~", "body"=>"content", "created_at"=>2007-12-07 05:47:12 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>171}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定期清理垃圾数据", "body"=>"content", "created_at"=>2007-12-08 15:54:19 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>172}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中的定期JOB的实现方式。", "body"=>"content", "created_at"=>2007-12-08 15:57:56 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>173}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将会试试FeedTools的功能", "body"=>"content", "created_at"=>2007-12-12 05:03:29 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>174}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scrot -- ubuntu/Linux 下一个很好用抓屏截图工具", "body"=>"content", "created_at"=>2007-12-15 15:54:42 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>175}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)完成重大升级", "body"=>"content", "created_at"=>2007-12-16 14:42:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>176}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ubuntu下配置使用nginx+mogrel跑Rails集群.", "body"=>"content", "created_at"=>2007-12-16 14:57:52 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>177}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"DH要升级Rails了。", "body"=>"content", "created_at"=>2007-12-18 01:18:51 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>178}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart Gem", "body"=>"content", "created_at"=>2007-12-21 05:24:01 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>179}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定制logger", "body"=>"content", "created_at"=>2007-12-23 17:41:09 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>180}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"YAML Configuration File", "body"=>"content", "created_at"=>2007-12-28 04:44:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>181}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Web 2.0 ,有文化的网站做不大", "body"=>"content", "created_at"=>2007-12-28 04:47:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>182}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Oracle中的截取字符更新", "body"=>"content", "created_at"=>2007-12-29 03:57:41 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>183}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"见到了传说中的透明同学", "body"=>"content", "created_at"=>2008-01-02 13:25:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>184}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"2008年都来了,该盘点下去年的历程了", "body"=>"content", "created_at"=>2008-01-02 13:54:57 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>185}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Nano简单就是美的基础指南", "body"=>"content", "created_at"=>2008-01-03 07:04:31 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>186}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google SOAP Search API不在提供服务", "body"=>"content", "created_at"=>2008-01-03 15:58:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>187}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"测试ruby中的gsub和scan等找到需要的字符串", "body"=>"content", "created_at"=>2008-01-07 02:38:25 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>188}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何完成非utf8格式的RSS转换", "body"=>"content", "created_at"=>2008-01-07 02:46:35 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>189}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag增加圈子编辑和其分类添加编辑功能", "body"=>"content", "created_at"=>2008-01-08 16:42:21 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>190}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Proc.new vs Lambda in Ruby", "body"=>"content", "created_at"=>2008-01-09 04:37:23 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>191}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RubyOnRails + S3 + EC2 = ?", "body"=>"content", "created_at"=>2008-01-10 08:58:56 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>192}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"刚刚注册完域名OriginalCopyright.com", "body"=>"content", "created_at"=>2008-01-10 16:31:04 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>193}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很不错的在线分析网站Clicky", "body"=>"content", "created_at"=>2008-01-10 16:37:24 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>194}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"vsftpd下显示的时间与系统时间不一致问题", "body"=>"content", "created_at"=>2008-01-15 04:35:19 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>195}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Mysql的连接数问题始末", "body"=>"content", "created_at"=>2008-01-15 04:40:55 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>196}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用消息队列的策略", "body"=>"content", "created_at"=>2008-01-18 06:48:07 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>197}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用backgroundrb任务队列", "body"=>"content", "created_at"=>2008-01-20 08:20:13 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>198}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何把用到的gems附到verdor中", "body"=>"content", "created_at"=>2008-01-21 08:46:15 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>199}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Open Flash Chart Plugin for Ruby on Rails - Graphs", "body"=>"content", "created_at"=>2008-01-24 02:54:00 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>200}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"突然感觉到picasaweb的速度好快!", "body"=>"content", "created_at"=>2008-01-24 03:16:43 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>201}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遇到一个很奇怪Rails logger的问题~", "body"=>"content", "created_at"=>2008-01-25 02:19:06 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>202}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"升级本地Rails到2.02版本", "body"=>"content", "created_at"=>2008-01-26 12:13:28 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>203}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"MySQL设置编码", "body"=>"content", "created_at"=>2008-01-27 13:17:33 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>204}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Upgrading your views to Rails 2.0", "body"=>"content", "created_at"=>2008-01-28 12:57:10 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>205}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"attachment_fu中callbacks_for方法出错解决!", "body"=>"content", "created_at"=>2008-01-30 05:34:50 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>206}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"link_to中的小甜点", "body"=>"content", "created_at"=>2008-01-30 06:56:27 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>207}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用XMPP4r在RubyOnRails中集成IM功能", "body"=>"content", "created_at"=>2008-01-31 02:53:08 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>208}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"下午开始尝试回长沙的可能性!", "body"=>"content", "created_at"=>2008-02-02 02:15:10 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>209}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"离开这几天?我是怎么度过的?", "body"=>"content", "created_at"=>2008-02-11 13:26:36 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>210}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"xfce4面板丢失问题的解决", "body"=>"content", "created_at"=>2008-02-11 16:17:13 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>211}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"手机掉了,选购中...", "body"=>"content", "created_at"=>2008-02-13 03:39:12 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>212}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加iTechTag的XSS防护功能", "body"=>"content", "created_at"=>2008-02-13 15:23:10 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>213}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RubyOnRails中实现syntax highlighter", "body"=>"content", "created_at"=>2008-02-15 02:48:30 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>214}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Five Balls of Life", "body"=>"content", "created_at"=>2008-02-18 02:34:33 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>215}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux之rm命令详解", "body"=>"content", "created_at"=>2008-02-20 01:28:55 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>216}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保持SSH客户端不掉线", "body"=>"content", "created_at"=>2008-02-21 03:16:17 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>217}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"这会是Gphone?", "body"=>"content", "created_at"=>2008-02-21 13:55:18 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>218}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag && Ohloh", "body"=>"content", "created_at"=>2008-02-21 14:03:01 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>219}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加通过IM(GoogleTalk)更新ING功能", "body"=>"content", "created_at"=>2008-02-23 06:34:00 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>220}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"键盘快速启动工具 :Launchy", "body"=>"content", "created_at"=>2008-02-25 02:02:45 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>221}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"制作视频教程的工具", "body"=>"content", "created_at"=>2008-02-25 02:18:37 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>222}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"50 Questions to Evaluate the Quality of Your Website", "body"=>"content", "created_at"=>2008-02-25 02:25:27 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>223}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu Mobile Edition:这个世界太疯狂了", "body"=>"content", "created_at"=>2008-02-25 14:07:25 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>224}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正则真的很强大", "body"=>"content", "created_at"=>2008-02-26 01:40:23 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>225}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在CSDN的blog中添加技能云", "body"=>"content", "created_at"=>2008-02-26 01:49:46 UTC, "updated_at"=>2012-06-24 15:50:52 UTC, "body_html"=>"

    content

    \n", "_id"=>226}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail版Gtalk终于出现“隐身功能”", "body"=>"content", "created_at"=>2008-02-27 01:06:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>227}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"真的,个人在线声望越来越重要!", "body"=>"content", "created_at"=>2008-02-27 07:33:01 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>228}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"FriendFeed高明在哪里?", "body"=>"content", "created_at"=>2008-02-28 02:44:31 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>229}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用Active Merchant快速支付", "body"=>"content", "created_at"=>2008-02-28 06:11:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>230}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"IP地址到物理地址的转化", "body"=>"content", "created_at"=>2008-03-07 05:05:12 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>231}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby中对正则表达式中的特殊字符转义的疑惑", "body"=>"content", "created_at"=>2008-03-12 07:51:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>232}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux和windows之间的压缩包乱码", "body"=>"content", "created_at"=>2008-03-15 15:02:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>233}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中发送大文件", "body"=>"content", "created_at"=>2008-03-17 07:53:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>234}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"别想馅饼啦,小心掉到陷阱里面去", "body"=>"content", "created_at"=>2008-03-18 06:39:05 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>235}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart API去除流量限制 增加新特性", "body"=>"content", "created_at"=>2008-03-19 04:42:52 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>236}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中调用系统的rar来打包文件包", "body"=>"content", "created_at"=>2008-03-23 14:36:47 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>237}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调优:大量的CLOSE_WAIT状态连接", "body"=>"content", "created_at"=>2008-03-24 05:34:17 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>238}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RESTClient:Web开发测试助手", "body"=>"content", "created_at"=>2008-03-25 03:47:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>239}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没有回到Windows下了", "body"=>"content", "created_at"=>2008-03-29 12:27:25 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>240}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复OpenOffice中打开Word文档行距很大", "body"=>"content", "created_at"=>2008-03-30 00:14:37 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>241}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用缓存(码表)的方式", "body"=>"content", "created_at"=>2008-03-30 15:09:38 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>242}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的集合对象的遍历技巧", "body"=>"content", "created_at"=>2008-03-30 15:16:13 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>243}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout是个挺有趣的tools", "body"=>"content", "created_at"=>2008-03-31 03:40:38 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>244}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"支持Elastic IP Addresses,EC2越来越成熟了.", "body"=>"content", "created_at"=>2008-04-01 15:00:29 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>245}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu的快捷键", "body"=>"content", "created_at"=>2008-04-01 15:21:12 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>246}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BaiDu之Hi体验~", "body"=>"content", "created_at"=>2008-04-02 06:37:00 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>247}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Mongrel之cluster::restart vs. stop/start的区别", "body"=>"content", "created_at"=>2008-04-07 06:14:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>248}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中捕获TimeOut异常及其处理", "body"=>"content", "created_at"=>2008-04-07 07:17:41 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>249}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ubuntu7.10上装rar/unrar", "body"=>"content", "created_at"=>2008-04-08 05:34:05 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>250}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"再次遭遇乱码侵袭~", "body"=>"content", "created_at"=>2008-04-08 05:57:32 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>251}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中调用系统的shell命令的异常", "body"=>"content", "created_at"=>2008-04-08 15:55:53 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>252}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"设置/美化SecureCRT让其更加适合自己", "body"=>"content", "created_at"=>2008-04-09 01:31:33 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>253}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"谈谈我使用过的几个国外服务器提供商", "body"=>"content", "created_at"=>2008-04-11 05:52:22 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>254}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BB入手,跨入智能时代", "body"=>"content", "created_at"=>2008-04-13 15:59:33 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>255}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby正则表达式小技巧", "body"=>"content", "created_at"=>2008-04-15 13:24:14 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>256}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,前途无量,充满乐趣", "body"=>"content", "created_at"=>2008-04-16 02:09:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>257}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout已经长大,正式上线,试用手记~", "body"=>"content", "created_at"=>2008-04-16 03:30:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>258}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"EC2支持Persistent Storage,日渐完善", "body"=>"content", "created_at"=>2008-04-16 04:41:26 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>259}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"服务器最近有些异常", "body"=>"content", "created_at"=>2008-04-20 16:30:27 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>260}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog归来,人员征集中。", "body"=>"content", "created_at"=>2008-04-21 02:25:57 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>261}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails之Component探析,引出Cells。", "body"=>"content", "created_at"=>2008-04-21 07:36:43 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>262}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"TibetIsXiZang,Tell this to all over the world,Tibet就是西藏!", "body"=>"content", "created_at"=>2008-04-22 05:49:37 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>263}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Amazon SQS,分布式作业不再费心", "body"=>"content", "created_at"=>2008-04-23 02:03:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>264}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"终于等到Google Docs Offline了", "body"=>"content", "created_at"=>2008-04-23 06:40:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>265}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lower Data Transfer Costs,AWS降价,欢喜吧.", "body"=>"content", "created_at"=>2008-04-23 15:30:30 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>266}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用RMagick动态生成图片", "body"=>"content", "created_at"=>2008-04-24 08:20:28 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>267}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu 8.04 LTS (Hardy Heron)和Netbeans6.1发布啦~", "body"=>"content", "created_at"=>2008-04-24 20:38:11 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>268}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"成功升级到Ubuntu8.08和Netbeans6.1", "body"=>"content", "created_at"=>2008-04-25 15:04:23 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>269}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu Hardy(8.04)源列表大全不断更新中)", "body"=>"content", "created_at"=>2008-04-26 00:55:54 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>270}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"利用Amazon Web Services(AWS)构建可扩展的WebApp应用", "body"=>"content", "created_at"=>2008-04-28 07:34:55 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>271}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google更新PR~", "body"=>"content", "created_at"=>2008-05-05 02:24:36 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>272}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RoR中取得最近记录的方法", "body"=>"content", "created_at"=>2008-05-05 02:37:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>273}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"F形网页浏览眼球轨迹的研究报告", "body"=>"content", "created_at"=>2008-05-07 03:33:50 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>274}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Puppy Linux,放入U盘随身带的演示环境", "body"=>"content", "created_at"=>2008-05-07 09:48:04 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>275}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"圣火登珠峰,卓望\"一键拍发\"助力新华网全球首发", "body"=>"content", "created_at"=>2008-05-08 02:32:29 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>276}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Ruby测试AWS之S3国内数据存贮", "body"=>"content", "created_at"=>2008-05-09 08:42:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>277}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"LoadError: no such file to load -- RMagick", "body"=>"content", "created_at"=>2008-05-11 02:00:55 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>278}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇Magick::ImageMagickError", "body"=>"content", "created_at"=>2008-05-11 02:12:48 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>279}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail妙用点滴聚合收集", "body"=>"content", "created_at"=>2008-05-12 03:14:47 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>280}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"中国,挺起自己的脊梁来", "body"=>"content", "created_at"=>2008-05-13 08:51:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>281}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails多个应用中共享数据库", "body"=>"content", "created_at"=>2008-05-14 03:24:44 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>282}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dreamhost的Share Rails确实已经采用了mod_rails(Passenger)", "body"=>"content", "created_at"=>2008-05-14 10:28:48 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>283}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用 NetBeans 开发 Blackberry", "body"=>"content", "created_at"=>2008-05-20 06:59:02 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>284}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"汶川地震,让我震撼的这瞬间", "body"=>"content", "created_at"=>2008-05-21 02:10:14 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>285}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"红十字会紧急救援队,救援队员写下个人资料以备不测", "body"=>"content", "created_at"=>2008-05-21 02:22:19 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>286}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lockdown: A authentication/authorization system for RubyOnRails", "body"=>"content", "created_at"=>2008-05-21 03:20:37 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>287}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇ActionController::InvalidAuthenticityToken", "body"=>"content", "created_at"=>2008-05-21 14:55:17 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>288}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新增“安全相关 | Security”分类", "body"=>"content", "created_at"=>2008-05-22 03:06:19 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>289}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CSRF: 不要低估了我的危害和攻击能力", "body"=>"content", "created_at"=>2008-05-22 03:48:41 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>290}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Sites开放,建立IceskYsl@Docs", "body"=>"content", "created_at"=>2008-05-22 12:39:29 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>291}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CsrfKiller: 看CSRF还怎么乐的起来", "body"=>"content", "created_at"=>2008-05-22 13:28:39 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>292}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"与时俱进,使用Git", "body"=>"content", "created_at"=>2008-05-23 16:19:22 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>293}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将1stlog迁移到GitHub上.", "body"=>"content", "created_at"=>2008-05-24 02:30:17 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>294}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Vlad通过Git在 Nginx+mogrels上部署RubyOnRails应用.", "body"=>"content", "created_at"=>2008-05-25 15:33:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>295}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"git-svn: 整合使用git和svn", "body"=>"content", "created_at"=>2008-05-27 05:14:42 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>296}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,正式向所有用户开放并推出收费计划", "body"=>"content", "created_at"=>2008-05-28 05:46:59 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>297}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我为什么那么喜欢GoogleDoc呢?", "body"=>"content", "created_at"=>2008-05-30 03:39:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>298}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"发布Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术系列文章", "body"=>"content", "created_at"=>2008-05-30 03:58:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>299}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Windows command shell (cmd.exe)下设置Proxy", "body"=>"content", "created_at"=>2008-05-30 05:51:59 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>300}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails的find中使用DISTINCT功能(MYSQL)", "body"=>"content", "created_at"=>2008-06-01 00:44:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>301}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1 释出,众多特性值的尝试", "body"=>"content", "created_at"=>2008-06-02 03:15:59 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>302}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fork了backup_fu 插件,将添加FTP传输支持等新特性.", "body"=>"content", "created_at"=>2008-06-02 04:50:27 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>303}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails+Memcached,跑起来嗖嗖的", "body"=>"content", "created_at"=>2008-06-04 04:55:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>304}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用WWW::Mechanize来开发爬虫程序.", "body"=>"content", "created_at"=>2008-06-06 02:49:50 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>305}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提升MYSQL性能可用思路和方案的技术分析", "body"=>"content", "created_at"=>2008-06-06 03:41:52 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>306}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"WWDC 2008中让人兴奋的那么些消息", "body"=>"content", "created_at"=>2008-06-10 00:14:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>307}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PayPal携手Skype网络电话,让无线运营商见鬼去吧!", "body"=>"content", "created_at"=>2008-06-10 01:54:37 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>308}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"HAProxy,智能分流的负载均衡方案。", "body"=>"content", "created_at"=>2008-06-10 09:38:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>309}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用will_Paginate的分页技巧", "body"=>"content", "created_at"=>2008-06-10 17:34:21 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>310}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails在MySQL的大表中add_column很慢的问题!", "body"=>"content", "created_at"=>2008-06-12 09:05:21 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>311}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu8.04安装gem install mysql 出错", "body"=>"content", "created_at"=>2008-06-12 12:48:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>312}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu:gzip: stdout: No space left on device", "body"=>"content", "created_at"=>2008-06-12 12:59:54 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>313}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留意你的layout和filter的摆放顺序", "body"=>"content", "created_at"=>2008-06-15 13:48:52 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>314}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"推荐两款支持Rails的服务提供商(SliceHost&DreamHost)", "body"=>"content", "created_at"=>2008-06-16 03:01:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>315}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"协作翻译: Ruby On Raisl 2.1新特性(第二版)", "body"=>"content", "created_at"=>2008-06-16 14:50:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>316}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"install and configuration vsftpd ftp service on Ubuntu Linux", "body"=>"content", "created_at"=>2008-06-17 12:33:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>317}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于这两天blog挂掉的说明", "body"=>"content", "created_at"=>2008-06-20 18:59:54 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>318}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1中文文档翻译完成[已发布]", "body"=>"content", "created_at"=>2008-06-20 19:13:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>319}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何在Rails的controller中取得URL中的anchor值", "body"=>"content", "created_at"=>2008-06-23 09:12:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>320}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"content", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>321}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"content", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>322}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"content", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>323}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"content", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>324}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"content", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>325}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"content", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>326}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"content", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>327}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"content", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>328}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"content", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>329}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"content", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>330}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"content", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>331}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"RatProxy:Google提供的开源web应用安全工具", "body"=>"content", "created_at"=>2008-07-07 02:02:55 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>332}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Amoeba:分布式数据库Proxy解决方案", "body"=>"content", "created_at"=>2008-07-08 07:02:08 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>333}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails: How to use helper inside a controller & model", "body"=>"content", "created_at"=>2008-07-10 08:33:29 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>334}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby中的Mixin特性", "body"=>"content", "created_at"=>2008-07-10 10:01:42 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>335}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机摔坏了,一个星期没开机", "body"=>"content", "created_at"=>2008-07-14 07:09:49 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>336}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Protocol Buffers:更简洁有效的数据交换格式!", "body"=>"content", "created_at"=>2008-07-15 03:20:15 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>337}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"content", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>338}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"content", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>339}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"http_load:压力测试小工具", "body"=>"content", "created_at"=>2008-07-17 08:30:26 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>340}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"潘多拉(Pandora)受限,谁来顶起这片天", "body"=>"content", "created_at"=>2008-07-22 01:39:35 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>341}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Starling: 消息队列服务器", "body"=>"content", "created_at"=>2008-07-22 02:24:50 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>342}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"原来我还不够果断", "body"=>"content", "created_at"=>2008-07-28 07:29:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>343}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fleximage:Rails图片处理新选择", "body"=>"content", "created_at"=>2008-07-29 02:54:14 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>344}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"收到《开源技术选型手册》,谢谢diuera", "body"=>"content", "created_at"=>2008-07-29 09:26:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>345}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"vi/vim命令大全壁纸", "body"=>"content", "created_at"=>2008-08-02 01:30:57 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>346}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装QQ的linux版本", "body"=>"content", "created_at"=>2008-08-02 03:21:11 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>347}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"DNS缓存投毒以及其他相关安全问题", "body"=>"content", "created_at"=>2008-08-05 04:59:21 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>348}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"把Ajax文件寄放在Google,Yahoo!", "body"=>"content", "created_at"=>2008-08-07 04:53:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>349}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Apache Tomcat Directory Traversal Vulnerability", "body"=>"content", "created_at"=>2008-08-11 09:51:56 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>350}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"中国网民都在做什么?", "body"=>"content", "created_at"=>2008-08-13 03:24:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>351}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID做ActiveRecord主键", "body"=>"content", "created_at"=>2008-08-14 02:43:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>352}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID隐藏系统敏感信息", "body"=>"content", "created_at"=>2008-08-14 02:53:05 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>353}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Yahoo! Music 放出API,音乐平台开放趋势凸显", "body"=>"content", "created_at"=>2008-08-15 06:32:02 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>354}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails Plugins]dnsbl_check过滤来源IP", "body"=>"content", "created_at"=>2008-08-15 09:02:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>355}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"ulimit:修改和检查文件句柄数限制", "body"=>"content", "created_at"=>2008-08-19 08:37:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>356}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"查看MYSQL表占用空间状态", "body"=>"content", "created_at"=>2008-08-19 09:08:34 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>357}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Prawn:Ruby生成PDF更简捷的选择", "body"=>"content", "created_at"=>2008-08-20 03:39:42 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>358}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BOSSMan: 用Ruby利用yahoo!Boss打造自己的搜索引擎", "body"=>"content", "created_at"=>2008-08-20 06:50:33 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>359}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Connection refused: SliceHost上SSH登录问题", "body"=>"content", "created_at"=>2008-08-20 13:29:56 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>360}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"content", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>361}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"《The Rails Way》召集railser协作翻译", "body"=>"content", "created_at"=>2008-08-21 03:05:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>362}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"cssh/DSH:ssh之cluster 管理工具", "body"=>"content", "created_at"=>2008-08-21 06:24:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>363}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用named_scope在Model中添加finder方法", "body"=>"content", "created_at"=>2008-08-21 16:33:42 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>364}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby再曝REXML库的DOS漏洞", "body"=>"content", "created_at"=>2008-08-25 01:24:50 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>365}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决/var空间不足导致的无法登录问题", "body"=>"content", "created_at"=>2008-08-26 03:37:04 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>366}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"God: 比Monit更好用的monitoring", "body"=>"content", "created_at"=>2008-08-26 07:50:47 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>367}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL存储引擎选择和比较", "body"=>"content", "created_at"=>2008-08-27 06:36:06 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>368}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"基于CookieStore的session存储机制的安全话题", "body"=>"content", "created_at"=>2008-08-28 02:42:18 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>369}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Thin: A fast and very simple Ruby web server", "body"=>"content", "created_at"=>2008-08-28 08:21:34 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>370}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Merb处理Rails中大文件上传难题", "body"=>"content", "created_at"=>2008-08-29 02:13:33 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>371}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock: 非常值得期待的一组类库", "body"=>"content", "created_at"=>2008-08-30 11:16:35 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>372}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] 值得期待的internationalization", "body"=>"content", "created_at"=>2008-08-30 17:10:00 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>373}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] Josh Peek,thread safety?", "body"=>"content", "created_at"=>2008-08-30 17:29:28 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>374}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Configatron&SimpleConfig: 在Rails中添加需要的配置", "body"=>"content", "created_at"=>2008-08-31 03:45:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>375}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]log4r&Logging: 替代Rails中logger的日志记录库", "body"=>"content", "created_at"=>2008-08-31 04:59:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>376}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Flash Message Conductor :在Rails中整合各类消息提示", "body"=>"content", "created_at"=>2008-09-01 03:09:56 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>377}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Google手机现身: 值得期待", "body"=>"content", "created_at"=>2008-09-01 04:58:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>378}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"开发Rails插件的方法和步骤", "body"=>"content", "created_at"=>2008-09-01 08:56:56 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>379}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Chrome: Google推浏览器正面迎战IE8", "body"=>"content", "created_at"=>2008-09-02 01:45:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>380}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"Download Chrome: 可以开始下载chrome", "body"=>"content", "created_at"=>2008-09-02 16:58:03 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>381}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"喔唷,崩溃啦! Chrome启动异常解决方法", "body"=>"content", "created_at"=>2008-09-04 01:32:20 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>382}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock到底有多快,对比测试说明问题", "body"=>"content", "created_at"=>2008-09-04 02:18:08 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>383}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Xsstc: 通过CSS跨站运行script", "body"=>"content", "created_at"=>2008-09-04 02:50:53 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>384}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]Rails 2.1.1发布,包括众多更新", "body"=>"content", "created_at"=>2008-09-05 17:50:56 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>385}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NEVERBLOCK支持Ruby1.8,性能对比测试,提升非常显著", "body"=>"content", "created_at"=>2008-09-05 18:20:12 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>386}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]2.2版本即将来临,新功能提前看(一)", "body"=>"content", "created_at"=>2008-09-08 01:49:49 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>387}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"雷击后网络异常分析和处理方法", "body"=>"content", "created_at"=>2008-09-08 05:36:38 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>388}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"使用gnuplot配合AB绘制性能测试结果图", "body"=>"content", "created_at"=>2008-09-08 05:53:22 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>389}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞续篇,union查询显威力", "body"=>"content", "created_at"=>2008-09-09 01:48:40 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>390}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Tips]自动填充测试需要的随机数据", "body"=>"content", "created_at"=>2008-09-09 02:25:49 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>391}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"网站安全开发手册 让每个程序员都提高安全意识", "body"=>"content", "created_at"=>2008-09-09 02:38:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>392}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调整ubuntu下的netbeans 6.1为英文界面", "body"=>"content", "created_at"=>2008-09-09 15:41:19 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>393}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Wicd: Ubuntu8.04终于用上无线了", "body"=>"content", "created_at"=>2008-09-09 15:59:14 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>394}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Rails部署:Nginx+Haproxy+Thin", "body"=>"content", "created_at"=>2008-09-12 01:18:35 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>395}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"LibFetion: Ubuntu下的飞信", "body"=>"content", "created_at"=>2008-09-14 16:55:36 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>396}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails应用系统的监控规划", "body"=>"content", "created_at"=>2008-09-16 03:53:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>397}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"今年我还在期待的两个东西,G1&MacBook", "body"=>"content", "created_at"=>2008-09-17 06:29:50 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>398}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成SMS功能", "body"=>"content", "created_at"=>2008-09-18 08:04:15 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>399}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"content", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>400}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完成,有问题请反馈", "body"=>"content", "created_at"=>2008-09-21 09:17:45 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>401}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Google Android(T-Mobile版)即将揭开神秘面纱", "body"=>"content", "created_at"=>2008-09-22 17:33:41 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>402}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"FrontCompiler: 写出更优雅的CSS代码", "body"=>"content", "created_at"=>2008-09-23 06:27:24 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>403}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"YOBO: 周杰伦《魔杰座》首播《稻香》--附歌词", "body"=>"content", "created_at"=>2008-09-23 14:29:30 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>404}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Android G1: 我有一次被震撼了", "body"=>"content", "created_at"=>2008-09-23 15:28:37 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>405}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android下开发初探,写个网络音乐播放器", "body"=>"content", "created_at"=>2008-09-24 17:30:33 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>406}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"自由行: 阳朔,我来了", "body"=>"content", "created_at"=>2008-09-27 12:05:09 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>407}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"序列化数据的速度对比: Marshal vs. JSON vs. Eval vs. YAML .ZAML", "body"=>"content", "created_at"=>2008-10-05 12:47:54 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>408}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"采用Ruby提取MP3的metadata信息", "body"=>"content", "created_at"=>2008-10-05 13:15:12 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>409}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"添加一个分类“架构设计 | Architecture”", "body"=>"content", "created_at"=>2008-10-07 02:10:51 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>410}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"在Startups时就考虑Scalability", "body"=>"content", "created_at"=>2008-10-07 02:28:16 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>411}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"为Mysql选择更加合适的硬件环境", "body"=>"content", "created_at"=>2008-10-07 03:18:16 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>412}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"content", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>413}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"7 Top Tips for Coding With Currency", "body"=>"content", "created_at"=>2008-10-08 09:05:08 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>414}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"content", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>415}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"content", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>416}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"content", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>417}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"content", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>418}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"content", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>419}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"content", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>420}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"content", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:50:53 UTC, "body_html"=>"

    content

    \n", "_id"=>421}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"content", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>422}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"一个终点会是另外一个新起点", "body"=>"content", "created_at"=>2008-10-20 03:27:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>423}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"content", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>424}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"新起点,来到北京", "body"=>"content", "created_at"=>2008-10-21 16:29:40 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>425}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在crontab中调用rake task定时跑job", "body"=>"content", "created_at"=>2008-10-24 16:51:45 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>426}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.2快来了,期待", "body"=>"content", "created_at"=>2008-10-24 17:57:35 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>427}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在attachment_fu中通过URL上传文件", "body"=>"content", "created_at"=>2008-10-25 15:34:50 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>428}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MYSQL的MERGE存储引擎", "body"=>"content", "created_at"=>2008-11-04 10:31:58 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>429}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Merb 1.0 Released", "body"=>"content", "created_at"=>2008-11-09 04:17:45 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>430}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"升级ubuntu8.10未果", "body"=>"content", "created_at"=>2008-11-09 17:31:38 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>431}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"memcached维护及其数据遍历实现", "body"=>"content", "created_at"=>2008-11-09 18:52:03 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>432}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"超越深夜宕机,有感机房服务质量", "body"=>"content", "created_at"=>2008-11-14 21:25:18 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>433}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成Nginx upload module解决上传大文件难题", "body"=>"content", "created_at"=>2008-11-29 06:00:45 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>434}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.2风潮来临,资源大列表", "body"=>"content", "created_at"=>2008-11-29 07:38:32 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>435}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rsay: ruby interface to the google translation api", "body"=>"content", "created_at"=>2008-12-08 14:41:45 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>436}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rake: uninitialized constant ActiveRecord", "body"=>"content", "created_at"=>2008-12-15 06:59:33 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>437}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Music Fingerprint: 音乐指纹认知篇", "body"=>"content", "created_at"=>2008-12-21 12:50:56 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>438}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的圣诞大餐: Merb&Rails合作了", "body"=>"content", "created_at"=>2008-12-24 14:59:44 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>439}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Android: 好东西终究是要爆发的", "body"=>"content", "created_at"=>2008-12-24 15:17:29 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>440}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"休假养伤,期间安排", "body"=>"content", "created_at"=>2009-01-09 02:31:49 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>441}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"进程&消息: 开始Erlang之旅", "body"=>"content", "created_at"=>2009-01-09 02:44:43 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>442}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"Android的Orientation Sensor三个坐标的含义", "body"=>"content", "created_at"=>2009-01-18 06:39:42 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>443}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"在Android中计算GPS两点间的距离/速度", "body"=>"content", "created_at"=>2009-01-18 07:02:07 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>444}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"content", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>445}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"content", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>446}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"content", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>447}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"content", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>448}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"content", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>449}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"content", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>450}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"content", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>451}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"content", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>452}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"content", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>453}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"content", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>454}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"content", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>455}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"content", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>456}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"content", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>457}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"content", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>458}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"content", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>459}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"content", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>460}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"content", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>461}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"content", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>462}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"content", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>463}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"content", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>464}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"content", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>465}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"content", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>466}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"content", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>467}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"content", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>468}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"content", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>469}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"content", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>470}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"content", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>471}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"content", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>472}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"content", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>473}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"content", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>474}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"content", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>475}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>"content", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>476}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"遭遇爬虫,关闭所有文章的评论", "body"=>"content", "created_at"=>2009-06-18 03:04:22 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>477}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Get POSSIBLE BREAK-IN ATTEMPT msg when i ssh to s server", "body"=>"content", "created_at"=>2009-06-19 02:17:03 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>478}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"content", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>479}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"content", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>480}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"content", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>481}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"回到深圳,安静的体会生活...", "body"=>"content", "created_at"=>2009-09-22 02:38:50 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>482}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android market的通信协议还是比较安全的", "body"=>"content", "created_at"=>2009-09-24 02:00:39 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>483}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"content", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>484}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"content", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>485}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMobile实习生计划", "body"=>"content", "created_at"=>2009-10-09 23:54:14 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>486}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Unicorn: Rack HTTP server for fast clients and Unix", "body"=>"content", "created_at"=>2009-10-11 00:52:20 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>487}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"content", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>488}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"第一次去香港随笔", "body"=>"content", "created_at"=>2009-10-15 04:51:32 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>489}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"笔记本要罢工了。", "body"=>"content", "created_at"=>2009-10-30 09:00:38 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>490}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"开始使用mac pro", "body"=>"content", "created_at"=>2009-11-08 03:01:52 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>491}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"如何让 Safari 默认使用新标签打开链接", "body"=>"content", "created_at"=>2009-11-08 03:06:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>492}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"install mercurial and Go Programming Language", "body"=>"content", "created_at"=>2009-11-12 17:53:55 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>493}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"how to avoid Net::SMTPFatalError (555 5.5.2 Syntax error.", "body"=>"content", "created_at"=>2009-11-12 19:58:54 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>494}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"content", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>495}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"content", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>496}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"content", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>497}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"content", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>498}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Facebooker error UnableToLoadAdapter", "body"=>"content", "created_at"=>2009-11-26 13:31:29 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>499}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完,继续写", "body"=>"content", "created_at"=>2010-01-13 00:42:39 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>500}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"content", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>501}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"content", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>502}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"content", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>503}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Fixing Ruby no such file to load readline error in centOS", "body"=>"content", "created_at"=>2010-01-19 21:46:28 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>504}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"content", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>505}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"content", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>506}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"content", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>507}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"content", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>508}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Make a short link with Bit.ly", "body"=>"content", "created_at"=>2010-01-25 05:49:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>509}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"content", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>510}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"content", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>511}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"content", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>512}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"content", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>513}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"content", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>514}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"content", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>515}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"content", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>516}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"content", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>517}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"content", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>518}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"content", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>519}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"content", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>520}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"content", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>521}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"content", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>522}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"content", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>523}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"content", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>524}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"content", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>525}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"content", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>526}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"content", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>527}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"content", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>528}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"content", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>529}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"content", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>530}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"content", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>531}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"content", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>532}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"content", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>533}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"content", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>534}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"content", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>535}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"content", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>536}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"content", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>537}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Nginx的X-Accel-Redirect在Rails中发送文件", "body"=>"content", "created_at"=>2010-04-17 18:06:38 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>538}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"publish a rails plugin:Nginx-X-Accel-Redirect", "body"=>"content", "created_at"=>2010-04-17 21:37:59 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>539}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"restful_authentication的加密真复杂", "body"=>"content", "created_at"=>2010-04-18 10:29:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>540}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Paperclip,按日期划分目录方法", "body"=>"content", "created_at"=>2010-04-27 11:11:25 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>541}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"content", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>542}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Encrypt & Decrypt in ruby", "body"=>"content", "created_at"=>2010-05-14 21:58:00 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>543}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ruby中使用des aes rsa 加密解密等安全技术", "body"=>"content", "created_at"=>2010-05-14 23:02:22 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>544}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"content", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>545}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"md5sum", "body"=>"content", "created_at"=>2010-06-01 22:11:30 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>546}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"content", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>547}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"TEXT fields in MySQL", "body"=>"content", "created_at"=>2010-06-27 20:56:02 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>548}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"content", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>549}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"content", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>550}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"content", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>551}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"参加“Orange开发者日“活动", "body"=>"content", "created_at"=>2010-07-17 21:04:05 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>552}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"content", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>553}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"content", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>554}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"content", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>555}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"content", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>556}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>"content", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>557}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"content", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>558}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"malformed format string on rails~", "body"=>"content", "created_at"=>2010-09-03 16:39:58 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>559}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"content", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>560}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"content", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>561}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"content", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>562}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"content", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>563}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Using the Rails logger outside of models and controllers", "body"=>"content", "created_at"=>2010-09-17 01:50:49 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>564}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Creating Small Unique Tokens In Ruby", "body"=>"content", "created_at"=>2010-09-19 22:36:01 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>565}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Configure SVN for your rails app.", "body"=>"content", "created_at"=>2010-10-04 06:24:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>566}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"delete & not exists in Mysql", "body"=>"content", "created_at"=>2010-10-04 06:49:42 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>567}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决ssh_exchange_identification: Connection closed by remote host,", "body"=>"content", "created_at"=>2010-10-18 18:45:27 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>568}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"content", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>569}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"2010年总结,2011年展望", "body"=>"content", "created_at"=>2011-01-02 23:46:24 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>570}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"mtr命令使用", "body"=>"content", "created_at"=>2011-01-14 00:04:42 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>571}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"那些时间点们", "body"=>"content", "created_at"=>2011-03-25 21:29:19 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>572}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Mac OS X(lion)软件推荐", "body"=>"content", "created_at"=>2011-09-02 20:31:57 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>573}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx开启 stub_status 模块", "body"=>"content", "created_at"=>2011-09-03 08:05:33 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>574}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"content", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>575}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机发的文章", "body"=>"content", "created_at"=>2011-11-22 06:02:19 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>576}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"content", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>577}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"防范垃圾利器Akismet使用体验和原理分析", "body"=>"content", "created_at"=>2012-01-01 18:32:52 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>578}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails项目android-group中集成Akismet", "body"=>"content", "created_at"=>2012-01-01 20:42:41 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>579}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"nginx upstream的5种配置方式", "body"=>"content", "created_at"=>2012-01-03 04:00:53 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>580}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"content", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>581}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客记忆:2007年-2011年的博客汇总", "body"=>"content", "created_at"=>2012-01-03 08:56:18 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>582}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"奶奶离开了我们,永远的", "body"=>"content", "created_at"=>2012-01-06 15:06:33 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>583}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"小心ruby中Array的include?方法", "body"=>"content", "created_at"=>2012-01-17 07:18:18 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>584}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"不常用但很有用的linux命令", "body"=>"content", "created_at"=>2012-01-18 00:18:12 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>585}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"content", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>586}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客功能修葺完毕,多写文字", "body"=>"content", "created_at"=>2012-01-27 22:47:29 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>587}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"排斥WYSIWYG编辑器", "body"=>"content", "created_at"=>2012-01-28 00:45:52 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>588}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"content", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>589}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"content", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>590}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"content", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>591}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"content", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>592}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"入手kindle 4初体验", "body"=>"content", "created_at"=>2012-02-13 06:03:36 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>593}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"源于内心,回归更纯粹的技术 -记eoeAndroid社区新版上线", "body"=>"content", "created_at"=>2012-02-15 10:08:16 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>594}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决用ruby生成大xml文件的性能问题", "body"=>"content", "created_at"=>2012-02-24 03:28:51 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>595}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"content", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>596}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"content", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>597}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"说说我招聘android技术人员的思路", "body"=>"content", "created_at"=>2012-03-16 05:42:16 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>598}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"content", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>599}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"content", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>600}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"关于Markdown和Mou", "body"=>"content", "created_at"=>2012-04-06 15:26:48 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>601}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"content", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>602}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"content", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>603}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"content", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:50:54 UTC, "body_html"=>"

    content

    \n", "_id"=>604}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:50:56 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 7426435107452375850 +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (170.1ms) +Completed 200 OK in 329ms (Views: 238.2ms | Mongo: 1.7ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:51:07 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB [DEBUG] Cursor#close 5405439586349382756 +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (51.2ms) +Completed 200 OK in 57ms (Views: 52.6ms | Mongo: 3.1ms) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:51:12 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 8248718265697734470 +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (18.4ms) +Completed 200 OK in 26ms (Views: 22.4ms | Mongo: 1.2ms) + + +Started GET "/cpanel/posts/576/edit" for 127.0.0.1 at 2012-06-24 23:51:23 +0800 +Processing by Cpanel::PostsController#edit as HTML + Parameters: {"id"=>"576"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:_id=>576}).limit(-1).sort([[:_id, :asc]]) + Rendered shared/_error_messages.html.erb (1.0ms) +MONGODB iceylog_development['categories'].find({}) + Rendered cpanel/posts/_form.html.erb (59.7ms) + Rendered cpanel/posts/edit.html.erb within layouts/cpanel (99.6ms) +Completed 200 OK in 214ms (Views: 183.9ms | Mongo: 1.1ms) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"site_configs"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"mongoid.auto_increment_ids"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"categories"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"pages"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"posts"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:drop=>"sites"}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"site_configs"}).limit(-1) +MONGODB iceylog_development['site_configs'].find({:key=>"site_title"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_title"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_title", "value"=>"Iceylog", "_id"=>1}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_slogan"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_slogan"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_slogan", "value"=>"Focus on Android,iPhone,Web,Business,Architecture,Agile,Technic and beyond…", "_id"=>2}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author", "value"=>"Icey", "_id"=>3}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_username"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_username"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_username", "value"=>"iceylog", "_id"=>4}]) +MONGODB iceylog_development['site_configs'].find({:key=>"site_author_password"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"site_author_password"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"site_author_password", "value"=>"password", "_id"=>5}]) +MONGODB iceylog_development['site_configs'].find({:key=>"about_me_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"about_me_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"about_me_html", "value"=>"
    \n

    IceskYsl, 简称Ice, 80后, 典型巨蟹男, 移动互联网创业者; Google产品重度依赖者, Mac, Android, iPhone, BB 非典型用户;关注创新,技术,产品和一切新奇的玩意儿;
    求学武汉, 毕业南下深圳, 尔后北漂在京, 至今数年有余; 追寻内心的想法, 不随波逐流, 爱折腾, 爱旅行, 孩子气, 享受工作, 安静的做喜欢的事情...

    \n
    \n", "_id"=>6}]) +MONGODB iceylog_development['site_configs'].find({:key=>"menu_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"menu_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"menu_html", "value"=>" \t\n", "_id"=>7}]) +MONGODB iceylog_development['site_configs'].find({:key=>"footer_html"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"site_configs", "query"=>{:key=>"footer_html"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"site_configs"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['site_configs'].insert([{"key"=>"footer_html", "value"=>"

    Copyright ©2007-2012 - Lovingly authored by IceskYsl - All my work is MIT licensed, Open and Free.

    \n

    \n Powered by Iceylog - Theme by IceskYsl@1.s.t \n - Build by Markdown,\n GitHub, \n Disqus\n

    \t\n", "_id"=>8}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"categories"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"默认分类"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"默认分类", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>1}]) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"pages"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"about"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"about", "title"=>"About", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>1}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"book"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"book", "title"=>"Book", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>2}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"movie"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"movie", "title"=>"Movie", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>3}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"music"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"music", "title"=>"Music", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>4}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"team"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"team", "title"=>"Team", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>5}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"travel"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"travel", "title"=>"travel", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>6}]) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil, :slug=>"toolkit"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"pages"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['pages'].insert([{"slug"=>"toolkit", "title"=>"Toolkit", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>7}]) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"posts"}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["demo", "tag"], "comments_count"=>0, "category_id"=>1, "title"=>"blog post title", "body"=>"This is a new post body,support **Markdown** format..", "updated_at"=>2012-06-24 15:52:58 UTC, "body_html"=>"

    This is a new post body,support Markdown format..

    \n", "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>1}]) +MONGODB iceylog_development['categories'].find({:_id=>1}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>1}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({:create=>"sites"}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{"$or"=>[{:url=>"http://www.iceskysl.com"}]}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"sites"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['sites'].insert([{"name"=>"Iceskysl Blog", "url"=>"http://www.iceskysl.com", "favicon"=>"http://www.google.com/profiles/c/favicons?domain=www.iceskysl.com", "updated_at"=>2012-06-24 15:52:58 UTC, "created_at"=>2012-06-24 15:52:58 UTC, "_id"=>1}]) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:53:06 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (1.2ms) +Completed 200 OK in 87ms (Views: 38.3ms | Mongo: 1.2ms) +MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production. +MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Ruby & Rails"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Ruby & Rails", "updated_at"=>2012-06-24 15:53:10 UTC, "created_at"=>2012-06-24 15:53:10 UTC, "_id"=>2}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Making rhtml better", "body"=>"It’s even easier like this:in app/views/layouts/application.rhtml:<%= xhtml_doctype :strict %><%= html_tag :lang => Globalize::Locale.active.language.iso_639_1 %><%= @content_for_layout %><%= end_html_tag %>and in app/helpers/application_helper.rb:module ApplicationHelper # Renders an xhtml doctype declaration for the document's prolog. Defaults to xhtml transitional. # <tt>xhtml_doctype :strict</tt> def xhtml_doctype( doctype=:transitional ) doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype case doctype when :transitional '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' when :strict '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' when :frameset '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' end end # Displays an html tag, complete with xhtml namespace and language. Accepts language as an option, but defaults to English. # <tt>html_tag :lang => 'de'</tt> def html_tag( options={} ) options[:lang] ||= 'en' lang = options.delete( :lang ) "<html xmlns=\\"http://www.w3.org/1999/xhtml\\" lang=\\"\#{lang}\\" xml:lang=\\"\#{lang}\\" \#{options.map { |k,v| "\#{k}=\\"\#{v}\\"" }.join( ' ' )}>" end # End html tag. def end_html_tag; "</html>" endend", "created_at"=>2007-05-19 01:37:13 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    It’s even easier like this:in app/views/layouts/application.rhtml:<%= xhtml_doctype :strict %><%= html_tag :lang => Globalize::Locale.active.language.iso_639_1 %><%= @content_for_layout %><%= end_html_tag %>and in app/helpers/application_helper.rb:module ApplicationHelper # Renders an xhtml doctype declaration for the document's prolog. Defaults to xhtml transitional. # <tt>xhtml_doctype :strict</tt> def xhtml_doctype( doctype=:transitional ) doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype case doctype when :transitional '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;' when :strict '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;' when :frameset '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">;' end end # Displays an html tag, complete with xhtml namespace and language. Accepts language as an option, but defaults to English. # <tt>html_tag :lang => 'de'</tt> def html_tag( options={} ) options[:lang] ||= 'en' lang = options.delete( :lang ) "<html xmlns=&quot;http://www.w3.org/1999/xhtml\\" lang=&quot;\#{lang}&quot; xml:lang=&quot;\#{lang}&quot; \#{options.map { |k,v| "\#{k}=&quot;\#{v}&quot;" }.join( ' ' )}>" end # End html tag. def end_html_tag; "</html>" endend

    \n", "_id"=>2}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Quick add slashes filter for Rails", "body"=>"读后:有的时候,需要在提交的URL后面自动加上"/",这个方法实现这样一个需求,你还可以扩展下去,比如在域名前加"http:\\\\"这样的字符。def add_slash unless %r{/$}.match(@request.path) redirect_to @request.path << '/' endendThis ensures you always have the trailing slash at the end of your URLs. Maybe it could be done better, but for now it works. Django has some stock middleware that does just this, as well as ensuring the first part of the hostname is ‘www’. The point is that your resource can be accessed with one and only one URL, rather than with potentially 4 combinations of / and www. I have no hard evidence, but this is supposedly good for teh Google, and some people find it elegant.I am thinking about maybe whipping up a module of such utilities that you could include in your ApplicationController and never think about again.", "created_at"=>2007-05-19 01:34:51 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    读后:有的时候,需要在提交的URL后面自动加上"/",这个方法实现这样一个需求,你还可以扩展下去,比如在域名前加"http:\\"这样的字符。def add_slash unless %r{/$}.match(@request.path) redirect_to @request.path << '/' endendThis ensures you always have the trailing slash at the end of your URLs. Maybe it could be done better, but for now it works. Django has some stock middleware that does just this, as well as ensuring the first part of the hostname is ‘www’. The point is that your resource can be accessed with one and only one URL, rather than with potentially 4 combinations of / and www. I have no hard evidence, but this is supposedly good for teh Google, and some people find it elegant.I am thinking about maybe whipping up a module of such utilities that you could include in your ApplicationController and never think about again.

    \n", "_id"=>3}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>"Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:其API都很简单,详细的可以看这个页面上的介绍:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl只有一个构造器:FeedControl四个函数:1.addFeed(url, label) //添加需要显示的FEED的URL2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:feedControl.draw( document.getElementById("feedControl"), { drawMode : google.feeds.FeedControl.DRAW_MODE_TABBED });feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下: * google.feeds.LINK_TARGET_BLANK - links will open in a new window * google.feeds.LINK_TARGET_SELF - links will open in the current window * google.feeds.LINK_TARGET_TOP - links will open in the topmost frame * google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame. * anything-else - the value of target in the resulting anchor element is set to linkTarget附录其网站上的说明:---------------This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:var feedControl = new google.feeds.FeedControl();feedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");feedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");feedControl.draw(document.getElementById("feedControl"));In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed. * Basic FeedControl - feedcontrol.html * Tabbed FeedControl - tabbed.html * Sidebar Style FeedControl - sidebar.html * AJAX Feed API Playground Blog", "created_at"=>2007-05-19 01:32:26 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:其API都很简单,详细的可以看这个页面上的介绍:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl只有一个构造器:FeedControl四个函数:1.addFeed(url, label) //添加需要显示的FEED的URL2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:feedControl.draw( document.getElementById("feedControl"), { drawMode : google.feeds.FeedControl.DRAW_MODE_TABBED });feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下: * google.feeds.LINK_TARGET_BLANK - links will open in a new window * google.feeds.LINK_TARGET_SELF - links will open in the current window * google.feeds.LINK_TARGET_TOP - links will open in the topmost frame * google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame. * anything-else - the value of target in the resulting anchor element is set to linkTarget附录其网站上的说明:---------------This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:var feedControl = new google.feeds.FeedControl();feedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");feedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");feedControl.draw(document.getElementById("feedControl"));In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed. * Basic FeedControl - feedcontrol.html * Tabbed FeedControl - tabbed.html * Sidebar Style FeedControl - sidebar.html * AJAX Feed API Playground Blog

    \n", "_id"=>4}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Database"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Database", "updated_at"=>2012-06-24 15:53:10 UTC, "created_at"=>2012-06-24 15:53:10 UTC, "_id"=>3}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Counting Distinct Records In Rails", "body"=>"If you ever need to count your Rails records based on a distinct column, here is a simple solution:Gift.count_by_sql("select count(distinct url) from gifts")In this example, I am counting the number of distinct gift urls from my gifts table.", "created_at"=>2007-05-19 01:30:32 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    If you ever need to count your Rails records based on a distinct column, here is a simple solution:Gift.count_by_sql("select count(distinct url) from gifts")In this example, I am counting the number of distinct gift urls from my gifts table.

    \n", "_id"=>5}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Appending to a string(ROR中的+=和<<操作符的比较)", "body"=>"If you come from another language, you might be tempted to use the += operator when appending to a string. 1. my_str = "Marco " 2. my_str += "Polo"It works… but there is a better way to do it : the << method. 1. my_str = "Marco " 2. my_str << "Polo"#UPDATEI have removed my initial claim about operator precedence as it isn’t really accurate. There is a much better reason to use << instead of += when appending to a string... something I didn't even realize (Thanks to Gregory). += will create a new String instance and will assign it to your left object. On the other hand, << will append the new string directly into your already existing left object. One could argue that += is only different than << and not better, but to me << is what you'll want to use 99% of the time (if not 100%) when appending to a String. I have yet to see a real case where one would want to "lose" it's existing String instance just to get a new one containing the exact same value.You can also use the << method with arrays : 1. [1,2,3] << 4 #gives [1,2,3,4]、 Be careful however when using << with Fixnum/Bignum instances. With these objects, the << method will shift the bits of your integer to the left. If you want to do a summation (append style that is), you will have to use +=", "created_at"=>2007-05-19 01:29:16 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    If you come from another language, you might be tempted to use the += operator when appending to a string. 1. my_str = "Marco " 2. my_str += "Polo"It works… but there is a better way to do it : the << method. 1. my_str = "Marco " 2. my_str << "Polo"#UPDATEI have removed my initial claim about operator precedence as it isn’t really accurate. There is a much better reason to use << instead of += when appending to a string... something I didn't even realize (Thanks to Gregory). += will create a new String instance and will assign it to your left object. On the other hand, << will append the new string directly into your already existing left object. One could argue that += is only different than << and not better, but to me << is what you'll want to use 99% of the time (if not 100%) when appending to a String. I have yet to see a real case where one would want to "lose" it's existing String instance just to get a new one containing the exact same value.You can also use the << method with arrays : 1. [1,2,3] << 4 #gives [1,2,3,4]、 Be careful however when using << with Fixnum/Bignum instances. With these objects, the << method will shift the bits of your integer to the left. If you want to do a summation (append style that is), you will have to use +=

    \n", "_id"=>6}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"Check for nil and initialize on a single line", "body"=>"点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。\n\nSometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :\n\n1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.\n\n2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :\n\n1. #eeww… we don’t like this one.\n\n2. if(x.nil?)\n\n3. x = get_some_object 4. end", "created_at"=>2007-05-19 01:23:10 UTC, "updated_at"=>2012-06-24 15:53:10 UTC, "body_html"=>"

    点评:关于ROR中的一中“遇nil赋值”的写法,这个很早的时候在书上看到的是||=操作符,也一直这么用,今天发现作者的另外这个写法也挺好的。

    \n\n

    Sometimes, you want to initialize a variable to some value only if that variable is equal to nil. If you like to write your methods as short, clean and readable as possible, you can do that task in a single line instead of taking the traditionnal 3 lines approach. You have two options :

    \n\n

    1) You can use the if modifier 1. x = get_some_object if x.nil?Very easy to read. This is my favorite.

    \n\n

    2) Or you can use the ||= operator 1. x ||= get_some_object This one is even shorter. The ||= operator is a little bit less verbose and might confuse a ruby newcomer… but I’m not saying that it should be a reason for not using it. This is more a matter of personal taste than anything else.Both of these methods are better than this :

    \n\n
      \n
    1. #eeww… we don’t like this one.

    2. \n
    3. if(x.nil?)

    4. \n
    5. x = get_some_object   4.  end\n
      \n
    6. \n
    \n", "_id"=>7}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Tips"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Tips", "updated_at"=>2012-06-24 15:53:11 UTC, "created_at"=>2012-06-24 15:53:11 UTC, "_id"=>4}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"在WP中实现代码高亮", "body"=>"", "created_at"=>2010-04-17 04:43:44 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"", "_id"=>8}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>nil}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"04. 无心呢喃 | Buzz"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"04. 无心呢喃 | Buzz", "updated_at"=>2012-06-24 15:53:11 UTC, "created_at"=>2012-06-24 15:53:11 UTC, "_id"=>5}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>".NFClass red links chrome", "body"=>"", "created_at"=>2012-01-28 01:37:59 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"", "_id"=>9}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"有感史诗般对决的澳网决赛", "body"=>"我不打网球,从来不打,也不会打,但是就像冰壶一样,我喜欢看网球~年后上班第一天的晚上窝在沙发里看书,看到电视里在直播网球,一看是澳网决赛,小德vs纳豆,第四盘~立马来了精神~\n\n", "created_at"=>2012-01-29 07:09:37 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    我不打网球,从来不打,也不会打,但是就像冰壶一样,我喜欢看网球~年后上班第一天的晚上窝在沙发里看书,看到电视里在直播网球,一看是澳网决赛,小德vs纳豆,第四盘~立马来了精神~

    \n", "_id"=>10}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"01. 视觉观察 | Observe"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"01. 视觉观察 | Observe", "updated_at"=>2012-06-24 15:53:11 UTC, "created_at"=>2012-06-24 15:53:11 UTC, "_id"=>6}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"CodeGear公司准备发布Ruby", "body"=>"CodeGear公司本周宣布他们将在2007年下半年发布针对rails的开发者Ruby集成开发环境(IDE)……  隶属Borland软件公司的开发工具业务公司CodeGear公布了即将发布的被称为“Ruby IDE”的部分信息,其主要特征包括: *   A full set of development and deployment modules including Ruby, Rails, Gems and Database. *   全面支持Ruby和Rails,具有代码完成、重构、类型浏览和导航等开发特性。 *   创新性的管理器集成了命令行的功能和IDE、向导与代码浏览器的易用性,提高了生产率。 *   可视化和导航依赖可以无缝的利用各种资源进行工作,不管它们的关系、位置或格式。 *   完整的开发和部署模块包括Ruby、Rails、 Gems和数据库。  Ruby IDE所包含的技术将有利于推动开源技术发展。CodeGear已经表示他们将为Ruby提供补丁及分发代码以支持Eclipse动态语言工具包的支持。  CodeGear生产战略事务副总裁Michael Swindell 在该公司发布的一次讲话中说到:“Ruby on Rails已经成为一个重要的Web应用程序开发平台,因为它使得利用最少的代码开发丰富、数据驱动Web2.0应用更快更简单。然而,生产力背后的“魔法”对开发人员“现实世界”生产力水平上Web应用的构建,开发和维护带来了新的挑战。”  Swindell说到:“我们新的Ruby on Rails 技术通过不再是仅仅编辑和调试Ruby脚本解决了这些挑战。它提供了一个综合的以Rails为中心的开发环境,该集成环境即适用于新手也适用于流线开发专家。同时,基于CodeGear IDE 的创新性,这是我们开发的第一个可同时吸引命令行开发者,IDE开发者和可视化开发者的工具。”来源:IT专家网", "created_at"=>2007-05-19 23:05:07 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    CodeGear公司本周宣布他们将在2007年下半年发布针对rails的开发者Ruby集成开发环境(IDE)……  隶属Borland软件公司的开发工具业务公司CodeGear公布了即将发布的被称为“Ruby IDE”的部分信息,其主要特征包括: *   A full set of development and deployment modules including Ruby, Rails, Gems and Database. *   全面支持Ruby和Rails,具有代码完成、重构、类型浏览和导航等开发特性。 *   创新性的管理器集成了命令行的功能和IDE、向导与代码浏览器的易用性,提高了生产率。 *   可视化和导航依赖可以无缝的利用各种资源进行工作,不管它们的关系、位置或格式。 *   完整的开发和部署模块包括Ruby、Rails、 Gems和数据库。  Ruby IDE所包含的技术将有利于推动开源技术发展。CodeGear已经表示他们将为Ruby提供补丁及分发代码以支持Eclipse动态语言工具包的支持。  CodeGear生产战略事务副总裁Michael Swindell 在该公司发布的一次讲话中说到:“Ruby on Rails已经成为一个重要的Web应用程序开发平台,因为它使得利用最少的代码开发丰富、数据驱动Web2.0应用更快更简单。然而,生产力背后的“魔法”对开发人员“现实世界”生产力水平上Web应用的构建,开发和维护带来了新的挑战。”  Swindell说到:“我们新的Ruby on Rails 技术通过不再是仅仅编辑和调试Ruby脚本解决了这些挑战。它提供了一个综合的以Rails为中心的开发环境,该集成环境即适用于新手也适用于流线开发专家。同时,基于CodeGear IDE 的创新性,这是我们开发的第一个可同时吸引命令行开发者,IDE开发者和可视化开发者的工具。”来源:IT专家网

    \n", "_id"=>11}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails view部分学习笔记", "body"=>"rails的view部分,是在controller执行完成后,通过显式或隐式调用render 寻找相关模板文件, 如 : rhtml 和rxml,并根据其生成相关页面推送至用户端。为了减少重复性,rails提供了一些复用机制:1、 layout 任何一个controller都可以有自己的layout(跟controller同名),该layout在其所有的action中共用。如果 controller没有设定自己的layout,rails会寻找application (controller的父类)的layout,当然也可以通过程序指定layout如: layout "standard" 或 render(:layout => "layouts/simple")也可以不使用layout用:render(:layout => false)在layout模板中需要有 : , 以表明实际内容的渲染位置。2、 action渲染模板缺省与action同名,也可以自己指定如:render(:action => "actionname") render(:template => 'controller/name')render(:file => 'dir/template')3、 partial除上述之外,rails还提供了局部页面模板,它用作当一些共享元件在很多页面都有使用是,可以提出成为一个局部页面模板,以提高复用性。通常把这些共享的局部模板放在目录: app/views/shared, 通过在模板中执行下面语句使用: 除了:object 还可以使用 :collection, :locals, :spacer_template 等参数另外,rails还提供组件的概念。为了提供ajax的支持, rails还提供了另外一种模板 rjs。rjs模板可以生成javascript代码。", "created_at"=>2007-05-19 22:30:36 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    rails的view部分,是在controller执行完成后,通过显式或隐式调用render 寻找相关模板文件, 如 : rhtml 和rxml,并根据其生成相关页面推送至用户端。为了减少重复性,rails提供了一些复用机制:1、 layout 任何一个controller都可以有自己的layout(跟controller同名),该layout在其所有的action中共用。如果 controller没有设定自己的layout,rails会寻找application (controller的父类)的layout,当然也可以通过程序指定layout如: layout "standard" 或 render(:layout => "layouts/simple")也可以不使用layout用:render(:layout => false)在layout模板中需要有 : , 以表明实际内容的渲染位置。2、 action渲染模板缺省与action同名,也可以自己指定如:render(:action => "actionname") render(:template => 'controller/name')render(:file => 'dir/template')3、 partial除上述之外,rails还提供了局部页面模板,它用作当一些共享元件在很多页面都有使用是,可以提出成为一个局部页面模板,以提高复用性。通常把这些共享的局部模板放在目录: app/views/shared, 通过在模板中执行下面语句使用: 除了:object 还可以使用 :collection, :locals, :spacer_template 等参数另外,rails还提供组件的概念。为了提供ajax的支持, rails还提供了另外一种模板 rjs。rjs模板可以生成javascript代码。

    \n", "_id"=>12}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"取各个板块的最近发帖方法", "body"=>"在论坛或者别的上面程序中,首页都会显示各个论坛板块的最新的帖子,请问这个是怎么实现的,按照我的设想,应该是这个的:@posts=Post.find(:all,:order=>"forum_id,create_at DESC" )然后在显示的时候按照forum_id来显示各自板块的最新帖子,但是这个在RHTML中怎么取出最新的帖子呢??我只能完全遍历,如下:<% @posts.each do |post| %><%= post.title %><% end %>这样就会全部显示出来,而我想要得只是每个板块的最新的那一个帖子,希望指教一二,谢了...--------1.个人参考Post.find_by_sql("select *,max(create_at) from post group forum_id"2.这样也许好一点:ruby 代码 1. forums = Forum.find :all 2. @last_post_of_forum = [] 3. for forum in forums 4. @last_post_of_forum << Post.find :first,:conditions=>['forum_id=?',forum.id], 5. :order => "create_at DESC",:limit => 1 1. end 或者你可以在models 中设置(参考自beast)。ruby 代码 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end views/form/index.rhtml代码 1. <td class="inv lp"> 2. <% if forum.posts.last %> 3. <%= time_ago_in_words(forum.posts.last.created_at) %><br /> 4. by <strong><%= h(forum.posts.last.user.display_name) %></strong> 5. <% end %> 6. </td>", "created_at"=>2007-05-19 22:29:27 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在论坛或者别的上面程序中,首页都会显示各个论坛板块的最新的帖子,请问这个是怎么实现的,按照我的设想,应该是这个的:@posts=Post.find(:all,:order=>"forum_id,create_at DESC" )然后在显示的时候按照forum_id来显示各自板块的最新帖子,但是这个在RHTML中怎么取出最新的帖子呢??我只能完全遍历,如下:<% @posts.each do |post| %><%= post.title %><% end %>这样就会全部显示出来,而我想要得只是每个板块的最新的那一个帖子,希望指教一二,谢了...--------1.个人参考Post.find_by_sql("select *,max(create_at) from post group forum_id"2.这样也许好一点:ruby 代码 1. forums = Forum.find :all 2. @last_post_of_forum = [] 3. for forum in forums 4. @last_post_of_forum << Post.find :first,:conditions=>['forum_id=?',forum.id], 5. :order => "create_at DESC",:limit => 1 1. end 或者你可以在models 中设置(参考自beast)。ruby 代码 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end 1. class Forum< ActiveRecord::Base 2. has_many :posts,:order => 'posts.created_at desc' do 3. def last 4. @last_post ||= find(:first, :include => :user, :limit => 1) 5. end 6. end 7. end 8. 9. class Post< ActiveRecord::Base 10. belongs_to :forum 11. belongs_to :user 12. end views/form/index.rhtml代码 1. <td class="inv lp"> 2. <% if forum.posts.last %> 3. <%= time_ago_in_words(forum.posts.last.created_at) %><br /> 4. by <strong><%= h(forum.posts.last.user.display_name) %></strong> 5. <% end %> 6. </td>

    \n", "_id"=>13}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ROR与MySQL的中文显示", "body"=>"一、安装数据库:1、安装5.0版本。2、在安装时选择"utf-8"编码。3、如果安装时未选"utf-8",可用 MySQL Administrator 的 “Startup Variables”/”Advanced” 更改 Def. Char Set 为 “utf-8” 。或者编辑MySQL目录下的my.ini文件:[mysql]default-character-set=utf8SET NAMES 'utf8'[mysqld]default-character-set=utf84、安裝 MySQL Tools :MySQL Administrator ,MySQL Query Browser5、在MySQL Query Browser中执行:SHOW VARIABLES LIKE 'character_set_%'; 查询系统的字符串均为utf8。6、建立数据库。选择MyISAM,InnoDB都可以,不过后者支持事务处理,这是它的诱人之处。7、建立表。在用MySQL Query Browser创建表时,可再次指定字符集。并可以对数据库的存储引擎进行修改。二、开发工具:使用“RedRails”。并在其“属性”选项中选择编码为"utf-8"格式。这样,你的所有文件就都是utf8格式了。三、修改文件:A、将public/dispatch.cgi文件的#!/path/to/ruby后面加上-Ku -rjcodeB、修改app/controller/application.rb文件。class ApplicationController < ActionController::Basebefore_filter :set_charsetdef set_charset@headers["Content-Type"] = "text/html; charset=utf-8"endend四、问题:浏览器,与代码内的中文的显示都可以了。但数据库中的表为什么还是乱码呢?此问题按james的意见,对database.yml文件进行了修改,数据库显示中文正常。你的数据库连接串也需要加上utf-8的设置,如:在database.yml中需要加上development:adapter: mysqldatabase: databaseusername: rootpassword:host: localhostencoding: utf8五、问题二:如果一个表选择MyISAM引擎时,可为一个表建立两个外键约束,但若是InnDB引擎时,建立一个外键约束还可以,但建立两个外键约束时,会提示error:150错误,创建失败。总结一下:一、在MySql这边: 将Charecter设置成为utf8二、application.rbbefore_filter :configure_charsetsdef configure_charsets@response.headers["Content-Type"] = "text/html; charset=utf-8"# Set connection charset. MySQL 4.0 doesn’t support this so it# will throw an error, MySQL 4.1 needs thissuppress(ActiveRecord::StatementInvalid) doActiveRecord::Base.connection.execute 'SET NAMES UTF8'endend三、environment.rb$KCODE = 'u'require 'jcode'", "created_at"=>2007-05-19 22:26:33 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    一、安装数据库:1、安装5.0版本。2、在安装时选择"utf-8"编码。3、如果安装时未选"utf-8",可用 MySQL Administrator 的 “Startup Variables”/”Advanced” 更改 Def. Char Set 为 “utf-8” 。或者编辑MySQL目录下的my.ini文件:[mysql]default-character-set=utf8SET NAMES 'utf8'[mysqld]default-character-set=utf84、安裝 MySQL Tools :MySQL Administrator ,MySQL Query Browser5、在MySQL Query Browser中执行:SHOW VARIABLES LIKE 'characterset%'; 查询系统的字符串均为utf8。6、建立数据库。选择MyISAM,InnoDB都可以,不过后者支持事务处理,这是它的诱人之处。7、建立表。在用MySQL Query Browser创建表时,可再次指定字符集。并可以对数据库的存储引擎进行修改。二、开发工具:使用“RedRails”。并在其“属性”选项中选择编码为"utf-8"格式。这样,你的所有文件就都是utf8格式了。三、修改文件:A、将public/dispatch.cgi文件的#!/path/to/ruby后面加上-Ku -rjcodeB、修改app/controller/application.rb文件。class ApplicationController < ActionController::Basebefore_filter :set_charsetdef set_charset@headers["Content-Type"] = "text/html; charset=utf-8"endend四、问题:浏览器,与代码内的中文的显示都可以了。但数据库中的表为什么还是乱码呢?此问题按james的意见,对database.yml文件进行了修改,数据库显示中文正常。你的数据库连接串也需要加上utf-8的设置,如:在database.yml中需要加上development:adapter: mysqldatabase: databaseusername: rootpassword:host: localhostencoding: utf8五、问题二:如果一个表选择MyISAM引擎时,可为一个表建立两个外键约束,但若是InnDB引擎时,建立一个外键约束还可以,但建立两个外键约束时,会提示error:150错误,创建失败。总结一下:一、在MySql这边: 将Charecter设置成为utf8二、application.rbbefore_filter :configure_charsetsdef configure_charsets@response.headers["Content-Type"] = "text/html; charset=utf-8"# Set connection charset. MySQL 4.0 doesn’t support this so it# will throw an error, MySQL 4.1 needs thissuppress(ActiveRecord::StatementInvalid) doActiveRecord::Base.connection.execute 'SET NAMES UTF8'endend三、environment.rb$KCODE = 'u'require 'jcode'

    \n", "_id"=>14}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Mac & *UNIX"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Mac & *UNIX", "updated_at"=>2012-06-24 15:53:11 UTC, "created_at"=>2012-06-24 15:53:11 UTC, "_id"=>7}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在防火墙后安装Rails", "body"=>"说到安装Rails,一般提到的方法就是使用rubygem,如果安装的是One-Click Installer – Windows版的ruby,里面自动附带了rubygem,如果不是,并且想用gem安装rails的话,到这里下载gem,http://rubyforge.org/frs/?group_id=126将它解压到任何目录下,到解压后的目录下,运行ruby setup.rb安装gem.如果还没有使用One-Click Installer,建议去装一个。下载地址如下:http://rubyforge.org/frs/?group_id=167然后是安装rails,官方网站上就明确教导大家用gem install rails --include-dependencies来安装rails。使用代理服务器上网的话,还可以通过指定参数 -p http://<代理服务器名>@<端口> 来进行安装。gem install rails -p http://<代理服务器名>@<端口>如果你的机器位于防火墙之后,或者有种种连接限制的环境下,则可以通过下载gem文件,用gem install ***.gem(保存到windows后会发现,gem文件的后缀实际上是.gem. tar)来进行安装。所有的gem文件都可以从以下网页下载:http://rubyforge.vm.bytemark.co.uk/gems/由于各个包之间有相互依赖的关系,所以安装的时候有安装顺序问题。不过即使安装顺序错误也问题不大,会有提示需要***.gem文件的*.*.*版本,去下载并安装就行了。保存gem文件后,转到gem文件所在目录,执行以下安装:笔者的安装顺序是1.)gem install rake-0.7.1.gem.tar2.) gem install activesupport-1.14.4.gem.tar3.) gem install activerecord-1.12.5.gem.tar4.) gem install actionpack-1.12.5.gem.tar5.) gem install actionmailer-1.2.5.gem.tar6.) gem install actionwebservice-1.1.6.gem.tar7.) gem install rails-1.1.6.gem.tar由于rake,active***.action***,rails等gem文件版本众多,笔者也不知道那个版本比较好,就全部挑了最新版进行安装。不过如果假如知道rails的1.1.4版比较稳定,可以将上面的顺序反过来,先试装rails,如果出错,出错信息里会包含所需要的gem(比如 actionwebservice)的版本,这样逆序找到所需的所有gem包之后,再顺序安装rake->active***-> action**->rails就可以了。 最后成功安装rails后,可以通过rails –v来确认安装,能看到C:\\>rails -vRails 1.1.6恭喜你,安装rails成功了。", "created_at"=>2007-05-19 22:25:12 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    说到安装Rails,一般提到的方法就是使用rubygem,如果安装的是One-Click Installer – Windows版的ruby,里面自动附带了rubygem,如果不是,并且想用gem安装rails的话,到这里下载gem,http://rubyforge.org/frs/?group_id=126ruby将它解压到任何目录下,到解压后的目录下,运行 setup.rb安装gem.如果还没有使用One-Click Installer,建议去装一个。下载地址如下:http://rubyforge.org/frs/?group_id=167然后是安装rails,官方网站上就明确教导大家用gem install rails --include-dependencies来安装rails。使用代理服务器上网的话,还可以通过指定参数 -p http://<代理服务器名>@<端口> 来进行安装。gem install rails -p http://<代理服务器名>@<端口>如果你的机器位于防火墙之后,或者有种种连接限制的环境下,则可以通过下载gem文件,用gem install .gem(保存到windows后会发现,gem文件的后缀实际上是.gem. tar)来进行安装。所有的gem文件都可以从以下网页下载:http://rubyforge.vm.bytemark.co.uk/gems/由于各个包之间有相互依赖的关系,所以安装的时候有安装顺序问题。不过即使安装顺序错误也问题不大,会有提示需要.gem文件的..版本,去下载并安装就行了。保存gem文件后,转到gem文件所在目录,执行以下安装:笔者的安装顺序是1.)gem install rake-0.7.1.gem.tar2.) gem install activesupport-1.14.4.gem.tar3.) gem install activerecord-1.12.5.gem.tar4.) gem install actionpack-1.12.5.gem.tar5.) gem install actionmailer-1.2.5.gem.tar6.) gem install actionwebservice-1.1.6.gem.tar7.) gem install rails-1.1.6.gem.tar由于rake,active.action,rails等gem文件版本众多,笔者也不知道那个版本比较好,就全部挑了最新版进行安装。不过如果假如知道rails的1.1.4版比较稳定,可以将上面的顺序反过来,先试装rails,如果出错,出错信息里会包含所需要的gem(比如 actionwebservice)的版本,这样逆序找到所需的所有gem包之后,再顺序安装rake->active-> action->rails就可以了。 最后成功安装rails后,可以通过rails –v来确认安装,能看到C:&gt;rails -vRails 1.1.6恭喜你,安装rails成功了。

    \n", "_id"=>15}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"纯CSS实现圆角效果", "body"=>"以前都是用背景图片来实现的,需要先切割好图片,很不方便,现在参考老外的一个做法,用纯CSS就可以实现这个效果,比起图片来,自然漂亮的多,下面是实现代码:<style type="text/css">#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}#xsnazzy h1 {font-size:2.5em; color:#fff;}#xsnazzy h2 {font-size:2em;color:#06a; border:0;}#xsnazzy p {padding-bottom:0.5em;}#xsnazzy h2 {padding-top:0.5em;}#xsnazzy {background: transparent; margin:1em;}.xtop, .xbottom {display:block; background:transparent; font-size:1px;}.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}.xb1, .xb2, .xb3 {height:1px;}.xb2, .xb3, .xb4 {background:#ccc; border-left:1px solid #08c; border-right:1px solid #08c;}.xb1 {margin:0 5px; background:#08c;}.xb2 {margin:0 3px; border-width:0 2px;}.xb3 {margin:0 2px;}.xb4 {height:2px; margin:0 1px;}.xboxcontent {display:block; background:#ccc; border:0 solid #08c; border-width:0 1px;}</style><div id="xsnazzy"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b><div class="xboxcontent"><h1>Snazzy Borders</h1><p>Based on Nifty Corners By Alessandro Fulciniti<br />http://pro.html.it/esempio/nifty/</p></div><b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>需要看效果的可以复制到本地,保存为HTML格式,打开就可以看到效果了..", "created_at"=>2007-05-19 22:23:05 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    以前都是用背景图片来实现的,需要先切割好图片,很不方便,现在参考老外的一个做法,用纯CSS就可以实现这个效果,比起图片来,自然漂亮的多,下面是实现代码:<style type="text/css">#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}#xsnazzy h1 {font-size:2.5em; color:#fff;}#xsnazzy h2 {font-size:2em;color:#06a; border:0;}#xsnazzy p {padding-bottom:0.5em;}#xsnazzy h2 {padding-top:0.5em;}#xsnazzy {background: transparent; margin:1em;}.xtop, .xbottom {display:block; background:transparent; font-size:1px;}.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}.xb1, .xb2, .xb3 {height:1px;}.xb2, .xb3, .xb4 {background:#ccc; border-left:1px solid #08c; border-right:1px solid #08c;}.xb1 {margin:0 5px; background:#08c;}.xb2 {margin:0 3px; border-width:0 2px;}.xb3 {margin:0 2px;}.xb4 {height:2px; margin:0 1px;}.xboxcontent {display:block; background:#ccc; border:0 solid #08c; border-width:0 1px;}</style><div id="xsnazzy"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b><div class="xboxcontent"><h1>Snazzy Borders</h1><p>Based on Nifty Corners By Alessandro Fulciniti<br />http://pro.html.it/esempio/nifty/</p></div><b; class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>需要看效果的可以复制到本地,保存为HTML格式,打开就可以看到效果了..

    \n", "_id"=>16}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"去掉CSS中的链接图片的外边框", "body"=>"在ROR的实际开发中,遇到这么一个情况:例如凡是有图片的地方,在图片外面显示了一个边框,很不好看,找了下资料,可以这样修复:1.如果是直接用image_tag来实现的 ,则加上:border => 0,结果如下:<%= link_to(image_tag("/images/btn_home.png", :border => 0), {:controller => "code"}) %>2.如果这个图片使用的是CSS中的DIV格式,则需要添加:border: 0就可以了.归结为:when images are used in links they put a border around them.To disable this globally (as most people do) add "img {border: 0}" to your css.", "created_at"=>2007-05-19 22:21:02 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在ROR的实际开发中,遇到这么一个情况:例如凡是有图片的地方,在图片外面显示了一个边框,很不好看,找了下资料,可以这样修复:1.如果是直接用image_tag来实现的 ,则加上:border => 0,结果如下:<%= link_to(image_tag("/images/btn_home.png", :border => 0), {:controller => "code"}) %>2.如果这个图片使用的是CSS中的DIV格式,则需要添加:border: 0就可以了.归结为:when images are used in links they put a border around them.To disable this globally (as most people do) add "img {border: 0}" to your css.

    \n", "_id"=>17}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"CSS控制整个框架居中显示", "body"=>"在整个ROR开发过程中,需要把整个框架居中,于是设置如下:body { margin:0 auto; font-family:arial; color:#000; width:900px; font-size:12pt;}按理论上这样就可以达到CSS居中控制DIV,但确不行,经过一上午的研究,终于搞定。添加3W的一段定义,应该是告诉IE按这种格式解析HTML。其实主要是因为我是手动写的代码,如果我用VS2005,这段是会自动添加的。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">", "created_at"=>2007-05-19 22:19:39 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在整个ROR开发过程中,需要把整个框架居中,于是设置如下:body { margin:0 auto; font-family:arial; color:#000; width:900px; font-size:12pt;}按理论上这样就可以达到CSS居中控制DIV,但确不行,经过一上午的研究,终于搞定。添加3W的一段定义,应该是告诉IE按这种格式解析HTML。其实主要是因为我是手动写的代码,如果我用VS2005,这段是会自动添加的。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html; xmlns="http://www.w3.org/1999/xhtml">

    \n", "_id"=>18}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby操作时间对象", "body"=>"在开发过程中,难免需要对时间对象进行一系列操作,比如统计新发的文章,统计在线会员等,如下是对时间对象的操作方法:distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)Reports the approximate distance in time between two Time or Date objects or integers as seconds. Set include_seconds to true if you want more detailed approximations when distance < 1 min, 29 secs Distances are reported base on the following table:0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1 minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours 23 hrs, 59 mins, 29 secs <-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days 29 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 31 secs # => [2..12] months 1 yr minus 30 secs <-> 2 yrs minus 31 secs # => about 1 year 2 yrs minus 30 secs <-> max time or date # => over [2..X] yearsWith include_seconds = true and the difference < 1 minute 29 seconds 0-4 secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19 secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs # => less than a minute 60-89 secs # => 1 minuteExamples: from_time = Time.now distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute distance_of_time_in_words(from_time, from_time + 15.seconds, true) # => less than 20 secondsNote: Rails calculates one year as 365.25 days.[ show source ] # File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 4848: def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)49: from_time = from_time.to_time if from_time.respond_to?(:to_time)50: to_time = to_time.to_time if to_time.respond_to?(:to_time)51: distance_in_minutes = (((to_time - from_time).abs)/60).round52: distance_in_seconds = ((to_time - from_time).abs).round53: 54: case distance_in_minutes55: when 0..156: return (distance_in_minutes == 0) ? 'less than a minute' : '1 minute' unless include_seconds57: case distance_in_seconds58: when 0..4 then 'less than 5 seconds'59: when 5..9 then 'less than 10 seconds'60: when 10..19 then 'less than 20 seconds'61: when 20..39 then 'half a minute'62: when 40..59 then 'less than a minute'63: else '1 minute'64: end65: 66: when 2..44 then "\#{distance_in_minutes} minutes"67: when 45..89 then 'about 1 hour'68: when 90..1439 then "about \#{(distance_in_minutes.to_f / 60.0).round} hours"69: when 1440..2879 then '1 day'70: when 2880..43199 then "\#{(distance_in_minutes / 1440).round} days"71: when 43200..86399 then 'about 1 month'72: when 86400..525959 then "\#{(distance_in_minutes / 43200).round} months"73: when 525960..1051919 then 'about 1 year'74: else "over \#{(distance_in_minutes / 525960).round} years"75: end76: enddistance_of_time_in_words_to_now(from_time, include_seconds = false)Alias for time_ago_in_words", "created_at"=>2007-05-19 22:18:11 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在开发过程中,难免需要对时间对象进行一系列操作,比如统计新发的文章,统计在线会员等,如下是对时间对象的操作方法:distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)Reports the approximate distance in time between two Time or Date objects or integers as seconds. Set include_seconds to true if you want more detailed approximations when distance < 1 min, 29 secs Distances are reported base on the following table:0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1 minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours 23 hrs, 59 mins, 29 secs <-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days 29 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 31 secs # => [2..12] months 1 yr minus 30 secs <-> 2 yrs minus 31 secs # => about 1 year 2 yrs minus 30 secs <-> max time or date # => over [2..X] yearsWith include_seconds = true and the difference < 1 minute 29 seconds 0-4 secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19 secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs # => less than a minute 60-89 secs # => 1 minuteExamples: from_time = Time.now distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute distance_of_time_in_words(from_time, from_time + 15.seconds, true) # => less than 20 secondsNote: Rails calculates one year as 365.25 days.[ show source ] # File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 4848: def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)49: from_time = from_time.to_time if from_time.respond_to?(:to_time)50: to_time = to_time.to_time if to_time.respond_to?(:to_time)51: distance_in_minutes = (((to_time - from_time).abs)/60).round52: distance_in_seconds = ((to_time - from_time).abs).round53: 54: case distance_in_minutes55: when 0..156: return (distance_in_minutes == 0) ? 'less than a minute' : '1 minute' unless include_seconds57: case distance_in_seconds58: when 0..4 then 'less than 5 seconds'59: when 5..9 then 'less than 10 seconds'60: when 10..19 then 'less than 20 seconds'61: when 20..39 then 'half a minute'62: when 40..59 then 'less than a minute'63: else '1 minute'64: end65: 66: when 2..44 then "\#{distance_in_minutes} minutes"67: when 45..89 then 'about 1 hour'68: when 90..1439 then "about \#{(distance_in_minutes.to_f / 60.0).round} hours"69: when 1440..2879 then '1 day'70: when 2880..43199 then "\#{(distance_in_minutes / 1440).round} days"71: when 43200..86399 then 'about 1 month'72: when 86400..525959 then "\#{(distance_in_minutes / 43200).round} months"73: when 525960..1051919 then 'about 1 year'74: else "over \#{(distance_in_minutes / 525960).round} years"75: end76: enddistance_of_time_in_words_to_now(from_time, include_seconds = false)Alias for time_ago_in_words

    \n", "_id"=>19}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给当前链接加上class属性", "body"=>"在WEB系统中,如果能给当前链接加上一些标识,那是一件比较high的事。link_to_unless_current 可以做到把当前的链接中去掉链接,不能指定我们自己的class类别,于是我们可以自己DIR,如下:写一个新的css类,例如叫:current然后把下面这个help方法加到您的help.rb中,然后在rhtml中进行引用,如下:def link_to_with_current_class_if_current(name, options = {}, html_options = {}, *parameters_for_method_reference) html_options[:class] = "current" if current_page?(options) link_to(name, options, html_options, *parameters_for_method_reference)end", "created_at"=>2007-05-19 22:16:18 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在WEB系统中,如果能给当前链接加上一些标识,那是一件比较high的事。link_to_unless_current 可以做到把当前的链接中去掉链接,不能指定我们自己的class类别,于是我们可以自己DIR,如下:写一个新的css类,例如叫:current然后把下面这个help方法加到您的help.rb中,然后在rhtml中进行引用,如下:def link_to_with_current_class_if_current(name, options = {}, html_options = {}, *parameters_for_method_reference) html_options[:class] = "current" if current_page?(options) link_to(name, options, html_options, *parameters_for_method_reference)end

    \n", "_id"=>20}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏最后四位字符", "body"=>"在这样一个需求中,可能会用到这个特性,需要把一个人的信用卡的最后几位(手机号码的最后几位)隐藏掉,用*代替,可以用这样来实现。。def mask_number(number) number.to_s.size < 5 ? number.to_s : (('*' * number.to_s[0..-5].length) + number.to_s[-4..-1])end 直接传递一个字符串或者数字都可以。。", "created_at"=>2007-05-19 22:14:54 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在这样一个需求中,可能会用到这个特性,需要把一个人的信用卡的最后几位(手机号码的最后几位)隐藏掉,用代替,可以用这样来实现。。def mask_number(number) number.to_s.size < 5 ? number.to_s : (('' * number.to_s[0..-5].length) + number.to_s[-4..-1])end 直接传递一个字符串或者数字都可以。。

    \n", "_id"=>21}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随机产生密码.", "body"=>"在WEB应用中,可能需要随机产生密码,比如一个用户的密码丢了,填写自己的取回密码的油箱后,可以随机产生一个密码给他,实现代码很简单,如下:def new_random_password self.password= Digest::SHA1.hexdigest("--\#{Time.now.to_s}--\#{login}--")[0,6] self.password_confirmation = self.passwordend然后在需要的地方调用就OK了.", "created_at"=>2007-05-19 22:13:03 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在WEB应用中,可能需要随机产生密码,比如一个用户的密码丢了,填写自己的取回密码的油箱后,可以随机产生一个密码给他,实现代码很简单,如下:def new_random_password self.password= Digest::SHA1.hexdigest("--\#{Time.now.to_s}--\#{login}--")[0,6] self.password_confirmation = self.passwordend然后在需要的地方调用就OK了.

    \n", "_id"=>22}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保证上传文件名字的唯一性", "body"=>"上传文件是都需要用到的功能,可以用以下代码实现:src_filename = params[:file][:name] if !src_filename.original_filename.empty? hashed_name = Digest::SHA1.hexdigest(Time.now.to_s) filename = "\#{RAILS_ROOT}/public/attachments/" + hashed_name + "_" + src_filename.original_filename if File.open(filename, 'w'){ |f| f.write(src_filename.read) } attachment = Attachment.new attachment.name = src_filename.original_filename attachment.hashed_name = hashed_name attachment.size = src_filename.size comment.attachments << attachment end end 当然,还有做一些后缀校验等。。。", "created_at"=>2007-05-19 22:11:32 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    上传文件是都需要用到的功能,可以用以下代码实现:srcfilename = params[:file][:name] if !src_filename.original_filename.empty? hashed_name = Digest::SHA1.hexdigest(Time.now.to_s) filename = "\#{RAILS_ROOT}/public/attachments/" + hashed_name + "" + src_filename.original_filename if File.open(filename, 'w'){ |f| f.write(src_filename.read) } attachment = Attachment.new attachment.name = src_filename.original_filename attachment.hashed_name = hashed_name attachment.size = src_filename.size comment.attachments << attachment end end 当然,还有做一些后缀校验等。。。

    \n", "_id"=>23}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"聚焦你的页面上的第一个输入框", "body"=>"如果可以在用户打开一个注册或者发表文章的页面,能把光标直接聚焦到第一个输入框,或许会改善不少的用户体验,我们在ROR中可以轻松实现,把如下代码粘贴到你的application.js 中,并保证在你的布局RHTML文件中包含这个js文件:"javascript_include_tag :defaults".Event.observe(window, 'load', function() { var e = $A(document.getElementsByTagName('*')).find(function(e) { return (e.tagName.toUpperCase() == 'INPUT' && (e.type == 'text' || e.type == 'password')) || e.tagName.toUpperCase() == 'TEXTAREA' || e.tagName.toUpperCase() == 'SELECT'; }); if (e) e.focus();}); 你也可以对你特定的需求进行编辑。。", "created_at"=>2007-05-19 22:06:30 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    如果可以在用户打开一个注册或者发表文章的页面,能把光标直接聚焦到第一个输入框,或许会改善不少的用户体验,我们在ROR中可以轻松实现,把如下代码粘贴到你的application.js 中,并保证在你的布局RHTML文件中包含这个js文件:"javascript_include_tag :defaults".Event.observe(window, 'load', function() { var e = $A(document.getElementsByTagName('*')).find(function(e) { return (e.tagName.toUpperCase() == 'INPUT' && (e.type == 'text' || e.type == 'password')) || e.tagName.toUpperCase() == 'TEXTAREA' || e.tagName.toUpperCase() == 'SELECT'; }); if (e) e.focus();}); 你也可以对你特定的需求进行编辑。。

    \n", "_id"=>24}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Security"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Security", "updated_at"=>2012-06-24 15:53:11 UTC, "created_at"=>2012-06-24 15:53:11 UTC, "_id"=>8}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"把Google等Spider挡在门外", "body"=>"有的时候,您可能不想GOOGLE或者其他的网络蜘蛛(Spider)造访您的站点(比如一个私密的同学录或者个人财富系统等),您可以在ApplicationController 里面加入如下这个方法:class ApplicationController < ActionController::Base before_filter :disable_link_prefetching private def disable_link_prefetching if request.env["HTTP_X_MOZ"] == "prefetch" logger.debug "prefetch detected: sending 403 Forbidden" render_nothing "403 Forbidden" return false end endend其他Spider的防范可以参考这个来实现,就是提取请求来源的参数标志,然后加以阻挡就可以了。", "created_at"=>2007-05-19 22:04:43 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    有的时候,您可能不想GOOGLE或者其他的网络蜘蛛(Spider)造访您的站点(比如一个私密的同学录或者个人财富系统等),您可以在ApplicationController 里面加入如下这个方法:class ApplicationController < ActionController::Base before_filter :disable_link_prefetching private def disable_link_prefetching if request.env["HTTP_X_MOZ"] == "prefetch" logger.debug "prefetch detected: sending 403 Forbidden" render_nothing "403 Forbidden" return false end endend其他Spider的防范可以参考这个来实现,就是提取请求来源的参数标志,然后加以阻挡就可以了。

    \n", "_id"=>25}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"按时间归档的Routes写法", "body"=>"在博客等系统中,通常需要按时间进行归档,这个Routes可以这样写。。如下:# allow neat perma urlsmap.connect 'articles/:year/:month/:day', :controller => 'articles', :action => 'find_by_date', :year => /\\d{4}/, :day => nil, :month => nilmap.connect 'articles/:year/:month/:day/:title', :controller => 'articles', :action => 'permalink', :year => /\\d{4}/", "created_at"=>2007-05-19 22:00:07 UTC, "updated_at"=>2012-06-24 15:53:11 UTC, "body_html"=>"

    在博客等系统中,通常需要按时间进行归档,这个Routes可以这样写。。如下:# allow neat perma urlsmap.connect 'articles/:year/:month/:day', :controller => 'articles', :action => 'find_by_date', :year => /\\d{4}/, :day => nil, :month => nilmap.connect 'articles/:year/:month/:day/:title', :controller => 'articles', :action => 'permalink', :year => /\\d{4}/

    \n", "_id"=>26}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"find out the current url / uri in *.rhtml file", "body"=>"// find out the current url / uri in *.rhtml file// is quite simple with the request object<% page = request.request_uri %>page: <%= page %>// but then different urls mean the same page// (../admin = ../admin/ = ../admin/index = ..admin/index/)// and maybe the id is unwanted too (../admin/show/8)// so below is an alternative with control on which parameter is used<% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %>page: <%= page %>", "created_at"=>2007-05-19 21:58:09 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    // find out the current url / uri in *.rhtml file// is quite simple with the request object<% page = request.request_uri %>page: <%= page %>// but then different urls mean the same page// (../admin = ../admin/ = ../admin/index = ..admin/index/)// and maybe the id is unwanted too (../admin/show/8)// so below is an alternative with control on which parameter is used<% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %>page: <%= page %>

    \n", "_id"=>27}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"Firefox doesn't display a popup for the alt attribute for images. While this is according to spec, it's slightly annoying to put the same text in both the alt and the title. Put the following in your ApplicationHelper to copy the alt to the title for every image. Please don't tell me how wrong this is. I don't care.module ApplicationHelper def image_tag(location, options) options[:title] ||= options[:alt] super(location, options) endend", "created_at"=>2007-05-19 21:56:35 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Firefox doesn't display a popup for the alt attribute for images. While this is according to spec, it's slightly annoying to put the same text in both the alt and the title. Put the following in your ApplicationHelper to copy the alt to the title for every image. Please don't tell me how wrong this is. I don't care.module ApplicationHelper def image_tag(location, options) options[:title] ||= options[:alt] super(location, options) endend

    \n", "_id"=>28}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"特别留意XSS攻击", "body"=>"跨站点脚本攻击有一个前提:攻击者能够将他们自己编写的JavaScript脚本放进网页,并且这些页面在显示时与他们想要的cookie相关联。幸运的是,这种攻击很容易提防——不要允许任何外来的东西直接显示在页面上就行了[1]。在将任何一个字符串显示在网页上之前,一定要将其中的HTML元字符(“<”和“>”)转换成对应的HTML实体(“&lt;”和 “&gt;”),这样不管攻击者在表单或者URL参数中输入了什么文本,浏览器都只会将其显示为普通文本,不会对其做任何HTML解释。即便不考虑安全问题,你也同样应该考虑这样做,因为如果允许用户输入HTML标签,页面的布局很容易被搞乱。如果使用Textile或者Markdown这样的标记语言,一定要倍加小心,因为它们允许用户在页面上添加HTML片段。Rails提供了h(string)辅助方法(实际上是html_escape()方法的别名),该方法正是用于在Rails视图中执行上述文本替换的。在这个容易遭受攻击的网站里,负责编写“查看留言”功能的人可以将表单写成这样,以消除安全问题:<div class="comment"><%= h(order.comment) %></div>Joe问……干吗不直接扔掉<script>标签呢?既然问题出在用户可以把<script>标签插进我们显示的内容中,也许你会想,直接把这些标签找到并删除不就是最简单的解决办法吗?可惜,这不管用。浏览器在很多情况下都会执行JavaScript,情况之多也许会令你吃惊。(譬如说, onclick=属性、<img>标签的scr=属性都可以是JavaScript的来源。)而且这也不仅仅是JavaScript的问题 ——如果允许用户在网页上放进超链接,就可能有人用它来干坏事。你可以试着检查所有这些情况,不过相比之下,HTML转义替换的方式要更安全,而且更不容易出错。所以,请养成习惯,在把任何变量放进视图显示之前,使用h()方法对其进行转义替换——即便你认为它来自一个可以信赖的来源。同时,在阅读别人的代码时,也得留意其中使用h()方法的地方——有些人在使用h()方法时喜欢不加括号,这可能让代码变得更加难懂。有时你确实需要把包含HTML的字符串放进视图模板,此时可以使用sanitize()方法,该方法可以去除其中可能造成危险的部分。不过,你最好仔细检查sanitize()方法是否能够提供你所需要的保护:每周都有新的HTML攻击手段出现,令人防不胜防。", "created_at"=>2007-05-19 21:54:46 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    跨站点脚本攻击有一个前提:攻击者能够将他们自己编写的JavaScript脚本放进网页,并且这些页面在显示时与他们想要的cookie相关联。幸运的是,这种攻击很容易提防——不要允许任何外来的东西直接显示在页面上就行了[1]。在将任何一个字符串显示在网页上之前,一定要将其中的HTML元字符(“<”和“>”)转换成对应的HTML实体(“&lt;”和 “&gt;”),这样不管攻击者在表单或者URL参数中输入了什么文本,浏览器都只会将其显示为普通文本,不会对其做任何HTML解释。即便不考虑安全问题,你也同样应该考虑这样做,因为如果允许用户输入HTML标签,页面的布局很容易被搞乱。如果使用Textile或者Markdown这样的标记语言,一定要倍加小心,因为它们允许用户在页面上添加HTML片段。Rails提供了h(string)辅助方法(实际上是html_escape()方法的别名),该方法正是用于在Rails视图中执行上述文本替换的。在这个容易遭受攻击的网站里,负责编写“查看留言”功能的人可以将表单写成这样,以消除安全问题:<div class="comment"><%= h(order.comment) %></div>Joe问……干吗不直接扔掉<script>标签呢?既然问题出在用户可以把<script>标签插进我们显示的内容中,也许你会想,直接把这些标签找到并删除不就是最简单的解决办法吗?可惜,这不管用。浏览器在很多情况下都会执行JavaScript,情况之多也许会令你吃惊。(譬如说, onclick=属性、<img>标签的scr=属性都可以是JavaScript的来源。)而且这也不仅仅是JavaScript的问题 ——如果允许用户在网页上放进超链接,就可能有人用它来干坏事。你可以试着检查所有这些情况,不过相比之下,HTML转义替换的方式要更安全,而且更不容易出错。所以,请养成习惯,在把任何变量放进视图显示之前,使用h()方法对其进行转义替换——即便你认为它来自一个可以信赖的来源。同时,在阅读别人的代码时,也得留意其中使用h()方法的地方——有些人在使用h()方法时喜欢不加括号,这可能让代码变得更加难懂。有时你确实需要把包含HTML的字符串放进视图模板,此时可以使用sanitize()方法,该方法可以去除其中可能造成危险的部分。不过,你最好仔细检查sanitize()方法是否能够提供你所需要的保护:每周都有新的HTML攻击手段出现,令人防不胜防。

    \n", "_id"=>29}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"神奇好用的find_or_create_by", "body"=>"简单来说,find_or_create_by 就是先去找说数据库里面有没有这个数据,如果没有他就顺手帮你建立一个。很简单的概念,但是却又非常频繁用到。使用方式如下今天有一个 User Model 有两个 attribute ,其中一个是 name ,另外一个是 email。 如果我们想要找出一个名叫做 'abc' 的使用者,如果没这个人,就创造一个,然后将他指定到 a 这个 Object 。使用方是就是a = User.find_or_create_by_name('abc')仔细去翻 SQL Code,我们可以发现SELECT * FROM users WHERE (userss.`name` = `abc` ) LIMIT 1BEGININSERT INTO users (`name`, `email`) VALUES('abc', '')COMMIT如果想要更进一步,我们想找出名叫做 'abc' ,并且 email 是 abc@example.com 的使用者,并且将他指定到 Object a。使用方是就是a = User.find_or_create_by_name_and_email('abc' , 'abc@example.com')SQL code 就是SELECT * FROM users WHERE (users.`name` = `abc` and users.`name` = `abc@example.com`) LIMIT 1BEGININSERT INTO users (`name`, `email`) VALUES('abc', 'abc@example.com')COMMIT我果然应该多花点时间再重新阅读 Ruby on Rails 的书好了,那么方便的东西居然都不知道。", "created_at"=>2007-05-19 21:52:24 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    简单来说,find_or_create_by 就是先去找说数据库里面有没有这个数据,如果没有他就顺手帮你建立一个。很简单的概念,但是却又非常频繁用到。使用方式如下今天有一个 User Model 有两个 attribute ,其中一个是 name ,另外一个是 email。 如果我们想要找出一个名叫做 'abc' 的使用者,如果没这个人,就创造一个,然后将他指定到 a 这个 Object 。使用方是就是a = User.find_or_create_by_name('abc')仔细去翻 SQL Code,我们可以发现SELECT * FROM users WHERE (userss.name = abc ) LIMIT 1BEGININSERT INTO users (name, email) VALUES('abc', '')COMMIT如果想要更进一步,我们想找出名叫做 'abc' ,并且 email 是 abc@example.com 的使用者,并且将他指定到 Object a。使用方是就是a = User.find_or_create_by_name_and_email('abc' , 'abc@example.com')SQL code 就是SELECT * FROM users WHERE (users.name = abc and users.name = abc@example.com) LIMIT 1BEGININSERT INTO users (name, email) VALUES('abc', 'abc@example.com')COMMIT我果然应该多花点时间再重新阅读 Ruby on Rails 的书好了,那么方便的东西居然都不知道。

    \n", "_id"=>30}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby对RSS(XML)的实例解析", "body"=>"有时候你可能想备份下原来的博客,或者对写的文章做些备份之类的,用RUBY很间就可以实现,下面是我的这个应用中所用的,针对用户推荐的文章,给出文章的RSS地址,然后写些自己的感受或者评论,就可以把提交的那个RSS文章取过来的。下面是代码:<code> @topic.body = '引言:' + @topic.body + '<br/>' feed = RSS::Parser.parse(open(params[:uri]).read, false) @topic.body += '<br />*来源:*' + feed.channel.title @topic.body += '<br />*地址:*' + feed.channel.link feed.items.each do |item| @topic.body += '<br />*标题:*' + item.title @topic.body += '<br />*内容摘要:*<br />' + item.description end </code>对了,你还需要在前面加上对库的引用,如下:require 'rss/2.0'require 'open-uri'另外,刚刚看到Javaeye上一个老兄写了一个差不多的,我就不多写了,大家可以参考下,地址如下:http://www.javaeye.com/blog/57538", "created_at"=>2007-06-01 23:25:45 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有时候你可能想备份下原来的博客,或者对写的文章做些备份之类的,用RUBY很间就可以实现,下面是我的这个应用中所用的,针对用户推荐的文章,给出文章的RSS地址,然后写些自己的感受或者评论,就可以把提交的那个RSS文章取过来的。下面是代码:<code> @topic.body = '引言:' + @topic.body + '<br/>' feed = RSS::Parser.parse(open(params[:uri]).read, false) @topic.body += '<br />来源:' + feed.channel.title @topic.body += '<br />地址:' + feed.channel.link feed.items.each do |item| @topic.body += '<br />标题:' + item.title @topic.body += '<br />内容摘要:<br />' + item.description end </code>对了,你还需要在前面加上对库的引用,如下:require 'rss/2.0'require 'open-uri'另外,刚刚看到Javaeye上一个老兄写了一个差不多的,我就不多写了,大家可以参考下,地址如下:http://www.javaeye.com/blog/57538

    \n", "_id"=>31}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"How to Transfer Files using SSH and Ruby", "body"=>"老外(Matthew Bass)写了一篇文章*Automating File Uploads with SSH and Ruby.*放在InfoQ上,其说明了如何使用Net-SSH 和 Net-SFTP 库实现了使用SSH备份文件到远程主机上的Ruby实现,如果你有类似方面的需求,可以好好看看这篇文章,地址在:http://www.infoq.com/articles/ruby-file-upload-ssh-intro", "created_at"=>2007-05-31 07:55:46 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    老外(Matthew Bass)写了一篇文章*Automating File Uploads with SSH and Ruby.*放在InfoQ上,其说明了如何使用Net-SSH 和 Net-SFTP 库实现了使用SSH备份文件到远程主机上的Ruby实现,如果你有类似方面的需求,可以好好看看这篇文章,地址在:http://www.infoq.com/articles/ruby-file-upload-ssh-intro

    \n", "_id"=>32}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Introduction to ActiveMessaging for Rails", "body"=>"ActiveMessaging是个感觉很不错的一个插件,通过它你可以发送、接收MO,总得来说很有诱惑力,还没有看完,下面这篇文章对这个东西做了详细的介绍,感兴趣的可以自己去看看,我就不翻译了,等我自己试用后,可以再些些心得什么的。*introduction*Rails has already planted its flag firmly in the ground of database driven web applications. *ActiveMessaging*is a Rails plugin framework that extends the borders of Rails territory by adding simplified messaging integration. With ActiveMessaging and Rails now you can loosely integrate with systems as disparate as mainframes sending MQ messages or J2EE webapps, offload processing long-running tasks, or create applications with event or message-driven architectures. As others have put it, ActiveMessaging is trying to do for messaging what ActiveRecord does for databases. This article will introduce you to ActiveMessaging and related technologies, and get you started using it in your Rails applications now.http://www.infoq.com/articles/intro-active-messaging-rails", "created_at"=>2007-05-30 21:12:54 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    ActiveMessaging是个感觉很不错的一个插件,通过它你可以发送、接收MO,总得来说很有诱惑力,还没有看完,下面这篇文章对这个东西做了详细的介绍,感兴趣的可以自己去看看,我就不翻译了,等我自己试用后,可以再些些心得什么的。*introduction*Rails has already planted its flag firmly in the ground of database driven web applications. *ActiveMessaging*is a Rails plugin framework that extends the borders of Rails territory by adding simplified messaging integration. With ActiveMessaging and Rails now you can loosely integrate with systems as disparate as mainframes sending MQ messages or J2EE webapps, offload processing long-running tasks, or create applications with event or message-driven architectures. As others have put it, ActiveMessaging is trying to do for messaging what ActiveRecord does for databases. This article will introduce you to ActiveMessaging and related technologies, and get you started using it in your Rails applications now.http://www.infoq.com/articles/intro-active-messaging-rails

    \n", "_id"=>33}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"清除HTML标签中的危险字符", "body"=>"很多时候,我们需要处理用户输入,为了适合WEB2的特性,做为开发者我们也会设计很对个途径让用户参与进去,但是“盖茨”大叔说得很对:*凡是用户的输入都是有害的!*一点不假,有时候用户可能是无意的或者一些不怀好意的用户会输入一些我们并不想让他们输入的东西,以防止破坏页面结构或者造成其他的危害(比如SQL注射和XSS攻击),所以我们需要对用户的输入认真的检验和过滤。在页面上显示的时候,我们可以选择+h()+或者+sanitize+或者+strip_tags+等等rails提供的方法进行过滤,但是这些危险的字符还适度会存在数据库,或许有一天就会引爆了呢,所以呢,最好的办法是在存入数据库的时候就做一些过滤或转换,一下一点点代码段只是一个小例子,真实世界中需要过滤和清除的危险字符是很多的,大家注意主机收集和完善,也希望大家一起来实现这个功能,做一个通用的 helper方法。<code> def stripped_html(html) # this is a copynpaste of the routine in article.rb # so the one in article.rb can change w/o breaking this. self.html.gsub(/<[^>]*>/,'').to_url end</code>对于HTML标签的过滤和清除,你有什么好的方法么?欢迎分享!", "created_at"=>2007-05-29 21:24:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很多时候,我们需要处理用户输入,为了适合WEB2的特性,做为开发者我们也会设计很对个途径让用户参与进去,但是“盖茨”大叔说得很对:凡是用户的输入都是有害的!*一点不假,有时候用户可能是无意的或者一些不怀好意的用户会输入一些我们并不想让他们输入的东西,以防止破坏页面结构或者造成其他的危害(比如SQL注射和XSS攻击),所以我们需要对用户的输入认真的检验和过滤。在页面上显示的时候,我们可以选择+h()+或者+sanitize+或者+strip_tags+等等rails提供的方法进行过滤,但是这些危险的字符还适度会存在数据库,或许有一天就会引爆了呢,所以呢,最好的办法是在存入数据库的时候就做一些过滤或转换,一下一点点代码段只是一个小例子,真实世界中需要过滤和清除的危险字符是很多的,大家注意主机收集和完善,也希望大家一起来实现这个功能,做一个通用的 helper方法。<code> def stripped_html(html) # this is a copynpaste of the routine in article.rb # so the one in article.rb can change w/o breaking this. self.html.gsub(/<[^>]>/,'').to_url end</code>对于HTML标签的过滤和清除,你有什么好的方法么?欢迎分享!

    \n", "_id"=>34}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Architecture"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Architecture", "updated_at"=>2012-06-24 15:53:12 UTC, "created_at"=>2012-06-24 15:53:12 UTC, "_id"=>9}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"理解REST软件架构", "body"=>"*导读:*infoq上的这篇REST构架分析的文章还是不错,从HTTP协议开始介绍了REST的构架理念,值得看看,再花点时间好好理解下REST。一种思维方式影响了软件行业的发展。REST软件架构是当今世界上最成功的互联网的超媒体分布式系统。它让人们真正理解我们的网络协议HTTP本来面貌。它正在成为网络服务的主流技术,同时也正在改变互联网的网络软件开发的全新思维方式。AJAX技术和Rails框架把REST软件架构思想真正地在实际中很好表现出来。今天微软也已经应用REST并且提出把我们现有的网络变成为一个语义网,这种网络将会使得搜索更加智能化。详细内容,请查看:http://www.infoq.com/cn/articles/rest-architecure", "created_at"=>2007-05-28 08:34:03 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    *导读:*infoq上的这篇REST构架分析的文章还是不错,从HTTP协议开始介绍了REST的构架理念,值得看看,再花点时间好好理解下REST。一种思维方式影响了软件行业的发展。REST软件架构是当今世界上最成功的互联网的超媒体分布式系统。它让人们真正理解我们的网络协议HTTP本来面貌。它正在成为网络服务的主流技术,同时也正在改变互联网的网络软件开发的全新思维方式。AJAX技术和Rails框架把REST软件架构思想真正地在实际中很好表现出来。今天微软也已经应用REST并且提出把我们现有的网络变成为一个语义网,这种网络将会使得搜索更加智能化。详细内容,请查看:http://www.infoq.com/cn/articles/rest-architecure

    \n", "_id"=>35}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"日期上的迭代问题", "body"=>"给定一个时间点,希望得到其他时间点的解决方案如下,Ruby 的所有时间对象都可像数字一样用在值域中。Date和DateTime对象按天递增,而Time对象按秒递增:*例子*require 'date'(Date.new(1976, 7, 2)..Date.new(1976, 7, 4)).each { |x| puts x }1976-07-021976-07-031976-07-04span = DateTime.new(1776, 7, 2, 1, 30, 15)..DateTime.new(1776, 7, 4, 7, 0,0)span.each { |x| puts x } 1776-07-02T01:30:15Z 1776-07-03T01:30:15Z 1776-07-04T01:30:15Z(Time.at(100)..Time.at(102)).each { |x| puts x } Wed Dec 31 19:01:40 EST 1969 Wed Dec 31 19:01:41 EST 1969 Wed Dec 31 19:01:42 EST 1969Ruby 的Date类定义了*step*和*upto*两种方便的由数字使用的迭代器:the_first = Date.new(2004, 1, 1)the_fifth = Date.new(2004, 1, 5)the_first.upto(the_fifth) { |x| puts x } 2004-01-01 2004-01-02 2004-01-03 2004-01-04 2004-01-05*讨论*Ruby的日期对象在内部被存储为数字,并且一定范围的这种对象可被视为一定范围的数字。对于Date和DateTime对象而言,内部表示是儒略历日期:每次在一定范围的这种对象上累加一天。对于Time对象而言,内部表示是自Unix 纪元以来的秒数:每次在一定范围的Time对象上累加一秒。*Time*没有定义step和upto方法,但添加它们也很简单:class Timebq. def step(other_time, increment) raise ArgumentError, "step can't be 0" if increment == 0 increasing = self < other_time if (increasing && increment < 0) || (!increasing && increment > 0) yield self return end d = self begin yield d d += increment end while (increasing ? d <= other_time : d >= other_time) enddef upto(other_time) step(other_time, 1) { |x| yield x } endendthe_first = Time.local(2004, 1, 1)the_second = Time.local(2004, 1, 2)the_first.step(the_second, 60 * 60 * 6) { |x| puts x } Thu Jan 01 00:00:00 EST 2004 Thu Jan 01 06:00:00 EST 2004 Thu Jan 01 12:00:00 EST 2004 Thu Jan 01 18:00:00 EST 2004 Fri Jan 02 00:00:00 EST 2004the_first.upto(the_first) { |x| puts x } Thu Jan 01 00:00:00 EST 2004", "created_at"=>2007-05-27 05:09:33 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    给定一个时间点,希望得到其他时间点的解决方案如下,Ruby 的所有时间对象都可像数字一样用在值域中。Date和DateTime对象按天递增,而Time对象按秒递增:*例子*require 'date'(Date.new(1976, 7, 2)..Date.new(1976, 7, 4)).each { |x| puts x }1976-07-021976-07-031976-07-04span = DateTime.new(1776, 7, 2, 1, 30, 15)..DateTime.new(1776, 7, 4, 7, 0,0)span.each { |x| puts x } 1776-07-02T01:30:15Z 1776-07-03T01:30:15Z 1776-07-04T01:30:15Z(Time.at(100)..Time.at(102)).each { |x| puts x } Wed Dec 31 19:01:40 EST 1969 Wed Dec 31 19:01:41 EST 1969 Wed Dec 31 19:01:42 EST 1969Ruby 的Date类定义了*step*和*upto*两种方便的由数字使用的迭代器:the_first = Date.new(2004, 1, 1)the_fifth = Date.new(2004, 1, 5)the_first.upto(the_fifth) { |x| puts x } 2004-01-01 2004-01-02 2004-01-03 2004-01-04 2004-01-05*讨论*Ruby的日期对象在内部被存储为数字,并且一定范围的这种对象可被视为一定范围的数字。对于Date和DateTime对象而言,内部表示是儒略历日期:每次在一定范围的这种对象上累加一天。对于Time对象而言,内部表示是自Unix 纪元以来的秒数:每次在一定范围的Time对象上累加一秒。*Time*没有定义step和upto方法,但添加它们也很简单:class Timebq. def step(other_time, increment) raise ArgumentError, "step can't be 0" if increment == 0 increasing = self < other_time if (increasing && increment < 0) || (!increasing && increment > 0) yield self return end d = self begin yield d d += increment end while (increasing ? d <= other_time : d >= other_time) enddef upto(other_time) step(other_time, 1) { |x| yield x } endendthe_first = Time.local(2004, 1, 1)the_second = Time.local(2004, 1, 2)the_first.step(the_second, 60 * 60 * 6) { |x| puts x } Thu Jan 01 00:00:00 EST 2004 Thu Jan 01 06:00:00 EST 2004 Thu Jan 01 12:00:00 EST 2004 Thu Jan 01 18:00:00 EST 2004 Fri Jan 02 00:00:00 EST 2004the_first.upto(the_first) { |x| puts x } Thu Jan 01 00:00:00 EST 2004

    \n", "_id"=>36}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Textile Editor Helper", "body"=>"*Textile*是一种语言标记格式,目前在ROR领域用的相当多,本着简洁好用的原则,这套规则就像PHP领域内的BBCODE一样流行,但是一直一来,都是靠手工去写这些标识符号,很不方便,也曾萌发了写一套可视化的东西来,可惜一直没有时间和精力,今天看到slate blog的blog上有关于这个的东西,感觉就是自己想实现的那个,看了下视频(http://www.youtube.com/watch?v=wQYedmbsJf4)和DEMO(http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper/demo),果然是的,试用了下,很方便,效果很好,再各种浏览器下都表现不错,推荐给大家。可以先看下它的功能:安装也挺方便的:+script/plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/+使用:bq. # 1. run rake textile_editor_helper:install 2. for the textarea(s) that you want to add the TEH toolbar to replace the text area tag(s) with: <%= textile_editor 'object', 'field' -%> just like writing a text area tag, same options 3. at the end of your form put in the following code: <%= textile_editor_initialize -%> Important! 4. save your view and check it out*注意*:To use Textile, you must install the RedCloth gem first.", "created_at"=>2007-05-24 21:08:58 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    *Textile*是一种语言标记格式,目前在ROR领域用的相当多,本着简洁好用的原则,这套规则就像PHP领域内的BBCODE一样流行,但是一直一来,都是靠手工去写这些标识符号,很不方便,也曾萌发了写一套可视化的东西来,可惜一直没有时间和精力,今天看到slate blog的blog上有关于这个的东西,感觉就是自己想实现的那个,看了下视频(http://www.youtube.com/watch?v=wQYedmbsJf4)和DEMO(http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper/demo),果然是的,试用了下,很方便,效果很好,再各种浏览器下都表现不错,推荐给大家。可以先看下它的功能:安装也挺方便的:+script/plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/+bq使用:. # 1. run rake textile_editor_helper:install 2. for the textarea(s) that you want to add the TEH toolbar to replace the text area tag(s) with: <%= textile_editor 'object', 'field' -%> just like writing a text area tag, same options 3. at the end of your form put in the following code: <%= textile_editor_initialize -%> Important! 4. save your view and check it out*注意*:To use Textile, you must install the RedCloth gem first.

    \n", "_id"=>37}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装mongrel服务器", "body"=>"需要安装这个的很简单,下面就是我在自己机子上安装的时候的过程演示,比起Apache等的配置,这个东西好多了。D:\\>gem install mongrelSelect which gem to install for your platform (i386-mswin32) 1. mongrel 1.0.1 (mswin32) 2. mongrel 1.0.1 (ruby) 3. mongrel 1.0 (mswin32) 4. mongrel 1.0 (ruby) 5. Skip this gem 6. Cancel installation> 1Install required dependency gem_plugin? [Yn] yInstall required dependency cgi_multipart_eof_fix? [Yn] ySuccessfully installed mongrel-1.0.1-mswin32Successfully installed gem_plugin-0.2.2Successfully installed cgi_multipart_eof_fix-2.1Installing ri documentation for mongrel-1.0.1-mswin32...Installing ri documentation for gem_plugin-0.2.2...Installing ri documentation for cgi_multipart_eof_fix-2.1...Installing RDoc documentation for mongrel-1.0.1-mswin32...Installing RDoc documentation for gem_plugin-0.2.2...Installing RDoc documentation for cgi_multipart_eof_fix-2.1...D:\\>", "created_at"=>2007-05-23 22:27:14 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    需要安装这个的很简单,下面就是我在自己机子上安装的时候的过程演示,比起Apache等的配置,这个东西好多了。D:&gt;gem install mongrelSelect which gem to install for your platform (i386-mswin32) 1. mongrel 1.0.1 (mswin32) 2. mongrel 1.0.1 (ruby) 3. mongrel 1.0 (mswin32) 4. mongrel 1.0 (ruby) 5. Skip this gem 6. Cancel installation> 1Install required dependency gem_plugin? [Yn] yInstall required dependency cgi_multipart_eof_fix? [Yn] ySuccessfully installed mongrel-1.0.1-mswin32Successfully installed gem_plugin-0.2.2Successfully installed cgi_multipart_eof_fix-2.1Installing ri documentation for mongrel-1.0.1-mswin32...Installing ri documentation for gem_plugin-0.2.2...Installing ri documentation for cgi_multipart_eof_fix-2.1...Installing RDoc documentation for mongrel-1.0.1-mswin32...Installing RDoc documentation for gem_plugin-0.2.2...Installing RDoc documentation for cgi_multipart_eof_fix-2.1...D:&gt;

    \n", "_id"=>38}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"如何再虚拟主机上安装gem", "body"=>"有的时候,虚拟主机提供商并不能按照每个用户的需求安装全部的gem,这个时候,我们就需要自己动手了,如下是我在一家虚拟主机上的安装builder的过程,主要就是先FTP把gem包放上去,然后本地安装的时候使用一个--install-dir来指定安装到的目录。<code>[1ster@1ster.cn@bee-00 gemdir]$ gem install builder-2.1.1.gem --install-dir /var/***/***/1ster.cn/gemdirSuccessfully installed builder, version 2.1.1Installing ri documentation for builder-2.1.1...Installing RDoc documentation for builder-2.1.1...</code>", "created_at"=>2007-05-23 19:03:10 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有的时候,虚拟主机提供商并不能按照每个用户的需求安装全部的gem,这个时候,我们就需要自己动手了,如下是我在一家虚拟主机上的安装builder的过程,主要就是先FTP把gem包放上去,然后本地安装的时候使用一个--install-dir来指定安装到的目录。<code>[1ster@1ster.cn@bee-00 gemdir]$ gem install builder-2.1.1.gem --install-dir /var///1ster.cn/gemdirSuccessfully installed builder, version 2.1.1Installing ri documentation for builder-2.1.1...Installing RDoc documentation for builder-2.1.1...</code>

    \n", "_id"=>39}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"初始化数据库", "body"=>"我们使用创建表的时候,是不想想初始化一些数据呢,比如一个默认的分类什么的,可以使用migration按照下面这个来实现: <code> def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words end</code>", "created_at"=>2007-05-22 21:32:41 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    我们使用创建表的时候,是不想想初始化一些数据呢,比如一个默认的分类什么的,可以使用migration按照下面这个来实现: <code> def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words end</code>

    \n", "_id"=>40}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"15步创建一个测试驱动(TDD)的Rails应用~", "body"=>"题外话:这个文章展示了一种测试驱动(TDD)的开发模式,针对Rails的基本步骤,原文很清楚,我就随便翻译下关键的部分,见下:原文地址:http://andrzejonsoftware.blogspot.com/2007/05/15-tdd-steps-to-create-rails.html15 TDD steps to create a Rails applicationIntroductionSeveral times recently, I have been asked how to develop a Rails application using the Test Driven Development approach. I'm not an expert here, but I've put together some notes on how to start working on a Rails application whilst being test-driven all the time.As an example I will use a word-learning web application. The simplest use case is to display a random word object (with its polish translation) from the database.Every time we refresh we want to see a different word.1. Create a new Rails applicationsrails my_appcd my_appRun tests with 'rake test'. It fails due to missing database configuration.2. Set up the databases - config/database.ymlThe code below assumes sqlite3 databases. development: adapter: sqlite3 database: db/my_app_development.sqlite test: adapter: sqlite3 database: db/my_app_test.sqlite'rake test' now runs fine.3. Create a Word class with a corresponding unit testscript/generate model Word4. Write a unit test for the Word class. Edit the test/unit/word_test.rb. def test_word_is_english_and_polish word = Word.new :eng=>'never', :pl=>'nigdy' assert_equal 'never', word.eng assert_equal 'nigdy', word.pl end'rake test' now fails due to missing words table.5. Edit db/migrate/001_create_words.rbWe are using a migration here in order to create a table. It's a recommended way of dealing with database changes. def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words endThe sample words that we are adding use Word.new .. lines, will be added to the development database. It's important to distinguish the 'test' and 'development' database. The first one is only used during tests. The latter is used by default when you start the application.Apply the migration with 'rake db:migrate'.'rake test' now succeeds with the following:'1 tests, 2 assertions, 0 failures, 0 errors'6. Fixtures and test for word.random. Edit word_test again.It's not easy to test a method which behaves randomly. Let's assume that it's enough to test that if we have only two words in our database then one of them should be called at least once per 10 calls.fixtures :wordsdef test_random results = [] 10.times {results << Word.random.eng} assert results.include?("yes")endNote the 'fixtures :words' line. Edit the 'words.yml' file.yes: id: 1 pl: 'tak' eng: 'yes'no: id: 2 pl: 'nie' eng: 'no'This will be loaded to the test database before every run of tests.7. Implement the Word.random method def self.random all = Word.find :all all[rand(all.size)] endWarning: The code above could be slow for many words in a database (we retrieve all words only for selecting a random element). It's good enough for our needs.8. Generate the Words controller with a 'learn' actionscript/generate controller Words learn9. Write a test for the learn methodJust as there is a one-to-one ratio between unit tests and models, so there is between functional tests and controllers. The Controller's responsibility is to retrieve objects from the Model layer and pass them to the View. Let's test the View part first. We use the 'assigns' collection which contains all the objects passed to the View.def test_learn_passes_a_random_word get 'learn' assert_kind_of Word, assigns('word')end10. Make the Test Passdef learn @word = Word.newend11. Write more tests in the words_controller_testHow can we test that controller uses the Word.random method? We don't want to duplicate the tests for the Word.random method.Mocks to the rescue! We will only test that the controller calls the Word.random method. The returned value will be faked with a prepared word.Let's install the mocha framework:gem install mochaNow we can use 'expects' and 'returns' methods.'expects' is used for setting an expectation on an object or a class. In this case we expect that the 'random' method will be called. We also set a return value by using 'returns' method. Setting a return value means faking (stubbing) the real method. The real Word.random won't be called. If an expectation isn't met the test fails.require 'mocha'def test_learn_passes_a_random_word random_word = Word.new Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word')end'rake test' now fails. The Word.method wasn't called.12. Rewrite the implementationdef learn @word = Word.randomend'rake test' now passes.13. Test that a word is displayed:Extend the existing test with assert_tag calls.def test_learn_passes_a_random_word random_word = Word.new(:pl=>'czesc', :eng=>'hello') Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word') assert_tag :tag=>'div', :child => /czesc/ assert_tag :tag=>'div', :child => /hello/end14. Implement the view - learn.rhtml <div> <%= word.eng %> <%= word.pl %> </div>15. Manual testingscript/serverGo to 'http://localhost:3000/words/learn'.Refresh several times.If you want to read more about testing in Rails go to the Guide To Testing The Rails.", "created_at"=>2007-05-22 21:30:02 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    题外话:这个文章展示了一种测试驱动(TDD)的开发模式,针对Rails的基本步骤,原文很清楚,我就随便翻译下关键的部分,见下:原文地址:http://andrzejonsoftware.blogspot.com/2007/05/15-tdd-steps-to-create-rails.html15 TDD steps to create a Rails applicationIntroductionSeveral times recently, I have been asked how to develop a Rails application using the Test Driven Development approach. I'm not an expert here, but I've put together some notes on how to start working on a Rails application whilst being test-driven all the time.As an example I will use a word-learning web application. The simplest use case is to display a random word object (with its polish translation) from the database.Every time we refresh we want to see a different word.1. Create a new Rails applicationsrails my_appcd my_appRun tests with 'rake test'. It fails due to missing database configuration.2. Set up the databases - config/database.ymlThe code below assumes sqlite3 databases. development: adapter: sqlite3 database: db/my_app_development.sqlite test: adapter: sqlite3 database: db/my_app_test.sqlite'rake test' now runs fine.3. Create a Word class with a corresponding unit testscript/generate model Word4. Write a unit test for the Word class. Edit the test/unit/word_test.rb. def test_word_is_english_and_polish word = Word.new :eng=>'never', :pl=>'nigdy' assert_equal 'never', word.eng assert_equal 'nigdy', word.pl end'rake test' now fails due to missing words table.5. Edit db/migrate/001_create_words.rbWe are using a migration here in order to create a table. It's a recommended way of dealing with database changes. def self.up create_table :words do |t| t.column :eng, :string t.column :pl, :string end Word.new(:eng=>'yes', :pl=>'tak').save Word.new(:eng=>'no', :pl=>'nie').save Word.new(:eng=>'everything', :pl=>'wszystko').save end def self.down drop_table :words endThe sample words that we are adding use Word.new .. lines, will be added to the development database. It's important to distinguish the 'test' and 'development' database. The first one is only used during tests. The latter is used by default when you start the application.Apply the migration with 'rake db:migrate'.'rake test' now succeeds with the following:'1 tests, 2 assertions, 0 failures, 0 errors'6. Fixtures and test for word.random. Edit word_test again.It's not easy to test a method which behaves randomly. Let's assume that it's enough to test that if we have only two words in our database then one of them should be called at least once per 10 calls.fixtures :wordsdef test_random results = [] 10.times {results << Word.random.eng} assert results.include?("yes")endNote the 'fixtures :words' line. Edit the 'words.yml' file.yes: id: 1 pl: 'tak' eng: 'yes'no: id: 2 pl: 'nie' eng: 'no'This will be loaded to the test database before every run of tests.7. Implement the Word.random method def self.random all = Word.find :all all[rand(all.size)] endWarning: The code above could be slow for many words in a database (we retrieve all words only for selecting a random element). It's good enough for our needs.8. Generate the Words controller with a 'learn' actionscript/generate controller Words learn9. Write a test for the learn methodJust as there is a one-to-one ratio between unit tests and models, so there is between functional tests and controllers. The Controller's responsibility is to retrieve objects from the Model layer and pass them to the View. Let's test the View part first. We use the 'assigns' collection which contains all the objects passed to the View.def test_learn_passes_a_random_word get 'learn' assert_kind_of Word, assigns('word')end10. Make the Test Passdef learn @word = Word.newend11. Write more tests in the words_controller_testHow can we test that controller uses the Word.random method? We don't want to duplicate the tests for the Word.random method.Mocks to the rescue! We will only test that the controller calls the Word.random method. The returned value will be faked with a prepared word.Let's install the mocha framework:gem install mochaNow we can use 'expects' and 'returns' methods.'expects' is used for setting an expectation on an object or a class. In this case we expect that the 'random' method will be called. We also set a return value by using 'returns' method. Setting a return value means faking (stubbing) the real method. The real Word.random won't be called. If an expectation isn't met the test fails.require 'mocha'def test_learn_passes_a_random_word random_word = Word.new Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word')end'rake test' now fails. The Word.method wasn't called.12. Rewrite the implementationdef learn @word = Word.randomend'rake test' now passes.13. Test that a word is displayed:Extend the existing test with assert_tag calls.def test_learn_passes_a_random_word random_word = Word.new(:pl=>'czesc', :eng=>'hello') Word.expects(:random).returns(random_word) get 'learn' assert_equal random_word, assigns('word') assert_tag :tag=>'div', :child => /czesc/ assert_tag :tag=>'div', :child => /hello/end14. Implement the view - learn.rhtml <div> <%= word.eng %> <%= word.pl %> </div>15. Manual testingscript/serverGo to 'http://localhost:3000/words/learn'.Refresh several times.If you want to read more about testing in Rails go to the Guide To Testing The Rails.

    \n", "_id"=>41}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"拟出的一些ROR的题目~", "body"=>"题外话:\t学习ROR这么久了,也没有时间仔细整理下到底学会了什么,今天一个朋友想招几个ROR的程序员,让我帮忙出几个题目,结合自己学的,也邀请了对岸的兄弟CFC帮忙,一起整理了以下这些问题,可能还不够严谨,有好的建议请提哈!有时间的可以对照着问题看看自己的答案是什么,欢迎留言!一、热身题1、ROR是什么的简写?2、你多大了,从你接触ROR到现在大概有多少时间了?3、你学习ROR之前还学习过哪些语言?为什么会来学ROR呢?4、你接触ROR后,被它的哪些特性(或者说哪些和别的语言不一样的地方)打动过呢?5、列举几个你了解的开源ROR项目?他们各自都是做什么的?二、基础题6. 现有一个User Model,我想要查ID为10, 30, 36三笔数据,请问如何做?7. 现有一个User Model,内有username、password两个字段,我想要做User Login的功能,使用哪个方法可以用最方便的方式去做Query动作?8. 网友们传来的数据总是不安全的!我想要个别处理params[:info](params[:info]内有nickname、email、body三个子参数),请问我可以怎样在存入Database前,过滤各个元素? 9. 请用Iterator来为User Model新增一笔数据吧(字段有:username, password, nickname, email, url)。10. ROR中有一些奇特的约定,尽自己的能力列举你认为ROR中很方便的约定吧?并简要说明怎么用,越多越好。三、应用题目11、对于一个用户输入的Email地址,我该怎么检查它,以最大限度的保证该Email地址的可用性及其真实性呢?给出你的思路和ROR实现的代码段。12、我想要这么一个效果,请问怎么做,我有一个大分类TYPE1,还有个小分类category,如如何实现级联效果,比如我点选第一个下拉框中的一个值,对应更新后面那个和他级联的下拉框中的值。13、我有一个数据表Topic,包含字段有(id,title,body,created_at,owner, category_id),请问你怎么就这个表生成一全量的RSS订阅(比如我想要的订阅地址为:/feed/index)和一个针对每个category的RSS订阅(比如我想要的订阅地址为:/feed/category/rails订阅rails的RSS,rails是分类表中的一个)。14、目前,经理想知道从A地址(例如10.1.3.1)到B地址(例如211.54.2.45)的网络状况,让你尽快的想个办法,可以指定源地址和目标地址,并且可以指定发送包的大小或者需要发送的文件,让你计算出发送完需要多少时间。你该怎么做呢?15、你晓得Trackback(引用)功能么?不知道的话可以上网上搜索下,请简要说明下Trackback的特点和实现原理;你认为目前这种Trackback有什么不足或者缺陷么?如果有,请问有什么办法改良或者完善么?给出你的Trackback实现代码片段(包括。四、拓展题16、你是怎么认识RESTful 的,你认为它的精髓在哪里,谈谈你是怎么认识这个东西的,它可以带给我们什么好处。17、你实际部署过Rails应用么?你会选择什么做为你的服务器;如果你是买的一个虚拟主机空间,你想跑几个Rails应用,该怎么部署呢?谈谈您的部署经验和好的方法以及您的维护经验~", "created_at"=>2007-05-22 08:27:43 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    题外话: 学习ROR这么久了,也没有时间仔细整理下到底学会了什么,今天一个朋友想招几个ROR的程序员,让我帮忙出几个题目,结合自己学的,也邀请了对岸的兄弟CFC帮忙,一起整理了以下这些问题,可能还不够严谨,有好的建议请提哈!有时间的可以对照着问题看看自己的答案是什么,欢迎留言!一、热身题1、ROR是什么的简写?2、你多大了,从你接触ROR到现在大概有多少时间了?3、你学习ROR之前还学习过哪些语言?为什么会来学ROR呢?4、你接触ROR后,被它的哪些特性(或者说哪些和别的语言不一样的地方)打动过呢?5、列举几个你了解的开源ROR项目?他们各自都是做什么的?二、基础题6. 现有一个User Model,我想要查ID为10, 30, 36三笔数据,请问如何做?7. 现有一个User Model,内有username、password两个字段,我想要做User Login的功能,使用哪个方法可以用最方便的方式去做Query动作?8. 网友们传来的数据总是不安全的!我想要个别处理params:info,请问我可以怎样在存入Database前,过滤各个元素? 9. 请用Iterator来为User Model新增一笔数据吧(字段有:username, password, nickname, email, url)。10. ROR中有一些奇特的约定,尽自己的能力列举你认为ROR中很方便的约定吧?并简要说明怎么用,越多越好。三、应用题目11、对于一个用户输入的Email地址,我该怎么检查它,以最大限度的保证该Email地址的可用性及其真实性呢?给出你的思路和ROR实现的代码段。12、我想要这么一个效果,请问怎么做,我有一个大分类TYPE1,还有个小分类category,如如何实现级联效果,比如我点选第一个下拉框中的一个值,对应更新后面那个和他级联的下拉框中的值。13、我有一个数据表Topic,包含字段有(id,title,body,created_at,owner, category_id),请问你怎么就这个表生成一全量的RSS订阅(比如我想要的订阅地址为:/feed/index)和一个针对每个category的RSS订阅(比如我想要的订阅地址为:/feed/category/rails订阅rails的RSS,rails是分类表中的一个)。14、目前,经理想知道从A地址(例如10.1.3.1)到B地址(例如211.54.2.45)的网络状况,让你尽快的想个办法,可以指定源地址和目标地址,并且可以指定发送包的大小或者需要发送的文件,让你计算出发送完需要多少时间。你该怎么做呢?15、你晓得Trackback(引用)功能么?不知道的话可以上网上搜索下,请简要说明下Trackback的特点和实现原理;你认为目前这种Trackback有什么不足或者缺陷么?如果有,请问有什么办法改良或者完善么?给出你的Trackback实现代码片段(包括。四、拓展题16、你是怎么认识RESTful 的,你认为它的精髓在哪里,谈谈你是怎么认识这个东西的,它可以带给我们什么好处。17、你实际部署过Rails应用么?你会选择什么做为你的服务器;如果你是买的一个虚拟主机空间,你想跑几个Rails应用,该怎么部署呢?谈谈您的部署经验和好的方法以及您的维护经验~

    \n", "_id"=>42}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"SuperRedCloth介绍~", "body"=>"SuperRedCloth项目就是开发中的RedCloth,也就是RedCloth 4。目标是尽可能地增强RedCloth: 1. 令到RedCloth比原来小2/3 2. 一般情况下将会快10倍以上 3. 消除Textile格式中的二义性安装:$ gem install superredcloth --source http://code.whytheluckystiff.net使用:1.首先在helpers/application_helper.rb 中覆盖textilize方法(这个方法在Rails 1.2中使用的是RedCloth),我们覆盖它,如下:<code> def textilize(text) require_library_or_gem "superredcloth" unless Object.const_defined?(:SuperRedCloth) if text.blank? "" else textilized = SuperRedCloth.new(text) textilized.to_html end end # def textilize</code>2.然后在VIEW可以直接使用,如:<code><%= textilize @page.body %></code>官方主页:http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth", "created_at"=>2007-05-21 21:20:43 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    SuperRedCloth项目就是开发中的RedCloth,也就是RedCloth 4。目标是尽可能地增强RedCloth: 1. 令到RedCloth比原来小2/3 2. 一般情况下将会快10倍以上 3. 消除Textile格式中的二义性安装:$ gem install superredcloth --source http://code.whytheluckystiff.net使用:1.首先在helpers/application_helper.rb 中覆盖textilize方法(这个方法在Rails 1.2中使用的是RedCloth),我们覆盖它,如下:<code> def textilize(text) require_library_or_gem "superredcloth" unless Object.const_defined?(:SuperRedCloth) if text.blank? "" else textilized = SuperRedCloth.new(text) textilized.to_html end end # def textilize</code>2.然后在VIEW可以直接使用,如:<code><%= textilize @page.body %></code>官方主页:http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth

    \n", "_id"=>43}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"calendar_helper.rb", "body"=>"在博客或者其他WEB开发中,有的时候可能想显示一个日历表格,ROR下有个老兄也写了一个helper,功能比较完善,可以按照自己的喜好进行定制,其默认需要的参数是年、月,其他都是定制参数,比如CSS等,代码如参考(http://www.jvoorhis.com/downloads/calendar_helper.rb)使用的时候放在helper里面就可以了。 # Example usage: # calendar(:year => 2005, :month => 6) # This generates the simplest possible 作者主页:http://www.jvoorhis.com/pages/calendar-helper", "created_at"=>2007-05-21 21:13:27 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在博客或者其他WEB开发中,有的时候可能想显示一个日历表格,ROR下有个老兄也写了一个helper,功能比较完善,可以按照自己的喜好进行定制,其默认需要的参数是年、月,其他都是定制参数,比如CSS等,代码如参考(http://www.jvoorhis.com/downloads/calendar_helper.rbhelper里面就可以了。)使用的时候放在 # Example usage: # calendar(:year => 2005, :month => 6) # This generates the simplest possible 作者主页:http://www.jvoorhis.com/pages/calendar-helper

    \n", "_id"=>44}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Get XML or YAML output of your data quickly", "body"=>"It's not necessary to create a Builder .rxml template to export data as XML. ActiveRecord has a to_xml method that will output the object or result set in XML format. It works with simple objects, to complete tables with includes. Examples:User.find(:all).to_xmlPost.find(:all, :include => [:comments]).to_xmlYAML is also supported, by using to_yaml instead.", "created_at"=>2007-05-21 07:27:24 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    It's not necessary to create a Builder .rxml template to export data as XML. ActiveRecord has a to_xml method that will output the object or result set in XML format. It works with simple objects, to complete tables with includes. Examples:User.find(:all).to_xmlPost.find(:all, :include => [:comments]).to_xmlYAML is also supported, by using to_yaml instead.

    \n", "_id"=>45}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"给你的ROR配置一些通用的常量", "body"=>"这个需求应该是来自于对一些常量的配置和修改上,比如网站的title等等,如果你想做出一个比较通用的WEB系统,那么这个常量的可修改性就是个不可少的需求!我们的做法是可以放在数据库里面,然后去读取,这个方法显然是可行的,但是我们还可以这么来作,放在一个YAML文件里,把你需要的变量写在这个文件里面,需要注意格式的正确性,然后就可以在程序中引用了,步骤如下:1.在你的/config/environment.rb的上方写上:require 'yaml'2.在你的/config/environment.rb的下发写上: YOUR_APP_CONFIG = YAML::load(File.open("\#{RAILS_ROOT}/config/appconfig.yml"))3.然后你就可以在程序里面进行变量的引用了,如下: YOUR_APP_CONFIG"variable"]如果想改变,只要修改这个文件就OK;如果想增加,则只需要在这个文件里面再增加一个变量就好了。。是不是很方便呀~~", "created_at"=>2007-05-21 06:41:49 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这个需求应该是来自于对一些常量的配置和修改上,比如网站的title等等,如果你想做出一个比较通用的WEB系统,那么这个常量的可修改性就是个不可少的需求!我们的做法是可以放在数据库里面,然后去读取,这个方法显然是可行的,但是我们还可以这么来作,放在一个YAML文件里,把你需要的变量写在这个文件里面,需要注意格式的正确性,然后就可以在程序中引用了,步骤如下:1.在你的/config/environment.rb的上方写上:require 'yaml'2.在你的/config/environment.rb的下发写上: YOUR_APP_CONFIG = YAML::load(File.open("\#{RAILS_ROOT}/config/appconfig.yml"))3.然后你就可以在程序里面进行变量的引用了,如下: YOUR_APP_CONFIG"variable"]如果想改变,只要修改这个文件就OK;如果想增加,则只需要在这个文件里面再增加一个变量就好了。。是不是很方便呀~~

    \n", "_id"=>46}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"说说Blog中的Trackback(引用)功能", "body"=>"什么是Trackback呢?简单说来,Trackback是网站与网站之间互相通告的一种方法。它能让甲对乙说:“这篇文章可能是你感兴趣的”,要实现这一动作,甲向乙发送一个 Trackback Ping(引用通告)即可。在这种情况下,一个ping就是一条从一个web服务器发送到另一个服务器的短消息(a small message)。Trackback Ping是由Moveable Type发明的规范,他们说Trackback是:<blockquote>"a framework for peer-to-peer communication and notifications between web sites"。</blockquote>这里是他们的Trackback技术规范文档:http://www.movabletype.org/docs/mttrackback.html举个例子来说明一下。比如B在A的Blog中看了一篇我感兴趣的文章,对这篇文章B自己有一些看法,如果按照传统BBS的做法,B需要在A这篇文章下发表自己的评论,但这样做的话B的文字只能存在于A的网站上,B无法再维护自己的这篇评论。另一个情况是B在自己的Blog中也在写一篇相类似的文章,B希望A也能来看一看B的这篇,传统BBS的习惯还是得到A的文章下发一篇回复,把B的URL贴过去。但有了Trackback Ping,我们的Blog不再需要这样做。Blog 跟BBS有点重要的不同,Blog是一种个人创作,用Blog来发表自己的东西,保存自己的东西,即使是对他人Blog文章的评论也要在自己的Blog中永久保留下来。通过Trackbak,我就可以在自己的Blog中发表文章,同时把自己这篇文章的URL地址Ping到A的那篇文章上去。这样,所有阅读A文章的人也能通过Trackback顺藤摸瓜地来我的Blog看我的文章。所以,当我们的Blog有了Trackback Ping功能,那么谁都可以通过Trackback Ping来发表意见和评论了。这样,多家Blog网站就通过相关话题而联接起来。各种评论在Internet上相互连接而织成一张大网。因此,可以说, Trackback创造出了Blog与BBS、Diary完全不同的文化,Blog的世界通过Trackback而变成真正的无限互连。作为Blogger,让我们习惯于这样讨论问题和做评论吧:把内容写在自己的Blog里面,Trackback Ping到别人的Blog。这个概念是论坛模式里从来没有的,称为Remote Commenting。如何在Blog中实现Trackback?在有Trackback功能的Blog系统中,每篇Blog文章都有两个URL,一个是要访问这篇文章所使用的URL,另一个就是Trackback Ping URL(引用通告地址),它是用来接受来自其他Blog网站Trackback Ping的程序。当我发表文章的时候,想要通知鱼头的话,只需要把鱼头那篇文章的Trackback Ping URL贴到我这边文章中来,我提交文章时,系统就会按照这个URL发送一个Ping给A的那篇文章。而鱼头则将在自己的文章下看到类似这样的一个引用通告:标题: 1ster的文章来自: 1ster的Blog摘要: 1ster的文章内容摘要...地址: http://1ster的文章地址这个Trackback Ping是通过标准的HTTP协议从我的Blog发送到鱼头的Blog的,我的Blog发送一个POST格式的HTTP请求到A那篇文章的 Trackback Ping URL。这个请求的content type是application/x-www-form-URLencoded,它大概是这个样子的:POST http://A文章的TrackbackPingURLContent-Type: application/x-www-form-URLencodedtitle=1ster的文章&url=http://1ster的文章地址&excerpt=1ster的文章摘要&blog_name=1ster的Blog早期版本的Trackback规范中,Ping是GET方式的HTTP请求,现在不再支持GET方式,只能用POST方式。参数包括: * title - 文章的标题 * excerpt - 文章的摘要。在Movable Type系统中,如果摘录信息超过255个字符将会被截断为252个字符,并在后面增加...三个字符 * url - 文章的永久连接。象其它永久连接一样,这个连接应可能准确地在页面中定位文章的入口,因有疑问时这个链接会用到 * blog_name - 发表文章的blog的名称在上述的参数中只有url是必须的。如果title没有提供,url的值将被用作标题。当我的Blog发出这个Trackback Ping后,将接收一个简单的XML格式应答,如果Ping成功,那么应答的格式如下:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response></blockquote>而失败应答的格式为:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>The error message</message></response></blockquote>", "created_at"=>2007-05-21 05:54:26 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    什么是Trackback呢?简单说来,Trackback是网站与网站之间互相通告的一种方法。它能让甲对乙说:“这篇文章可能是你感兴趣的”,要实现这一动作,甲向乙发送一个 Trackback Ping(引用通告)即可。在这种情况下,一个ping就是一条从一个web服务器发送到另一个服务器的短消息(a small message)。Trackback Ping是由Moveable Type发明的规范,他们说Trackback是:<blockquote>"a framework for peer-to-peer communication and notifications between web sites"。</blockquote>这里是他们的Trackback技术规范文档:http://www.movabletype.org/docs/mttrackback.html举个例子来说明一下。比如B在A的Blog中看了一篇我感兴趣的文章,对这篇文章B自己有一些看法,如果按照传统BBS的做法,B需要在A这篇文章下发表自己的评论,但这样做的话B的文字只能存在于A的网站上,B无法再维护自己的这篇评论。另一个情况是B在自己的Blog中也在写一篇相类似的文章,B希望A也能来看一看B的这篇,传统BBS的习惯还是得到A的文章下发一篇回复,把B的URL贴过去。但有了Trackback Ping,我们的Blog不再需要这样做。Blog 跟BBS有点重要的不同,Blog是一种个人创作,用Blog来发表自己的东西,保存自己的东西,即使是对他人Blog文章的评论也要在自己的Blog中永久保留下来。通过Trackbak,我就可以在自己的Blog中发表文章,同时把自己这篇文章的URL地址Ping到A的那篇文章上去。这样,所有阅读A文章的人也能通过Trackback顺藤摸瓜地来我的Blog看我的文章。所以,当我们的Blog有了Trackback Ping功能,那么谁都可以通过Trackback Ping来发表意见和评论了。这样,多家Blog网站就通过相关话题而联接起来。各种评论在Internet上相互连接而织成一张大网。因此,可以说, Trackback创造出了Blog与BBS、Diary完全不同的文化,Blog的世界通过Trackback而变成真正的无限互连。作为Blogger,让我们习惯于这样讨论问题和做评论吧:把内容写在自己的Blog里面,Trackback Ping到别人的Blog。这个概念是论坛模式里从来没有的,称为Remote Commenting。如何在Blog中实现Trackback?在有Trackback功能的Blog系统中,每篇Blog文章都有两个URL,一个是要访问这篇文章所使用的URL,另一个就是Trackback Ping URL(引用通告地址),它是用来接受来自其他Blog网站Trackback Ping的程序。当我发表文章的时候,想要通知鱼头的话,只需要把鱼头那篇文章的Trackback Ping URL贴到我这边文章中来,我提交文章时,系统就会按照这个URL发送一个Ping给A的那篇文章。而鱼头则将在自己的文章下看到类似这样的一个引用通告:标题: 1ster的文章来自: 1ster的Blog摘要: 1ster的文章内容摘要...地址: http://1ster的文章地址这个Trackback Ping是通过标准的HTTP协议从我的Blog发送到鱼头的Blog的,我的Blog发送一个POST格式的HTTP请求到A那篇文章的 Trackback Ping URL。这个请求的content type是application/x-www-form-URLencoded,它大概是这个样子的:POST http://A文章的TrackbackPingURLContent-Type: application/x-www-form-URLencodedtitle=1ster的文章&url=http://1ster的文章地址&excerpt=1ster的文章摘要&blog_name=1ster的Blog早期版本的Trackback规范中,Ping是GET方式的HTTP请求,现在不再支持GET方式,只能用POST方式。参数包括: * title - 文章的标题 * excerpt - 文章的摘要。在Movable Type系统中,如果摘录信息超过255个字符将会被截断为252个字符,并在后面增加...三个字符 * url - 文章的永久连接。象其它永久连接一样,这个连接应可能准确地在页面中定位文章的入口,因有疑问时这个链接会用到 * blog_name - 发表文章的blog的名称在上述的参数中只有url是必须的。如果title没有提供,url的值将被用作标题。当我的Blog发出这个Trackback Ping后,将接收一个简单的XML格式应答,如果Ping成功,那么应答的格式如下:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response></blockquote>而失败应答的格式为:<blockquote><?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>The error message</message></response></blockquote>

    \n", "_id"=>47}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"witter发布Gem包提供witter主要功能", "body"=>"witter越来越火了,这个提供IM服务的应用,越来越受到大家的关注,越来越多的人加入其中,昨天台湾的一个朋友还说对witter的这个IM功能很感兴趣,想了解是怎么实现的,呵呵~witter通过网络或者SMS(短消息)使得你和自己的朋友取得及时沟通。你有没有考虑过给自己的WebApp加上这样的功能呢,现在借助witter发布的Gem包,可以很方便的实现这个功能了,更多说明请到http://www.rubyinside.com/twitter-gem-twitterize-your-ruby-application-498.html查看,我这里稍微说下用法,如下:# to post an update to twitter$ twitter post "posting from the twitter gem"# to see you and your friends timeline$ twitter timeline命令行接口很简单,支持YAML配置,也支持Ruby的API:twit.update('me got dizzy this time')# Show your friends' statustwit.timeline(:friends).each do |s| puts s.text, s.user.nameendUse RubyGems as usual to install it:gem install twitter --include-dependenciesps:One note, the gem uses hpricot to parse the xml and there is an annoying bug that reared it's head in the 0.5+ versions (it doesn't like xml elements named text). That said, be sure to sudo gem install hpricot --source http://code.whytheluckystiff.net -v 0.4.86 and uninstall any hpricot versions 0.5+.", "created_at"=>2007-05-20 21:17:49 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    witter越来越火了,这个提供IM服务的应用,越来越受到大家的关注,越来越多的人加入其中,昨天台湾的一个朋友还说对witter的这个IM功能很感兴趣,想了解是怎么实现的,呵呵~witter通过网络或者SMS(短消息)使得你和自己的朋友取得及时沟通。你有没有考虑过给自己的WebApp加上这样的功能呢,现在借助witter发布的Gem包,可以很方便的实现这个功能了,更多说明请到http://www.rubyinside.com/twitter-gem-twitterize-your-ruby-application-498.html#查看,我这里稍微说下用法,如下: to post an update to twitter$ twitter post "posting from the twitter gem"# to see you and your friends timeline$ twitter timeline命令行接口很简单,支持YAML配置,也支持Ruby的API:twit.update('me got dizzy this time')# Show your friends' statustwit.timeline(:friends).each do |s| puts s.text, s.user.nameendUse RubyGems as usual to install it:gem install twitter --include-dependenciesps:One note, the gem uses hpricot to parse the xml and there is an annoying bug that reared it's head in the 0.5+ versions (it doesn't like xml elements named text). That said, be sure to sudo gem install hpricot --source http://code.whytheluckystiff.net -v 0.4.86 and uninstall any hpricot versions 0.5+.

    \n", "_id"=>48}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"简单的require写法", "body"=>"当你需要加载多个require的时候,是不是写了很多的require ×××什么的呢,就像JAVA一样,前面一对的import一样,其实我们可以这样写,是不是更方便快捷呢~%w(uri net/http yaml rubygems hpricot active_support).each { |f| require f }如上,少了不少字符吧~", "created_at"=>2007-05-20 20:58:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    当你需要加载多个require的时候,是不是写了很多的require ×××什么的呢,就像JAVA一样,前面一对的import一样,其实我们可以这样写,是不是更方便快捷呢~%w(uri net/http yaml rubygems hpricot active_support).each { |f| require f }如上,少了不少字符吧~

    \n", "_id"=>49}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现防垃圾的Trackback思路", "body"=>"Trackback可谓是WEB2.0的一个特征吧,Trackback的特征和好处我就不多说了,Trackback大部分人刚接触到肯定会觉得很迷惑,不知道怎么用。其实它也没有那么神秘,以下介绍一下我对Trackback的理解。 简单说trackback是一个点对点通信和网站间互相通告的框架。这句话也讲不明白. 那就拿实例来说: <blockquote>A在他的博客A.com上写了一篇文章 支持Trackback 引用地址为:http://a.com/trackback.php?id=1 B想写一篇文章回复A,惯用方法是我在A文章的下面写评论,但是Trackback带来了新的革命:B可以把文章写在自己的blog上,而同时又能在A的文章下面显示B这篇文章的部分内容。这就是利用了Trackback,那么A想要看别人评论的全文就要到B的网站上去,这样就带来了网站之间的互通,这才是Blog的精髓。虽然在国内大部分还习惯用comment的方式。 Trackback与comment不同的地方在于,你可以更好的控制自己的文章,按规定当你在你网站修改文章的时候,A网站上的你的内容同步改动.甚至删除 </blockquote>实现Trackback的原理也很简单,但是正是因为这种简单的机理,使得很多垃圾,造成“垃圾泛滥”,我想按照下面说得方法应该可以防范:1.加验证码2.编码-解码或者把这两个结合起来,在RUBY中可以使用base64编码,如下:decode64(str) 对经过Base64编码的str字符串进行解码。encode64(str) 对str字符串进行Base64编码。这样在生成Trackback地址的时候,可以把指定如下几个参数:1.私有的Key,在APP的配置文件(可以使用YML或者数据库)中指定一个私人的Key,然后生成Trackback地址时用这个key+文章创建时间,按照一定的规则截取,然后加上文章的ID以及编码规则(UTF-8、GBK等)组合一个字符串,再BASE64编码下,赋给一个指定的变量(比如code),/trackback/code=MjcyCXV0Zi04CTExNzkzNTkzNjQJMA%3D%3D,接收的时候先encode64解码,再验证Key等是不是正确的,如果正确的,就入库,否则抛弃。PS:还可以进一步,对这个地址先不显示,如果读者需要这个,就按照页面上的点一个“点击显示引用URL”,然后用个AJAX实现,就不怕网络爬虫了~以上是我的思路,页是参考别人的一些思路综合起来的,希望对大家有用,如果你有更好的想法,反应和我交流~", "created_at"=>2007-05-20 18:37:36 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Trackback可谓是WEB2.0的一个特征吧,Trackback的特征和好处我就不多说了,Trackback大部分人刚接触到肯定会觉得很迷惑,不知道怎么用。其实它也没有那么神秘,以下介绍一下我对Trackback的理解。 简单说trackback是一个点对点通信和网站间互相通告的框架。这句话也讲不明白. 那就拿实例来说: <blockquote>A在他的博客A.com上写了一篇文章 支持Trackback 引用地址为:http://a.com/trackback.php?id=1 B想写一篇文章回复A,惯用方法是我在A文章的下面写评论,但是Trackback带来了新的革命:B可以把文章写在自己的blog上,而同时又能在A的文章下面显示B这篇文章的部分内容。这就是利用了Trackback,那么A想要看别人评论的全文就要到B的网站上去,这样就带来了网站之间的互通,这才是Blog的精髓。虽然在国内大部分还习惯用comment的方式。 Trackback与comment不同的地方在于,你可以更好的控制自己的文章,按规定当你在你网站修改文章的时候,A网站上的你的内容同步改动.甚至删除 </blockquote>实现Trackback的原理也很简单,但是正是因为这种简单的机理,使得很多垃圾,造成“垃圾泛滥”,我想按照下面说得方法应该可以防范:1.加验证码2.编码-解码或者把这两个结合起来,在RUBY中可以使用base64编码,如下:decode64(str) 对经过Base64编码的str字符串进行解码。encode64(str) 对str字符串进行Base64编码。这样在生成Trackback地址的时候,可以把指定如下几个参数:1.私有的Key,在APP的配置文件(可以使用YML或者数据库)中指定一个私人的Key,然后生成Trackback地址时用这个key+文章创建时间,按照一定的规则截取,然后加上文章的ID以及编码规则(UTF-8、GBK等)组合一个字符串,再BASE64编码下,赋给一个指定的变量(比如code),/trackback/code=MjcyCXV0Zi04CTExNzkzNTkzNjQJMA%3D%3D,接收的时候先encode64解码,再验证Key等是不是正确的,如果正确的,就入库,否则抛弃。PS:还可以进一步,对这个地址先不显示,如果读者需要这个,就按照页面上的点一个“点击显示引用URL”,然后用个AJAX实现,就不怕网络爬虫了~以上是我的思路,页是参考别人的一些思路综合起来的,希望对大家有用,如果你有更好的想法,反应和我交流~

    \n", "_id"=>50}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog插件开发指南", "body"=>"一、什么是1stlog 1stlog是由1sters.com开发的一款基于RubyOnRails的博客系统,主要针对中国用户,符合中国用户的使用习惯,功能强大,结构合理,易于扩展和定制,是一款很有前景的博客系统。二、为什么要开发插件插件是对原有功能的扩充,以集成实现更多的更有特色的功能,主版本保证可扩展性,提供扩展的方法,制定开发规范和流程,方便不同需求的人可以快速的开发自己需要的插件;也可以把自己的插件分享给别人使用,甚至被1stlog开发官方收录,进入正式版本,为开源的RoR做出自己的贡献。三、怎样开发插件 1stlog是基于RubyOnRals开发,严格遵循MVC构架思想,本着数据层和表现出分离的原则,使用RoR的组件原理,可以很方便的开发插件,且整合使用简单,下面将就一个具体的例子说明如何进行插件开发。四、插件开发实例解析 目标:下面将实例说明如何进行插件的开发,我们的目标是使用Youtube提供的API,结合一组Youtube的Ruby代码lib,在1stlog上扩充一个展示您在Youtube上视频的小插件,该插件可以根据提供的USERNAME取其在Youtube上收藏的影片。详细指南请参考附件,或者到如下两个URL查看:http://code.google.com/p/1stlog/wiki/CreatePluginFor1stlogGuidehttp://docs.google.com/View?docid=dhf86kr9_28g7jthk", "created_at"=>2007-06-17 08:14:03 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一、什么是1stlog 1stlog是由1sters.com开发的一款基于RubyOnRails的博客系统,主要针对中国用户,符合中国用户的使用习惯,功能强大,结构合理,易于扩展和定制,是一款很有前景的博客系统。二、为什么要开发插件插件是对原有功能的扩充,以集成实现更多的更有特色的功能,主版本保证可扩展性,提供扩展的方法,制定开发规范和流程,方便不同需求的人可以快速的开发自己需要的插件;也可以把自己的插件分享给别人使用,甚至被1stlog开发官方收录,进入正式版本,为开源的RoR做出自己的贡献。三、怎样开发插件 1stlog是基于RubyOnRals开发,严格遵循MVC构架思想,本着数据层和表现出分离的原则,使用RoR的组件原理,可以很方便的开发插件,且整合使用简单,下面将就一个具体的例子说明如何进行插件开发。四、插件开发实例解析 目标:下面将实例说明如何进行插件的开发,我们的目标是使用Youtube提供的API,结合一组Youtube的Ruby代码lib,在1stlog上扩充一个展示您在Youtube上视频的小插件,该插件可以根据提供的USERNAME取其在Youtube上收藏的影片。详细指南请参考附件,或者到如下两个URL查看:http://code.google.com/p/1stlog/wiki/CreatePluginFor1stlogGuidehttp://docs.google.com/View?docid=dhf86kr9_28g7jthk

    \n", "_id"=>51}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog演示环境搭建好了", "body"=>"在bluehost上搭建了一套演示环境,欢迎大家使用,体验,谢谢~演示地址:"1stlog":http://1stlog.1sters.com/管理登录:"1stlogAdmin":http://1stlog.1sters.com/index/login登录帐号:1stlog登录密码:1stlog请大家不要修改密码,数据库定时清空,谢谢~如果发现哪里用着不爽或者bug,欢迎提出,我尽快修改,谢谢~", "created_at"=>2007-06-15 16:46:54 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在bluehost上搭建了一套演示环境,欢迎大家使用,体验,谢谢~演示地址:"1stlog":http://1stlog.1sters.com/管理登录:"1stlogAdmin":http://1stlog.1sters.com/index/login登录帐号:1stlog登录密码:1stlog请大家不要修改密码,数据库定时清空,谢谢~如果发现哪里用着不爽或者bug,欢迎提出,我尽快修改,谢谢~

    \n", "_id"=>52}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在bluehost上部署ROR应用1stlog.", "body"=>"前段时间搞了个bluehost,看他支持ror,一直不敢用,今天部署了套1stlog,还真不简单,总结下下遇到的困难和应对的措施。*1.绑定域名*我把1stlog.1sters.com这个二级域名绑定到bluehost上,很快就生效了。*2.添加域名绑定*把前面我指向的1stlog.1sters.com绑定进去。*3.建立数据库和用户*在bluehost的控制面板上创建MYSQL数据库和用户,注意要给该用户赋权。OK,准备好了,我们开始安装吧。*4.dispatcher配置*首先遇到的就是dispatcher路径(/public/dispatch.rb)Set dispatcher path in "typo/public/dispatch.rb" 把#require "dispatcher" 修改为:#require "/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher"*5.遇到的是数据库编码*由于必须使用UTF-8,而在它的控制面板里面创建的数据库默认是latin1_swedish_ci的,找了一会,发现可以在phpMyadmin里面进行修改(幸好还有phpmyadmin)。点上面的“操作”标签,然后选择最下面的“整理”,选择utf8_unicode_ci就可以了。*6.配置FastCGI*紧接着来的是FastCGI的配置(在public/.htaccess),需要修改如下几个地方:AddHandler fastcgi-script .fcgi RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]添加一行:SetEnv RAILS_ENV production *7.dispatch.fcgi修改*确认#!/usr/bin/env ruby*8.然后给dispatch.fcgi执行权限*。这个很容易遗忘。。*9.初始化数据库*rake db:migrate VERSION=0*10.安装RedCloth*这个竟然默认是没有安装的,只能自己来装了,先下载(wget或者你用FTP传上去)gzip -d RedCloth-3.0.4.tar.gz --解压tar xvf RedCloth-3.0.4.tar --解tarmv RedCloth-3.0.4 redcloth --改个名字(可以不做)然后需要自己加载:在environment.rb里面加入: config.load_paths += %W( vendor/redcloth/lib ).map {|dir| "\#{RAILS_ROOT}/\#{dir}"}.select { |dir| File.directory?(dir) }require 'redcloth'*11.把log和tmp目录及其子目录属性修改为777*恩,差不多了吧,应该没有忘记什么吧:)", "created_at"=>2007-06-15 16:40:29 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    前段时间搞了个bluehost,看他支持ror,一直不敢用,今天部署了套1stlog,还真不简单,总结下下遇到的困难和应对的措施。1.绑定域名*我把1stlog.1sters.com这个二级域名绑定到bluehost上,很快就生效了。*2.添加域名绑定*把前面我指向的1stlog.1sters.com绑定进去。*3.建立数据库和用户*在bluehost的控制面板上创建MYSQL数据库和用户,注意要给该用户赋权。OK,准备好了,我们开始安装吧。*4.dispatcher配置*首先遇到的就是dispatcher路径(/public/dispatch.rb)Set dispatcher path in "typo/public/dispatch.rb" 把#require "dispatcher" 修改为:#require "/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher"*5.遇到的是数据库编码*由于必须使用UTF-8,而在它的控制面板里面创建的数据库默认是latin1_swedish_ci的,找了一会,发现可以在phpMyadmin里面进行修改(幸好还有phpmyadmin)。点上面的“操作”标签,然后选择最下面的“整理”,选择utf8_unicode_ci就可以了。*6.配置FastCGI*紧接着来的是FastCGI的配置(在public/.htaccess),需要修改如下几个地方:AddHandler fastcgi-script .fcgi RewriteRule ^(.)$ dispatch.fcgi [QSA,L]添加一行:SetEnv RAILS_ENV production *7.dispatch.fcgi修改*确认#!/usr/bin/env ruby*8.然后给dispatch.fcgi执行权限*。这个很容易遗忘。。*9.初始化数据库*rake db:migrate VERSION=0*10.安装RedCloth*这个竟然默认是没有安装的,只能自己来装了,先下载(wget或者你用FTP传上去)gzip -d RedCloth-3.0.4.tar.gz --解压tar xvf RedCloth-3.0.4.tar --解tarmv RedCloth-3.0.4 redcloth --改个名字(可以不做)然后需要自己加载:在environment.rb里面加入: config.load_paths += %W( vendor/redcloth/lib ).map {|dir| "\#{RAILS_ROOT}/\#{dir}"}.select { |dir| File.directory?(dir) }require 'redcloth'*11.把log和tmp目录及其子目录属性修改为777*恩,差不多了吧,应该没有忘记什么吧:)

    \n", "_id"=>53}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby版的YouTube库接口", "body"=>"YouTube的快速窜红,得到很多人的喜爱,加上被google收购以后,直觉告诉我们,肯定会推出类似google其他产品的API,果不其然,马上就推出了YouTube REST API,然后在rubyforge看到支持这个API的Ruby库,试了下,很简单好用,如下:1.先要安装% gem install youtubeBulk updating Gem source index for: http://gems.rubyforge.orgInstall required dependency xml-simple? [Yn] ySuccessfully installed youtube-0.8.6Successfully installed xml-simple-1.0.11Installing ri documentation for youtube-0.8.6...Installing RDoc documentation for youtube-0.8.6...2.申请developer id到http://youtube.com/my_profile_dev申请一个developer id。3.使用如下展示的是他的一个例子,很简单哈~<code> require 'rubygems' require 'youtube' youtube = YouTube::Client.new 'DEVELOPER_ID' profile = youtube.profile('br0wnpunk') puts "age: " + profile.age.to_s favorites = youtube.favorite_videos('br0wnpunk') puts "number of favorite videos: " + favorites.size.to_s friends = youtube.friends('paolodona') puts "number of friends: " + friends.size.to_s puts "friend name: " + friends[0].user videos = youtube.videos_by_tag('iron maiden') puts "number of videos by tag iron maiden: " + videos.size.to_s videos = youtube.videos_by_user('whytheluckystiff') puts "number of videos by why: " + videos.size.to_s puts "title: " + videos[0].title videos = youtube.featured_videos puts "number of featured videos: " + videos.size.to_s puts "title: " + videos[0].title puts "url: " + videos[0].url puts "embed url: " + videos[0].embed_url puts "embed html: \\n" + videos[0].embed_html details = youtube.video_details(videos[0]) puts "detailed description: " + details.description puts "thumbnail url: " + details.thumbnail_url</code>附件是这个lib包。更多信息请参考:RDOC : http://youtube.shanesbrain.net/", "created_at"=>2007-06-15 00:52:05 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    YouTube的快速窜红,得到很多人的喜爱,加上被google收购以后,直觉告诉我们,肯定会推出类似google其他产品的API,果不其然,马上就推出了YouTube REST API,然后在rubyforge看到支持这个API的Ruby库,试了下,很简单好用,如下:1.先要安装% gem install youtubeBulk updating Gem source index for: http://gems.rubyforge.orgInstall required dependency xml-simple? [Yn] ySuccessfully installed youtube-0.8.6Successfully installed xml-simple-1.0.11Installing ri documentation for youtube-0.8.6...Installing RDoc documentation for youtube-0.8.6...2.申请developer id到http://youtube.com/my_profile_devdeveloper申请一个 id。3.使用如下展示的是他的一个例子,很简单哈~<code> require 'rubygems' require 'youtube' youtube = YouTube::Client.new 'DEVELOPER_ID' profile = youtube.profile('br0wnpunk') puts "age: " + profile.age.to_s favorites = youtube.favorite_videos('br0wnpunk') puts "number of favorite videos: " + favorites.size.to_s friends = youtube.friends('paolodona') puts "number of friends: " + friends.size.to_s puts "friend name: " + friends[0].user videos = youtube.videos_by_tag('iron maiden') puts "number of videos by tag iron maiden: " + videos.size.to_s videos = youtube.videos_by_user('whytheluckystiff') puts "number of videos by why: " + videos.size.to_s puts "title: " + videos[0].title videos = youtube.featured_videos puts "number of featured videos: " + videos.size.to_s puts "title: " + videos[0].title puts "url: " + videos[0].url puts "embed url: " + videos[0].embed_url puts "embed html: \\n" + videos[0].embed_html details = youtube.video_details(videos[0]) puts "detailed description: " + details.description puts "thumbnail url: " + details.thumbnail_url</code>附件是这个lib包。更多信息请参考:RDOC : http://youtube.shanesbrain.net/

    \n", "_id"=>54}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.0发布啦!", "body"=>"很高兴的和大家说,做为*1sters.com*的第二个开源产品*1stlog*终于发布了,谢谢这么多朋友的关心和鼓励,谢谢你们大家的帮助,谢谢所有帮助、鼓励、支持我的朋友们!做为第一个对外发布版,从规划到实现,测试,到一步步的修正bug,一个来月的*“业余时间”*或许真的不算多(我白天是需要上班的,都是下班晚上写的代码),并且经常有其他的事情打扰,说真的,时间真的比较紧张。其实开源是需要勇气的,特别是对于我这样还没有多少经验和资本的时候,开源真的需要勇气,有的时候真的怕一个用户接二连三的抱怨或者漫骂,虽然做为开源的东西,做为作者的我并没有多少责任去满足每个用户的需求,但是从一个产品的开发者角度,我还是害怕大家用那种鄙视的目光,或者那种类似“就他也配开源”等等的话语,但是无所谓了,从开始规划1stlog我就打算开源了,我不能失约于关心我的朋友们。于是,狠狠心,咬咬牙,开源吧...或许还有很多的不足,还有很多的地方需要优化,很多地方需要调整和优化,等不及了,做为第一个版本,我想现在的功能已经足够丰富了。持续的改进,修复,优化将在后续版本继续吧。如果您使用或者借鉴了1stlog,如果有时间,可以发个mail什么的鼓励、感谢下我,也算对我心灵的犒劳;如果你有什么建议、意见,或者对1stlog有什么看法,也欢迎发Email给我。也可以到我的公司的网页上提建议:www.1sters.com..我的邮箱是:+iceskysl@gmail.com+马上就到6.14了,一个很特殊的日子,1stlog开源了...", "created_at"=>2007-06-13 07:59:51 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很高兴的和大家说,做为*1sters.com*的第二个开源产品*1stlog*终于发布了,谢谢这么多朋友的关心和鼓励,谢谢你们大家的帮助,谢谢所有帮助、鼓励、支持我的朋友们!做为第一个对外发布版,从规划到实现,测试,到一步步的修正bug,一个来月的*“业余时间”*或许真的不算多(我白天是需要上班的,都是下班晚上写的代码),并且经常有其他的事情打扰,说真的,时间真的比较紧张。其实开源是需要勇气的,特别是对于我这样还没有多少经验和资本的时候,开源真的需要勇气,有的时候真的怕一个用户接二连三的抱怨或者漫骂,虽然做为开源的东西,做为作者的我并没有多少责任去满足每个用户的需求,但是从一个产品的开发者角度,我还是害怕大家用那种鄙视的目光,或者那种类似“就他也配开源”等等的话语,但是无所谓了,从开始规划1stlog我就打算开源了,我不能失约于关心我的朋友们。于是,狠狠心,咬咬牙,开源吧...或许还有很多的不足,还有很多的地方需要优化,很多地方需要调整和优化,等不及了,做为第一个版本,我想现在的功能已经足够丰富了。持续的改进,修复,优化将在后续版本继续吧。如果您使用或者借鉴了1stlog,如果有时间,可以发个mail什么的鼓励、感谢下我,也算对我心灵的犒劳;如果你有什么建议、意见,或者对1stlog有什么看法,也欢迎发Email给我。也可以到我的公司的网页上提建议:www.1sters.com..我的邮箱是:+iceskysl@gmail.com+马上就到6.14了,一个很特殊的日子,1stlog开源了...

    \n", "_id"=>55}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog Version1.0.0安装部署文档", "body"=>"1stlog的安装部署文档,是基于51boo提供的空间做的演示,如果你是使用51boo的用户应该比较容易理解,如果你还没有ROR空间,建议你去51boo.com看看有没有合适你的产品,如果你有自己的服务器,那就不用我教了,部署方法和其他Rails部署基本上是一致的。需要提醒大家的是,搭建1stlog需要如下基本条件: mysql4.0及其以上版本数据库 rails1.2.3及其版本 ruby1.8.4及其以上版本 RedCloth RMagick详细的安装部署步骤在附件,请先自行下载查看,源文件将在晚上24点提供下载,请关注!", "created_at"=>2007-06-13 00:00:58 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    1stlog的安装部署文档,是基于51boo提供的空间做的演示,如果你是使用51boo的用户应该比较容易理解,如果你还没有ROR空间,建议你去51boo.com看看有没有合适你的产品,如果你有自己的服务器,那就不用我教了,部署方法和其他Rails部署基本上是一致的。需要提醒大家的是,搭建1stlog需要如下基本条件: mysql4.0及其以上版本数据库 rails1.2.3及其版本 ruby1.8.4及其以上版本 RedCloth RMagick详细的安装部署步骤在附件,请先自行下载查看,源文件将在晚上24点提供下载,请关注!

    \n", "_id"=>56}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) + String not valid UTF-8 +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"选取随机的记录的几个方法汇总", "body"=>"有的时候,我们可能想吧满足某个条件的记录随机的选几条出来,比如用户查看一篇文章的时候,我们想再旁边随机的列出与这个文章相关的几篇文章,我们就有如下几个方法:\n\n1.在Ruby中一次实现\n\nthings = Thing.find(:all)\nrandom_things = []\n3.times do\nrandom_things << things[rand(things.size)]\nend\n\n上面这个方法是可以的,但是有个缺点,它把整个表都查询出来,再随机的取三个,缺点很明显,如果数据库表太大,效率很差(内存等消耗很大);且可能取出两条相同的记录(尽管概率不大),第二个问题比较好修复,如下代码即可解决:\n\nthings = Thing.find(:all)\nrandom_things = []\nwhile random_things.size < 3\nrandom_things |= things[rand(things.size)]\nend\n\n2.Ruby查询两次\n\nthing_ids = Thing.find(:all, :select => 'id').map(&:id)\nrandom_ids = []\nwhile random_ids.size < 3 random_things |= things[rand(things.size)] end random_things = Thing.find(:all, :conditions => ['id IN (?)', random_ids])\n\n这个方法只是先随机取出ids较,然后再取ids对应的记录,比前面说的那个有个好处就是不会消耗太多的系统资源,比起第一种方法会快很多。\n\n3.在数据库层面上做\n\n<code>random_things = Thing.find(:all, :limit => 3, :order => 'random()')</code>\n\n是不是神奇呢,我们直接把:random(如果是MySQL则需要使用 rand()) 传给Find方法就可以了,这个方法看似比较好,其实不然,其构造出来的SQL比较变形,且对于不同的数据库不能通用。且类似与order by rand() limit 1这样的语句是很畸形的。并且这个sql效率奇低!!\n\n*4.使用offset进一步改进*\n\n<code>Thing.find :first, :offset => rand(Thing.count)</code>\n\n上面这个方法好多了,但是只能取一条,你可以按照第一种办法构造一个取多条的,页很简单,不是么?以上四个方法,请按照自己的实际情况使用,对于不同的需求,效率是不一样的,如果你有更好的方法,欢迎留言讨论。", "created_at"=>2007-06-10 21:09:11 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有的时候,我们可能想吧满足某个条件的记录随机的选几条出来,比如用户查看一篇文章的时候,我们想再旁边随机的列出与这个文章相关的几篇文章,我们就有如下几个方法:

    \n\n

    1.在Ruby中一次实现

    \n\n

    things = Thing.find(:all)
    \nrandom_things = []
    \n3.times do
    \nrandom_things << things[rand(things.size)]
    \nend

    \n\n

    上面这个方法是可以的,但是有个缺点,它把整个表都查询出来,再随机的取三个,缺点很明显,如果数据库表太大,效率很差(内存等消耗很大);且可能取出两条相同的记录(尽管概率不大),第二个问题比较好修复,如下代码即可解决:

    \n\n

    things = Thing.find(:all)
    \nrandom_things = []
    \nwhile random_things.size < 3
    \nrandom_things |= things[rand(things.size)]
    \nend

    \n\n

    2.Ruby查询两次

    \n\n

    thing_ids = Thing.find(:all, :select => 'id').map(&:id)
    \nrandom_ids = []
    \nwhile random_ids.size < 3 random_things |= things[rand(things.size)] end random_things = Thing.find(:all, :conditions => ['id IN (?)', random_ids])

    \n\n

    这个方法只是先随机取出ids较,然后再取ids对应的记录,比前面说的那个有个好处就是不会消耗太多的系统资源,比起第一种方法会快很多。

    \n\n

    3.在数据库层面上做

    \n\n

    <code>random_things = Thing.find(:all, :limit => 3, :order => 'random()')</code>

    \n\n

    是不是神奇呢,我们直接把:random(如果是MySQL则需要使用 rand()) 传给Find方法就可以了,这个方法看似比较好,其实不然,其构造出来的SQL比较变形,且对于不同的数据库不能通用。且类似与order by rand() limit 1这样的语句是很畸形的。并且这个sql效率奇低!!

    \n\n

    4.使用offset进一步改进

    \n\n

    <code>Thing.find :first, :offset => rand(Thing.count)</code>

    \n\n

    上面这个方法好多了,但是只能取一条,你可以按照第一种办法构造一个取多条的,页很简单,不是么?以上四个方法,请按照自己的实际情况使用,对于不同的需求,效率是不一样的,如果你有更好的方法,欢迎留言讨论。

    \n", "_id"=>58}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails实现下载文件的小技巧", "body"=>"

    有的时候,如果你把需要下载的文件放在public目录或者其子目录下,是可以通过URL直接下载的,但是有的时候,你可能想把文件存放在别的目录以保证不会被爬虫或者其他恶意的人下载到(比如你写的电子书或者好的资料等等.),这个时候Rails的send_file函数就显得很好用,它每次发送4096byte,所以发送文件会很快,
    \n下面是个例子:

    \n
    send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
    \n
    \n


    \n这里只是一个例子,真实的使用中,你可以把一个文件的信息存放在数据库里面,然后下载的时候就可以根据每个文件来指定上述的值了,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def attachment  
    2. \n
    3. @attachment = Attachment.find(params[:id]) @attachment.update_attribute(:downloads,@attachment.downloads+1)  
    4. \n
    5. send_file @attachment.filepath, :type => @attachment.filetype, :disposition => 'inline'
      \n
    6. \n
    7. end 
      \n
    8. \n
    \n
    \n

    很棒,不是么~

    ", "created_at"=>2007-06-10 09:19:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有的时候,如果你把需要下载的文件放在public目录或者其子目录下,是可以通过URL直接下载的,但是有的时候,你可能想把文件存放在别的目录以保证不会被爬虫或者其他恶意的人下载到(比如你写的电子书或者好的资料等等.),这个时候Rails的send_file函数就显得很好用,它每次发送4096byte,所以发送文件会很快,
    \n下面是个例子:
    \nsend_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
    \n
    \n
    \n这里只是一个例子,真实的使用中,你可以把一个文件的信息存放在数据库里面,然后下载的时候就可以根据每个文件来指定上述的值了,如下:
    \n
    \nRuby代码
    \n
    \n def attachment  
    \n @attachment = Attachment.find(params[:id]) @attachment.update_attribute(:downloads,@attachment.downloads+1)  
    \n send_file @attachment.filepath, :type => @attachment.filetype, :disposition => 'inline'
    \n
    \n end 
    \n
    \n
    \n
    \n很棒,不是么~

    \n", "_id"=>59}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails4Days中文翻译版", "body"=>"这个是我很早前开始接触ROR的时候翻译的,也有不少人看了,很是欣慰,今天1stlog加上了附件上传下载功能,顺便吧这个PDF发上来,需要的朋友可以在这里下载了。写在前面的话:自己正在学习ROR,鉴于关于ROR的中文资料比较少,虽然自己E语不怎么样,但是每次看到E文资料都尽力翻译过来。一来方便自己日后回头看这些资料比较方便;二是这样可以使自己看的比较认真,仔细揣摩原文的意思;还有一点就是尽量为后来的学习者提供一些关于ROR的中文资料。一边看一边翻译记录,没有仔细校核,如有不妥,还望海涵,如能指出,不甚感激!", "created_at"=>2007-06-10 09:01:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这个是我很早前开始接触ROR的时候翻译的,也有不少人看了,很是欣慰,今天1stlog加上了附件上传下载功能,顺便吧这个PDF发上来,需要的朋友可以在这里下载了。写在前面的话:自己正在学习ROR,鉴于关于ROR的中文资料比较少,虽然自己E语不怎么样,但是每次看到E文资料都尽力翻译过来。一来方便自己日后回头看这些资料比较方便;二是这样可以使自己看的比较认真,仔细揣摩原文的意思;还有一点就是尽量为后来的学习者提供一些关于ROR的中文资料。一边看一边翻译记录,没有仔细校核,如有不妥,还望海涵,如能指出,不甚感激!

    \n", "_id"=>60}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ROR中实现验证码需要注意的地方", "body"=>"开始以为没有什么难得,参考了http://www.blogjava.net/killme2008/archive/2007/04/09/109456.html和JAVAEYE上的一些文章,其实大家说的都差不多的,都是说win下注意的事情,我在lunix上怎么就是跑不起来,一直报告Missing model noisy_image.rb这个错误,后来看到http://wiki.rubyonrails.com/rails/pages/HowtoSecureFormsWithNoisyImages这个文章,恍然大悟。<code>class NoisyImagerequire 'RMagick'include Magick</code>注意这个*require 'RMagick'*是放在class里面的,如果放在外面,就会报我上面说的那个错误。PS:刚刚给1stlog加上了验证码,也是最后一个功能点了。明天找时间整理下文档就可以开源了。真开心~", "created_at"=>2007-06-09 09:55:40 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    开始以为没有什么难得,参考了http://www.blogjava.net/killme2008/archive/2007/04/09/109456.html和JAVAEYE上的一些文章,其实大家说的都差不多的,都是说win下注意的事情,我在lunix上怎么就是跑不起来,一直报告Missing model noisy_image.rb这个错误,后来看到http://wiki.rubyonrails.com/rails/pages/HowtoSecureFormsWithNoisyImages这个文章,恍然大悟。<code>class NoisyImagerequire 'RMagick'include Magick</code>注意这个*require 'RMagick'*是放在class里面的,如果放在外面,就会报我上面说的那个错误。PS:刚刚给1stlog加上了验证码,也是最后一个功能点了。明天找时间整理下文档就可以开源了。真开心~

    \n", "_id"=>61}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"完善你的URL显示信息", "body"=>"当你允许用户评论的时候,可能需要他们输入主页等URL,你以为用户会很认真的写上*http://*,现实是用户很多时候懒得写,只写www.1ster.cn这样的,你可以在接收数据的时候或者JS处理一下,如果没有http://就加上,但有的时候,面对一些历史数据或者你不想在接收的时候处理,可以按照下面这个来处理。<code> def url=(addr) super (addr.blank? || addr.starts_with?('http')) ? addr : "http://\#{addr}" end</code>当然,你也可以按照这个思路在你接收数据的时候处理。", "created_at"=>2007-06-07 19:43:51 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    当你允许用户评论的时候,可能需要他们输入主页等URL,你以为用户会很认真的写上*http://*,现实是用户很多时候懒得写,只写www.1ster.cn这样的,你可以在接收数据的时候或者JS处理一下,如果没有http://就加上,但有的时候,面对一些历史数据或者你不想在接收的时候处理,可以按照下面这个来处理。<code> def url=(addr) super (addr.blank? || addr.starts_with?('http')) ? addr : "http://\#{addr}" end</code>当然,你也可以按照这个思路在你接收数据的时候处理。

    \n", "_id"=>62}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Layout in Rails(三种方法)", "body"=>"Rails里面的layout的主要思想是template的merge机制 — 即在布局中留下若干占位符。当HTTP请求过来,响应页面将具体内容插入到对应的占位符合并而成完成的内容,站在具体响应页面的角度看,当然“推”的处理方法项目可维护性更好。下面我们主要说说在Rails的controller中对layout的控制范围。*1. method级别的控制*。在某些特定的请求(对应rails controller里面一个method)需要特定的layout, 这时候可以<code> class ExampleController < AppplicationController def index render :layout => ‘my_layout’ end def list end end</code>*2. controller级别的控制*。很多情况下,需要对同一个controller中的所有或者大多数method应用一个layout。那么我们可以在controller级别上来定义layout<code> class ExampleController < AppplicationController layout 'my_layout', :except => rss # layout :my_def_layout # layout proc{|c| …} def index end def list end end</code>我们可以使用layout函数的三种方式来处理对应的情况。*3. application级别的控制*。因为所有的controller都是继承于ApplicationController, 所以要在application的级别控制layout, 我们只要把2中的layout定义上升到ApplicationController class。比如对于应用程序而言,XMLHttpRequest不需要layout, 那么<code> class ApplicationController < ActionController::Base layout proc{ |c| c.request.xhr? ? false : "application" } end</code>在以后我们将说说在layout中怎么插入多部分内容。", "created_at"=>2007-06-07 17:35:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Rails里面的layout的主要思想是template的merge机制 — 即在布局中留下若干占位符。当HTTP请求过来,响应页面将具体内容插入到对应的占位符合并而成完成的内容,站在具体响应页面的角度看,当然“推”的处理方法项目可维护性更好。下面我们主要说说在Rails的controller中对layout的控制范围。*1. method级别的控制*。在某些特定的请求(对应rails controller里面一个method)需要特定的layout, 这时候可以<code> class ExampleController < AppplicationController def index render :layout => ‘my_layout’ end def list end end</code>*2. controller级别的控制*。很多情况下,需要对同一个controller中的所有或者大多数method应用一个layout。那么我们可以在controller级别上来定义layout<code> class ExampleController < AppplicationController layout 'my_layout', :except => rss # layout :my_def_layout # layout proc{|c| …} def index end def list end end</code>我们可以使用layout函数的三种方式来处理对应的情况。*3. application级别的控制*。因为所有的controller都是继承于ApplicationController, 所以要在application的级别控制layout, 我们只要把2中的layout定义上升到ApplicationController class。比如对于应用程序而言,XMLHttpRequest不需要layout, 那么<code> class ApplicationController < ActionController::Base layout proc{ |c| c.request.xhr? ? false : "application" } end</code>在以后我们将说说在layout中怎么插入多部分内容。

    \n", "_id"=>63}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用check_box_tag时需要注意的", "body"=>"*check_box_tag*这个辅助方法,不晓得是rails自己的Bug还是其他的原因,按照道理来说,应该是和*check_box*这个辅助方法差不多的才对呀,但是在使用过程中发现有些问题,提醒各位下:check_box是可以自动生成*hidden_field*区域的代码的,这样选中或者不选中的时候,都可以正常工作;但是check_box_tag这个东西却没有那么好,它不会自动生成+hidden_field+的代码,所以使得你在不选该复选框的时候,其值是不会送到服务端的。必须手工添加以下代码:<%=hidden_field_tag item.name, 0 %>切忌切忌哈~", "created_at"=>2007-06-07 09:41:03 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    *check_box_tag*这个辅助方法,不晓得是rails自己的Bug还是其他的原因,按照道理来说,应该是和*check_box*这个辅助方法差不多的才对呀,但是在使用过程中发现有些问题,提醒各位下:check_box是可以自动生成*hidden_field*区域的代码的,这样选中或者不选中的时候,都可以正常工作;但是check_box_tag这个东西却没有那么好,它不会自动生成+hidden_field+的代码,所以使得你在不选该复选框的时候,其值是不会送到服务端的。必须手工添加以下代码:<%=hidden_field_tag item.name, 0 %>切忌切忌哈~

    \n", "_id"=>64}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dir.glob基本操作", "body"=>"使用*Dir.glob*可以方便的进行目录遍历,如下的例子是查找D:/gem的子目录中所有包含readme.txt文件的子目录。<code> themes_root = "D:/gem" glob = "\#{themes_root}/[a-zA-Z0-9]*" @theme_cache = Dir.glob(glob).select do |file| File.readable?("\#{file}/readme.txt") end.compact p @theme_cache</code>还有一系列的延伸,请参考ruby手册。", "created_at"=>2007-06-05 23:17:36 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    使用Dir.glob*可以方便的进行目录遍历,如下的例子是查找D:/gem的子目录中所有包含readme.txt文件的子目录。<code> themes_root = "D:/gem" glob = "\#{themes_root}/[a-zA-Z0-9]" @theme_cache = Dir.glob(glob).select do |file| File.readable?("\#{file}/readme.txt") end.compact p @theme_cache</code>还有一系列的延伸,请参考ruby手册。

    \n", "_id"=>65}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"自动备份数据库的脚本", "body"=>"一个WEB应用,基本上是不能保证其100%安全的,网络安全、系统的稳定性都可能在某个时间突然发生,您辛辛苦苦写的文章,收集的资料,很可能在瞬间消失,再也找不回来;数据真的是越来越重要了;另外,你可能想把一个WEB迁移到另外一台主机上等等,这个时候,数据库的备份就显得各位的重要。ROR应用中,使用的最多的是MYSQL数据库了,一直都没有找到比较好的、方便的方来来备份数据,上次自己写了一个备份到YMAL文件的,使用起来比较慢,导出来的格式也不是很好,所以也就没有发布出来,如果有人对这个比较感兴趣,可以mail我。今天说的是另外的一个备份的工具(*AutoMySQLBackup*),在COR上看到的链接,脚本是个老外写的,主要使用的是mysqldump来定时备份数据,下来简单的配置试了下,果然好用,你使用的时候,需要修改你需要备份的数据库名、连接用户、密码和主机地址,另外如果你是在虚拟主机上的,则需要修改备份目标文件夹,如+BACKUPDIR="./backups"+(需要加上*./*,否则你可能会得到目录拒绝写操作的提示);另外,还可以配置邮件,使得备份以后会把其压缩后的文件发送到你的邮箱(这个大小受到邮件附件大小的限制),可以定时(天、周、月)来备份。值得一提的是采用的是增量备份,非常方便。详细的介绍页面你可以参考:http://www.debianhelp.co.uk/mysqlscript.htm或者直接下载脚本程序(里面有说明的)", "created_at"=>2007-06-05 20:50:05 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一个WEB应用,基本上是不能保证其100%安全的,网络安全、系统的稳定性都可能在某个时间突然发生,您辛辛苦苦写的文章,收集的资料,很可能在瞬间消失,再也找不回来;数据真的是越来越重要了;另外,你可能想把一个WEB迁移到另外一台主机上等等,这个时候,数据库的备份就显得各位的重要。ROR应用中,使用的最多的是MYSQL数据库了,一直都没有找到比较好的、方便的方来来备份数据,上次自己写了一个备份到YMAL文件的,使用起来比较慢,导出来的格式也不是很好,所以也就没有发布出来,如果有人对这个比较感兴趣,可以mail我。今天说的是另外的一个备份的工具(AutoMySQLBackup*),在COR上看到的链接,脚本是个老外写的,主要使用的是mysqldump来定时备份数据,下来简单的配置试了下,果然好用,你使用的时候,需要修改你需要备份的数据库名、连接用户、密码和主机地址,另外如果你是在虚拟主机上的,则需要修改备份目标文件夹,如+BACKUPDIR="./backups"+(需要加上./*,否则你可能会得到目录拒绝写操作的提示);另外,还可以配置邮件,使得备份以后会把其压缩后的文件发送到你的邮箱(这个大小受到邮件附件大小的限制),可以定时(天、周、月)来备份。值得一提的是采用的是增量备份,非常方便。详细的介绍页面你可以参考:http://www.debianhelp.co.uk/mysqlscript.htm或者直接下载脚本程序(里面有说明的)

    \n", "_id"=>66}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在windows上安装RMagick", "body"=>"看到网上很多人说再WIN下安装RMagick的方法都是这样的,gem install ImageMagick-6.3.0-7-Q8-windows-dll.exe,这样我感觉谁有问题的,至少我这样安装的时候是有错误的,如:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install ImageMagick-6.3.0-7-Q8-windows-dll.exeERROR: Error installing gem ImageMagick-6.3.0-7-Q8-windows-dll.exe[.gem]: string contains null byte所以正确的应该是用gem包来安装,如下:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install rmagick-1.14.1-win32.gemSuccessfully installed rmagick, version 1.14.1看看是不是安装上了:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem listrmagick (1.14.1) RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries.", "created_at"=>2007-06-04 22:06:54 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    看到网上很多人说再WIN下安装RMagick的方法都是这样的,gem install ImageMagick-6.3.0-7-Q8-windows-dll.exe,这样我感觉谁有问题的,至少我这样安装的时候是有错误的,如:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install ImageMagick-6.3.0-7-Q8-windows-dll.exeERROR: Error installing gem ImageMagick-6.3.0-7-Q8-windows-dll.exe[.gem]: string contains null byte所以正确的应该是用gem包来安装,如下:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem install rmagick-1.14.1-win32.gemSuccessfully installed rmagick, version 1.14.1看看是不是安装上了:D:\\gem\\RMagick-1.14.1_IM-6.3.0-7-Q8>gem listrmagick (1.14.1) RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries.

    \n", "_id"=>67}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"mini_magick 1.2.2 Released", "body"=>"*mini_magick* version 1.2.2 has been released!RMagick是大家用的最多的图片处理类库,但是它台复杂了,消耗太多的内存,比如下面这段最简单的代码都会吃掉100M的内存:<code>Magick::read("image.jpg") do |f|f.write("manipulated.jpg")end</code>*mini_magick*是把ImageMagick进行的一次封装,使得可以很方便的使用MiniMagick的commandline,可以在http://www.imagemagick.org/script/mogrify.php 查看可耕多的ImageMagick has 信息。*mini_magick*1.2.2包含如下更新:# 1.) all image commands return the image object (The output of the last command is saved in @output)# 2.) identify doesn't trip over strangley named files# 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions)# 4.) identify commands escape output path correctly", "created_at"=>2007-06-03 00:01:12 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    mini_magick version 1.2.2 has been released!RMagick是大家用的最多的图片处理类库,但是它台复杂了,消耗太多的内存,比如下面这段最简单的代码都会吃掉100M的内存:<code>Magick::read("image.jpg") do |f|f.write("manipulated.jpg")end</code>*mini_magick*是把ImageMagick进行的一次封装,使得可以很方便的使用MiniMagick的commandline,可以在http://www.imagemagick.org/script/mogrify.php 查看可耕多的ImageMagick has 信息。*mini_magick*1.2.2包含如下更新:# 1.) all image commands return the image object (The output of the last command is saved in @output)# 2.) identify doesn't trip over strangley named files# 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions#) 4.) identify commands escape output path correctly

    \n", "_id"=>68}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"days_in_month函数介绍", "body"=>"days_in_month这个函数返回给定的年月的月的天数,对于写阴历什么的很有帮助,下面是英文的介绍。Descriptiondays_in_month(month, year=nil)Return the number of days in the given month. If a year is given, February will return the correct number of days for leap years. Otherwise, this method will always report February as having 28 days.<code> 1. >> Time.days_in_month(4) => 30 2. >> Time.days_in_month(4,2006) => 30 3. >> Time.days_in_month(2,2006) => 28 4. >> Time.days_in_month(2) => 28 5. >> Time.days_in_month(2,2008) => 29</code>", "created_at"=>2007-06-02 00:29:03 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    days_in_month这个函数返回给定的年月的月的天数,对于写阴历什么的很有帮助,下面是英文的介绍。Descriptiondays_in_month(month, year=nil)Return the number of days in the given month. If a year is given, February will return the correct number of days for leap years. Otherwise, this method will always report February as having 28 days.<code> 1. >> Time.days_in_month(4) => 30 2. >> Time.days_in_month(4,2006) => 30 3. >> Time.days_in_month(2,2006) => 28 4. >> Time.days_in_month(2) => 28 5. >> Time.days_in_month(2,2008) => 29</code>

    \n", "_id"=>69}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装SSH库的时候出现问题的修复", "body"=>"在使用SSH的时候,需要另外安装SSH的库,但是我按照官方上的方法无论是远程安装还是本地安装都出现错误,如下:D:\\>gem install net-ssh --include-dependenciesERROR: While executing gem ... (Zlib::BufError) buffer error查了下资料,貌似问题是出在Windows版本上的RUBY有点问题,可以按照下面的进行修复:1.修改ruby的安装目录下(c:\\ruby\\lib\\ruby\\site_ruby\\1.8\\rubygems\\package.rb)的package.rb文件,在 618 行,把1.2.1修改为 1.2.3。2) removed the linessh 22/tcp #SSHfrom file %systemroot%\\system32\\drivers\\etc\\services", "created_at"=>2007-06-01 23:57:42 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在使用SSH的时候,需要另外安装SSH的库,但是我按照官方上的方法无论是远程安装还是本地安装都出现错误,如下:D:&gt;gem install net-ssh --include-dependenciesERROR: While executing gem ... (Zlib::BufError) buffer error查了下资料,貌似问题是出在Windows版本上的RUBY有点问题,可以按照下面的进行修复:1.修改ruby的安装目录下(c:\\ruby\\lib\\ruby\\site_ruby\\1.8\\rubygems\\package.rb)的package.rb文件,在 618 行,把1.2.1修改为 1.2.3。2) removed the linessh 22/tcp #SSHfrom file %systemroot%\\system32\\drivers\\etc\\services

    \n", "_id"=>70}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Jsonifier在rails中生成json", "body"=>"

    由于一个系统需要对外提供数据,自然使用widget来实现,JS中自然是对json支持最好,也是就可以吧数据组装成json格式的,再用JS解析显示,于是就有了这个需求:在rails中生成JSON,尽管rails1.1版本就增加了对json的支持,但要想更加灵活,自然使用插件来实现了,而Jsonifier 正是我们需要的。
    \n看看Jsonifier的自我介绍:
    \nJsonifier is a Rails plugin that adds options to the ActiveRecord#to_json method similar to ActiveRecord#to_xml. It's time to treat the JSON encoding of AR objects with more respect ;)The :only, :except, :methods, and :include options are supported. Check out the examples below.
    \n
    \n*安装:*
    \n很简单,script/plugin install svn://svn.codefront.net/jsonifier/trunk
    \n
    \n*使用:*

    \n
    \n
    Ruby代码
    \n
      \n
    1. david = User.find(1)  
    2. \n
    3. david.to_json # {id: 1, name: "David", awesome: true, created_at: "07/01/2007"}  
    4. \n
    5. david.to_json(:only => :name# {name: "David"}  
    6. \n
    7. david.to_json(:only => [:id:name]) # {id: 1, name: "David"}  
    8. \n
    9. david.to_json(:except => :created_at# {id: 1, name: "David", awesome: true}  
    10. \n
    11. david.to_json(:except => [:id:created_at]) # {name: "David", awesome: true}  
    12. \n
    \n
    \n

    很简单吧~

    ", "created_at"=>2007-07-12 01:14:11 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    由于一个系统需要对外提供数据,自然使用widget来实现,JS中自然是对json支持最好,也是就可以吧数据组装成json格式的,再用JS解析显示,于是就有了这个需求:在rails中生成JSON,尽管rails1.1版本就增加了对json的支持,但要想更加灵活,自然使用插件来实现了,而Jsonifier 正是我们需要的。
    \n看看Jsonifier的自我介绍:
    \nJsonifier is a Rails plugin that adds options to the ActiveRecord#to_json method similar to ActiveRecord#to_xml. It's time to treat the JSON encoding of AR objects with more respect ;)The :only, :except, :methods, and :include options are supported. Check out the examples below.
    \n
    \n安装:
    \n很简单,script/plugin install svn://svn.codefront.net/jsonifier/trunk
    \n
    \n使用:
    \n
    \nRuby代码
    \n
    \n david = User.find(1)  
    \n david.to_json # {id: 1, name: "David", awesome: true, created_at: "07/01/2007"}  
    \n david.to_json(:only => :name) # {name: "David"}  
    \n david.to_json(:only => [:id, :name]) # {id: 1, name: "David"}  
    \n david.to_json(:except => :created_at) # {id: 1, name: "David", awesome: true}  
    \n david.to_json(:except => [:id, :created_at]) # {name: "David", awesome: true}  
    \n
    \n
    \n很简单吧~

    \n", "_id"=>71}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"敏捷软件开发宣言", "body"=>"觉得敏捷开发模式就是我们目前追寻的理想开发模式,配合RoR的灵活,足以使得更加敏捷~于是给这个blog重新添加了一个“敏捷开发”的分类,记录该类的读书感受等等,以下便是大名鼎鼎的敏捷宣言!*敏捷软件开发宣言*个体和交互 胜过 过程和工具可以工作的软件 胜过 面面俱到的文档客户合作 胜过 合同谈判响应变化 胜过 遵循计划虽然右项也有价值,但是我们认为左项具有更大的价值。PS:发现个37的那本Getting Real里面宣称的几乎完全一致!", "created_at"=>2007-07-11 17:44:44 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    觉得敏捷开发模式就是我们目前追寻的理想开发模式,配合RoR的灵活,足以使得更加敏捷~于是给这个blog重新添加了一个“敏捷开发”的分类,记录该类的读书感受等等,以下便是大名鼎鼎的敏捷宣言!*敏捷软件开发宣言*个体和交互 胜过 过程和工具可以工作的软件 胜过 面面俱到的文档客户合作 胜过 合同谈判响应变化 胜过 遵循计划虽然右项也有价值,但是我们认为左项具有更大的价值。PS:发现个37的那本Getting Real里面宣称的几乎完全一致!

    \n", "_id"=>72}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何快速统计RoR网站的访问量", "body"=>"本文来源JavaEye,由于没有提供单篇RSS,我就全部转过来了,版权所有规robbin所有。链接地址:http://robbin.javaeye.com/blog/97287统计网站的访问量有很多专业的第三方工具,例如Google Analytics,提供强大,而且详细的统计功能。当然,也许不是每个人都需要这么复杂而且操作麻烦的工具,如果你只是需要大概了解一下网站的访问量和访问URL的比例,那么让我们看看最简单最容易的统计工具:Unix Shell。一个RoR网站的访问纪录,Web Server(Apache or lighttpd)会记录所有的访问请求,包括动态请求和静态请求,但大量图片,JS,CSS的请求对我们没有太大的统计价值,因此web server的日志参考价值就不大。RoR会记录所有动态请求日志到log/production.log里面,我们要做的就是让RoR进行日志交换,每天产生一个新的日志文件。很简单,修改config/environment.rb RAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}.log", "daily") 那么每天就会产生一个诸如+production.log.20070702+这样的日志文件。*一、统计每日动态请求处理总数*cat production.log.20070702|grep "200 OK"|wc -l 打印日志文件,挑选正确处理的请求行,统计行数,一条shell命令就搞定了网站处理的动态请求数量。虽然动态请求数量不等于网站访问量,但是可以作为一个重要的参考指标。*二、统计URL的访问频度*网站管理员都很希望知道哪些频道受欢迎被访问的频繁,哪些URL格外受到关注,不必寻求专业的网站流量统计系统,一条shell命令就搞定了:cat production.log.20070702 |grep "200 OK" | awk '{print $17}'|sort|uniq -c | sort -r -n > stat.log 打印日志文件,挑选正确处理请求行,把第17列即URL那一列挑出来,排序,统计唯一URL出现的次数,按照URL次数倒序输出到stat.log文件里面,让我们看看stat.log是什么:10096 [http://www.javaeye.com/] 3590 [http://www.javaeye.com/forums/index] 3446 [http://www.javaeye.com/forums/board/Java] 3300 [http://www.javaeye.com/index/rss_index_topics] 2477 [http://www.javaeye.com/forums/board/Life] 1605 [http://www.javaeye.com/forums/board/AJAX] ......... 网站首页被访问了10096次,论坛频道首页被访问了3590次,......是不是很爽?我们用一条shell命令可以做简单的网站访问统计系统了。那么用Java做的系统,能不能这样统计呢?其实照样可以。你可以在tomcat的配置文件里面设置输出详细的日志信息,然后照样用shell命令搞定。", "created_at"=>2007-07-10 16:58:48 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    本文来源JavaEye,由于没有提供单篇RSS,我就全部转过来了,版权所有规robbin所有。链接地址:http://robbin.javaeye.com/blog/97287统计网站的访问量有很多专业的第三方工具,例如Google Analytics,提供强大,而且详细的统计功能。当然,也许不是每个人都需要这么复杂而且操作麻烦的工具,如果你只是需要大概了解一下网站的访问量和访问URL的比例,那么让我们看看最简单最容易的统计工具:Unix Shell。一个RoR网站的访问纪录,Web Server(Apache or lighttpd)会记录所有的访问请求,包括动态请求和静态请求,但大量图片,JS,CSS的请求对我们没有太大的统计价值,因此web server的日志参考价值就不大。RoR会记录所有动态请求日志到log/production.log里面,我们要做的就是让RoR进行日志交换,每天产生一个新的日志文件。很简单,修改config/environment.rb RAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}.log", "daily") 那么每天就会产生一个诸如+production.log.20070702+这样的日志文件。*一、统计每日动态请求处理总数*cat production.log.20070702|grep "200 OK"|wc -l 打印日志文件,挑选正确处理的请求行,统计行数,一条shell命令就搞定了网站处理的动态请求数量。虽然动态请求数量不等于网站访问量,但是可以作为一个重要的参考指标。*二、统计URL的访问频度*网站管理员都很希望知道哪些频道受欢迎被访问的频繁,哪些URL格外受到关注,不必寻求专业的网站流量统计系统,一条shell命令就搞定了:cat production.log.20070702 |grep "200 OK" | awk '{print $17}'|sort|uniq -c | sort -r -n > stat.log 打印日志文件,挑选正确处理请求行,把第17列即URL那一列挑出来,排序,统计唯一URL出现的次数,按照URL次数倒序输出到stat.log文件里面,让我们看看stat.log是什么:10096 [http://www.javaeye.com/] 3590 [http://www.javaeye.com/forums/index] 3446 [http://www.javaeye.com/forums/board/Java] 3300 [http://www.javaeye.com/index/rss_index_topics] 2477 [http://www.javaeye.com/forums/board/Life] 1605 [http://www.javaeye.com/forums/board/AJAX] ......... 网站首页被访问了10096次,论坛频道首页被访问了3590次,......是不是很爽?我们用一条shell命令可以做简单的网站访问统计系统了。那么用Java做的系统,能不能这样统计呢?其实照样可以。你可以在tomcat的配置文件里面设置输出详细的日志信息,然后照样用shell命令搞定。

    \n", "_id"=>73}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"话题广告测试~", "body"=>"feedsky的话题广告测试下1ef0baf2", "created_at"=>2007-07-04 00:52:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    feedsky的话题广告测试下1ef0baf2

    \n", "_id"=>74}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用图片代替link_to中的文字", "body"=>"link_to大家都会用吧,也有人用户把image_tag和link_to结合起来使用过吧,是不是觉得很长很不干净呢,不用怕,我们其实可以在link_to中直接使用图片来替代文字的,如下:<code><%= link_to image_tag("search.gif", :border=>0), :action => 'show', :id => user %></code>注意里面的:border=>0是为了去掉图片四周那个无聊的框框的,需要加上哦~", "created_at"=>2007-07-03 16:52:41 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    link_to大家都会用吧,也有人用户把image_tag和link_to结合起来使用过吧,是不是觉得很长很不干净呢,不用怕,我们其实可以在link_to中直接使用图片来替代文字的,如下:<code><%= link_to image_tag("search.gif", :border=>0), :action => 'show', :id => user %></code>注意里面的:border=>0是为了去掉图片四周那个无聊的框框的,需要加上哦~

    \n", "_id"=>75}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中实现跟踪记录每个用户的最近十条记录", "body"=>"有的时候,你可能想显示给每个用户他最近浏览的页面,这个时候的一个很自然的想法就是使用数据库来存放,但是这样如果你的用户足够的多,而且页面的读取数据库又很频繁的话,就会对性能造成很大的影响,换个思路,我们可以在session里面存取,示范代码如下:<code>class ApplicationController < ActionController::Base\tbefore_filter :add_to_history\tbefore_filter :page_title\t###def add_to_history session[:history] ||= []## if File.exists?("\#{RAILS_ROOT}/app/views/\#{self.controller_name}/\#{self.action_name}.rhtml") && session[:history].empty? || session[:history].first['uri'] != @request.request_uri session[:history].unshift({ 'uri' => @request.request_uri, 'name' => page_title }) session[:history].pop while session[:history].length > 11 endend######## This bit came from Peter Cooper's snippets source and was moved into the application controller:###\tdef page_title\t\tcase self.controller_name\t\t\twhen 'tag' \t\t\t\ttitle = "Tags &raquo; " + @params[:tags].join(" &gt; ")\t\t\twhen 'user'\t\t\t\ttitle = "Users &raquo; \#{@params[:user]}"\t \t\t\twhen 'features'\t\t\t\t\tcase self.action_name\t\t\t\t\t\twhen 'show' then title = "Feature &raquo; \#{Feature.find(@params[:id]).title}"\t\t\t\t\t\telse title = APP_CONFIG["default_title"]\t\t\t\t\tend\t\t\telse \t\t\t\ttitle = APP_CONFIG["default_title"] + self.controller_name + ":" + self.action_name\t\tend\tend\thelper_method :page_title###...end</code>然后在页面上就可以这样显示了:<code><h4>User History</h4><% for cur in session[:history][0..9] -%> <p><a href="<%= cur["url"] %>"><%= cur["name"] %></a></p><% end -%></code>", "created_at"=>2007-07-03 16:47:31 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有的时候,你可能想显示给每个用户他最近浏览的页面,这个时候的一个很自然的想法就是使用数据库来存放,但是这样如果你的用户足够的多,而且页面的读取数据库又很频繁的话,就会对性能造成很大的影响,换个思路,我们可以在session里面存取,示范代码如下:<code>class ApplicationController < ActionController::Base before_filter :add_to_history before_filter :page_title ###def add_to_history session[:history] ||= []## if File.exists?("\#{RAILS_ROOT}/app/views/\#{self.controller_name}/\#{self.action_name}.rhtml") && session[:history].empty? || session[:history].first['uri'] != @request.request_uri session[:history].unshift({ 'uri' => @request.request_uri, 'name' => page_title }) session[:history].pop while session[:history].length > 11 endend######## This bit came from Peter Cooper's snippets source and was moved into the application controller:### def page_title case self.controller_name when 'tag' title = "Tags &raquo; " + @params[:tags].join(" &gt; ") when 'user' title = "Users &raquo; \#{@params[:user]}" when 'features' case self.action_name when 'show' then title = "Feature &raquo; \#{Feature.find(@params[:id]).title}" else title = APP_CONFIG["default_title"] end else title = APP_CONFIG["default_title"] + self.controller_name + ":" + self.action_name end end helper_method :page_title###...end</code>然后在页面上就可以这样显示了:<code><h4>User History</h4><% for cur in session[:history][0..9] -%> <p><a href="<%= cur["url"] %>"><%= cur["name"] %></a></p><% end -%></code>

    \n", "_id"=>76}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中一个方法返回多个结果的实例", "body"=>"

    大家知道,在一般的编程实现中,一个method只能返回一个结果,如果想实现返回多个结果,java中可以使用VO来实现,但是ruby借助其灵活的语法,我们可以一次返回多个结果,我记得前些时候还不晓得这么做,问了几个人貌似也没有提到,今天五一看到了这个实现,分享给大家:首先,按照这个需求,你可能会写出类似下面的这段代码来检验,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def a_method_to_insult_innocent_people   
    2. \n
    3.   error = compute_error   
    4. \n
    5.   if error == :stupid   
    6. \n
    7.     return false"You made a stupid error"   
    8. \n
    9.   elsif error == :ridiculous   
    10. \n
    11.     return false"You made a ridiculous error"   
    12. \n
    13.   elsif error == :worst_of_all_time   
    14. \n
    15.     return false"You made the most idiot error in history. Way to go…"   
    16. \n
    17.   else return true"You made no error, you are still an idiot"   
    18. \n
    19.   end   
    20. \n
    21. end   
    22. \n
    23.   
    24. \n
    25. success, msg = a_method_to_insult_innocent_people   
    26. \n
    27. do_something_with_success(success)   
    28. \n
    29. destroy_hateful_words!(msg) 
      \n
    30. \n
    \n
    \n

    但是这段代码还是只能返回一个结果,如何实现返回多个值呢,很简单,使用数组来实现,只要把上面这段代码中的- return false, "you made a stupid error"- 修改为 *return [false, "you made a stupid error"]*就可以了。记录记录以备不时之需。

    ", "created_at"=>2007-07-03 16:30:06 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    大家知道,在一般的编程实现中,一个method只能返回一个结果,如果想实现返回多个结果,java中可以使用VO来实现,但是ruby借助其灵活的语法,我们可以一次返回多个结果,我记得前些时候还不晓得这么做,问了几个人貌似也没有提到,今天五一看到了这个实现,分享给大家:首先,按照这个需求,你可能会写出类似下面的这段代码来检验,如下:
    \n
    \nRuby代码
    \n
    \n def a_method_to_insult_innocent_people   
    \n   error = compute_error   
    \n   if error == :stupid   
    \n     return false, "You made a stupid error"   
    \n   elsif error == :ridiculous   
    \n     return false, "You made a ridiculous error"   
    \n   elsif error == :worst_of_all_time   
    \n     return false, "You made the most idiot error in history. Way to go…"   
    \n   else return true, "You made no error, you are still an idiot"   
    \n   end   
    \n end   
    \n   
    \n success, msg = a_method_to_insult_innocent_people   
    \n do_something_with_success(success)   
    \n destroy_hateful_words!(msg) 
    \n
    \n
    \n
    \n但是这段代码还是只能返回一个结果,如何实现返回多个值呢,很简单,使用数组来实现,只要把上面这段代码中的- return false, "you made a stupid error"- 修改为 *return [false, "you made a stupid error"]*就可以了。记录记录以备不时之需。

    \n", "_id"=>77}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用POP3接收邮件", "body"=>"

    上次我们写了如何在rails中发送email,自然接收email也是常常需要的功能,今天给出一段代码实现在rails中接受并处理email,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. #!/usr/bin/env ruby  
    2. \n
    3. require 'net/pop'  
    4. \n
    5. require File.dirname(__FILE__) + '/../config/environment'  
    6. \n
    7. logger = RAILS_DEFAULT_LOGGER  
    8. \n
    9. logger.info "Running Mail Importer..."   
    10. \n
    11. Net::POP3.start("localhost"nil"username""password"do |pop|   
    12. \n
    13. if pop.mails.empty?   
    14. \n
    15.    logger.info "NO MAIL"   
    16. \n
    17. else   
    18. \n
    19.    pop.mails.each do |email|   
    20. \n
    21.    begin   
    22. \n
    23.     logger.info "receiving mail..."   
    24. \n
    25.     Notifier.receive(email.pop)   
    26. \n
    27.     email.delete   
    28. \n
    29.    rescue Exception => e   
    30. \n
    31.     logger.error "Error receiving email at " + Time.now.to_s + "::: " + e.message   
    32. \n
    33.    end   
    34. \n
    35.    end   
    36. \n
    37. end  
    38. \n
    39. end  
    40. \n
    41. logger.info "Finished Mail Importer."  
    42. \n
    \n
    \n


    \n做些说明:
    \n你需要在*Net::POP3.start*这行写上你要接收的邮箱的服务器地址以及你的用户名密码,如上配置好了,你就可以在cron中配置调度这个任务了,至于调度的频度你可以按照自己的需求来设定了。如何,还算简单吧。

    ", "created_at"=>2007-07-03 16:24:28 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    上次我们写了如何在rails中发送email,自然接收email也是常常需要的功能,今天给出一段代码实现在rails中接受并处理email,代码如下:
    \n
    \nRuby代码
    \n
    \n #!/usr/bin/env ruby  
    \n require 'net/pop'  
    \n require File.dirname(FILE) + '/../config/environment'  
    \n logger = RAILS_DEFAULT_LOGGER  
    \n logger.info "Running Mail Importer..."   
    \n Net::POP3.start("localhost", nil, "username", "password") do |pop|   
    \n if pop.mails.empty?   
    \n    logger.info "NO MAIL"   
    \n else   
    \n    pop.mails.each do |email|   
    \n    begin   
    \n     logger.info "receiving mail..."   
    \n     Notifier.receive(email.pop)   
    \n     email.delete   
    \n    rescue Exception => e   
    \n     logger.error "Error receiving email at " + Time.now.to_s + "::: " + e.message   
    \n    end   
    \n    end   
    \n end  
    \n end  
    \n logger.info "Finished Mail Importer."  
    \n
    \n
    \n
    \n做些说明:
    \n你需要在*Net::POP3.start*这行写上你要接收的邮箱的服务器地址以及你的用户名密码,如上配置好了,你就可以在cron中配置调度这个任务了,至于调度的频度你可以按照自己的需求来设定了。如何,还算简单吧。

    \n", "_id"=>78}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"本站可以订阅啦~", "body"=>"很多朋友说喜欢在googleReader里面看文章,希望我提供XML的订阅功能,其实这个feed早就有了,细心的朋友可能已经找到了,呵呵,在左下角的# RSS、# Comments RSS,是可以直接订阅的。有朋友推荐feedburner,说更加方便、也适合自己做统计,于是就添加了这个功能,在右边可以看到有个大大的订阅图标啦,其地址是http://feeds.feedburner.com/1stlog,大家可以使用这个来订阅啦。我会写出更多的Rails方面的文章,欢迎讨论~", "created_at"=>2007-07-01 09:24:21 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很多朋友说喜欢在googleReader里面看文章,希望我提供XML的订阅功能,其实这个feed早就有了,细心的朋友可能已经找到了,呵呵,在左下角的# RSS、# Comments RSS,是可以直接订阅的。有朋友推荐feedburner,说更加方便、也适合自己做统计,于是就添加了这个功能,在右边可以看到有个大大的订阅图标啦,其地址是http://feeds.feedburner.com/1stlog,大家可以使用这个来订阅啦。我会写出更多的Rails方面的文章,欢迎讨论~

    \n", "_id"=>79}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提交多个check_box的写法-check_box_tag.", "body"=>"有的时候可能需要有这样的需求,发一篇文章的时候,需要选择多个tag,我们把Tag取出来后就可以循环显示,但是注意应该是使用check_box_tag,如下是几个例子:<code><% Business.find(@know.business_id).know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>--------------<% @know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>---------------<% @tags.each do |tag|%><%= check_box_tag ("topic[tags_ids][]",tag.id)%><%= tag.name %><% end %></code>我想上面几个例子,大家应该明白了吧?", "created_at"=>2007-06-30 01:28:06 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有的时候可能需要有这样的需求,发一篇文章的时候,需要选择多个tag,我们把Tag取出来后就可以循环显示,但是注意应该是使用check_box_tag,如下是几个例子:<code><% Business.find(@know.business_id).know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>--------------<% @know_tags.each do |t| %><%= check_box_tag('know[know_tags_ids][]',t.know_tag_id,@know.know_tags.include?(t))%>&nbsp;<%= t.name %><%end %>---------------<% @tags.each do |tag|%><%= check_box_tag ("topic[tags_ids][]",tag.id)%><%= tag.name %><% end %></code>我想上面几个例子,大家应该明白了吧?

    \n", "_id"=>80}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用ActionMaile发送邮件实例", "body"=>"来源:http://www.javaeye.com/topic/40778更改config目录下的配置文件*environment.rb* 在最下面追加一段:<code>ActionMailer::Base.delivery_method = :smtp#以简单邮件传送协议发送邮件ActionMailer::Base.default_charset = "GBK"#设置邮件的默认编码为国标码否则发送的邮件主题可能会乱码ActionMailer::Base.server_settings = {:address => "192.168.1.110",:port => 25,:domain => "xxx.com",:authentication => :login,:user_name => "xxx",:password => "xxx",}</code>1、:address => and :port => 决定你将使用的SMTP的地址和端口。这些缺省值分别为localhost和25。2、:domain => 当识别自己是服务器时 mailer应该使用的域名。这是对HELO(因为HELO是命令客户端发送服务来启动一个连接)域的调用。你通常应该使用顶级域名机制来发送e-mail,但这依赖于你的SMTP服务的设置(some don’t check, and some check to try to reduce spam and socalled open-relay issues)3、:user_name => and :password => 如果:authentication被设置则要求有此。4、:authentication => :plain,:login,或:cram_md中的一个。你的服务器管理员将帮助选择正确的选项。当前没使用TLS(SSL)来从Rails连接邮件服务器的方式。这个参数应该被忽略,如果你的服务器不要求确认。 创建一个mailer的models<code>class OrderMailer < ActionMailer::Base def signup(domain, sent_at = Time.now) @subject = 'Welcome to Beast' @body = "hello world" @recipients = "yyy@yyy.com" @from = 'yyy@yyy.com' @sent_on = sent_at @headers = {} endend</code>@subject:邮件标题@body:邮件正文可以使用html标签但需要设置参考下面@recipients:收件人可以接收数组进行群发多人发送:@recipients = [ "1@a.com","2@b.com"]@from:发件人@sent_on:用于设置邮件 Date: header的Time 对象@headers:一个header name/value 对的哈希望表,用于添加任意header行给邮件 如:@headers["Organization"] = "Pragmatic Programmers, LLC"既要使用HTML格式发送邮件又要增加附件的话,需要在model里就对content-type进行设置 @content-type=”text/html” *创建一个controller 用于发送邮件*def send_maileremail = OrderMailer.deliver_signup(request.host_with_port)Puts email.encoded #邮件内容打印#email = OrderMailer.create_signup(request.host_with_port)#email.set_content_type("text/html") 可在模型中设置#OrderMailer.deliver(email)#发送HTML格式的邮件的设置end *发送HTML模板邮件*在views中创建一个模板:_mail_content.rhtml ……model中的mailer类改成如下:def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} endcontroller中更改发送方法: def send_mail content =render_to_string :partial=>" mail_content "email = OrderMailer.create_signup(request.host_with_port,content) email.set_content_type("text/html") OrderMailer.deliver(email) render :text=>"发送成功" end render_to_string方法返回的是String 与render不同的是它返回后不会发送给客户端。 *发送附件* 修改model中的mailer类,如下: def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} @data = "" File.open("D:\\\\Tools\\\\FastAIT.rar", "rb") { |fp| @data< } #参数的含义rb表示只读并且以二进制方式创建一个file对象 #不写r会出现丢失数据的问题,发送的附件也就被破坏了``r''\tRead-only, starts at beginning of file (default mode).只读,清除原有内容(默认方式)``r+''\tRead-write, starts at beginning of file.读写,清除原有内容``w''\tWrite-only, truncates existing file to zero length or creates a new file for writing.只写,创建一个新的文件覆盖旧的``w+''\tRead-write, truncates existing file to zero length or creates a new file for reading and writing.读写,创建一个新的文件覆盖旧的``a''\tWrite-only, starts at end of file if file exists, otherwise creates a new file for writing.只写,追加``a+''\tRead-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.读写,追加``b''\t(DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).*二进制模式* attachment :content_type => "application/rar", :filename => "FastAIT.rar" , :body => @data end邮件附件的content_type(内容类型表) ".asf" ContentType = "video/x-ms-asf" ".avi" ContentType = "video/avi" ".doc" ContentType = "application/msword" ".zip" ContentType = "application/zip" ".xls" ContentType = "application/vnd.ms-excel" ".gif" ContentType = "image/gif" ".jpg", "jpeg" ContentType = "image/jpeg" ".wav" ContentType = "audio/wav" ".mp3" ContentType = "audio/mpeg3" ".mpg", "mpeg" ContentType = "video/mpeg" ".rtf" ContentType = "application/rtf" ".htm", "html" ContentType = "text/html" ".txt" ContentType = "text/plain"".pdf" ContentType = "application/pdf" 其他 ContentType = "application/octet-stream"", "created_at"=>2007-06-29 16:12:18 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    来源:http://www.javaeye.com/topic/40778更改config目录下的配置文件environment.rb 在最下面追加一段:<code>ActionMailer::Base.delivery_method = :smtp#以简单邮件传送协议发送邮件ActionMailer::Base.default_charset = "GBK"#设置邮件的默认编码为国标码否则发送的邮件主题可能会乱码ActionMailer::Base.server_settings = {:address => "192.168.1.110",:port => 25,:domain => "xxx.com",:authentication => :login,:user_name => "xxx",:password => "xxx",}</code>1、:address => and :port => 决定你将使用的SMTP的地址和端口。这些缺省值分别为localhost和25。2、:domain => 当识别自己是服务器时 mailer应该使用的域名。这是对HELO(因为HELO是命令客户端发送服务来启动一个连接)域的调用。你通常应该使用顶级域名机制来发送e-mail,但这依赖于你的SMTP服务的设置(some don’t check, and some check to try to reduce spam and socalled open-relay issues)3、:user_name => and :password => 如果:authentication被设置则要求有此。4、:authentication => :plain,:login,或:cram_md中的一个。你的服务器管理员将帮助选择正确的选项。当前没使用TLS(SSL)来从Rails连接邮件服务器的方式。这个参数应该被忽略,如果你的服务器不要求确认。 创建一个mailer的models<code>class OrderMailer < ActionMailer::Base def signup(domain, sent_at = Time.now) @subject = 'Welcome to Beast' @body = "hello world" @recipients = "yyy@yyy.com" @from = 'yyy@yyy.com' @sent_on = sent_at @headers = {} endend</code>@subject:邮件标题@body:邮件正文可以使用html标签但需要设置参考下面@recipients:收件人可以接收数组进行群发多人发送:@recipients = [ "1@a.com","2@b.com"]@from:发件人@sent_on:用于设置邮件 Date: header的Time 对象@headers:一个header name/value 对的哈希望表,用于添加任意header行给邮件 如:@headers["Organization"] = "Pragmatic Programmers, LLC"既要使用HTML格式发送邮件又要增加附件的话,需要在model里就对content-type进行设置 @content-type=”text/html” 创建一个controller 用于发送邮件*def send_maileremail = OrderMailer.deliver_signup(request.host_with_port)Puts email.encoded #邮件内容打印#email = OrderMailer.create_signup(request.host_with_port)#email.set_content_type("text/html") 可在模型中设置#OrderMailer.deliver(email)#发送HTML格式的邮件的设置end *发送HTML模板邮件*在views中创建一个模板:_mail_content.rhtml ……model中的mailer类改成如下:def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} endcontroller中更改发送方法: def send_mail content =render_to_string :partial=>" mail_content "email = OrderMailer.create_signup(request.host_with_port,content) email.set_content_type("text/html") OrderMailer.deliver(email) render :text=>"发送成功" end render_to_string方法返回的是String 与render不同的是它返回后不会发送给客户端。 *发送附件 修改model中的mailer类,如下: def signup(domain,content,sent_at = Time.now) @subject = "xxx" @body = content @recipients = "xxx@xxx.com" @from = 'xxx@xxx.com' @sent_on = sent_at @headers = {} @data = "" File.open("D:\\Tools\\FastAIT.rar", "rb") { |fp| @data< } #参数的含义rb表示只读并且以二进制方式创建一个file对象 #不写r会出现丢失数据的问题,发送的附件也就被破坏了r'' Read-only, starts at beginning of file (default mode).只读,清除原有内容(默认方式)r+'' Read-write, starts at beginning of file.读写,清除原有内容w'' Write-only, truncates existing file to zero length or creates a new file for writing.只写,创建一个新的文件覆盖旧的w+'' Read-write, truncates existing file to zero length or creates a new file for reading and writing.读写,创建一个新的文件覆盖旧的a'' Write-only, starts at end of file if file exists, otherwise creates a new file for writing.只写,追加a+'' Read-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.读写,追加``b'' (DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).二进制模式 attachment :content_type => "application/rar", :filename => "FastAIT.rar" , :body => @data end邮件附件的content_type(内容类型表) ".asf" ContentType = "video/x-ms-asf" ".avi" ContentType = "video/avi" ".doc" ContentType = "application/msword" ".zip" ContentType = "application/zip" ".xls" ContentType = "application/vnd.ms-excel" ".gif" ContentType = "image/gif" ".jpg", "jpeg" ContentType = "image/jpeg" ".wav" ContentType = "audio/wav" ".mp3" ContentType = "audio/mpeg3" ".mpg", "mpeg" ContentType = "video/mpeg" ".rtf" ContentType = "application/rtf" ".htm", "html" ContentType = "text/html" ".txt" ContentType = "text/plain"".pdf" ContentType = "application/pdf" 其他 ContentType = "application/octet-stream"

    \n", "_id"=>81}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby中的方法调用", "body"=>"引言:张雪同学blog上的这个文章很是不错,从一个侧面展示了Ruby的一些和别的不一样的特性,显出了其灵活和强大,很值得仔细看看~会使得你对ruby中的方法调用更加理解~<br/><br />*来源:*for each_day in life: ruby中的方法调用<br />*地址:*http://blog.snowonrails.com/articles/2007/05/15/ruby%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8<br />*标题:*ruby中的方法调用<br />*内容摘要:*<br />和我一样许多习惯了java的程序员在刚刚开始接触ruby的时候对ruby当中的方法声名以及调用的方式会感到非常的奇怪和别扭。比如我们在ruby当中经常可以看到类似的方法声名 method(arg1, *args), 又如这样的方法 method2(arg2, &block), 等等。相比于java那明确简单的方法声名方式,ruby中的方法声名要灵活许多,下面就ruby当中常见的几种方法声名的形式,以及方法调用的方式做一个简要的总结:1. 首先,不同于java的方法声名,ruby中的方法可以接收的参数是可变的,而不是像java那样必须和方法声名中的参数类型相等,个数相等。当你希望ruby方法接收一个或者多个参数的时候,可在普通的参数名前放置一个星号(*),比如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">def </span><span class="method">varargs</span><span class="punct">(</span><span class="ident">arg1</span><span class="punct">,</span> <span class="punct">*</span><span class="ident">rest</span><span class="punct">)</span> “<span class="constant">Received</span> <span class="comment">\#{arg1} and \#{rest.join(', ')}”</span><span class="keyword">end</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and &quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two&quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;,&quot;</span><span class="string">three</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two, three&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p80</span></notextile></code></pre></div>在这里,varargs方法的第二个形参前有一个星号,表示将方法中第二个以后的所有参数都装到一个数组当中,然后赋值给rest. 所以当方法声名的参数前边又一个*的时候,代表:将方法调用时传入的所有<b>除之前已匹配完毕的参数外的剩余参数</b>放入一个Array并将其赋值给*后边的形参。2. 我们也经常会见到在方法声名的参数当中有“&args”的形式,比如<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">class </span><span class="class">TaxCalculator</span> <span class="keyword">def </span><span class="method">initialize</span><span class="punct">(</span><span class="ident">name</span><span class="punct">,&amp;</span><span class="ident">block</span><span class="punct">)</span> <span class="attribute">@name</span><span class="punct">,</span><span class="attribute">@block</span> <span class="punct">=</span> <span class="ident">name</span><span class="punct">,</span> <span class="ident">block</span> <span class="keyword">end</span> <span class="keyword">def </span><span class="method">get_tax</span><span class="punct">(</span><span class="ident">amount</span><span class="punct">)</span> <span class="punct">&quot;</span><span class="string"><span class="expr">\#{@name}</span> on <span class="expr">\#{amount}</span> = <span class="expr">\#{@block.call(amount)}</span></span><span class="punct">&quot;</span> <span class="keyword">end</span><span class="keyword">end</span><span class="ident">tc</span> <span class="punct">=</span> <span class="constant">TaxCalculator</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(&quot;</span><span class="string">Sales tax</span><span class="punct">&quot;){|</span><span class="ident">amt</span><span class="punct">|</span> <span class="ident">amt</span> <span class="punct">*</span> <span class="number">0.075</span><span class="punct">}</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">100</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 100 = 7.5&quot;</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">200</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 250 = 18.75&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p81</span></notextile></code></pre></div>当方法的<b>最后一个参数</b>前缀为&,那么改方法调用的后边可以跟一个block,同时方法会将block转换为一个Proc对象,然后赋值给该参数。3. 我们经常可以在rails的文档中看到这种方法声名:<div class="typocode"><pre><code class="typocode_ruby "><\nno\ntextile><span class="keyword">def </span><span class="method">method</span><span class="punct">(</span><span class="ident">id</span><span class="punct">,</span><span class="ident">option</span><span class="punct">={})</span> <span class="punct">...</span><span class="keyword">end</span></notextile></code></pre></div>然后我们调用的时候可以以任意的顺序传入key=>value hash pair 如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="ident">method</span><span class="punct">(</span><span class="number">5</span><span class="punct">,</span><span class="ident">key1</span><span class="punct">=&gt;</span><span class="ident">value1</span><span class="punct">,</span><span class="ident">key2</span><span class="punct">=&gt;</span><span class="ident">value2</span><span class="punct">,...)</span></notextile></code></pre></div>在参数列表中,<b>当hash参数在正常参数之后,并且位于任何数组或block参数之前</b>,我们就可以直接用key=>value对,而不用加{}。所有的这些key=>value对会被集合到一个hash,然后赋值给形参,传入方法。", "created_at"=>2007-06-25 21:00:54 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    引言:张雪同学blog上的这个文章很是不错,从一个侧面展示了Ruby的一些和别的不一样的特性,显出了其灵活和强大,很值得仔细看看~会使得你对ruby中的方法调用更加理解~<br/><br />来源:*for each_day in life: ruby中的方法调用<br />*地址:*http://blog.snowonrails.com/articles/2007/05/15/ruby%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8<br; />*标题:*ruby中的方法调用<br />*内容摘要:<br />和我一样许多习惯了java的程序员在刚刚开始接触ruby的时候对ruby当中的方法声名以及调用的方式会感到非常的奇怪和别扭。比如我们在ruby当中经常可以看到类似的方法声名 method(arg1, args), 又如这样的方法 method2(arg2, &block), 等等。相比于java那明确简单的方法声名方式,ruby中的方法声名要灵活许多,下面就ruby当中常见的几种方法声名的形式,以及方法调用的方式做一个简要的总结:1. 首先,不同于java的方法声名,ruby中的方法可以接收的参数是可变的,而不是像java那样必须和方法声名中的参数类型相等,个数相等。当你希望ruby方法接收一个或者多个参数的时候,可在普通的参数名前放置一个星号(),比如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">def </span><span class="method">varargs</span><span class="punct">(</span><span class="ident">arg1</span><span class="punct">,</span> <span class="punct"></span><span class="ident">rest</span><span class="punct">)</span> “<span class="constant">Received</span> <span class="comment">\#{arg1} and \#{rest.join(', ')}”</span><span class="keyword">end</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and &quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two&quot;</span><span class="ident">varargs</span><span class="punct">(&quot;</span><span class="string">one</span><span class="punct">&quot;,&quot;</span><span class="string">two</span><span class="punct">&quot;,&quot;</span><span class="string">three</span><span class="punct">&quot;)</span> <span class="comment">#=&gt;&quot;Received one and two, three&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p80</span></notextile></code></pre></div>在这里,varargs方法的第二个形参前有一个星号,表示将方法中第二个以后的所有参数都装到一个数组当中,然后赋值给rest. 所以当方法声名的参数前边又一个*的时候,代表:将方法调用时传入的所有<b>除之前已匹配完毕的参数外的剩余参数</b>放入一个Array并将其赋值给*后边的形参。2. 我们也经常会见到在方法声名的参数当中有“&args”的形式,比如<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="keyword">class </span><span class="class">TaxCalculator</span> <span class="keyword">def </span><span class="method">initialize</span><span class="punct">(</span><span class="ident">name</span><span class="punct">,&amp;</span><span class="ident">block</span><span class="punct">)</span> <span class="attribute">@name</span><span class="punct">,</span><span class="attribute">@block</span> <span class="punct">=</span> <span class="ident">name</span><span class="punct">,</span> <span class="ident">block</span> <span class="keyword">end</span> <span class="keyword">def </span><span class="method">get_tax</span><span class="punct">(</span><span class="ident">amount</span><span class="punct">)</span> <span class="punct">&quot;</span><span class="string"><span class="expr">\#{@name}</span> on <span class="expr">\#{amount}</span> = <span class="expr">\#{@block.call(amount)}</span></span><span class="punct">&quot;</span> <span class="keyword">end</span><span class="keyword">end</span><span class="ident">tc</span> <span class="punct">=</span> <span class="constant">TaxCalculator</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(&quot;</span><span class="string">Sales tax</span><span class="punct">&quot;){|</span><span class="ident">amt</span><span class="punct">|</span> <span class="ident">amt</span> <span class="punct"></span> <span class="number">0.075</span><span class="punct">}</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">100</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 100 = 7.5&quot;</span><span class="ident">tc</span><span class="punct">.</span><span class="ident">get_tax</span><span class="punct">(</span><span class="number">200</span><span class="punct">)</span> <span class="comment">#=&gt;&quot;Sales tax on 250 = 18.75&quot;</span>以上代码出自《<span class="ident">programming</span> <span class="ident">ruby</span> 中文版》<span class="ident">p81</span></notextile></code></pre></div>当方法的<b>最后一个参数</b>前缀为&,那么改方法调用的后边可以跟一个block,同时方法会将block转换为一个Proc对象,然后赋值给该参数。3. 我们经常可以在rails的文档中看到这种方法声名:<div class="typocode"><pre><code class="typocode_ruby "><
    \nno
    \ntextile><span class="keyword">def </span><span class="method">method</span><span class="punct">(</span><span class="ident">id</span><span class="punct">,</span><span class="ident">option</span><span class="punct">={})</span> <span class="punct">...</span><span class="keyword">end</span></notextile></code></pre></div>然后我们调用的时候可以以任意的顺序传入key=>value hash pair 如:<div class="typocode"><pre><code class="typocode_ruby "><notextile><span class="ident">method</span><span class="punct">(</span><span class="number">5</span><span class="punct">,</span><span class="ident">key1</span><span class="punct">=&gt;</span><span class="ident">value1</span><span class="punct">,</span><span class="ident">key2</span><span class="punct">=&gt;</span><span class="ident">value2</span><span class="punct">,...)</span></notextile></code></pre></div>在参数列表中,<b>当hash参数在正常参数之后,并且位于任何数组或block参数之前</b>,我们就可以直接用key=>value对,而不用加{}。所有的这些key=>value对会被集合到一个hash,然后赋值给形参,传入方法。

    \n", "_id"=>82}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"来,Rubyize你的代码~", "body"=>"了解Ruby语法的朋友应该对Ruby的语法和表达形式很惊叹,这都要归功与Ruby强大的表达能力,有的时候,把以前的写的不完善的代码Ruby化不仅能加深对Ruby的理解,还能提高代码质量,更加可读,或者说更加Ruby一些~好,下面举个例子来说明一下,希望有见解的朋友能分享你的写法。<code> def manage_ducks(ducks) if ducks == nil ducks = fetch_some_champions else unless ducks.won_stanley_cup? ducks = fetch_some_champions end end ducks.beat_random_opponent end</code>如果是刚刚解除Ruby的话,上面这段代码可能就是你写出来的,她虽然可行,但是一点都不符合ruby的风格,你将怎么改呢~请留言分享~", "created_at"=>2007-06-25 17:12:19 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    了解Ruby语法的朋友应该对Ruby的语法和表达形式很惊叹,这都要归功与Ruby强大的表达能力,有的时候,把以前的写的不完善的代码Ruby化不仅能加深对Ruby的理解,还能提高代码质量,更加可读,或者说更加Ruby一些~好,下面举个例子来说明一下,希望有见解的朋友能分享你的写法。<code> def manage_ducks(ducks) if ducks == nil ducks = fetch_some_champions else unless ducks.won_stanley_cup? ducks = fetch_some_champions end end ducks.beat_random_opponent end</code>如果是刚刚解除Ruby的话,上面这段代码可能就是你写出来的,她虽然可行,但是一点都不符合ruby的风格,你将怎么改呢~请留言分享~

    \n", "_id"=>83}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1可以下载了!", "body"=>"不好意思,今天出去有点事情,回来晚了点,结果就没能赶在0点之前发布,对不起了~现在可以下载了,为了保持1ster的ROR技术笔记氛围,不在这里提供下载了,将下载统一转到*1sters.com*站上,请大家前去下载,谢谢~为了再以后发布新版本的时候能迅速通知到大家,这次要求要下载的朋友提供邮箱,下次发布将第一时间通知各位,谢谢~下载页面:http://www.1sters.com/download谢谢大家支持~", "created_at"=>2007-06-24 08:50:02 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    不好意思,今天出去有点事情,回来晚了点,结果就没能赶在0点之前发布,对不起了~现在可以下载了,为了保持1ster的ROR技术笔记氛围,不在这里提供下载了,将下载统一转到*1sters.com*站上,请大家前去下载,谢谢~为了再以后发布新版本的时候能迅速通知到大家,这次要求要下载的朋友提供邮箱,下次发布将第一时间通知各位,谢谢~下载页面:http://www.1sters.com/download谢谢大家支持~

    \n", "_id"=>84}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"1stlog Version1.0.1即将发布~", "body"=>"1stlog Version1.0.1即将发布~1、添加一些必须的数据库初始化脚本2、完善定制模板的实现原理3、修复文件拷贝在UNIX下不工作的4、后台界面修改为中文的5、添加了一个Youtube的组件6、修改了模板定制的规范7、增加初次安装注册管理员8、制定组件编写规范包和文档都整理好了,实在太困了,明天发布吧~", "created_at"=>2007-06-23 08:29:01 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    1stlog Version1.0.1即将发布~1、添加一些必须的数据库初始化脚本2、完善定制模板的实现原理3、修复文件拷贝在UNIX下不工作的4、后台界面修改为中文的5、添加了一个Youtube的组件6、修改了模板定制的规范7、增加初次安装注册管理员8、制定组件编写规范包和文档都整理好了,实在太困了,明天发布吧~

    \n", "_id"=>85}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很棒的Find方法!", "body"=>"今天CFC问我有没有用过find(:all, :select => )这个用法,别说,还真没有用过,直接告诉我应该是可以取指定的字段。果不其然,比如我要取Contact表的id和name两个字段,可以有兩種寫法,一個是find,一個是find_by_sql,如下:<code>Contact.find(:all, :select => "id, name")Contact.find_by_sql("SELECT id, name FROM `contacts`")</code>这两种写法效果是一样的,怎么样,是不是比较棒呀?可能你还要问这个写法有什么好处呀?写过rails的朋友应该对它的Find方法很熟悉,但是Find是一次吧所有字段都取出来,如果字段内容比较多,会耗费很多的内存的哦,这样的话,我们只取需要的字段就OK了。你还有什么想法,欢迎留言讨论~", "created_at"=>2007-06-22 04:47:16 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    今天CFC问我有没有用过find(:all, :select => )这个用法,别说,还真没有用过,直接告诉我应该是可以取指定的字段。果不其然,比如我要取Contact表的id和name两个字段,可以有兩種寫法,一個是find,一個是find_by_sql,如下:<code>Contact.find(:all, :select => "id, name")Contact.find_by_sql("SELECT id, name FROM contacts")</code>这两种写法效果是一样的,怎么样,是不是比较棒呀?可能你还要问这个写法有什么好处呀?写过rails的朋友应该对它的Find方法很熟悉,但是Find是一次吧所有字段都取出来,如果字段内容比较多,会耗费很多的内存的哦,这样的话,我们只取需要的字段就OK了。你还有什么想法,欢迎留言讨论~

    \n", "_id"=>86}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"乱码,警惕编辑器的编码~", "body"=>"今天没什么事情,写个小的问题分析系统,在数据库初始化的时候,用了<code> def self.up create_table :priorities do |t| t.column :name, :string, :default => "" t.column :desc, :string, :default => "" end Priority.new(:name=>"一级",:desc=>"很紧急,4-8小时完成").save Priority.new(:name=>"二级",:desc=>"紧急,8-24小时完成").save Priority.new(:name=>"三级",:desc=>"一般,24-48小时完成").save Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save Priority.new(:name=>"不详",:desc=>"不详").save end</code>遇到下列错误bq. ./db/migrate//003_create_priorities.rb:10: Invalid char `\\274' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\266' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\262' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\273' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\275' in expression./db/migrate//003_create_priorities.rb:10: syntax error, unexpected tIDENTIFIER, expecting kEND Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save真是ft,感觉是编码的问题,我数据库用的是UTF-8呀,我在environment.rb也加了$KCODE = 'u' require 'jcode'了呀,我在application.rb也写了:configure_charsets了下,我在数据库配置文件也加了encoding: utf8了呀。这个问题搞得我一肚子火,最后想到了,还有一处编码需要注意,那就是文件的编码,也就是把radrails的editor默认字符集改成utf-8。寒~真是ft,大家遇到类似问题千万记住呀,需要检查下面几个地方~ # 数据库编码 # application.rb # environment.rb # database.yml", "created_at"=>2007-06-22 02:37:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    今天没什么事情,写个小的问题分析系统,在数据库初始化的时候,用了<code> def self.up create_table :priorities do |t| t.column :name, :string, :default => "" t.column :desc, :string, :default => "" end Priority.new(:name=>"一级",:desc=>"很紧急,4-8小时完成").save Priority.new(:name=>"二级",:desc=>"紧急,8-24小时完成").save Priority.new(:name=>"三级",:desc=>"一般,24-48小时完成").save Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save Priority.new(:name=>"不详",:desc=>"不详").save end</code>遇到下列错误bq. ./db/migrate//003_create_priorities.rb:10: Invalid char \\274' in expression./db/migrate//003_create_priorities.rb:10: Invalid char\\266' in expression./db/migrate//003_create_priorities.rb:10: Invalid char \\262' in expression./db/migrate//003_create_priorities.rb:10: Invalid char\\273' in expression./db/migrate//003_create_priorities.rb:10: Invalid char `\\275' in expression./db/migrate//003_create_priorities.rb:10: syntax error, unexpected tIDENTIFIER, expecting kEND Priority.new(:name=>"四级",:desc=>"不紧急,48小时以上").save真是ft,感觉是编码的问题,我数据库用的是UTF-8呀,我在environment.rb也加了$KCODE = 'u' require 'jcode'了呀,我在application.rb也写了:configure_charsets了下,我在数据库配置文件也加了encoding: utf8了呀。这个问题搞得我一肚子火,最后想到了,还有一处编码需要注意,那就是文件的编码,也就是把radrails的editor默认字符集改成utf-8。寒~真是ft,大家遇到类似问题千万记住呀,需要检查下面几个地方~ # 数据库编码 # application.rb # environment.rb # database.yml

    \n", "_id"=>87}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"关于HAML的一点点想法~", "body"=>"大清早的,CFC就给我推荐HAML,说未来必将流行,这个东西以前我关注过,无非是使用一种规定的标记来替代RHTML,在显示的时候反向解析(这是我的理解),CFC给我看了他写的一篇文章(没有找到单篇的RSS,只能COPY过来啦=="),内容如下:---------------------------最近開始接觸HAML在Rails中,預設使用ERb來當作模板描述語言,可是這樣寫個人認為非常醜也非常累...而之前看到HAML時感覺到那東西似乎沒有太大的可用性,難道要Designer也學Ruby嗎?不過後來我想通了..架構這部分可以給Coder作,Designer乖乖設計CSS就夠了..來看看底下這個Sample吧:*這是rhtml*<code><div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p> <%= print_information %> </p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div></code>*這是HAML*<code> #content .left.column %h2 Welcome to our site! %p= print_information .right.column= render :partial => "sidebar"</code>看!少了多少行?可以讓開發速度變快耶= v =...最主要的是,看起來也比較美觀了!--------------------------说说偶的看法:(基本上是不推荐的)1、多了一次解析反解析,效果难道不受影响(除非是直接解析成html)2、难道要Designer也學Ruby嗎?同问?3、我把RHTML分成 局部模板,单个文件就不会很大,也很简单。4、美观么?ruby本来是不强制缩进的,这个东西还要求缩进~=_=~有谁再给出一些理由呢?", "created_at"=>2007-06-21 17:32:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    大清早的,CFC就给我推荐HAML,说未来必将流行,这个东西以前我关注过,无非是使用一种规定的标记来替代RHTML,在显示的时候反向解析(这是我的理解),CFC给我看了他写的一篇文章(没有找到单篇的RSS,只能COPY过来啦=="),内容如下:---------------------------最近開始接觸HAML在Rails中,預設使用ERb來當作模板描述語言,可是這樣寫個人認為非常醜也非常累...而之前看到HAML時感覺到那東西似乎沒有太大的可用性,難道要Designer也學Ruby嗎?不過後來我想通了..架構這部分可以給Coder作,Designer乖乖設計CSS就夠了..來看看底下這個Sample吧:這是rhtml<code><div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p> <%= printinformation %> </p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div></code>這是HAML<code> #content .left.column %h2 Welcome to our site! %p= print_information .right.column= render :partial => "sidebar"</code>看!少了多少行?可以讓開發速度變快耶= v =...最主要的是,看起來也比較美觀了!--------------------------说说偶的看法:(基本上是不推荐的)1、多了一次解析反解析,效果难道不受影响(除非是直接解析成html)2、难道要Designer也學Ruby嗎?同问?3、我把RHTML分成 局部模板,单个文件就不会很大,也很简单。4、美观么?ruby本来是不强制缩进的,这个东西还要求缩进~==~有谁再给出一些理由呢?

    \n", "_id"=>88}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于rails启动报500错误的可能问题点", "body"=>"当你启动rails的时候可能会遇到500错误“500- Premature end of script.”或者类似的错误,使得程序跑不起来~问题可能出在两个地方: 1、 The file permissions are not set to allow the dispatch.cgi to execute properly. Chmod the dispatch.cgi to +0755+. 2、The path to Ruby is is incorrect in the dispatch.cgi file. The first line of the file is called the shebang-- it sets the location of the intrepretor (in this case ruby). Change the shebang to the correct path to Ruby (/usr/bin/ruby). The first line of the dispatch.cgi file should look like this: #!/usr/bin/ruby", "created_at"=>2007-06-19 19:24:55 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    当你启动rails的时候可能会遇到500错误“500- Premature end of script.”或者类似的错误,使得程序跑不起来~问题可能出在两个地方: 1、 The file permissions are not set to allow the dispatch.cgi to execute properly. Chmod the dispatch.cgi to +0755+. 2、The path to Ruby is is incorrect in the dispatch.cgi file. The first line of the file is called the shebang-- it sets the location of the intrepretor (in this case ruby). Change the shebang to the correct path to Ruby (/usr/bin/ruby). The first line of the dispatch.cgi file should look like this: #!/usr/bin/ruby

    \n", "_id"=>89}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中用Gmail发送邮件", "body"=>"在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html", "created_at"=>2007-06-18 20:25:43 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在rails中配置发送邮件还是比较简单的,但是由于rails还不支持TLS,也就是说默认的情况下是不可以通过gmail来发送邮件的,还好,老外改写了一个类库,使得我们可以使用gmail来发送了。步骤如下:1、把附件smtp_tls.rb放在你的/lib/smtp_tls.rb下。2.然后在你的environment.rb中添加require ‘smtp_tls’3.配置邮件服务器<code>ActionMailer::Base.server_settings = {:address => "smtp.gmail.com",:port => "587",:domain => "localhost.localdomain",:authentication => :plain,:user_name => "someusername",:password => "somepassword"}</code>需要注意的是,该版本只支持ruby1.8.4及其以上版本。参考:http://blog.pomozov.info/posts/how-to-send-actionmailer-mails-to-gmailcom.html

    \n", "_id"=>90}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)二期功能收集整理", "body"=>"

    技能云(iTechTag)从策划到一期的实现,经历了不少的波折,现在终于稳定,就朋友们的反应来看还是比较认同的,都认为是个很好的Idea,也有很多人鼓励支持我,很是激动,于是再接再厉,收集整理第二期需求,并加快开发速度。
    \n
    \n目前已经有好几个朋友提到了几个不错的功能,记录于此,以免遗忘,我们会筛选优先级加以实现,谢谢这些给我建议的朋友,也希望更多的人能提一些建议和意见,您的关注将激励我不断前行。
    \n
    \n庄表伟:
    \n一个非常榜的主意!我曾经有另一个类似的设想,每个人都有一个地方记录自己的项目经验和教训。比如:多少人做了一个项目,在哪些方面是成功的,在哪些方面是失败的。
    \n
    \n冰云:
    \n我曾经也有类似的想法。不妨考虑把个人的经历组织起来,形成一个人的视图。这个视图可以看作是个人门户,包括做过的项目(可以查看做过这个项目的还有谁),写的blog(从个人blog来聚合),参与的论坛(例如JavaEye),发表过的文章,别人的评价等等。综合起来可以提供信息给其他网站,例如获取一个人的简历,或者别人对他的评价 。
    \n
    \nIceskYsl:

    \n

    维护公司的基本信息,比如可以修改该公司的地址,简介,等等。。考虑提供对其公司的评价,顶、踩等功能,以展示该公司在大家心目中的样子,而求职者一些游泳的参考。
    \n
    \nIceskYsl:
    \n生成简历, 个人简历生成。
    \n
    \nDavid:
    \n把个人技能做成论坛前面图片。
    \n
    \n霍泰稳:
    \n做项目肯定会遇到各种各样的问题
    \n而项目经理的问题差不多
    \n他们肯定想和有类似问题的人交流

    ", "created_at"=>2007-09-05 06:19:00 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    技能云(iTechTag)从策划到一期的实现,经历了不少的波折,现在终于稳定,就朋友们的反应来看还是比较认同的,都认为是个很好的Idea,也有很多人鼓励支持我,很是激动,于是再接再厉,收集整理第二期需求,并加快开发速度。
    \n
    \n目前已经有好几个朋友提到了几个不错的功能,记录于此,以免遗忘,我们会筛选优先级加以实现,谢谢这些给我建议的朋友,也希望更多的人能提一些建议和意见,您的关注将激励我不断前行。
    \n
    \n庄表伟:
    \n一个非常榜的主意!我曾经有另一个类似的设想,每个人都有一个地方记录自己的项目经验和教训。比如:多少人做了一个项目,在哪些方面是成功的,在哪些方面是失败的。
    \n
    \n冰云:
    \n我曾经也有类似的想法。不妨考虑把个人的经历组织起来,形成一个人的视图。这个视图可以看作是个人门户,包括做过的项目(可以查看做过这个项目的还有谁),写的blog(从个人blog来聚合),参与的论坛(例如JavaEye),发表过的文章,别人的评价等等。综合起来可以提供信息给其他网站,例如获取一个人的简历,或者别人对他的评价 。
    \n
    \nIceskYsl:
    \n维护公司的基本信息,比如可以修改该公司的地址,简介,等等。。考虑提供对其公司的评价,顶、踩等功能,以展示该公司在大家心目中的样子,而求职者一些游泳的参考。
    \n
    \nIceskYsl:
    \n生成简历, 个人简历生成。
    \n
    \nDavid:
    \n把个人技能做成论坛前面图片。
    \n
    \n霍泰稳:
    \n做项目肯定会遇到各种各样的问题
    \n而项目经理的问题差不多
    \n他们肯定想和有类似问题的人交流

    \n", "_id"=>91}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"为技能云的绽放贡献自己的力量!", "body"=>"

    技能云上线测试这么些天来,得到不少朋友的支持和鼓励,不少朋友甚至还特意写了文章介绍过,在此表示感谢,一下列举几篇我看到的推荐“技能云”的几篇文章,如果你曾写过关于“技能云”的文章,请通过回复让我们知晓,谢谢!
    \n
    \n个人品牌:程序同人,我们的声望被严重低估了。(小容)
    \niTechTag: 重建软件开发者的声望(透明思考)
    \niTechTag:声望创造价值(透明之眼)
    \niTechTag:声望创造价值(透明思考@CSDN)
    \niTechTag: 记录程序员的声望(敏捷中国)

    \n

    为了让这朵“技能云”更好的绽放,欢迎也感谢所有写过介绍、推荐、说明“技能云”的文章,如果你写了一篇关于“技能云”的文章,请让我们知道,一起见证它的绽放!

    ", "created_at"=>2007-09-05 07:08:32 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    技能云上线测试这么些天来,得到不少朋友的支持和鼓励,不少朋友甚至还特意写了文章介绍过,在此表示感谢,一下列举几篇我看到的推荐“技能云”的几篇文章,如果你曾写过关于“技能云”的文章,请通过回复让我们知晓,谢谢!
    \n
    \n个人品牌:程序同人,我们的声望被严重低估了。(小容)
    \niTechTag: 重建软件开发者的声望(透明思考)
    \niTechTag:声望创造价值(透明之眼)
    \niTechTag:声望创造价值(透明思考@CSDN)
    \niTechTag: 记录程序员的声望(敏捷中国)
    \n为了让这朵“技能云”更好的绽放,欢迎也感谢所有写过介绍、推荐、说明“技能云”的文章,如果你写了一篇关于“技能云”的文章,请让我们知道,一起见证它的绽放!

    \n", "_id"=>92}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没通宵了,偶尔来下还行!", "body"=>"

    上学那会经常通宵写程序、做设计、编稿子等,特别是那年暑假的时候几乎完全是颠倒的,太阳升起的时候我准时出门去“过早”,而后回宿舍睡觉到下午3点,吃点东西去球场,也挺不错的;

    \n

    工作后就没有怎么那么晚了,偶尔周末的时候晚一点,但是会在凌晨3点前睡觉,为了自己给某些人的承诺,也为了自己不那么快的衰老(谁说熬夜会衰老的),尽管每次都抓紧时间写代码,做设计,但是很久都不曾通宵了。

    \n

    今天项目组升级现网,做为项目开发组接口,需要留下来配合SS升级,从晚上7点开始一直干到早上8点多,几十台服务器,十几个子系统的升级,浩浩荡荡呀,虽然出现了一些问题,但是还好有惊无险,一切都还顺利。

    \n

    敲了24小时的键盘了,手指都不灵活了~好久不曾通宵~

    ", "created_at"=>2007-09-05 20:20:11 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    上学那会经常通宵写程序、做设计、编稿子等,特别是那年暑假的时候几乎完全是颠倒的,太阳升起的时候我准时出门去“过早”,而后回宿舍睡觉到下午3点,吃点东西去球场,也挺不错的;
    \n工作后就没有怎么那么晚了,偶尔周末的时候晚一点,但是会在凌晨3点前睡觉,为了自己给某些人的承诺,也为了自己不那么快的衰老(谁说熬夜会衰老的),尽管每次都抓紧时间写代码,做设计,但是很久都不曾通宵了。
    \n今天项目组升级现网,做为项目开发组接口,需要留下来配合SS升级,从晚上7点开始一直干到早上8点多,几十台服务器,十几个子系统的升级,浩浩荡荡呀,虽然出现了一些问题,但是还好有惊无险,一切都还顺利。
    \n敲了24小时的键盘了,手指都不灵活了~好久不曾通宵~

    \n", "_id"=>93}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新注册了一个NET域名~", "body"=>"

    偶以前创办的“天马行空技术组(1.S.T)”的域名到期了,几个朋友说天马需要革新了,于是大家决定从头再来,一个暂新的开始,于是我们打算改变,原来的域名1steam.cn不打算续费了,大家一致同意采用新的域名1sters.net,我们重新开始。

    \n

    正好装上芒果,立即申请下这个域名,然后做指向,再翻出N久N久前偶和另外一个朋友整的一个logo图片;再去阿里妈妈申请了个帐号,拿来一个广告,一起放在主页上,至于里面的东西,我们会按照讨论的模式重新开始。

    \n

    至于是什么杨的模式,不久后就可见分晓,不多言,有兴趣的朋友继续关注1sters.net的发展。

    \n

    附录:1.S.T简介

    \n

    天马行空(1.S.T),是一个纯技术型研究小组,如同天马自由自在、灵气十足。 主要致力于软件开发、Web设计、网络安全及其相关技术的学习和研究;纯小组成员个人爱好,无任何商业赢利成份.

    \n

    小组坚持原创,追求自由;小组成员平等互助,一起进步;诣在塑造一个和平轻松,自由快乐的环境,我们的梦想是有一天,我们都可以在个人喜好的领域扬眉吐气,天马行空...

    ", "created_at"=>2007-09-05 21:00:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    偶以前创办的“天马行空技术组(1.S.T)”的域名到期了,几个朋友说天马需要革新了,于是大家决定从头再来,一个暂新的开始,于是我们打算改变,原来的域名1steam.cn不打算续费了,大家一致同意采用新的域名1sters.net,我们重新开始。
    \n正好装上芒果,立即申请下这个域名,然后做指向,再翻出N久N久前偶和另外一个朋友整的一个logo图片;再去阿里妈妈申请了个帐号,拿来一个广告,一起放在主页上,至于里面的东西,我们会按照讨论的模式重新开始。
    \n至于是什么杨的模式,不久后就可见分晓,不多言,有兴趣的朋友继续关注1sters.net的发展。
    \n附录:1.S.T简介
    \n天马行空(1.S.T),是一个纯技术型研究小组,如同天马自由自在、灵气十足。 主要致力于软件开发、Web设计、网络安全及其相关技术的学习和研究;纯小组成员个人爱好,无任何商业赢利成份.
    \n小组坚持原创,追求自由;小组成员平等互助,一起进步;诣在塑造一个和平轻松,自由快乐的环境,我们的梦想是有一天,我们都可以在个人喜好的领域扬眉吐气,天马行空...

    \n", "_id"=>94}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"有惊无险,玩心跳~", "body"=>"

    昨天夜里通宵,今天回家睡觉,中午醒来的时候打开电脑突然发现“技能云”和“第一次”均无法打开,寒呀,急呀,怎么回事,一切来的都太突然了。

    \n

    我记得早上睡觉的时候还是好好的呢,抓紧解决中。。

    \n

    google一批资料均没有什么大的作用,应该不会是我配置的问题吧,先前可以跑的嘛,google到的资料一般说的就下面:

    \n

    修改plublic目录下的dispatch.*的三个文件中的头为服务器上ruby的路径,如bluehost是”/usr/bin/ruby”

    \n

    还是不行,真是见鬼了,后来直接rails mygod生成一个,把上面几个文件连同.htaccess搞下来看看,有点不一样,急忙替换上去后,重启后,技能云终于可以访问,比较下异同,最大的区别就是这句:

    \n

    RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

    \n

    原来使用的是dispatch.fcgi的,难道这个也。。奇怪中。。

    \n

    还发SMS给偶兄弟彭了呢,把他从半路上搞了回来,真囧~

    ", "created_at"=>2007-09-06 08:01:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    昨天夜里通宵,今天回家睡觉,中午醒来的时候打开电脑突然发现“技能云”和“第一次”均无法打开,寒呀,急呀,怎么回事,一切来的都太突然了。
    \n我记得早上睡觉的时候还是好好的呢,抓紧解决中。。
    \ngoogle一批资料均没有什么大的作用,应该不会是我配置的问题吧,先前可以跑的嘛,google到的资料一般说的就下面:
    \n修改plublic目录下的dispatch.的三个文件中的头为服务器上ruby的路径,如bluehost是”/usr/bin/ruby”
    \n还是不行,真是见鬼了,后来直接rails mygod生成一个,把上面几个文件连同.htaccess搞下来看看,有点不一样,急忙替换上去后,重启后,技能云终于可以访问,比较下异同,最大的区别就是这句:
    \nRewriteRule ^(.
    )$ dispatch.cgi [QSA,L]
    \n原来使用的是dispatch.fcgi的,难道这个也。。奇怪中。。
    \n还发SMS给偶兄弟彭了呢,把他从半路上搞了回来,真囧~

    \n", "_id"=>95}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"最近好多事情~", "body"=>"

    最近好多事情,业余的事情进展很缓慢~项目的事情好多,设计,编码,

    \n

    升级,部署,扩容,一大堆了,一个patch加上一个patch,一个版本接着一个版本,快顶不主了,都~ 觉得都是重复劳动,做这样的事情不是我的性格和风格,也不符合我追寻的风格。

    \n

    还记得有人说过:现实中可以稍微的低头,但是心目中的那个脑袋一定要是高昂着的。

    ", "created_at"=>2007-09-10 11:59:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    最近好多事情,业余的事情进展很缓慢~项目的事情好多,设计,编码,
    \n升级,部署,扩容,一大堆了,一个patch加上一个patch,一个版本接着一个版本,快顶不主了,都~ 觉得都是重复劳动,做这样的事情不是我的性格和风格,也不符合我追寻的风格。
    \n还记得有人说过:现实中可以稍微的低头,但是心目中的那个脑袋一定要是高昂着的。

    \n", "_id"=>96}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PS命令查看进程详细参数~", "body"=>"

    遇到一个问题需要查看下当前进程中执行到哪条命令了,于是

    \n

    使用ps -ef | grep java,无奈看不全参数,于是google,请教了下其他同学,得到:

    \n
    \n
    LUNIX代码
    \n
      \n
    1. ps -auxww | more  
    2. \n
    \n
    ", "created_at"=>2007-09-11 02:13:51 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    遇到一个问题需要查看下当前进程中执行到哪条命令了,于是
    \n使用ps -ef | grep java,无奈看不全参数,于是google,请教了下其他同学,得到:
    \n
    \nLUNIX代码
    \n
    \n ps -auxww | more  
    \n

    \n", "_id"=>97}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)下一步需要实现的功能!", "body"=>"

    恩,做互联网,尤其是做web2的人都知道beta是什么意思,技能云的理想模式也是web2的,所以也一直在beta阶段。

    \n

    也许透明同学说的对“可以说很快,大概两周就上线了;也可以说一直没有开发完,不断的在提高和改善。这也是web 2.0的特点,永远都在beta。"

    \n

    初步规划了下当前最需求的功能如下:

    \n

    1、简历生成 -本来打算导出PDF的,但是ruby中我采用了FPDF来生成,总体效果还不错,但是不能自动换行和英文字符的显示都存在一些问题,于是打算先生成HTNL格式的好了。

    \n

    2、通知功能  -当一个新功能上线的时候,可以给用户发送通知mail告诉他这个新功能,以及其使用,附带其他一些话语。

    \n

    3、邀请成员  --这个很重要,现在发完一个项目后,往往就提交项目后自己加入了,但是项目的 其他人并不知道,于是需要这个功能,使得可以针对项目发出邀请。输入对方的mail和你需要说的话,附带上项目URL已经注册,登录URL等发给被邀请者。

    \n

    4、用户自定义  --需要给用户提供定制功能,比如是否需要接收新功能通知等。

    \n

    先就规划这么多,快速实现之再规划下一步需要的功能~

    ", "created_at"=>2007-09-11 03:21:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    恩,做互联网,尤其是做web2的人都知道beta是什么意思,技能云的理想模式也是web2的,所以也一直在beta阶段。
    \n也许透明同学说的对“可以说很快,大概两周就上线了;也可以说一直没有开发完,不断的在提高和改善。这也是web 2.0的特点,永远都在beta。"
    \n初步规划了下当前最需求的功能如下:
    \n1、简历生成 -本来打算导出PDF的,但是ruby中我采用了FPDF来生成,总体效果还不错,但是不能自动换行和英文字符的显示都存在一些问题,于是打算先生成HTNL格式的好了。
    \n2、通知功能  -当一个新功能上线的时候,可以给用户发送通知mail告诉他这个新功能,以及其使用,附带其他一些话语。
    \n3、邀请成员  --这个很重要,现在发完一个项目后,往往就提交项目后自己加入了,但是项目的 其他人并不知道,于是需要这个功能,使得可以针对项目发出邀请。输入对方的mail和你需要说的话,附带上项目URL已经注册,登录URL等发给被邀请者。
    \n4、用户自定义  --需要给用户提供定制功能,比如是否需要接收新功能通知等。
    \n先就规划这么多,快速实现之再规划下一步需要的功能~

    \n", "_id"=>98}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)的简历功能已经完成.", "body"=>"

    今天在家休息,自然想到正好有时间把技能云的简历功能添加上,于是衣服都没来得及穿好就抱出本本干活,开点音乐,let's coding...\"\"

    \n

    按照和透明同学讨论的结果,生成简历属于紧急需求,于是经过简单的规划设计就开始了,在技能云的简历是按照技能云记载的你参与的项目自动生成的,辅助其他一些信息,比如你掌握的技能和扮演过的角色,生成一份能真实的展现自我实力的简历。

    \n

    目前还不允许个人编辑自己的简历,这个后期看情况可能会加入(还要看情况),目前看不到这个需求。针对这个功能,还请各位提提意见和建议,以更加符合大家的口味,谢谢。

    \n

    如想看看效果,可以看这里是我的简历,其他人的简历,你可以在他们的介绍页面看到,登录后在最上方可以看到自己简历的链接,希望大家喜欢这个功能。

    ", "created_at"=>2007-09-13 03:15:43 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    今天在家休息,自然想到正好有时间把技能云的简历功能添加上,于是衣服都没来得及穿好就抱出本本干活,开点音乐,let's coding...
    \n按照和透明同学讨论的结果,生成简历属于紧急需求,于是经过简单的规划设计就开始了,在技能云的简历是按照技能云记载的你参与的项目自动生成的,辅助其他一些信息,比如你掌握的技能和扮演过的角色,生成一份能真实的展现自我实力的简历。
    \n目前还不允许个人编辑自己的简历,这个后期看情况可能会加入(还要看情况),目前看不到这个需求。针对这个功能,还请各位提提意见和建议,以更加符合大家的口味,谢谢。
    \n如想看看效果,可以看这里是我的简历,其他人的简历,你可以在他们的介绍页面看到,登录后在最上方可以看到自己简历的链接,希望大家喜欢这个功能。

    \n", "_id"=>99}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(一):tar和gzip及其压缩相关~", "body"=>"

    老是忘记,干脆记下来好了~

    \n

    最简提示:
    \ntar zxvf XXXX.tar.gz
    \ntar jxvf XXXX tar.bz2
    \n1.压缩一组文件为tar.gz后缀。
    \n# tar cvf backup.tar /etc #gzip -q backup.tar
    \n或
    \n# tar cvfz backup.tar.gz /etc/
    \n
    \n2.释放一个后缀为tar.gz的文件。
    \n#gunzip backup.tar.gz #tar xvf backup.tar
    \n或
    \n# tar xvfz backup.tar.gz
    \n
    \n3.用一个命令完成压缩
    \n#tar cvf - /etc/ | gzip -qc > backup.tar.gz
    \n4.用一个命令完成释放
    \n# gunzip -c backup.tar.gz | tar xvf -
    \n
    \n5.如何解开tar.Z的文件?
    \n# tar xvfz backup.tar.Z 或 # uncompress backup.tar.Z #tar xvf backup.tar
    \n
    \n6.如何解开.tgz文件?
    \n#gunzip backup.tgz
    \n
    \n7.如何压缩和解压缩.bz2的包?
    \n#bzip2 /etc/smb.conf
    \n这将压缩文件smb.conf成smb.conf.bz2
    \n#bunzip2 /etc/smb.conf.bz2
    \n这将在当前目录下还原smb.conf.bz2为smb.conf
    \n
    \n(bzip2 -d也一样)
    \n注: .bz2压缩格式不是很常用,你可以man bzip2

    ", "created_at"=>2007-09-15 02:05:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    老是忘记,干脆记下来好了~
    \n最简提示:
    \ntar zxvf XXXX.tar.gz
    \ntar jxvf XXXX tar.bz2
    \n1.压缩一组文件为tar.gz后缀。

    \n\n

    tar cvf backup.tar /etc #gzip -q backup.tar

    \n\n

    \n\n

    tar cvfz backup.tar.gz /etc/

    \n\n

    2.释放一个后缀为tar.gz的文件。

    \n\n

    gunzip backup.tar.gz #tar xvf backup.tar

    \n\n

    \n\n

    tar xvfz backup.tar.gz

    \n\n

    3.用一个命令完成压缩

    \n\n

    tar cvf - /etc/ | gzip -qc > backup.tar.gz

    \n\n

    4.用一个命令完成释放

    \n\n

    gunzip -c backup.tar.gz | tar xvf -

    \n\n

    5.如何解开tar.Z的文件?

    \n\n

    tar xvfz backup.tar.Z 或 # uncompress backup.tar.Z #tar xvf backup.tar

    \n\n

    6.如何解开.tgz文件?

    \n\n

    gunzip backup.tgz

    \n\n

    7.如何压缩和解压缩.bz2的包?

    \n\n

    bzip2 /etc/smb.conf

    \n\n

    这将压缩文件smb.conf成smb.conf.bz2

    \n\n

    bunzip2 /etc/smb.conf.bz2

    \n\n

    这将在当前目录下还原smb.conf.bz2为smb.conf
    \n
    \n(bzip2 -d也一样)
    \n注: .bz2压缩格式不是很常用,你可以man bzip2

    \n", "_id"=>100}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决ubuntu下的rails开发时mysql的问题!", "body"=>"今天开电脑的时候没有注意选择,直接重启到前几天装的ubuntu下,于是懒得重新启动了,于是就在 ubuntu下继续开发好了,rails环境前几天就搭建好了,也测试过了,于是把源代码copy过来,重启后,初始化数据库,页面显示乱码,进数据库看看也是乱码,看来是有点问题。于是google了一把,抓住关键点,很快就解决了,以前在win下出现过乱码都解决了,所以这里针对ubuntu上的问题:1、配置sock地址另外还可能会出现一个错误No such file or directory - /tmp/mysql.sock这个是因为在ubuntu下默认的mysql是如上位置,于是在database.ym里面需要重新设置一下就ok了,如下:SQL代码 1. development: 2. adapter: mysql 3. database: sdroad_development 4. username: root 5. password: 6. host: localhost 7. socket: /var/run/mysqld/mysqld.sock 2、改变mysql编码,如下:1.) 修改mysql的配置文件 sudo gedit /etc/mysql/my.cnf在[client]下面增加 default-character=utf82. )在mysql shell下建立数据库.create database 1ster default character set utf8;*同时发表:*http://weblog.1ster.cn/?action=show&id=153", "created_at"=>2007-07-30 19:47:59 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    今天开电脑的时候没有注意选择,直接重启到前几天装的ubuntu下,于是懒得重新启动了,于是就在 ubuntu下继续开发好了,rails环境前几天就搭建好了,也测试过了,于是把源代码copy过来,重启后,初始化数据库,页面显示乱码,进数据库看看也是乱码,看来是有点问题。于是google了一把,抓住关键点,很快就解决了,以前在win下出现过乱码都解决了,所以这里针对ubuntu上的问题:1、配置sock地址另外还可能会出现一个错误No such file or directory - /tmp/mysql.sock这个是因为在ubuntu下默认的mysql是如上位置,于是在database.ym里面需要重新设置一下就ok了,如下:SQL代码 1. development: 2. adapter: mysql 3. database: sdroad_development 4. username: root 5. password: 6. host: localhost 7. socket: /var/run/mysqld/mysqld.sock 2、改变mysql编码,如下:1.) 修改mysql的配置文件 sudo gedit /etc/mysql/my.cnf在[client]下面增加 default-character=utf82. )在mysql shell下建立数据库.create database 1ster default character set utf8;*同时发表:*http://weblog.1ster.cn/?action=show&id=153;

    \n", "_id"=>101}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rails笔记 active controller", "body"=>"别人写的一篇文章,推荐整理下,如下地址:http://weblog.1ster.cn/?action=show&id=150", "created_at"=>2007-07-30 19:45:51 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    别人写的一篇文章,推荐整理下,如下地址:http://weblog.1ster.cn/?action=show&id=150;

    \n", "_id"=>102}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Magick操作数据库blog字段的图像!", "body"=>"一直不是很喜欢用一些插件,一来觉得没有必要使用那么复杂的,一些特色功能我们完全可以写代码完成,比如用Magick操作图片等等,就很方便和简单;以前说过如何处理磁盘上的图片,今天看看如何用Magick操作数据库中blob字段的图片,看代码就明白咯,如果对你有用,记得谢谢我哈:)Ruby代码 1. #这个是用来生成用户图像的 2. def picture 3. @user = User.find(params[:id]) 4. image = Magick::Image::from_blob(@user.data).first 5. # clown = Magick::Image.read(.read).first 6. image.crop_resized!(60, 60, Magick::NorthGravity) 7. send_data(image.to_blob, 8. :filename => @user.nickname, 9. :type => @user.content_type, 10. :disposition => "inline") 11. end 有不明白的就留言问哈。同时发表于:http://weblog.1ster.cn/?action=show&id=145", "created_at"=>2007-07-30 19:43:53 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一直不是很喜欢用一些插件,一来觉得没有必要使用那么复杂的,一些特色功能我们完全可以写代码完成,比如用Magick操作图片等等,就很方便和简单;以前说过如何处理磁盘上的图片,今天看看如何用Magick操作数据库中blob字段的图片,看代码就明白咯,如果对你有用,记得谢谢我哈:)Ruby代码 1. #这个是用来生成用户图像的 2. def picture 3. @user = User.find(params[:id]) 4. image = Magick::Image::from_blob(@user.data).first 5. # clown = Magick::Image.read(.read).first 6. image.crop_resized!(60, 60, Magick::NorthGravity) 7. send_data(image.to_blob, 8. :filename => @user.nickname, 9. :type => @user.content_type, 10. :disposition => "inline") 11. end 有不明白的就留言问哈。同时发表于:http://weblog.1ster.cn/?action=show&id=145;

    \n", "_id"=>103}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"10 Great New Ruby / Rails Screencasts from July 2007", "body"=>"这里列举了十个很不错的视频教程,但是都是老外的,打击可以看看,很不错的!http://www.rubyinside.com/12-great-new-ruby-rails-screencasts-from-july-2007-566.html", "created_at"=>2007-07-29 17:32:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这里列举了十个很不错的视频教程,但是都是老外的,打击可以看看,很不错的!http://www.rubyinside.com/12-great-new-ruby-rails-screencasts-from-july-2007-566.html

    \n", "_id"=>104}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"mongrel启动时报错的解决", "body"=>"记不得时候在本地机子上安装了mongrel,今天把1stlog用mongrel运行时,报告:-e:3:in `load': no such file to load -- mongrel_rails (LoadError)\tfrom -e:3看错误提示貌似mongrel_rails 这个加载不到,那么应该就是配置的问题了,问题解决如下:找到RadRails的 preferences > Rails > configuration ,在这里指定mongrel_rails的路径就可以了(注意不是bat也不是cmd,而是那个没有后缀的)ok,解决了,如果有谁遇到这个问题,也算帮忙了。呵呵。。。", "created_at"=>2007-07-20 16:55:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    记不得时候在本地机子上安装了mongrel,今天把1stlog用mongrel运行时,报告:-e:3:in `load': no such file to load -- mongrel_rails (LoadError) from -e:3看错误提示貌似mongrel_rails 这个加载不到,那么应该就是配置的问题了,问题解决如下:找到RadRails的 preferences > Rails > configuration ,在这里指定mongrel_rails的路径就可以了(注意不是bat也不是cmd,而是那个没有后缀的)ok,解决了,如果有谁遇到这个问题,也算帮忙了。呵呵。。。

    \n", "_id"=>105}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"警惕rails中的保留字带来的问题~", "body"=>"这个问题还真一直没有关注过,只是晓得rails和ruby中有些关键字、保留字,也没太注意,昨天开始遇到一个很奇怪的问题,我建立了一个用来存放友情链接的表links,里面有title,desc,*type*,created_at等字段,然后在controller中取记录的时候类似如下语句: @friend_links = Link.find(:all, :conditions => { :type => 1, :visible => 1 })貌似一切都很平常,却发生如下的错误:compile errorD:/soft/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1358: syntax errorObject::1一切都很平常呀,试着换个find的写法,还是一样出问题,真是够邪门的~!然后今天问了几个朋友,也说奇怪,没有遇到过,还好google还是找到了这个问题的根源:保留字。请注意,这里我使用了一个保留字*type*做为字段名,导致这个错误的发生,就像一个朋友这样解释的一样:Its because *type *is a reserved word, so you'll have to change that column's name (perhaps to kind or something). Otherwise you're code looks fine wink.大家以后一定要注意,这个小问题浪费了不少时间~", "created_at"=>2007-07-12 05:10:19 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这个问题还真一直没有关注过,只是晓得rails和ruby中有些关键字、保留字,也没太注意,昨天开始遇到一个很奇怪的问题,我建立了一个用来存放友情链接的表links,里面有title,desc,*type*,created_at等字段,然后在controller中取记录的时候类似如下语句: @friend_links = Link.find(:all, :conditions => { :type => 1, :visible => 1 })貌似一切都很平常,却发生如下的错误:compile errorD:/soft/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1358: syntax errorObject::1一切都很平常呀,试着换个find的写法,还是一样出问题,真是够邪门的~!然后今天问了几个朋友,也说奇怪,没有遇到过,还好google还是找到了这个问题的根源:保留字。请注意,这里我使用了一个保留字*type*做为字段名,导致这个错误的发生,就像一个朋友这样解释的一样:Its because *type *is a reserved word, so you'll have to change that column's name (perhaps to kind or something). Otherwise you're code looks fine wink.大家以后一定要注意,这个小问题浪费了不少时间~

    \n", "_id"=>106}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"服务器坏掉了~", "body"=>"

    真是闹心,坏了好几天了,还没有好~~

    \n

    可怜的技能云才上线两天就挂掉了,实在悲哀。。

    \n

    什么时间才能好呀~~

    ", "created_at"=>2007-08-23 16:31:17 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    真是闹心,坏了好几天了,还没有好~~
    \n可怜的技能云才上线两天就挂掉了,实在悲哀。。
    \n什么时间才能好呀~~

    \n", "_id"=>107}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)上线了~", "body"=>"

    服务器的事情总算差不多了,以前的数据还是导不出来(暗暗的郁闷一下,也对某些人BS一下),现在换了新的服务器;

    \n

    还请注册过的朋友重新注册,这次我们不会再丢失数据了(每天都有备份),谢谢各位大理支持~

    \n

    如果发现Bug或者有其他一些建议、意见,欢迎交流~

    ", "created_at"=>2007-08-28 01:25:49 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    服务器的事情总算差不多了,以前的数据还是导不出来(暗暗的郁闷一下,也对某些人BS一下),现在换了新的服务器;
    \n还请注册过的朋友重新注册,这次我们不会再丢失数据了(每天都有备份),谢谢各位大理支持~
    \n如果发现Bug或者有其他一些建议、意见,欢迎交流~

    \n", "_id"=>108}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Blog换服务器了!", "body"=>"

    在没有自己独立服务器器的日志里,我只能搬来搬去,原来是和技能云放在一个老外的空间里面的,但是觉得有点慢,且对PHP的二级目录支持不好,很多图片都看不到。

    \n

    于是联系了浪子兄弟暂时寄存在这里,数据随手备份,方便有自己服务器的时候可以迁移。

    \n

    感谢浪子。

    ", "created_at"=>2007-09-04 15:21:07 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在没有自己独立服务器器的日志里,我只能搬来搬去,原来是和技能云放在一个老外的空间里面的,但是觉得有点慢,且对PHP的二级目录支持不好,很多图片都看不到。
    \n于是联系了浪子兄弟暂时寄存在这里,数据随手备份,方便有自己服务器的时候可以迁移。
    \n感谢浪子。

    \n", "_id"=>109}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转透明:iTechTag:声望创造价值", "body"=>"
    \n

    本文是透明同学为“技能云”写的介绍,看完热血沸腾,转过来激励不断的完善技能云。

    \n

    以前在JavaEye的一个讨论里,有位同志说“简历嘛,大家都知道,肯定是有水分的”。于是我在另一个blog里说到,简历里唯一有意义的,就是工作经历。认真回想一下,我在看应聘者的简历时,也基本上不看基本信息、自我评价之类的,只看工作经历:做过什么项目,用过什么技术,比说什么“熟练”、“精通”要有意义得多。我的期望、我的评估、整个后续的面试过程都是围绕着工作经历来展开的。

    \n

    求职者的工作经历,这份信息对于潜在雇主有价值。但这份价值在求职者自己身上实现了多少?作为软件开发者,不妨问问自己:还有谁记得你几年前完成的那些“不可能的任务”?还有谁记得你通宵加班为项目做出的贡献?还有谁记得客户和领导曾给你的赞扬?有多少求贤若渴的潜在雇主想要知道你曾经那些了不起的成就,却无从获取这些信息?那么这份信息的价值去了哪里?我们把工作经历告诉了谁?是的,我们把工作经历写在简历里,把简历放在了招聘网站;而招聘网站把我们的简历锁起来,把我们的工作经历信息卖给潜在雇主。我们的工作经历,去给招聘网站创造价值了。

    \n

    并非所有行业都是这样的。就拿电影来说吧,除了导演和演员以外,一部好电影离不开无数的幕后英雄:灯光、音乐、武指、剪辑……不过这些幕后英雄并没有因为身处幕后而被埋没,他们的名字出现在影片的演职员表里,展现在所有观众的眼前。当大导演想要拍下一部大影片时,他立即就能想到自己喜欢哪部影片里的配乐,然后立即就能找出这个配乐的人。幕后英雄们的每一段工作经历不仅给自己带来收入,还积累成为自己的声望,为自己打开了未来的门。

    \n

    iTechTag的目标就是让软件开发者的工作经历真正成为自己的声望,让声望给我们自己创造价值。我们希望记录下自己辛勤工作的成果,并与他人分享我们的骄傲。我们希望让别人知道我们掌握什么技能、参与过什么项目、帮助过什么客户、做出过什么贡献。我们希望让自己、让同事、让朋友、让所有关注我们的人有机会了解:我们是多么优秀的软件开发者。
    \n把这样一朵“技能云”贴在自己的blog旁边,向所有人炫耀自己的强大技能和丰富经验,让自己的声望开始发挥价值。这就是iTechTag想要给你的。

    \n
    ", "created_at"=>2007-09-04 15:45:01 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    本文是透明同学为“技能云”写的介绍,看完热血沸腾,转过来激励不断的完善技能云。
    \n以前在JavaEye的一个讨论里,有位同志说“简历嘛,大家都知道,肯定是有水分的”。于是我在另一个blog里说到,简历里唯一有意义的,就是工作经历。认真回想一下,我在看应聘者的简历时,也基本上不看基本信息、自我评价之类的,只看工作经历:做过什么项目,用过什么技术,比说什么“熟练”、“精通”要有意义得多。我的期望、我的评估、整个后续的面试过程都是围绕着工作经历来展开的。
    \n求职者的工作经历,这份信息对于潜在雇主有价值。但这份价值在求职者自己身上实现了多少?作为软件开发者,不妨问问自己:还有谁记得你几年前完成的那些“不可能的任务”?还有谁记得你通宵加班为项目做出的贡献?还有谁记得客户和领导曾给你的赞扬?有多少求贤若渴的潜在雇主想要知道你曾经那些了不起的成就,却无从获取这些信息?那么这份信息的价值去了哪里?我们把工作经历告诉了谁?是的,我们把工作经历写在简历里,把简历放在了招聘网站;而招聘网站把我们的简历锁起来,把我们的工作经历信息卖给潜在雇主。我们的工作经历,去给招聘网站创造价值了。
    \n并非所有行业都是这样的。就拿电影来说吧,除了导演和演员以外,一部好电影离不开无数的幕后英雄:灯光、音乐、武指、剪辑……不过这些幕后英雄并没有因为身处幕后而被埋没,他们的名字出现在影片的演职员表里,展现在所有观众的眼前。当大导演想要拍下一部大影片时,他立即就能想到自己喜欢哪部影片里的配乐,然后立即就能找出这个配乐的人。幕后英雄们的每一段工作经历不仅给自己带来收入,还积累成为自己的声望,为自己打开了未来的门。
    \niTechTag的目标就是让软件开发者的工作经历真正成为自己的声望,让声望给我们自己创造价值。我们希望记录下自己辛勤工作的成果,并与他人分享我们的骄傲。我们希望让别人知道我们掌握什么技能、参与过什么项目、帮助过什么客户、做出过什么贡献。我们希望让自己、让同事、让朋友、让所有关注我们的人有机会了解:我们是多么优秀的软件开发者。
    \n把这样一朵“技能云”贴在自己的blog旁边,向所有人炫耀自己的强大技能和丰富经验,让自己的声望开始发挥价值。这就是iTechTag想要给你的。

    \n", "_id"=>110}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails上使用ruby来发Jabber消息~", "body"=>"

    近日考虑一个新的需求,希望在技能云上加上一种IM的支持,可以直接对Gtalk之类的发消息,自然是用ruby实现,于是google到一些资料,如下:
    \n
    \n参考:
    \nxmpp4r文档:
    \nhttp://home.gna.org/xmpp4r/rdoc/
    \n
    \n一个老外写了三篇文章:
    \nhttp://devblog.famundo.com/articles/category/xmpp4r-jabber
    \n
    \njavaeye上的一个例子:
    \nhttp://danoyang.javaeye.com/blog/67884
    \n
    \n一个日本人写的例子:
    \nhttp://d.hatena.ne.jp/technohippy/20070803#1186104969
    \n
    \n另外还可以使用xmpp4r-simple:
    \nhttp://romeda.org/blog/2006/11/announcing-jabbersimple.html

    ", "created_at"=>2007-09-15 08:05:20 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    近日考虑一个新的需求,希望在技能云上加上一种IM的支持,可以直接对Gtalk之类的发消息,自然是用ruby实现,于是google到一些资料,如下:
    \n
    \n参考:
    \nxmpp4r文档:
    \nhttp://home.gna.org/xmpp4r/rdoc/
    \n
    \n一个老外写了三篇文章:
    \nhttp://devblog.famundo.com/articles/category/xmpp4r-jabber
    \n
    \njavaeye上的一个例子:
    \nhttp://danoyang.javaeye.com/blog/67884
    \n
    \n一个日本人写的例子:
    \nhttp://d.hatena.ne.jp/technohippy/20070803#1186104969
    \n
    \n另外还可以使用xmpp4r-simple:
    \nhttp://romeda.org/blog/2006/11/announcing-jabbersimple.html

    \n", "_id"=>111}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"How do I install my own Gems?", "body"=>"

    BH 上缺少了一些我需要的gem,于是需要自己安装,BH允许把Gems安装到自己的目录下,于是找了些资料,操作步骤如下:

    \n

    The easiest and fastest way to install Ruby gems is to install them in your local directory, you will need shell access. To install your own gems use the following steps:
    \n
    \n1) Using File Manager in your cPanel make a copy of the .bashrc file in your root directory, name it .bashrc.bak.
    \n2) Now edit the .bashrc file and add the following to the end of the file:

    \n
    \n
    lunix代码
    \n
      \n
    1. export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin"  
    2. \n
    3. export GEM_HOME="$HOME/.gems"  
    4. \n
    5. export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"  
    6. \n
    7.   
    8. \n
    9. export GEM_CACHE=”$GEM_HOME/cache” 
      \n
    10. \n
    \n
    \n

    3) Using your favorite SSH client connect to your site.
    \n
    \n4) at the prompt type:
    \n
    \ncp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ./
    \ngem install sources-0.0.1.gem
    \ngem update -y
    \n
    \nThis will update rails to the latest version and install it to your local gem directory.
    \n
    \n5) When using a rails application, make sure you add the following to your ./config/environment.rb:
    \n
    \nENV['GEM_PATH'] = '/path/to/your/home/.gems:/usr/lib/ruby/gems/1.8'
    \n
    \n这里还有一个帖子,可以参考下:
    \nhttp://www.bluehostforum.com/showthread.php?t=1064

    \n

     

    \n

    另外:还可以把在本地安装好gem后把其copy到Vendor目录下,但是这个方法我不喜欢,不晓得能不能直接把gem包copy到Vendor目录下?试过的告诉下下,多谢!

    ", "created_at"=>2007-09-17 07:39:53 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    BH 上缺少了一些我需要的gem,于是需要自己安装,BH允许把Gems安装到自己的目录下,于是找了些资料,操作步骤如下:
    \nThe easiest and fastest way to install Ruby gems is to install them in your local directory, you will need shell access. To install your own gems use the following steps:
    \n
    \n1) Using File Manager in your cPanel make a copy of the .bashrc file in your root directory, name it .bashrc.bak.
    \n2) Now edit the .bashrc file and add the following to the end of the file:
    \n
    \nlunix代码
    \n
    \n export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin"  
    \n export GEM_HOME="$HOME/.gems"  
    \n export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"  
    \n   
    \n export GEM_CACHE=”$GEM_HOME/cache” 
    \n
    \n
    \n
    \n3) Using your favorite SSH client connect to your site.
    \n
    \n4) at the prompt type:
    \n
    \ncp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ./
    \ngem install sources-0.0.1.gem
    \ngem update -y
    \n
    \nThis will update rails to the latest version and install it to your local gem directory.
    \n
    \n5) When using a rails application, make sure you add the following to your ./config/environment.rb:
    \n
    \nENV['GEM_PATH'] = '/path/to/your/home/.gems:/usr/lib/ruby/gems/1.8'
    \n
    \n这里还有一个帖子,可以参考下:
    \nhttp://www.bluehostforum.com/showthread.php?t=1064
    \n 
    \n另外:还可以把在本地安装好gem后把其copy到Vendor目录下,但是这个方法我不喜欢,不晓得能不能直接把gem包copy到Vendor目录下?试过的告诉下下,多谢!

    \n", "_id"=>112}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"郁闷的事情,Blue上的XMPP4R竟然连不出来..", "body"=>"

    本来已经突破最后一个难题以为搞定了这个XMOO4R的使用,在本地测试很顺利,无奈的是在bluehost上就是不成功,开始因为上面没有安装XMPP4R,后来突破了这个后,还是不行,错误如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. Processing PeopleController#notify_in_gtalk (for 121.35.109.40 at 2007-09-17 09:02:42) [GET]  
    2. \n
    3.   Session ID: 192fbe2f031b846cbcba5fad37f32228  
    4. \n
    5.   Parameters: {"action"=>"notify_in_gtalk""controller"=>"people"}  
    6. \n
    7.   SQL (0.000151)   SET NAMES 'utf8'  
    8. \n
    9.   SQL (0.000047)   SET SQL_AUTO_IS_NULL=0  
    10. \n
    11.   SQL (0.000000)   Mysql::Error: Query was empty:   
    12. \n
    13.   
    14. \n
    15.   
    16. \n
    17. Errno::ETIMEDOUT (Connection timed out - connect(2)):  
    18. \n
    19.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `initialize' 
    20. \n
    21.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `new'  
    22. \n
    23.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in `connect' 
    24. \n
    25.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:73:in `connect'  
    26. \n
    27.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:60:in `connect' 
    28. \n
    29.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in `each'  
    30. \n
    31.     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in `connect' 
    32. \n
    33.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:390:in `connect!'  
    34. \n
    35.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:322:in `client' 
    36. \n
    37.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:331:in `send!'  
    38. \n
    39.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:147:in `status' 
    40. \n
    41.     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:90:in `initialize'  
    42. \n
    43.     /app/controllers/people_controller.rb:122:in `new' 
    44. \n
    45.     /app/controllers/people_controller.rb:122:in `notify_in_gtalk'  
    46. \n
    47.     /usr/lib/ruby/gems/1.8/gems  
    48. \n
    \n
    \n真是郁闷,我估计是BH上的限制,明天发个mail问问,但愿可以搞定,好想有一台自己的服务器哦。。

    ", "created_at"=>2007-09-17 15:46:17 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    本来已经突破最后一个难题以为搞定了这个XMOO4R的使用,在本地测试很顺利,无奈的是在bluehost上就是不成功,开始因为上面没有安装XMPP4R,后来突破了这个后,还是不行,错误如下:
    \n
    \n
    \nRuby代码
    \n
    \n Processing PeopleController#notify_in_gtalk (for 121.35.109.40 at 2007-09-17 09:02:42) [GET]  
    \n   Session ID: 192fbe2f031b846cbcba5fad37f32228  
    \n   Parameters: {"action"=>"notify_in_gtalk", "controller"=>"people"}  
    \n   SQL (0.000151)   SET NAMES 'utf8'  
    \n   SQL (0.000047)   SET SQL_AUTO_IS_NULL=0  
    \n   SQL (0.000000)   Mysql::Error: Query was empty:   
    \n   
    \n   
    \n Errno::ETIMEDOUT (Connection timed out - connect(2)):  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in initialize</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in&nbsp;
    new'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/connection.rb:53:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:73:in&nbsp;
    connect'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:60:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in&nbsp;
    each'  
    \n     /home/liquidch/ruby/gems/gems/xmpp4r-0.3/lib/xmpp4r/client.rb:58:in connect</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:390:in&nbsp;
    connect!'  
    \n     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:322:in client</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:331:in&nbsp;
    send!'  
    \n     /vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:147:in status</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/vendor/plugins/xmpp4r-simple-0.8.7/lib/xmpp4r-simple.rb:90:in&nbsp;
    initialize'  
    \n     /app/controllers/people_controller.rb:122:in </span><span class="keyword">new</span><span class="string">'</span>&nbsp;</span></li>
    \n <li class="alt"><span><span class="string">&nbsp;&nbsp;&nbsp;&nbsp;/app/controllers/people_controller.rb:122:in&nbsp;
    notify_in_gtalk'  
    \n     /usr/lib/ruby/gems/1.8/gems  
    \n
    \n
    \n真是郁闷,我估计是BH上的限制,明天发个mail问问,但愿可以搞定,好想有一台自己的服务器哦。。

    \n", "_id"=>113}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"weblogic性能调优", "body"=>"

    注:在下面做的介绍都是以Weblogic8.1为例的,其它版本的Weblogic可能会有些许不同。
    \n
    \n1) 设置JAVA参数;
    \na) 编辑Weblogic Server启动脚本文件;
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startWebLogic.cmd(startWebLogic.sh on Unix) 
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startManagedWebLogic.cmd(startManagedWebLogic.sh on Unix) --这个是做集群的时候用的
    \nb) 编辑set JAVA_OPTIONS命令,如:set JAVA_OPTIONS=-Xms256m –Xmx256m;
    \n(在UNIX下把MEM_ARGS="-Xms1024m -Xmx1024m -Xmn128m"加到上述两个.sh文件中即可)
    \nc) 保存,重启即可。
    \n注:在WebLogic中,为了获得更好的性能,BEA公司推荐最小Java堆等于最大Java堆。
    \n(这个偶们的设置都是1024M的,反正偶们内存大大的4G呢)
    \n
    \n2) 开发模式 vs. 产品模式;
    \n开发模式和产品模式的一些参数的默认值不同,可能会对性能造成影响,下面是对性能有影响的参数列表:

    \n

    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    参数开发模式默认值产品模式默认值
    Execute Queue: Thread Count15 threads25 threads
    JDBC Connection Pool: MaxCapacity15 connnections25 connections
    \n
    \n通过启动管理控制台,在域(如:mydomain)> 配置 > 常规选择产品模式。
    \n(这个在创建weblogic的domain的时候是有选择的,选择“产品”模式就可以了,如果后期需要修改,可以按照上面的方法修改)
    \n
    \n3) 尽量开启本地I/O;

    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 配置 > 调整选择启用本地I/O。
    \n注:此值也可通过手动的修改config.xml配置文件。
    \n(这个没有试验过,不晓得有什么效果和好处,知道的告诉偶下下。)
    \n
    \n4) 调优执行队列线程;
    \na) 修改默认执行线程数
    \n在这里,执行队列的线程数表示执行队列能够同时执行的操作的数量。但此值不是设的越大越好,应该恰到好处的去设置它,太小了,执行队列中将会积累很多待处理的任务,太大了,则会消耗大量的系统资源从而影响整体的性能。在产品模式下默认为25个执行线程。
    \n(点:一般来说,其上限是每个CPU对应50个线程,其按照CPU个数线性增长.)
    \n
    \n为了设置理想的执行队列的线程数,我们可以启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 监视 > 性能中监控最大负载时执行队列的吞吐量和队列中的等待请求数,据此确定理想的数值。
    \n理想的默认执行线程数是由多方面的因素决定的,比如机器CPU性能、总体体系架构、I/O、操作系统的进程调度机制、JVM的线程调度机制。随着CPU个数的增加,WebLogic可以近乎线性地提高线程数。线程数越多,花费在线程切换的时间也就越多;线程数越小,CPU可能无法得到充分的利用。为获取一个理想的线程数,需要经过反复的测试。在测试中,可以以25*CPU个数为基准进行调整。当空闲线程较少,CPU利用率较低时,可以适当增加线程数的大小(每五个递增)。对于PC Server和Windows 2000,则最好每个CPU小于50个线程,以CPU利用率为90%左右为最佳。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置中修改线程计数。
    \n
    \nb) 设定执行队列的溢出条件;
    \n    Weblogic Server提供给默认的执行队列或用户自定义的执行队列自定义溢出条件的功能,当满足此溢出条件时,服务器改变其状态为“警告”状态,并且额外的再分配一些线程去处理在队列中的请求,而达到降低队列长度的目的。
    \n    通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置下面几项:
    \n●队列长度:此值表示执行队列中可容纳的最大请求数,默认值是65536,最后不要手动改变此值。
    \n●队列长度阈值百分比:此值表示溢出条件,在此服务器指出队列溢出之前可以达到的队列长度大小的百分比。
    \n●线程数增加:当检测到溢出条件时,将增加到执行队列中的线程数量。如果CPU和内存不是足够的高,尽量不要改变默认值“0”。因为Weblogic一旦增加后不会自动缩减,虽然最终可能确实起到了降低请求的作用,但在将来的运行中将影响程序的性能。
    \n●最大线程数:为了防止创建过多的线程数量,可以通过设定最大的线程数进行控制。
    \n在实际的应用场景中,应根据具体情况适当的调整以上参数。
    \n
    \nc) 设定执行队列监测行为
    \nWeblogic Server能够自动监测到当一个执行线程变为“阻塞”。变为“阻塞”状态的执行线程将无法完成当前的工作,也无法再执行新请求。如果执行队列中的所有执行线程都变为“阻塞”状态,Weblogic server可能改变状态为“警告”或“严重”状态。如果Weblogic server变为“严重”状态,可以通过Node Manager来自动关闭此服务器并重新启动它。具体请参考:Node Manager Capabilities文档。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置下面几项:
    \n●阻塞线程最长时间:在此服务器将线程诊断为阻塞线程之前,线程必须连续工作的时间长度(秒)。默认情况下,WebLogic Server 认为线程在连续工作 600 秒后成为阻塞线程。
    \n●阻塞线程计时器间隔:WebLogic Server 定期扫描线程以查看它们是否已经连续工作了 "阻塞线程最长时间" 字段中指定的时间长度的间隔时间(秒)。默认情况下,WebLogic Server 将此时间间隔设置为 600 秒。
    \n
    \n5) 调优TCP连接缓存数;
    \nWebLogic Server用Accept Backlog参数规定服务器向操作系统请求的队列大小,默认值为50。当系统重载负荷时,这个值可能过小,日志中报Connection Refused,导致有效连接请求遭到拒绝,此时可以提高Accept Backlog 25%直到连接拒绝错误消失。对于Portal类型的应用,默认值往往是不够的。
    \nLogin Timeout和SSL Login Timeout参数表示普通连接和SSL连接的超时时间,如果客户连接被服务器中断或者SSL容量大,可以尝试增加该值。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置“接受预备连接”。
    \n
    \n6) 改变Java编译器;
    \n标准的Java编译器是javac,但编译JSP servlets速度太慢,为了提高编译速度,可以使用sj或jikes编译器取代javac编译器。下面说说更改Java编译器:
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 常规下改变Java 编译器,默认为javac。输入完整路径,如:c:\\visualcafe31\\bin\\sj.exe。然后打开高级选项,在预规划到类路径填写编译 Java 代码时为 Java 编译器类路径预规划的选项,如:BEA_HOME\\jdk141_02\\jre\\lib\\rt.jar。
    \n
    \n7) 使用Webogic Server集群提高性能;
    \n具体关于如何配置Weblogic集群,我就不细说了。详情可参考:Introduction to WebLogic Server Clustering。
    \n
    \n8) Weblogic EJB调优
    \n由于EJB2.0已经很少项目在用了,EJB3.0再成熟一点,我再补充这一部分吧!
    \n
    \n9) JDBC应用调优
    \nJDBC Connection Pool的调优受制于WebLogic Server线程数的设置和数据库进程数,游标的大小。通常我们在一个线程中使用一个连接,所以连接数并不是越多越好,为避免两边的资源消耗,建议设置连接池的最大值等于或者略小于线程数。同时为了减少新建连接的开销,将最小值和最大值设为一致。
    \n增加Statement Cache Size对于大量使用PreparedStatement对象的应用程序很有帮助,WebLogic能够为每一个连接缓存这些对象,此值默认为10。在保证数据库游标大小足够的前提下,可以根据需要提高Statement Cache Size。比如当你设置连接数为25,Cache Size为10时,数据库可能需要打开25*10=250个游标。不幸的是,当遇到与PreparedStatement Cache有关的应用程序错误时,你需要将Cache Size设置为0。
    \n尽管JDBC Connection Pool提供了很多高级参数,在开发模式下比较有用,但大部分在生产环境下不需调整。这里建议最好不要设置测试表, 同时Test Reserved Connections和Test Released Connections也无需勾上。 当然如果你的数据库不稳定,时断时续,你就可能需要上述的参数打开。
    \n最后提一下驱动程序类型的选择,以Oracle为例,Oracle提供thin驱动和oci驱动,从性能上来讲,oci驱动强于thin驱动,特别是大数据量的操作。但在简单的数据库操作中,性能相差不大,随着thin驱动的不断改进,这一弱势将得到弥补。而thin驱动的移植性明显强于oci驱动。所以在通常情况下建议使用thin驱动。而最新驱动器由于WebLogic server/bin目录下的类包可能不是最新的,请以Oracle网站为准: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html。
    \n
    \n10) JSP调优
    \n设置jsp-param pageCheckSeconds=-1;
    \n设置serlet-reload-check=-1或ServletReloadCheckSecs=-1;
    \n设置jsp-param precompile=true,关闭JSP预编译选项。

    ", "created_at"=>2007-09-18 02:58:44 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    注:在下面做的介绍都是以Weblogic8.1为例的,其它版本的Weblogic可能会有些许不同。
    \n
    \n1) 设置JAVA参数;
    \na) 编辑Weblogic Server启动脚本文件;
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startWebLogic.cmd(startWebLogic.sh on Unix) 
    \nBEA_HOME\\user_projects\\domains\\domain-name\\startManagedWebLogic.cmd(startManagedWebLogic.sh on Unix) --这个是做集群的时候用的
    \nb) 编辑set JAVA_OPTIONS命令,如:set JAVA_OPTIONS=-Xms256m –Xmx256m;
    \n(在UNIX下把MEM_ARGS="-Xms1024m -Xmx1024m -Xmn128m"加到上述两个.sh文件中即可)
    \nc) 保存,重启即可。
    \n注:在WebLogic中,为了获得更好的性能,BEA公司推荐最小Java堆等于最大Java堆。
    \n(这个偶们的设置都是1024M的,反正偶们内存大大的4G呢)
    \n
    \n2) 开发模式 vs. 产品模式;
    \n开发模式和产品模式的一些参数的默认值不同,可能会对性能造成影响,下面是对性能有影响的参数列表:
    \n
    \n
    \n
    \n
    \n 参数
    \n 开发模式默认值
    \n 产品模式默认值
    \n
    \n
    \n Execute Queue: Thread Count
    \n 15 threads
    \n 25 threads
    \n
    \n
    \n JDBC Connection Pool: MaxCapacity
    \n 15 connnections
    \n 25 connections
    \n
    \n
    \n
    \n
    \n通过启动管理控制台,在域(如:mydomain)> 配置 > 常规选择产品模式。
    \n(这个在创建weblogic的domain的时候是有选择的,选择“产品”模式就可以了,如果后期需要修改,可以按照上面的方法修改)
    \n
    \n3) 尽量开启本地I/O;
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 配置 > 调整选择启用本地I/O。
    \n注:此值也可通过手动的修改config.xml配置文件。
    \n(这个没有试验过,不晓得有什么效果和好处,知道的告诉偶下下。)
    \n
    \n4) 调优执行队列线程;
    \na) 修改默认执行线程数
    \n在这里,执行队列的线程数表示执行队列能够同时执行的操作的数量。但此值不是设的越大越好,应该恰到好处的去设置它,太小了,执行队列中将会积累很多待处理的任务,太大了,则会消耗大量的系统资源从而影响整体的性能。在产品模式下默认为25个执行线程。
    \n(点:一般来说,其上限是每个CPU对应50个线程,其按照CPU个数线性增长.)
    \n
    \n为了设置理想的执行队列的线程数,我们可以启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> 监视 > 性能中监控最大负载时执行队列的吞吐量和队列中的等待请求数,据此确定理想的数值。
    \n理想的默认执行线程数是由多方面的因素决定的,比如机器CPU性能、总体体系架构、I/O、操作系统的进程调度机制、JVM的线程调度机制。随着CPU个数的增加,WebLogic可以近乎线性地提高线程数。线程数越多,花费在线程切换的时间也就越多;线程数越小,CPU可能无法得到充分的利用。为获取一个理想的线程数,需要经过反复的测试。在测试中,可以以25*CPU个数为基准进行调整。当空闲线程较少,CPU利用率较低时,可以适当增加线程数的大小(每五个递增)。对于PC Server和Windows 2000,则最好每个CPU小于50个线程,以CPU利用率为90%左右为最佳。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置中修改线程计数。
    \n
    \nb) 设定执行队列的溢出条件;
    \n    Weblogic Server提供给默认的执行队列或用户自定义的执行队列自定义溢出条件的功能,当满足此溢出条件时,服务器改变其状态为“警告”状态,并且额外的再分配一些线程去处理在队列中的请求,而达到降低队列长度的目的。
    \n    通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)> Execute Queue > weblogic.kernel.Defalt > 配置下面几项:
    \n●队列长度:此值表示执行队列中可容纳的最大请求数,默认值是65536,最后不要手动改变此值。
    \n●队列长度阈值百分比:此值表示溢出条件,在此服务器指出队列溢出之前可以达到的队列长度大小的百分比。
    \n●线程数增加:当检测到溢出条件时,将增加到执行队列中的线程数量。如果CPU和内存不是足够的高,尽量不要改变默认值“0”。因为Weblogic一旦增加后不会自动缩减,虽然最终可能确实起到了降低请求的作用,但在将来的运行中将影响程序的性能。
    \n●最大线程数:为了防止创建过多的线程数量,可以通过设定最大的线程数进行控制。
    \n在实际的应用场景中,应根据具体情况适当的调整以上参数。
    \n
    \nc) 设定执行队列监测行为
    \nWeblogic Server能够自动监测到当一个执行线程变为“阻塞”。变为“阻塞”状态的执行线程将无法完成当前的工作,也无法再执行新请求。如果执行队列中的所有执行线程都变为“阻塞”状态,Weblogic server可能改变状态为“警告”或“严重”状态。如果Weblogic server变为“严重”状态,可以通过Node Manager来自动关闭此服务器并重新启动它。具体请参考:Node Manager Capabilities文档。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置下面几项:
    \n●阻塞线程最长时间:在此服务器将线程诊断为阻塞线程之前,线程必须连续工作的时间长度(秒)。默认情况下,WebLogic Server 认为线程在连续工作 600 秒后成为阻塞线程。
    \n●阻塞线程计时器间隔:WebLogic Server 定期扫描线程以查看它们是否已经连续工作了 "阻塞线程最长时间" 字段中指定的时间长度的间隔时间(秒)。默认情况下,WebLogic Server 将此时间间隔设置为 600 秒。
    \n
    \n5) 调优TCP连接缓存数;
    \nWebLogic Server用Accept Backlog参数规定服务器向操作系统请求的队列大小,默认值为50。当系统重载负荷时,这个值可能过小,日志中报Connection Refused,导致有效连接请求遭到拒绝,此时可以提高Accept Backlog 25%直到连接拒绝错误消失。对于Portal类型的应用,默认值往往是不够的。
    \nLogin Timeout和SSL Login Timeout参数表示普通连接和SSL连接的超时时间,如果客户连接被服务器中断或者SSL容量大,可以尝试增加该值。
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 调整下可配置“接受预备连接”。
    \n
    \n6) 改变Java编译器;
    \n标准的Java编译器是javac,但编译JSP servlets速度太慢,为了提高编译速度,可以使用sj或jikes编译器取代javac编译器。下面说说更改Java编译器:
    \n通过启动管理控制台,在域(如:mydomain)> 服务器 > server实例(如:myserver)>配置 > 常规下改变Java 编译器,默认为javac。输入完整路径,如:c:\\visualcafe31\\bin\\sj.exe。然后打开高级选项,在预规划到类路径填写编译 Java 代码时为 Java 编译器类路径预规划的选项,如:BEA_HOME\\jdk141_02\\jre\\lib\\rt.jar。
    \n
    \n7) 使用Webogic Server集群提高性能;
    \n具体关于如何配置Weblogic集群,我就不细说了。详情可参考:Introduction to WebLogic Server Clustering。
    \n
    \n8) Weblogic EJB调优
    \n由于EJB2.0已经很少项目在用了,EJB3.0再成熟一点,我再补充这一部分吧!
    \n
    \n9) JDBC应用调优
    \nJDBC Connection Pool的调优受制于WebLogic Server线程数的设置和数据库进程数,游标的大小。通常我们在一个线程中使用一个连接,所以连接数并不是越多越好,为避免两边的资源消耗,建议设置连接池的最大值等于或者略小于线程数。同时为了减少新建连接的开销,将最小值和最大值设为一致。
    \n增加Statement Cache Size对于大量使用PreparedStatement对象的应用程序很有帮助,WebLogic能够为每一个连接缓存这些对象,此值默认为10。在保证数据库游标大小足够的前提下,可以根据需要提高Statement Cache Size。比如当你设置连接数为25,Cache Size为10时,数据库可能需要打开25*10=250个游标。不幸的是,当遇到与PreparedStatement Cache有关的应用程序错误时,你需要将Cache Size设置为0。
    \n尽管JDBC Connection Pool提供了很多高级参数,在开发模式下比较有用,但大部分在生产环境下不需调整。这里建议最好不要设置测试表, 同时Test Reserved Connections和Test Released Connections也无需勾上。 当然如果你的数据库不稳定,时断时续,你就可能需要上述的参数打开。
    \n最后提一下驱动程序类型的选择,以Oracle为例,Oracle提供thin驱动和oci驱动,从性能上来讲,oci驱动强于thin驱动,特别是大数据量的操作。但在简单的数据库操作中,性能相差不大,随着thin驱动的不断改进,这一弱势将得到弥补。而thin驱动的移植性明显强于oci驱动。所以在通常情况下建议使用thin驱动。而最新驱动器由于WebLogic server/bin目录下的类包可能不是最新的,请以Oracle网站为准: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
    \n
    \n10) JSP调优
    \n设置jsp-param pageCheckSeconds=-1;
    \n设置serlet-reload-check=-1或ServletReloadCheckSecs=-1;
    \n设置jsp-param precompile=true,关闭JSP预编译选项。

    \n", "_id"=>114}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"*UNIX学习之系统调优篇", "body"=>"

    本文用来总结UNIX系统参数的理解和调优实践、理论等,不断补充,不断更新,

    ", "created_at"=>2007-09-18 06:28:05 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    本文用来总结UNIX系统参数的理解和调优实践、理论等,不断补充,不断更新,

    \n", "_id"=>115}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"gtalk表情符号,纯粹吹水~", "body"=>"

    发现自己发明的表情符号还挺有趣,Gt的桌面客户端是不支持表情的,于是大家都用只发明的表情符号,还挺好玩的。。。

    \n

    大比拼开始啦~~

    ", "created_at"=>2007-09-20 11:51:30 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    发现自己发明的表情符号还挺有趣,Gt的桌面客户端是不支持表情的,于是大家都用只发明的表情符号,还挺好玩的。。。
    \n大比拼开始啦~~

    \n", "_id"=>116}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"转:To技能云:还请耐住寂寞 ——送给IceskYsl的“困惑”", "body"=>"

    一个在技能云注册的用户对技能云的关注,以及送我的困惑,其中很多部分正是前期考虑到的,也有尚未考虑成熟的,针对这个文章,我想到很多,也倍受鼓舞,也对“寂寞”做好了心理准备,但是我一定会坚持,突破,把技能云绽放在每个程序员的心目中。。
    \n
    \n得原作者“过河卒”的允许,特意把这篇文章娶回来,一来鼓励我自己,二来思考更多的东西,谢谢“过河卒”,希望你一路向前,永不退缩,早日绽放自己的那块“蘑菇云”。。

    \n
    \n
    -----以下是转来的文章--------------
    \n
      \n
    1. 在互联网里面让一个东西火起来,聚集更多的人气并不是一件想得到做不到的事情,只要去做了效果是立杆见影的。但是我觉得一个互联网上的东西吸引人的东西只有两种:内容和服务。有些网站靠内容,如javaeye,有些网站靠服务,如自称要转向服务的IBM。而技能云,我觉得是偏向内容的,当然一个好的网站内容和服务都是不可或缺的。  
    2. \n
    3.   
    4. \n
    5.         技能云的初衷是好的,但是最终能不能作出预期的模样,还看当事人是否奈得住寂寞。在我看来,技能云提倡的保持程序员的一种骨子里面的骄傲,勇敢的 show,勇敢的show出真实的自己。技能云中技能的来源的基础来自于从事过的项目,而项目本身的状态是公开的,面向所有人的,受到所有人监督的,这样会起到一定的约束力。进而想通过这种约束力,形成一种公正诚信的氛围,在这种氛围中提取有价值的信息作为网站的自养之道。诚然,社会舆论和监督是一种巨大的力量。但是这对于技能云是个双刃剑,正面维护了网站内容的公正和诚信,负面隔绝了那些还需要通过通过一纸简历来养家糊口,给孩子卖奶粉的从业者。基于这点技能云不可能有太大的规模,毕竟程序员数量有限,能坦诚的交代自己的程序员就更有限了。记得几天前上技能云发现上面注册的用户的大多是些大牛,还有很大一部分是些只留下了ID,其他什么也没有留下的人。我觉得这些人也是值得我们尊敬,他们或基于现实的考虑,或受困于自身的经历,没有能在技能云上面留下什么,但是一个简单的ID表明了作为一个程序员的骄傲。  
    6. \n
    7.   
    8. \n
    9.             维护技能云信息的公正诚信很大一方面靠的的技能云本身提供的监督机制,而另外程序员本身的诚信。这种诚信最为可贵。古语云:诚信是金,而且在当前这种现实环境中这句话太惨白。据闻某彩票点把500W归还某代买彩票的人,一般听众的反应是:彩票点的人傻了。这就是现实。但是我想说的是技能云做的不错,在那个小的环境里面,我个人愿意相信所有的信息都是真实的。这可能就是技能云想要的氛围。而我个人的感觉也就是这种氛围影响了我。留下一个ID后就悄悄的离开的,回到自己的地方小声的吼了一下。话说,打江山不易,守江山更难。形成一种氛围固然不容易,但是要巩固它,加深它的影响自然是难上加难。虽然上面说的都很难,但是容易的事情也很容易,就是吹散这种氛围。  
    10. \n
    11.   
    12. \n
    13.             如何维护这种氛围,我本无发言权。但是我觉得javaeye做的很不错。一件小事情可以看出来,前不久javaeye更改了论坛的积分规则,把只要回帖就有的两分给取消了。自然,这样少了论坛的人气,但是同时也少了论坛里面的无意义内容。这符合javaeye的口号:做最棒的软件开发交流社区。正是这样的手段,隔离了那些看似的热闹,才有了javaeye上面的激烈的讨论和质量颇高的原创文章。这方面的问题,你自可以和robbin交流去,看上去他是个相当热心的人。  
    14. \n
    15.   
    16. \n
    17.     (BWT:我以前也在javaeye上面写Blog,可是感觉力不从心,任何一个问题似乎都没有人看的明白和透彻,看着一山又比一山高,压力实在太大,所以我就到这里来了。这里自由,写写自己看的,听的,想的,挺好。当然,我还是时不时的回去看看,毕竟那很吸引人。)  
    18. \n
    19.   
    20. \n
    21.         看看现在的javaeye,每天是3WIP,15W左右的PV。而技能云要做到这个现在似乎很难,但是javaeye可能很难复制了,不可能再有一个 rubyeye,perleye了。但是技能云还有这个潜力,不仅仅是程序员会对自己的工作产生自豪感,任何一个行业对有一群人狂热的爱着自己的工作。古语云:360行,行行出状元。只要技能云能够把握好自己,耐住了寂寞,维护建站的初衷和理想。可以想见:总有一天技能云会看起来像核弹引爆后的蘑菇云的。  
    22. \n
    23.   
    24. \n
    25.         副标题里面说这是“困惑”,这只是应景的一个说法。或许在IceskYsl心里面另有高谋。说的不好,还请IceskYsl自酌。  
    26. \n
    \n
    \n

     

    ", "created_at"=>2007-09-21 04:16:32 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一个在技能云注册的用户对技能云的关注,以及送我的困惑,其中很多部分正是前期考虑到的,也有尚未考虑成熟的,针对这个文章,我想到很多,也倍受鼓舞,也对“寂寞”做好了心理准备,但是我一定会坚持,突破,把技能云绽放在每个程序员的心目中。。
    \n
    \n得原作者“过河卒”的允许,特意把这篇文章娶回来,一来鼓励我自己,二来思考更多的东西,谢谢“过河卒”,希望你一路向前,永不退缩,早日绽放自己的那块“蘑菇云”。。
    \n
    \n-----以下是转来的文章--------------
    \n
    \n 在互联网里面让一个东西火起来,聚集更多的人气并不是一件想得到做不到的事情,只要去做了效果是立杆见影的。但是我觉得一个互联网上的东西吸引人的东西只有两种:内容和服务。有些网站靠内容,如javaeye,有些网站靠服务,如自称要转向服务的IBM。而技能云,我觉得是偏向内容的,当然一个好的网站内容和服务都是不可或缺的。  
    \n   
    \n         技能云的初衷是好的,但是最终能不能作出预期的模样,还看当事人是否奈得住寂寞。在我看来,技能云提倡的保持程序员的一种骨子里面的骄傲,勇敢的 show,勇敢的show出真实的自己。技能云中技能的来源的基础来自于从事过的项目,而项目本身的状态是公开的,面向所有人的,受到所有人监督的,这样会起到一定的约束力。进而想通过这种约束力,形成一种公正诚信的氛围,在这种氛围中提取有价值的信息作为网站的自养之道。诚然,社会舆论和监督是一种巨大的力量。但是这对于技能云是个双刃剑,正面维护了网站内容的公正和诚信,负面隔绝了那些还需要通过通过一纸简历来养家糊口,给孩子卖奶粉的从业者。基于这点技能云不可能有太大的规模,毕竟程序员数量有限,能坦诚的交代自己的程序员就更有限了。记得几天前上技能云发现上面注册的用户的大多是些大牛,还有很大一部分是些只留下了ID,其他什么也没有留下的人。我觉得这些人也是值得我们尊敬,他们或基于现实的考虑,或受困于自身的经历,没有能在技能云上面留下什么,但是一个简单的ID表明了作为一个程序员的骄傲。  
    \n   
    \n             维护技能云信息的公正诚信很大一方面靠的的技能云本身提供的监督机制,而另外程序员本身的诚信。这种诚信最为可贵。古语云:诚信是金,而且在当前这种现实环境中这句话太惨白。据闻某彩票点把500W归还某代买彩票的人,一般听众的反应是:彩票点的人傻了。这就是现实。但是我想说的是技能云做的不错,在那个小的环境里面,我个人愿意相信所有的信息都是真实的。这可能就是技能云想要的氛围。而我个人的感觉也就是这种氛围影响了我。留下一个ID后就悄悄的离开的,回到自己的地方小声的吼了一下。话说,打江山不易,守江山更难。形成一种氛围固然不容易,但是要巩固它,加深它的影响自然是难上加难。虽然上面说的都很难,但是容易的事情也很容易,就是吹散这种氛围。  
    \n   
    \n             如何维护这种氛围,我本无发言权。但是我觉得javaeye做的很不错。一件小事情可以看出来,前不久javaeye更改了论坛的积分规则,把只要回帖就有的两分给取消了。自然,这样少了论坛的人气,但是同时也少了论坛里面的无意义内容。这符合javaeye的口号:做最棒的软件开发交流社区。正是这样的手段,隔离了那些看似的热闹,才有了javaeye上面的激烈的讨论和质量颇高的原创文章。这方面的问题,你自可以和robbin交流去,看上去他是个相当热心的人。  
    \n   
    \n     (BWT:我以前也在javaeye上面写Blog,可是感觉力不从心,任何一个问题似乎都没有人看的明白和透彻,看着一山又比一山高,压力实在太大,所以我就到这里来了。这里自由,写写自己看的,听的,想的,挺好。当然,我还是时不时的回去看看,毕竟那很吸引人。)  
    \n   
    \n         看看现在的javaeye,每天是3WIP,15W左右的PV。而技能云要做到这个现在似乎很难,但是javaeye可能很难复制了,不可能再有一个 rubyeye,perleye了。但是技能云还有这个潜力,不仅仅是程序员会对自己的工作产生自豪感,任何一个行业对有一群人狂热的爱着自己的工作。古语云:360行,行行出状元。只要技能云能够把握好自己,耐住了寂寞,维护建站的初衷和理想。可以想见:总有一天技能云会看起来像核弹引爆后的蘑菇云的。  
    \n   
    \n         副标题里面说这是“困惑”,这只是应景的一个说法。或许在IceskYsl心里面另有高谋。说的不好,还请IceskYsl自酌。  
    \n
    \n
    \n 

    \n", "_id"=>117}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"

    透明同学说需要给技能云一个”自动登录“的功能,于是下午睡觉起来google了些资料,也大概问了下几个朋友,思路就有了,思路很多种,这里采取的是这篇文章介绍的方式。

    \n

    基本步骤如下:

    \n

    1、首先创建一个用来保存用户信息的表modle(PersistentLogin),代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class CreatePersistentLogins < ActiveRecord::Migration  
    2. \n
    3.   def self.up  
    4. \n
    5.     
    6. \n
    7.     create_table :persistent_logins do |t|  
    8. \n
    9.       t.column :uid:string:null => false  
    10. \n
    11.       t.column :user_id:integer:null => false  
    12. \n
    13.       t.column :created_on:datetime:null => false  
    14. \n
    15.     end  
    16. \n
    17.           
    18. \n
    19.     add_index :persistent_logins:uid:name => "uid"  
    20. \n
    21.     add_index :persistent_logins:created_on:name => "created_on"      
    22. \n
    23.       
    24. \n
    25.   end  
    26. \n
    27.   
    28. \n
    29.   def self.down  
    30. \n
    31.     drop_table :persistent_logins  
    32. \n
    33.   end  
    34. \n
    35. end  
    36. \n
    \n
    \n

    2、然后写这个modle,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class PersistentLogin < ActiveRecord::Base  
    2. \n
    3.     
    4. \n
    5.   belongs_to :user  
    6. \n
    7.   before_create :assign_uid  
    8. \n
    9.     
    10. \n
    11.   private  
    12. \n
    13.     
    14. \n
    15.   def assign_uid  
    16. \n
    17.     self.uid = UUID.random_create.to_s  
    18. \n
    19.   end  
    20. \n
    21. end  
    22. \n
    \n
    \n

    3、紧接着在登录的页面加一个chechk_box用来供用户选择是否保存自己的信息以实现自动登录,代码如下:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <%=check_box_tag("persist", value = "1"checked = trueoptions = {})%>    记住我吧.  
    2. \n
    \n
    \n

    4、接着在你原来的验证登录的地方,添加如下代码:

    \n
    \n
    Ruby代码
    \n
      \n
    1. # inside your 'login' code after you have validated the credentials  
    2. \n
    3. if params[:persist]  
    4. \n
    5.   p = PersistentLogin.create(:user=>u)  
    6. \n
    7.   cookies[:p_session_id] = {:value => p.uid, :expires => Time.now + 7.days}  
    8. \n
    9. end  
    10. \n
    \n
    \n

    5、写一个前置过滤器,判断用户是否存在cookie,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def get_current_user  
    2. \n
    3.   if session[:user].nil?  
    4. \n
    5.     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    6. \n
    7.       session[:user] = c_user.id  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end  
    14. \n
    \n
    \n

    6、最后用户点了退出登录以后,删除cookie和表中记录,代码如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def logout  
    2. \n
    3.   session[:user] = nil  
    4. \n
    5.     
    6. \n
    7.   if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    8. \n
    9.     p.destroy  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   cookies.delete :p_session_id   
    16. \n
    17. end  
    18. \n
    \n
    \n

    备注:需要安装一个UUID用来产生随机数,自然你也可以自己写,对时间MD5一下肯定重复不了,呵呵。

    \n

    代码偶给的已经相当详细了,就不具体解释了。

    \n

    另外还可以参考:

    \n

    http://lightyror.thegiive.net/2007/04/persistent-login-on-rails.html

    \n

    http://livsey.org/2006/6/30/persistent-logins-in-rails

    ", "created_at"=>2007-09-21 07:15:38 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    透明同学说需要给技能云一个”自动登录“的功能,于是下午睡觉起来google了些资料,也大概问了下几个朋友,思路就有了,思路很多种,这里采取的是这篇文章介绍的方式。
    \n基本步骤如下:
    \n1、首先创建一个用来保存用户信息的表modle(PersistentLogin),代码如下:
    \n
    \nRuby代码
    \n
    \n class CreatePersistentLogins < ActiveRecord::Migration  
    \n   def self.up  
    \n     
    \n     create_table :persistent_logins do |t|  
    \n       t.column :uid, :string, :null => false  
    \n       t.column :user_id, :integer, :null => false  
    \n       t.column :created_on, :datetime, :null => false  
    \n     end  
    \n           
    \n     add_index :persistent_logins, :uid, :name => "uid"  
    \n     add_index :persistent_logins, :created_on, :name => "created_on"      
    \n       
    \n   end  
    \n   
    \n   def self.down  
    \n     drop_table :persistent_logins  
    \n   end  
    \n end  
    \n
    \n
    \n2、然后写这个modle,代码如下:
    \n
    \nRuby代码
    \n
    \n class PersistentLogin < ActiveRecord::Base  
    \n     
    \n   belongs_to :user  
    \n   before_create :assign_uid  
    \n     
    \n   private  
    \n     
    \n   def assign_uid  
    \n     self.uid = UUID.random_create.to_s  
    \n   end  
    \n end  
    \n
    \n
    \n3、紧接着在登录的页面加一个chechk_box用来供用户选择是否保存自己的信息以实现自动登录,代码如下:
    \n
    \nXML/HTML代码
    \n
    \n <%=check_box_tag("persist", value = "1", checked = true, options = {})%>    记住我吧.  
    \n
    \n
    \n4、接着在你原来的验证登录的地方,添加如下代码:
    \n
    \nRuby代码
    \n
    \n # inside your 'login' code after you have validated the credentials  
    \n if params[:persist]  
    \n   p = PersistentLogin.create(:user=>u)  
    \n   cookies[:p_session_id] = {:value => p.uid, :expires => Time.now + 7.days}  
    \n end  
    \n
    \n
    \n5、写一个前置过滤器,判断用户是否存在cookie,如下:
    \n
    \nRuby代码
    \n
    \n def get_current_user  
    \n   if session[:user].nil?  
    \n     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    \n       session[:user] = c_user.id  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n6、最后用户点了退出登录以后,删除cookie和表中记录,代码如下:
    \n
    \nRuby代码
    \n
    \n def logout  
    \n   session[:user] = nil  
    \n     
    \n   if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])  
    \n     p.destroy  
    \n   end  
    \n   
    \n   cookies.delete :p_session_id   
    \n end  
    \n
    \n
    \n备注:需要安装一个UUID用来产生随机数,自然你也可以自己写,对时间MD5一下肯定重复不了,呵呵。
    \n代码偶给的已经相当详细了,就不具体解释了。
    \n另外还可以参考:
    \nhttp://lightyror.thegiive.net/2007/04/persistent-login-on-rails.html
    \nhttp://livsey.org/2006/6/30/persistent-logins-in-rails

    \n", "_id"=>118}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中实现自动登录功能!", "body"=>"

    做WEB开发的都知道log的重要性,开发过java的肯定知道log4j等日志记录工具,使用起来非常方便的;RoR下发开发自然也少不了日志的应用,刚刚开始的那会把日志都写到一个文件里,很恐怖的说,后来查了些资料,可以看到ROR默认的log是可以分级别的,记录如下:
    \n
    \n日志级别(Log Level)
    \nRails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever有:debug, :info, :warn,:error, :fatal.
    \n:debug level提供最详细的log, 可以将每一条sql都记录下来。
    \n:info  level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录下每封信的内容,Log文件内容就是快速增长。
    \n为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn level等log level, 只记录重要的信息.
    \n
    \n设置方法:
    \n在/config/environment.rb文件中可以设置以下选项
    \nconfig.log_level = :debug
    \n如果只希望在production环境下,输入少量的log,
    \n则只需要在config/environments/production.rb中增加一项(我就是这样设置的)
    \nconfig.log_level = :warn

    ", "created_at"=>2007-09-23 06:19:40 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    做WEB开发的都知道log的重要性,开发过java的肯定知道log4j等日志记录工具,使用起来非常方便的;RoR下发开发自然也少不了日志的应用,刚刚开始的那会把日志都写到一个文件里,很恐怖的说,后来查了些资料,可以看到ROR默认的log是可以分级别的,记录如下:
    \n
    \n日志级别(Log Level)
    \nRails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever有:debug, :info, :warn,:error, :fatal.
    \n:debug level提供最详细的log, 可以将每一条sql都记录下来。
    \n:info  level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录下每封信的内容,Log文件内容就是快速增长。
    \n为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn level等log level, 只记录重要的信息.
    \n
    \n设置方法:
    \n在/config/environment.rb文件中可以设置以下选项
    \nconfig.log_level = :debug
    \n如果只希望在production环境下,输入少量的log,
    \n则只需要在config/environments/production.rb中增加一项(我就是这样设置的)
    \nconfig.log_level = :warn

    \n", "_id"=>119}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails Security Guide", "body"=>"

     

    \n

    好久没去ROR官方站点了,今天google到他上面的一个wiki,看完后随手到其blog里面看看,看到一篇好文章,是介绍Rails中安全控制的,于是跟着那个链接过去,看了一部分,没时间看完,特转回来记录着有时间再看~

    \n

    Ruby on Rails does a decent job in handling security concerns in the background. You will have to configure your application to avoid few security attacks while plugins would be required for many security concerns which are not at all or poorly managed by rails.

    \n

    In this article I have described the security issues related to a ruby on rails web application. I have followed DRY by linking to articles with good explanation and solutions to security concerns wherever required. This guide can also be used as a quick security check for your current web application.

    \n

    原文地址:http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide

    \n

    ", "created_at"=>2007-09-24 08:06:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

     
    \n好久没去ROR官方站点了,今天google到他上面的一个wiki,看完后随手到其blog里面看看,看到一篇好文章,是介绍Rails中安全控制的,于是跟着那个链接过去,看了一部分,没时间看完,特转回来记录着有时间再看~
    \nRuby on Rails does a decent job in handling security concerns in the background. You will have to configure your application to avoid few security attacks while plugins would be required for many security concerns which are not at all or poorly managed by rails.
    \nIn this article I have described the security issues related to a ruby on rails web application. I have followed DRY by linking to articles with good explanation and solutions to security concerns wherever required. This guide can also be used as a quick security check for your current web application.
    \n原文地址:http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide

    \n", "_id"=>120}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中两种\"多对多\"关系的建立的方法 !", "body"=>"

    以前的时候只知道在Rails中建立多对多的关系可以把两个表的复数做表名,并去掉其主键ID,后来使用的过程中遇到不少问题,虽然当时也可以 hack过去了,但是心理一直觉得不爽,上次看《敏捷开发第二版》的时候,看到还有另外一个方法,刚好刚才在railscasts上也看到了,现在归纳记 录如下:

    \n

     

    \n
    \n
    第一种方法: has_and_belongs_to_many
    \n
      \n
    1. # in migration  
    2. \n
    3. def self.up  
    4. \n
    5.   create_table 'categories_products':id => false do |t|  
    6. \n
    7.     t.column :category_id:integer  
    8. \n
    9.     t.column :product_id:integer  
    10. \n
    11.   end  
    12. \n
    13. end  
    14. \n
    15.   
    16. \n
    17. # models/product.rb  
    18. \n
    19. has_and_belongs_to_many :categories  
    20. \n
    21.   
    22. \n
    23. # models/category.rb  
    24. \n
    25. has_and_belongs_to_many :products  
    26. \n
    \n
    \n
    \n
    第二种方法:has_many :through
    \n
      \n
    1. # models/categorization.rb  
    2. \n
    3. belongs_to :product  
    4. \n
    5. belongs_to :category  
    6. \n
    7.   
    8. \n
    9. # models/product.rb  
    10. \n
    11. has_many :categorizations  
    12. \n
    13. has_many :categories:through => :categorizations  
    14. \n
    15.   
    16. \n
    17. # models/category.rb  
    18. \n
    19. has_many :categorizations  
    20. \n
    21. has_many :products:through => :categorizations  
    22. \n
    \n
    \n

    很显然,使用第二种会更加明了和便捷,且那个联系表可以随意命名,更加优雅!

    \n

     

    ", "created_at"=>2007-09-24 08:27:13 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    以前的时候只知道在Rails中建立多对多的关系可以把两个表的复数做表名,并去掉其主键ID,后来使用的过程中遇到不少问题,虽然当时也可以 hack过去了,但是心理一直觉得不爽,上次看《敏捷开发第二版》的时候,看到还有另外一个方法,刚好刚才在railscasts上也看到了,现在归纳记 录如下:
    \n 
    \n
    \n第一种方法: has_and_belongs_to_many
    \n
    \n # in migration  
    \n def self.up  
    \n   create_table 'categories_products', :id => false do |t|  
    \n     t.column :category_id, :integer  
    \n     t.column :product_id, :integer  
    \n   end  
    \n end  
    \n   
    \n # models/product.rb  
    \n has_and_belongs_to_many :categories  
    \n   
    \n # models/category.rb  
    \n has_and_belongs_to_many :products  
    \n
    \n
    \n
    \n第二种方法:has_many :through
    \n
    \n # models/categorization.rb  
    \n belongs_to :product  
    \n belongs_to :category  
    \n   
    \n # models/product.rb  
    \n has_many :categorizations  
    \n has_many :categories, :through => :categorizations  
    \n   
    \n # models/category.rb  
    \n has_many :categorizations  
    \n has_many :products, :through => :categorizations  
    \n
    \n
    \n很显然,使用第二种会更加明了和便捷,且那个联系表可以随意命名,更加优雅!
    \n 

    \n", "_id"=>121}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails项目管理之SubVersion(SVN)", "body"=>"

    多人协作的时候版本控制是很重要的,我以前公司使用的VSS或者CC&CQ,这些都是比较重量级的,做大项目的控制比较合适,但是做一些 rails的比较小的项目的时候就没有这个必要,也没有这个必要;

    \n

    相反,SVN和CVS可能更适合一点,因为CVS比较老,现在SVN比较主流,使用起来 也很方便,于是做Rails项目自然选择SVN,以前使用不多,虽然也会用,但是做了不少无用功,今天看到一篇介绍的文章,改吧改吧记录下。

    \n

    \n

    \n
    第一步,创建Rails应用并做基础设置
    \n
      \n
    1. mkdir project //创建工程目录,在此目录下设置基础的导入数据  
    2. \n
    3. cd project    //进入project目录  
    4. \n
    5. rails test    //生成rails应用,名字为test  
    6. \n
    7. cd test       //进入rails应用目录  
    8. \n
    9. mv config/database.yml config/database_example.yml //修改数据库配置文件的名字,因为这个配置文件可能每个开发人员的都不一样  
    10. \n
    11. rm -r log/*   //删除log目录下的所有文件,这个目录下的文件不需要加入到版本控制  
    12. \n
    13. rm -r tmp/*   //同上,临时目录也不要加入版本控制  
    14. \n
    15. cd ..         //回到project目录  
    16. \n
    17. mv test trunk //修改rails应用test目录的名字为trunk,这是svn的惯例,相当与CVS的HEAD,是开发主目录  
    18. \n
    19. mkdir tags    //惯例,保存tag  
    20. \n
    21. mkdir branches//惯例,保存分支第二步,生成将项目文件导入SVN   
    22. \n
    \n
    \n没个项目的SVN库所使用的协议可能个不相同,这里假设你已经创建好了SVN库并可以使用了 。

    \n

    \n

    \n
    第二步:导入
    \n
      \n
    1. cd project 在project目录下执行  
    2. \n
    3. svn import . http://your_domain/svn/test -m "初始化导入" --username your_name  
    4. \n
    \n
    \n如果没有错误,项目就导入成功了,现在我们到自己的rails项目工作目录checkout刚刚创建的项目
    \n

    \n

    \n

    \n
    第三步:签出
    \n
      \n
    1. cd /rails //进入你的rails工作目录  
    2. \n
    3. svn co http://your_domain/svn/test/trunk test //checkout代码到test  
    4. \n
    5. cd test  
    6. \n
    7. cp config/database_example.yml config/database.yml //创建自己的数据库配置文件  
    8. \n
    9. svn propset svn:ignore database.yml config/        //忽略database.yml文件,也就是不将此文件纳入版本控制  
    10. \n
    11. svn propset svn:ignore "*" log/                    //忽略log下的所有文件  
    12. \n
    13. svn propset svn:ignore "*" tmp/                    //忽略tmp目录下的所有文件  
    14. \n
    15. svn commit -m "忽略文件"                           //提交配置好了,到现在基本的项目初始化 
      \n
    16. \n
    \n
    \n工作即可告一段落了,以后的工作基本就是更新,编码,提交了,属于svn基本使用问题,我们就不详述了。
    \n

    \n

    参考其他类似文章:

    \n

    http://www.javaeye.com/article/107799

    \n

    http://railscasts.com/episodes/36
    \n

    ", "created_at"=>2007-09-24 09:09:39 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    多人协作的时候版本控制是很重要的,我以前公司使用的VSS或者CC&CQ,这些都是比较重量级的,做大项目的控制比较合适,但是做一些 rails的比较小的项目的时候就没有这个必要,也没有这个必要;
    \n相反,SVN和CVS可能更适合一点,因为CVS比较老,现在SVN比较主流,使用起来 也很方便,于是做Rails项目自然选择SVN,以前使用不多,虽然也会用,但是做了不少无用功,今天看到一篇介绍的文章,改吧改吧记录下。
    \n
    \n
    \n第一步,创建Rails应用并做基础设置
    \n
    \n mkdir project //创建工程目录,在此目录下设置基础的导入数据  
    \n cd project    //进入project目录  
    \n rails test    //生成rails应用,名字为test  
    \n cd test       //进入rails应用目录  
    \n mv config/database.yml config/database_example.yml //修改数据库配置文件的名字,因为这个配置文件可能每个开发人员的都不一样  
    \n rm -r log/   //删除log目录下的所有文件,这个目录下的文件不需要加入到版本控制  
    \n rm -r tmp/
       //同上,临时目录也不要加入版本控制  
    \n cd ..         //回到project目录  
    \n mv test trunk //修改rails应用test目录的名字为trunk,这是svn的惯例,相当与CVS的HEAD,是开发主目录  
    \n mkdir tags    //惯例,保存tag  
    \n mkdir branches//惯例,保存分支第二步,生成将项目文件导入SVN   
    \n
    \n
    \n没个项目的SVN库所使用的协议可能个不相同,这里假设你已经创建好了SVN库并可以使用了 。
    \n
    \n
    \n第二步:导入
    \n
    \n cd project 在project目录下执行  
    \n svn import . http://your_domain/svn/test -m "初始化导入" --username your_name  
    \n
    \n
    \n如果没有错误,项目就导入成功了,现在我们到自己的rails项目工作目录checkout刚刚创建的项目
    \n
    \n
    \n
    \n第三步:签出
    \n
    \n cd /rails //进入你的rails工作目录  
    \n svn co http://your_domain/svn/test/trunk test //checkout代码到test  
    \n cd test  
    \n cp config/database_example.yml config/database.yml //创建自己的数据库配置文件  
    \n svn propset svn:ignore database.yml config/        //忽略database.yml文件,也就是不将此文件纳入版本控制  
    \n svn propset svn:ignore "" log/                    //忽略log下的所有文件  
    \n svn propset svn:ignore "
    " tmp/                    //忽略tmp目录下的所有文件  
    \n svn commit -m "忽略文件"                           //提交配置好了,到现在基本的项目初始化 
    \n
    \n
    \n
    \n工作即可告一段落了,以后的工作基本就是更新,编码,提交了,属于svn基本使用问题,我们就不详述了。
    \n
    \n参考其他类似文章:
    \nhttp://www.javaeye.com/article/107799
    \nhttp://railscasts.com/episodes/36

    \n", "_id"=>122}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"让你的Rails远离SQL Injection", "body"=>"

    做为一名安全爱好者,我自然知道现在在动态语言写的web系统中可能存在的安全隐患的,例如大名鼎鼎的SQL Injection,CSS/XSS,文件包含,暴路径,泄露源代码等等,其中目前最杀手级的应该是SQL注射了,在PHP和ASP的世界了,辅助 union查询可以恩容易的暴出敏感数据,例如管理员用户名、密码等,就算你的密码MD5加密了,也有诸如XMD5这样的站点在线查询破解,如果存在漏 洞,自然非常危险。

    \n

    Rails出生于真实的WEB应用,自然考虑到这些问题,例如如下代码即可杜绝Rails的SQL Injection:

    \n

    \n

    \n
    示范代码
    \n
      \n
    1. # tasks_controller.rb  
    2. \n
    3. def index  
    4. \n
    5.   @tasks = Task.find(:all:conditions => ["name LIKE ?""%\#{params[:query]}%"])  
    6. \n
    7. end  
    8. \n
    \n
    \n如上代码在PHP或者ASP中的处理逻辑是先取得params[:query],再对这个进行检查、过滤,才能放进去查询的,在Rails中,只要使用? 替代符,然后就可以实现这个效果。如果你写成下面这个样子,肯定是危险的:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # tasks_controller.rb        
    2. \n
    3. def index        
    4. \n
    5.    @tasks = Task.find(:all:conditions => ["name LIKE \#{params[:query]}"])        
    6. \n
    7. end     
    8. \n
    \n
    \n以一个业余hacker的口气告诫您,一定要注意!
    \n

    ", "created_at"=>2007-09-24 09:26:08 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    做为一名安全爱好者,我自然知道现在在动态语言写的web系统中可能存在的安全隐患的,例如大名鼎鼎的SQL Injection,CSS/XSS,文件包含,暴路径,泄露源代码等等,其中目前最杀手级的应该是SQL注射了,在PHP和ASP的世界了,辅助 union查询可以恩容易的暴出敏感数据,例如管理员用户名、密码等,就算你的密码MD5加密了,也有诸如XMD5这样的站点在线查询破解,如果存在漏 洞,自然非常危险。
    \nRails出生于真实的WEB应用,自然考虑到这些问题,例如如下代码即可杜绝Rails的SQL Injection:
    \n
    \n
    \n示范代码
    \n
    \n # tasks_controller.rb  
    \n def index  
    \n   @tasks = Task.find(:all, :conditions => ["name LIKE ?", "%\#{params[:query]}%"])  
    \n end  
    \n
    \n
    \n如上代码在PHP或者ASP中的处理逻辑是先取得params[:query],再对这个进行检查、过滤,才能放进去查询的,在Rails中,只要使用? 替代符,然后就可以实现这个效果。如果你写成下面这个样子,肯定是危险的:
    \n
    \n
    \nRuby代码
    \n
    \n # tasks_controller.rb        
    \n def index        
    \n    @tasks = Task.find(:all, :conditions => ["name LIKE \#{params[:query]}"])        
    \n end     
    \n
    \n
    \n以一个业余hacker的口气告诫您,一定要注意!

    \n", "_id"=>123}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随意指定Layouts~", "body"=>"

    很多时候,我们会使用global layouts, controller layouts, shared layouts, dynamic layouts and action layouts.另外,我们还可以用如下方法的layouts,看例子:

    \n

    \n

    \n
    layouts示例代码
    \n
      \n
    1. # projects_controller.rb  
    2. \n
    3. layout :user_layout  
    4. \n
    5.   
    6. \n
    7. def index  
    8. \n
    9.   @projects = Project.find(:all)  
    10. \n
    11.   render :layout => 'projects'  
    12. \n
    13. end  
    14. \n
    15.   
    16. \n
    17. protected  
    18. \n
    19.   
    20. \n
    21. def user_layout  
    22. \n
    23.   if current_user.admin?  
    24. \n
    25.     "admin"  
    26. \n
    27.   else  
    28. \n
    29.     "application"  
    30. \n
    31.   end  
    32. \n
    33. end 
      \n
    34. \n
    \n
    \n

    ", "created_at"=>2007-09-25 02:18:33 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很多时候,我们会使用global layouts, controller layouts, shared layouts, dynamic layouts and action layouts.另外,我们还可以用如下方法的layouts,看例子:
    \n
    \n
    \nlayouts示例代码
    \n
    \n # projects_controller.rb  
    \n layout :user_layout  
    \n   
    \n def index  
    \n   @projects = Project.find(:all)  
    \n   render :layout => 'projects'  
    \n end  
    \n   
    \n protected  
    \n   
    \n def user_layout  
    \n   if current_user.admin?  
    \n     "admin"  
    \n   else  
    \n     "application"  
    \n   end  
    \n end 
    \n
    \n
    \n

    \n", "_id"=>124}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"content_for:动态改变您的Layouts", "body"=>"

    content_for这个方法竟然一直没看到过,今天也是无意中看到的,看到对此介绍为:
    \nIf you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.
    \n也就是说,如果你想动态的改变你原来layout中的东西,你可以使用content_for这个方法,结合代码就很好理解了,如下:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. <!-- projects/index.rhtml -->  
    2. \n
    3. <% content_for :head do %>  
    4. \n
    5.   <%= stylesheet_link_tag 'projects' %>  
    6. \n
    7. <% end %>  
    8. \n
    9.   
    10. \n
    11. <!-- layouts/application.rhtml -->  
    12. \n
    13. <head>  
    14. \n
    15.   <title>Todo List</title>  
    16. \n
    17.   <%= stylesheet_link_tag 'application' %>  
    18. \n
    19.   <%= yield :head %>  
    20. \n
    21. </head>  
    22. \n
    \n
    \n先用content_for申明一个变量,接着可以在你需要的地方使用<%= yield :name %> 来调用,参考如上代码应该不难理解。

    \n

    另外,对于其详细用法,

    \n

    请参考API:http://api.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html
    \n

    ", "created_at"=>2007-09-25 03:19:53 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    content_for这个方法竟然一直没看到过,今天也是无意中看到的,看到对此介绍为:
    \nIf you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.
    \n也就是说,如果你想动态的改变你原来layout中的东西,你可以使用content_for这个方法,结合代码就很好理解了,如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n <!-- projects/index.rhtml -->  
    \n <% content_for :head do %>  
    \n   <%= stylesheet_link_tag 'projects' %>  
    \n <% end %>  
    \n   
    \n <!-- layouts/application.rhtml -->  
    \n <head>  
    \n   <title>Todo List</title>  
    \n   <%= stylesheet_link_tag 'application' %>  
    \n   <%= yield :head %>  
    \n </head>  
    \n
    \n
    \n先用content_for申明一个变量,接着可以在你需要的地方使用<%= yield :name %> 来调用,参考如上代码应该不难理解。
    \n另外,对于其详细用法,
    \n请参考API:http://api.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html

    \n", "_id"=>125}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"隐藏你log中的敏感信息~", "body"=>"

    写过rails的肯定看过它的日志文件,在登录的时候,你肯定看过类型下面的内容:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. Processing UsersController#create (for 127.0.0.1 at 2007-02-23 19:11:20) [POST]    
    2. \n
    3. Session ID: 4047778b64af62d387f7e860e51cce20    
    4. \n
    5. <span style="color:red;">Parameters</span>: {"user" => {"name" => "name", "password_confirmation" => "123456", "password" => "123456"}, "commit" =>     
    6. \n
    7. "Register", "action" => "create", "controller" => "users"}    
    8. \n
    9. SQL (0.000108) BEGIN    
    10. \n
    11. <span style="color:red;">SQL</span> (0.000238) INSERT INTO users ('name', 'password') VALUES('name', '123456')    
    12. \n
    13. SQL (0.000395) COMMIT    
    14. \n
    15. Redirected to http://localhost:3000/users/5    
    16. \n
    17. ...   
      \n
    18. \n
    \n
    \n

    做为一个安全爱好者,我可以负责任的告诉你,这些东西非常危险,恶意的人总是能想办法(这个办法很多,比如旁注等)拿到你的日志文件,而这个日志文件比起加密的数据库文件还要危险,于是肯定是需要做一些工作的。

    \n

    ActionController#filter_parameter_logging 就是我们需要的东西,它可以用来过滤那些你不想保存在日志中的数据,它可以阻止一些敏感数据赤裸裸的暴露在日志文件中,比如密码,或者信用卡帐号。也可以防止一些大块的数据占用日志文件,等等。
    \n如果你的应用用到passwords,复制下面这行到你的ApplicaitonController  Class:

    \n
    \n
    Ruby代码
    \n
      \n
    1. filter_parameter_logging "password" 
      \n
    2. \n
    \n
    \n

    这样就可以阻止任何匹配/password/i模式的数据被写入日志,诸如:[user][password] 或 [user][password_confirmation]
    \n
    \n另外,如果想在开发环境下显示POST logging,但是在产品环境下完全不显示,如何做呢?

    \n
    \n
    Ruby代码
    \n
      \n
    1. filter_parameter_logging("password"if RAILS_ENV == "production" 
      \n
    2. \n
    \n
    \n

    如果想完全禁止POST logging,则可以在production.rb中修改:config.log_level = :warn
    \n
    \n其他类似文章,请参考:

    \n

    http://blackanger.blog.51cto.com/140924/35735
    \nhttp://hideto.javaeye.com/blog/106956
    \nhttp://api.rubyonrails.com/classes/ActionController/Base.html#M000260

    ", "created_at"=>2007-09-25 05:20:22 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    写过rails的肯定看过它的日志文件,在登录的时候,你肯定看过类型下面的内容:
    \n
    \nXML/HTML代码
    \n
    \n Processing UsersController#create (for 127.0.0.1 at 2007-02-23 19:11:20) [POST]    
    \n Session ID: 4047778b64af62d387f7e860e51cce20    
    \n <span style="color:red;">Parameters</span>: {"user" => {"name" => "name", "password_confirmation" => "123456", "password" => "123456"}, "commit" =>     
    \n "Register", "action" => "create", "controller" => "users"}    
    \n SQL (0.000108) BEGIN    
    \n <span style="color:red;">SQL</span> (0.000238) INSERT INTO users ('name', 'password') VALUES('name', '123456')    
    \n SQL (0.000395) COMMIT    
    \n Redirected to http://localhost:3000/users/5    
    \n ...   
    \n
    \n
    \n
    \n做为一个安全爱好者,我可以负责任的告诉你,这些东西非常危险,恶意的人总是能想办法(这个办法很多,比如旁注等)拿到你的日志文件,而这个日志文件比起加密的数据库文件还要危险,于是肯定是需要做一些工作的。
    \nActionController#filter_parameter_logging 就是我们需要的东西,它可以用来过滤那些你不想保存在日志中的数据,它可以阻止一些敏感数据赤裸裸的暴露在日志文件中,比如密码,或者信用卡帐号。也可以防止一些大块的数据占用日志文件,等等。
    \n如果你的应用用到passwords,复制下面这行到你的ApplicaitonController  Class:
    \n
    \nRuby代码
    \n
    \n filter_parameter_logging "password" 
    \n
    \n
    \n
    \n这样就可以阻止任何匹配/password/i模式的数据被写入日志,诸如:[user][password] 或 [user][password_confirmation]
    \n
    \n另外,如果想在开发环境下显示POST logging,但是在产品环境下完全不显示,如何做呢?
    \n
    \nRuby代码
    \n
    \n filter_parameter_logging("password") if RAILS_ENV == "production" 
    \n
    \n
    \n
    \n如果想完全禁止POST logging,则可以在production.rb中修改:config.log_level = :warn
    \n
    \n其他类似文章,请参考:
    \nhttp://blackanger.blog.51cto.com/140924/35735
    \nhttp://hideto.javaeye.com/blog/106956
    \nhttp://api.rubyonrails.com/classes/ActionController/Base.html#M000260

    \n", "_id"=>126}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中取得REFERER!", "body"=>"``需要取打开技能云tag的页面地址,于是需要取得referer的值,记录如下:
    Try:

    request.env['HTTP_REFERER']
    或者
    request.referer
    参考:http://www.ruby-forum.com/topic/79405```", "created_at"=>2007-09-26 09:22:48 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    需要取打开技能云tag的页面地址,于是需要取得<strong>referer</strong>的值,记录如下:<strong><br />Try: </strong><br />request.env['HTTP_REFERER']<br />或者<br />request.referer<br />参考:http://www.ruby-forum.com/topic/79405`

    \n", "_id"=>127}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"warning: already initialized constant OPTIONS", "body"=>"

    着手开发1stlog Ver 1.1版本,把代码整理了一下,带到公司跑不起来,看了下Ruby版本,是1.8.4的,难道是版本太老,卸掉重新装个1.8.6的版本,接着装rails,mongrel和mongrel_service等。

    \n

    \n

    \n
    安装套件
    \n
      \n
    1. gem install rails –y  
    2. \n
    3. gem install mongrel –y  
    4. \n
    5. gem install mongrel_service -y  
    6. \n
    \n
    \n可是ruby ./script/server启动后,还是报错,如下:

    \n
    \n
    \n
    XML/HTML代码
    \n
      \n
    1. => Booting Mongrel (use 'script/server webrick' to force WEBrick)  
    2. \n
    3. => Rails application starting on http://0.0.0.0:3000  
    4. \n
    5. => Call with -d to detach  
    6. \n
    7. => Ctrl-C to shutdown server  
    8. \n
    9. ** Starting Mongrel listening at 0.0.0.0:3000  
    10. \n
    11. ** Starting Rails with development environment...  
    12. \n
    13. Exiting  
    14. \n
    15. /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS  
    16. \n
    17. /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method `options' for []:Array (NoMethodError)  
    18. \n
    19.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'  
    20. \n
    21.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in `require'  
    22. \n
    23.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    24. \n
    25.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'  
    26. \n
    27.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    28. \n
    29.         from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39  
    30. \n
    31.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'  
    32. \n
    33.         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'  
    34. \n
    35.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    36. \n
    37.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'  
    38. \n
    39.         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    40. \n
    41.         from script/server:3  
    42. \n
    \n
    \n 十分之不解,于是卸掉
    mongrel,重新安装下,还是不行,google到这篇文章:情况几乎差不多,他说是缺少app中使用的gem,恩,很有可能,打开我的environment.rb,看到require 'redcloth',哦,原来如此。
    \n 装上这个gem后一切正常,接着看到一个修复方法,如下:
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. “require ‘nonexistingfile’”. 
      \n
    2. \n
    \n
    \n 但是加上这句保证可启动,但是其中遇到需要使用gem的时候,肯定还是不行的。
    ", "created_at"=>2007-09-27 03:52:41 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    着手开发1stlog Ver 1.1版本,把代码整理了一下,带到公司跑不起来,看了下Ruby版本,是1.8.4的,难道是版本太老,卸掉重新装个1.8.6的版本,接着装rails,mongrel和mongrel_service等。
    \n
    \n
    \n安装套件
    \n
    \n gem install rails –y  
    \n gem install mongrel –y  
    \n gem install mongrel_service -y  
    \n
    \n
    \n可是ruby ./script/server启动后,还是报错,如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n => Booting Mongrel (use 'script/server webrick' to force WEBrick)  
    \n => Rails application starting on http://0.0.0.0:3000  
    \n => Call with -d to detach  
    \n => Ctrl-C to shutdown server  
    \n  Starting Mongrel listening at 0.0.0.0:3000  
    \n
     Starting Rails with development environment...  
    \n Exiting  
    \n /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS  
    \n /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method options'&nbsp;for&nbsp;[]:Array&nbsp;(NoMethodError)&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in&nbsp;
    gem_original_require'  
    \n         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:32:in require'&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in new_constants_in'&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39  
    \n         from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in&nbsp;
    require'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in require'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in&nbsp;
    new_constants_in'  
    \n         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'  
    \n         from script/server:3  
    \n
    \n
    \n 十分之不解,于是卸掉mongrel,重新安装下,还是不行,google到这篇文章:情况几乎差不多,他说是缺少app中使用的gem,恩,很有可能,打开我的environment.rb,看到require 'redcloth',哦,原来如此。
    \n 装上这个gem后一切正常,接着看到一个修复方法,如下:
    \n
    \n
    \n Ruby代码
    \n
    \n “require ‘nonexistingfile’”. 
    \n
    \n
    \n
    \n 但是加上这句保证可启动,但是其中遇到需要使用gem的时候,肯定还是不行的。

    \n", "_id"=>128}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)最新功能及其来源~", "body"=>"

    最新的两个功能,完成后将进行一次宣传推广,抓紧时间实现,记录:
    \n 1、要求战友功能 --自动的给项目成员(提交者)发送提醒Email,让其邀请自己的战友加入项目成员;

    \n

    2、智能抓取  --按照展示“技能云”的地址,智能抓取其对于的BLOG内容(按照RSS抓取),解析后入库,显示在其个人的页面上。

    ", "created_at"=>2007-09-29 08:52:24 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    最新的两个功能,完成后将进行一次宣传推广,抓紧时间实现,记录:
    \n 1、要求战友功能 --自动的给项目成员(提交者)发送提醒Email,让其邀请自己的战友加入项目成员;
    \n2、智能抓取  --按照展示“技能云”的地址,智能抓取其对于的BLOG内容(按照RSS抓取),解析后入库,显示在其个人的页面上。

    \n", "_id"=>129}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取到了展示“技能云”的页面URL了", "body"=>"

    和前面说的那个文章中的道理,今天晚上测试了下,可以顺利抓取到展示“技能云”的页面URL了,并且做了一些处理,比如记录次数,就可以帮忙用户统计其页 面被欢迎程度了,呵呵,感觉和站点统计有点相像,下一步是抓取用户页面上的RSS地址,并抓取解析其内容,截个图片,如下:

    ", "created_at"=>2007-09-29 15:15:13 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    和前面说的那个文章中的道理,今天晚上测试了下,可以顺利抓取到展示“技能云”的页面URL了,并且做了一些处理,比如记录次数,就可以帮忙用户统计其页 面被欢迎程度了,呵呵,感觉和站点统计有点相像,下一步是抓取用户页面上的RSS地址,并抓取解析其内容,截个图片,如下:

    \n", "_id"=>130}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"(x)HTML解析利器:Hpricot", "body"=>"

    由于需要在技能云(iTechTag) 上智能抓取展示“技能云”的页面的URL对于的RSS进行解析,所以需要写取RSS已经解析的代码,先贴一个一般的例子,如下:

    \n

     

    \n
    \n
    首先给一段XML代码(my.xml)
    \n
      \n
    1. <Export>  
    2. \n
    3.   <Product>  
    4. \n
    5.     <SKU>403276</SKU>  
    6. \n
    7.     <ItemName>Trivet</ItemName>  
    8. \n
    9.     <CollectionNo>0</CollectionNo>  
    10. \n
    11.     <Pages>0</Pages>  
    12. \n
    13.   </Product>  
    14. \n
    15. </Export>  
    16. \n
    \n
    \n

    紧接着,我们用来解析并入库:

    \n

     

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. FIELDS = %w[SKU ItemName CollectionNo Pages]  
    2. \n
    3.   
    4. \n
    5. doc = Hpricot.parse(File.read("my.xml"))  
    6. \n
    7. (doc/:product).each do |xml_product|  
    8. \n
    9.   product = Product.new  
    10. \n
    11.   for field in FIELDS  
    12. \n
    13.     product[field] = (xml_product/field.intern).first.innerHTML  
    14. \n
    15.   end  
    16. \n
    17.   product.save  
    18. \n
    19. end  
    20. \n
    \n
    \n

    遗留问题:

    \n

     

    \n

    1、对于中文,可能会出现乱码

    \n

    2、另外,有人说不是线程安全的,多线程的话可能有问题。

    \n

    再附录一段我写的:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require "open-uri"  
    2. \n
    3. require "hpricot"  
    4. \n
    5. doc = open("http://blog.1sters.com") { |f| Hpricot(f) }  
    6. \n
    7. rel = doc.search("//link[@rel='alternate']").first[:href]  
    8. \n
    9.   
    10. \n
    11. print rel.to_s  
    12. \n
    13.   
    14. \n
    15. #xmldoc = Hpricot.XML(open("http://blog.1sters.com/"+rel))  
    16. \n
    17. xmldoc = open("http://blog.1sters.com/"+rel) do |fi|  
    18. \n
    19.    Hpricot.XML(fi)  
    20. \n
    21.  end  
    22. \n
    23.  (xmldoc/:item).each do |item|  
    24. \n
    25.    title = (item/:title).inner_html  
    26. \n
    27.    link = (item/:link).inner_html  
    28. \n
    29.    date = (item/'dc:date').inner_html  
    30. \n
    31.    puts "\#{title}: \#{link}"   
    32. \n
    33.  end  
    34. \n
    35. #print xmldoc.to_s 
      \n
    36. \n
    \n
    \n

    \n

    参考:

    \n

    1、http://www.ave7.net/forum/showthread.php?t=5919
    \n2、http://club.phpe.net/index.php?act=ST&f=19&t=15267&s=04a67d90deb7607c0907d28dafba10f5

    ", "created_at"=>2007-09-30 03:20:33 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    由于需要在技能云(iTechTag) 上智能抓取展示“技能云”的页面的URL对于的RSS进行解析,所以需要写取RSS已经解析的代码,先贴一个一般的例子,如下:
    \n 
    \n
    \n首先给一段XML代码(my.xml)
    \n
    \n <Export>  
    \n   <Product>  
    \n     <SKU>403276</SKU>  
    \n     <ItemName>Trivet</ItemName>  
    \n     <CollectionNo>0</CollectionNo>  
    \n     <Pages>0</Pages>  
    \n   </Product>  
    \n </Export>  
    \n
    \n
    \n紧接着,我们用来解析并入库:
    \n 
    \n 
    \n
    \nRuby代码
    \n
    \n FIELDS = %w[SKU ItemName CollectionNo Pages]  
    \n   
    \n doc = Hpricot.parse(File.read("my.xml"))  
    \n (doc/:product).each do |xml_product|  
    \n   product = Product.new  
    \n   for field in FIELDS  
    \n     product[field] = (xml_product/field.intern).first.innerHTML  
    \n   end  
    \n   product.save  
    \n end  
    \n
    \n
    \n 遗留问题:
    \n 
    \n1、对于中文,可能会出现乱码
    \n2、另外,有人说不是线程安全的,多线程的话可能有问题。
    \n再附录一段我写的:
    \n
    \n
    \nRuby代码
    \n
    \n require "open-uri"  
    \n require "hpricot"  
    \n doc = open("http://blog.1sters.com") { |f| Hpricot(f) }  
    \n rel = doc.search("//link[@rel='alternate']").first[:href]  
    \n   
    \n print rel.to_s  
    \n   
    \n #xmldoc = Hpricot.XML(open("http://blog.1sters.com/"+rel);)  
    \n xmldoc = open("http://blog.1sters.com/"+rel) do |fi|  
    \n    Hpricot.XML(fi)  
    \n  end  
    \n  (xmldoc/:item).each do |item|  
    \n    title = (item/:title).inner_html  
    \n    link = (item/:link).inner_html  
    \n    date = (item/'dc:date').inner_html  
    \n    puts "\#{title}: \#{link}"   
    \n  end  
    \n #print xmldoc.to_s 
    \n
    \n
    \n
    \n
    \n参考:
    \n1、http://www.ave7.net/forum/showthread.php?t=5919
    \n2、http://club.phpe.net/index.php?act=ST&f=19&t=15267&s=04a67d90deb7607c0907d28dafba10f5;

    \n", "_id"=>131}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云上又一个令人兴奋的功能:智能抓取", "body"=>"

    实现了对展示“技能云”的用户的博客内容的智能抓取,效果相当不错,呵呵,为以后的发展提供了不错的思路,大家可以看这个地址上的右下角,显示的即是该用户的blog上的最新内容:
    \n
    \n http://www.itechtag.com/people/view/16

    \n

    http://www.itechtag.com/people/view/1

    \n

    其他的,只有用户在自己的页面上展示了自己的“技能云”,我们就可以智能的抓取到其最新的博客内容,相当方便。

    ", "created_at"=>2007-09-30 12:13:32 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    实现了对展示“技能云”的用户的博客内容的智能抓取,效果相当不错,呵呵,为以后的发展提供了不错的思路,大家可以看这个地址上的右下角,显示的即是该用户的blog上的最新内容:
    \n
    \n http://www.itechtag.com/people/view/16
    \nhttp://www.itechtag.com/people/view/1
    \n其他的,只有用户在自己的页面上展示了自己的“技能云”,我们就可以智能的抓取到其最新的博客内容,相当方便。

    \n", "_id"=>132}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Win下安装Rmagick!", "body"=>"

    说来惭愧,写了这么久的Ruby,做了那么多的网站,也写过不少使用Rmagick来处理图片的代码,但是自己的机子上始终安装不成功,折腾了好几 次,我记得都没有最终完全搞定。本来准备使用Ubuntu上,但是很多东西在Win下使用惯了,所以还是安心的在WIN下做开发吧。

    \n

    言归正传,说说怎么在Win下安装Rmagick,其他的部分可以参考http://www.javaeye.com/post/167758和 http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html这两文章,我大概说下步骤和可能会出现的问 题,记录一下:

    \n
    1、首先到这个地方去下载RMagick的最新Windows版本,到目前为止的最新版本是rmagick-win32-1.13.0_IM-6.2.9-3.zip
    \n
    2、先解压,然后输入命令安装:gem install rmagick-1.13.0-win32.gem
    \n
    3、然后再点ImageMagick-6.2.9-3-Q8-windows-dll.exe安装,并且把这个的安装路径放到path环境变量里面去,否则会出现CORE_RL_magick_.dll找不到的错误(需要注意,加入后CMD需要重新打开下,否则不行)。
    \n然后试试这段代码,如下:
    \n
    \n
    示例代码
    \n
      \n
    1. require 'RMagick'  
    2. \n
    3. include Magick  
    4. \n
    5. pic = ImageList.new("vd2.jpg")  
    6. \n
    7. l = pic.columns > pic.rows ? pic.columns : pic.rows  
    8. \n
    9. f = 128.0/l;  
    10. \n
    11. thumb = pic.thumbnail(f)  
    12. \n
    13. thumb.write("vd2_tb.jpg")  
    14. \n
    \n
    \n其他的就不写的,互联网的资源是无限的,参考以下:
    \n1、http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html
    \n2、http://www.javaeye.com/post/167758
    \n3、http://rmagick.rubyforge.org/portfolio.html
    ", "created_at"=>2007-10-01 12:29:15 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    说来惭愧,写了这么久的Ruby,做了那么多的网站,也写过不少使用Rmagick来处理图片的代码,但是自己的机子上始终安装不成功,折腾了好几 次,我记得都没有最终完全搞定。本来准备使用Ubuntu上,但是很多东西在Win下使用惯了,所以还是安心的在WIN下做开发吧。
    \n言归正传,说说怎么在Win下安装Rmagick,其他的部分可以参考http://www.javaeye.com/post/167758和 http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html这两文章,我大概说下步骤和可能会出现的问 题,记录一下:
    \n1、首先到这个地方去下载RMagick的最新Windows版本,到目前为止的最新版本是rmagick-win32-1.13.0IM-6.2.9-3.zip。
    \n2、先解压,然后输入命令安装:gem install rmagick-1.13.0-win32.gem
    \n3、然后再点ImageMagick-6.2.9-3-Q8-windows-dll.exe安装,并且把这个的安装路径放到path环境变量里面去,否则会出现CORE_RL_magick
    .dll找不到的错误(需要注意,加入后CMD需要重新打开下,否则不行)。
    \n然后试试这段代码,如下:
    \n
    \n示例代码
    \n
    \n require 'RMagick'  
    \n include Magick  
    \n pic = ImageList.new("vd2.jpg")  
    \n l = pic.columns > pic.rows ? pic.columns : pic.rows  
    \n f = 128.0/l;  
    \n thumb = pic.thumbnail(f)  
    \n thumb.write("vd2_tb.jpg")  
    \n
    \n
    \n其他的就不写的,互联网的资源是无限的,参考以下:
    \n1、http://blog.sina.com.cn/s/blog_4a6ae9750100076w.html
    \n2、http://www.javaeye.com/post/167758
    \n3、http://rmagick.rubyforge.org/portfolio.html

    \n", "_id"=>133}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复一个关于自动登录的BUG!", "body"=>"

    前几天给“技能云”加上了自动登录的功能,并写了一篇手记文章(参考这里:在Rails中实现自动登录功能!),但是前几天wangdi.cd提了一个问题如下:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. 我前几天用了一下itechtag,并且注册了一个hobitton的用户名,,但是现在,,我还没登  
    2. \n
    3. 录,就自己给我用trail的用户名登录了,,还能修改他的信息,,怎么回事呢?  
    4. \n
    \n
    \n开始还没有引起重视,昨天晚上另外一个用户dbd也说存在这个问题,详细问了下,他说上次登录的时候选择了“记住我”,今天再次登录的时候就出现该问题了,而后google时无意看到JAVAEYE的抛出异常的爱说:

    \n

    \n

    \n
    抛出异常的爱:
    \n
      \n
    1. 刚刚在  
    2. \n
    3. 技能云http://www.itechtag.com/about  
    4. \n
    5. 遇到了。。。  
    6. \n
    7. 用的是温柔一刀的账号。。。。。  
    8. \n
    \n
    \n看来是有问题了,立即检查代码,看到取当前用户是否自动登录的代码如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def get_current_user    
    2. \n
    3.   if session[:user].nil?    
    4. \n
    5.     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])    
    6. \n
    7.       session[:user] = c_user.id    
    8. \n
    9.     end    
    10. \n
    11.   end    
    12. \n
    13. end   
    14. \n
    \n
    \n再看看PersistentLogin这个表的结构,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. class CreatePersistentLogins < ActiveRecord::Migration  
    2. \n
    3.   def self.up  
    4. \n
    5.     create_table :persistent_logins do |t|  
    6. \n
    7.       t.column :uid:string:null => false  
    8. \n
    9.       t.column :user_id:integer:null => false  
    10. \n
    11.       t.column :created_on:datetime:null => false  
    12. \n
    13.     end  
    14. \n
    15.       
    16. \n
    17.    add_index :persistent_logins:uid:name => "uid"  
    18. \n
    19.    add_index :persistent_logins:created_on:name => "created_on"      
    20. \n
    21.   end  
    22. \n
    23.   
    24. \n
    25.   def self.down  
    26. \n
    27.     drop_table :persistent_logins  
    28. \n
    29.   end  
    30. \n
    31. end  
    32. \n
    \n
    \n一眼看出问题所在,user_id这个字段保存的才是用户的ID,而前面那段代码取成了id 字段,真是疏忽呀~

    \n

    找到问题,自然好解决了,不在废话~
    \n

    ", "created_at"=>2007-10-02 05:13:40 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    前几天给“技能云”加上了自动登录的功能,并写了一篇手记文章(参考这里:在Rails中实现自动登录功能!),但是前几天wangdi.cd提了一个问题如下:
    \n
    \n
    \nXML/HTML代码
    \n
    \n 我前几天用了一下itechtag,并且注册了一个hobitton的用户名,,但是现在,,我还没登  
    \n 录,就自己给我用trail的用户名登录了,,还能修改他的信息,,怎么回事呢?  
    \n
    \n
    \n开始还没有引起重视,昨天晚上另外一个用户dbd也说存在这个问题,详细问了下,他说上次登录的时候选择了“记住我”,今天再次登录的时候就出现该问题了,而后google时无意看到JAVAEYE的抛出异常的爱说:
    \n
    \n
    \n抛出异常的爱:
    \n
    \n 刚刚在  
    \n 技能云http://www.itechtag.com/about  
    \n 遇到了。。。  
    \n 用的是温柔一刀的账号。。。。。  
    \n
    \n
    \n看来是有问题了,立即检查代码,看到取当前用户是否自动登录的代码如下:
    \n
    \n
    \nRuby代码
    \n
    \n def get_current_user    
    \n   if session[:user].nil?    
    \n     if cookies[:p_session_id] && p = PersistentLogin.find_by_uid(cookies[:p_session_id])    
    \n       session[:user] = c_user.id    
    \n     end    
    \n   end    
    \n end   
    \n
    \n
    \n再看看PersistentLogin这个表的结构,如下:
    \n
    \n
    \nRuby代码
    \n
    \n class CreatePersistentLogins < ActiveRecord::Migration  
    \n   def self.up  
    \n     create_table :persistent_logins do |t|  
    \n       t.column :uid, :string, :null => false  
    \n       t.column :user_id, :integer, :null => false  
    \n       t.column :created_on, :datetime, :null => false  
    \n     end  
    \n       
    \n    add_index :persistent_logins, :uid, :name => "uid"  
    \n    add_index :persistent_logins, :created_on, :name => "created_on"      
    \n   end  
    \n   
    \n   def self.down  
    \n     drop_table :persistent_logins  
    \n   end  
    \n end  
    \n
    \n
    \n一眼看出问题所在,user_id这个字段保存的才是用户的ID,而前面那段代码取成了id 字段,真是疏忽呀~
    \n找到问题,自然好解决了,不在废话~

    \n", "_id"=>134}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的音乐DNA测评报告~", "body"=>"

    朋友发了一个URL,说在FF下太震撼了,随手打开,是个音乐的网站,首页最显著的地方有个很好玩的心理测试flash,按照自己的性格,做了下,按照其 生成的报告,还真挺准的,真的很准的。比如我喜欢的摇滚和朋克等,以及其推荐的linkpark等歌曲,这个网站貌似有点前途~

    \n

    报告如下:

    \n

    你的音乐DNA测评报告

    \n
    \n
    \n
    \n
    (S)沉思的萨克斯25%
    \n
    (G)激烈的电吉他44%
    \n
    (P)动听的钢琴16%
    \n
    (D)动感的电子鼓15%
    \n
     
    \n
    \n
    \n
    \n
    \n
    显性音乐DNA为:(G)激烈的电吉他
    \n
    隐性音乐DNA为:(S)沉思的萨克斯
    \n
    \n
    \n
    \n\n\n\n
    \n\n
    \n
    \n
    \n
    \n### 你是:典型的“(G)激烈的电吉他”类型\n

    G类型(反叛型)音乐DNA呈显性的人,认为音乐是情绪表达的最好出口。音乐于你来讲就如同一项刺激的探险旅行,你期待在音乐中获得异于他人的新鲜体验。

    \n
      \n
    • 速度偏爱
    • \n

      在大多数情况下,偏爱节拍速度较快的音乐(BPM ”Beat per Minute”>80)。在歌曲节奏性与旋律性的对比上,你更倾向于节奏性较强的音乐表达和充满能量的速度感体验。

      \n
    • 歌词偏爱
    • \n

      简单直接,甚至带有一些无所谓何般抵抗的词汇才是脑中所想,反叛性的歌词亦是这类听者的最爱“我不愿相信真的有魔鬼,也不愿与任何人作对”,“噢姐 姐,我想回家,牵着我的手,我有些困了……”。“你会看见雾、看见云、看见太阳,纪念和大地重复着悲伤……”你完全不喜欢千篇一律的情感描述词句。

      \n
    • 歌曲情绪体现
    • \n

      在你看来,情绪表达是一首歌的重要内容之一。你会十分在意一首歌的情绪是否与你心情合拍,并倾向于较为直接和激烈的情绪表达。

      \n
    • 人声体现
    • \n

      喜欢不一样的声音,喜欢嗓子里像粘上碎玻璃的声音;喜欢人声随着乐器越来越猛烈的嘶喊,混乱、躁动,不安现状的声音会得到青睐;不喜欢做作和感情扭捏造作的口水式演唱。

      \n
    • 曲风偏好
    • \n

      在纷繁的音乐类型中,这种类型的爱好者会偏爱硬摇滚、另类、朋克(PUNK)、重金属Heavy metal、流行金属等能量较高的音乐。

      \n
    • 乐器偏好
    • \n

      偏爱电声乐器(什么是?):如失真电吉他、电贝司、架子鼓、饱满的木吉他扫弦或是一段精彩的乐器SOLO(什么是?)中那充满延伸的电子合成器;喜欢原始却不失热情的配器,

      \n
    • 能量消耗
    • \n

      无论从演奏者还是演唱者,都会有极度消耗能量的倾向,而这样的倾向,会获得典型此类型人的极大共鸣

      \n
    • 音乐人偏好
    • \n

      Beyond、F.I.R、蔡健雅、信乐团、孙燕姿、崔健、莫文蔚、谢天啸、Metallica 、Nirvana、Korn、Green Day、Coldplay、X-Japan

      \n
    \n
    \n
    \n
    \n
    \n
    \n

    注:关于测评结果,你需要了解,

    \n
      \n
    • YOBO 根据人们对音乐偏好的差异,将每个人的音乐DNA分为4种倾向性。你的音乐DNA可能在其中一类上尤为突出,也有可能同时倾向于2-3类不同的音乐偏好。 YOBO的前期调查显示,每个人都具有其最明显的显性倾向和相对较为隐蔽的隐性倾向,然而,没有会对4类音乐偏好都同时具有明显倾向性的人—当然,你也有 可能是最例外的一位
    • \n
    • 在音乐心理测评报告中,我们描述你的音乐喜好所举的实例,包括歌词、歌曲、人名等等,有可能因为一些不可预计的因素而存在个体差异,请你更关注整体描述
    • \n
    • 除了针对音乐元素的心理分析报告,我们还将分析你的性格特征和情感体现
    • \n
    \n
    \n
    \n
    \n
     
    \n
    ", "created_at"=>2007-10-02 06:52:02 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    朋友发了一个URL,说在FF下太震撼了,随手打开,是个音乐的网站,首页最显著的地方有个很好玩的心理测试flash,按照自己的性格,做了下,按照其 生成的报告,还真挺准的,真的很准的。比如我喜欢的摇滚和朋克等,以及其推荐的linkpark等歌曲,这个网站貌似有点前途~
    \n报告如下:
    \n你的音乐DNA测评报告
    \n
    \n
    \n
    \n(S)沉思的萨克斯25%
    \n(G)激烈的电吉他44%
    \n(P)动听的钢琴16%
    \n(D)动感的电子鼓15%
    \n 
    \n
    \n
    \n
    \n
    \n显性音乐DNA为:(G)激烈的电吉他
    \n隐性音乐DNA为:(S)沉思的萨克斯
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \nvar js_564=new yobo_SWF("/flash/t/102/YoboPsyTest.swf", "finalPlayer", "8", "GW=engine.yobo.com&U=825856&L=0&S=d71d8677cddb40469bcaf749a80a0a0ed0c9d1c5&P=0&V=-1&D=0&cID=0&VER=0.30", "591", "206", "#ffffff");js_564.write("swf_564_finalPlayer");
    \n
    \n
    \n

    \n\n

    你是:典型的“(G)激烈的电吉他”类型

    \n\n

    G类型(反叛型)音乐DNA呈显性的人,认为音乐是情绪表达的最好出口。音乐于你来讲就如同一项刺激的探险旅行,你期待在音乐中获得异于他人的新鲜体验。
    \n
    \n 速度偏爱
    \n 在大多数情况下,偏爱节拍速度较快的音乐(BPM ”Beat per Minute”>80)。在歌曲节奏性与旋律性的对比上,你更倾向于节奏性较强的音乐表达和充满能量的速度感体验。
    \n 歌词偏爱
    \n 简单直接,甚至带有一些无所谓何般抵抗的词汇才是脑中所想,反叛性的歌词亦是这类听者的最爱“我不愿相信真的有魔鬼,也不愿与任何人作对”,“噢姐 姐,我想回家,牵着我的手,我有些困了……”。“你会看见雾、看见云、看见太阳,纪念和大地重复着悲伤……”你完全不喜欢千篇一律的情感描述词句。
    \n 歌曲情绪体现
    \n 在你看来,情绪表达是一首歌的重要内容之一。你会十分在意一首歌的情绪是否与你心情合拍,并倾向于较为直接和激烈的情绪表达。
    \n 人声体现
    \n 喜欢不一样的声音,喜欢嗓子里像粘上碎玻璃的声音;喜欢人声随着乐器越来越猛烈的嘶喊,混乱、躁动,不安现状的声音会得到青睐;不喜欢做作和感情扭捏造作的口水式演唱。
    \n 曲风偏好
    \n 在纷繁的音乐类型中,这种类型的爱好者会偏爱硬摇滚、另类、朋克(PUNK)、重金属Heavy metal、流行金属等能量较高的音乐。
    \n 乐器偏好
    \n 偏爱电声乐器(什么是?):如失真电吉他、电贝司、架子鼓、饱满的木吉他扫弦或是一段精彩的乐器SOLO(什么是?)中那充满延伸的电子合成器;喜欢原始却不失热情的配器,
    \n 能量消耗
    \n 无论从演奏者还是演唱者,都会有极度消耗能量的倾向,而这样的倾向,会获得典型此类型人的极大共鸣
    \n 音乐人偏好
    \n Beyond、F.I.R、蔡健雅、信乐团、孙燕姿、崔健、莫文蔚、谢天啸、Metallica 、Nirvana、Korn、Green Day、Coldplay、X-Japan
    \n
    \n
    \n
    \n
    \n
    \n
    \n注:关于测评结果,你需要了解,
    \n
    \n YOBO 根据人们对音乐偏好的差异,将每个人的音乐DNA分为4种倾向性。你的音乐DNA可能在其中一类上尤为突出,也有可能同时倾向于2-3类不同的音乐偏好。 YOBO的前期调查显示,每个人都具有其最明显的显性倾向和相对较为隐蔽的隐性倾向,然而,没有会对4类音乐偏好都同时具有明显倾向性的人—当然,你也有 可能是最例外的一位
    \n 在音乐心理测评报告中,我们描述你的音乐喜好所举的实例,包括歌词、歌曲、人名等等,有可能因为一些不可预计的因素而存在个体差异,请你更关注整体描述
    \n 除了针对音乐元素的心理分析报告,我们还将分析你的性格特征和情感体现
    \n
    \n
    \n
    \n
    \n 

    \n", "_id"=>135}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Migration把 MySQL的表引擎修改为InnoDB", "body"=>"

    尽管现在还没有这个需求,但是还是有必要了解一下,也是对Migration掌握的必须掌握的东西,代码不是我写的,来自与http://snippets.dzone.com/posts/show/4601,我怕时间按久了在那里找不到,所以干脆贴过来。

    \n
    \n
    Migration的Ruby代码
    \n
      \n
    1. class ChangeTableTypes < ActiveRecord::Migration  
    2. \n
    3.     
    4. \n
    5.   def self.up  
    6. \n
    7.     ActiveRecord::Migration::say 'Setting all tables to InnoDB engine (excluding schema_info table)...'  
    8. \n
    9.     result = ActiveRecord::Migration::execute 'show tables'  
    10. \n
    11.     while table = result.fetch_row  
    12. \n
    13.       execute("ALTER TABLE \#{table.to_s} TYPE = InnoDB"unless table.to_s == 'schema_info'  
    14. \n
    15.     end  
    16. \n
    17.   end  
    18. \n
    19.   
    20. \n
    21.   def self.down  
    22. \n
    23.     raise ActiveRecord::IrreversibleMigration  
    24. \n
    25.   end  
    26. \n
    27. end  
    28. \n
    \n
    ", "created_at"=>2007-10-02 07:26:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    尽管现在还没有这个需求,但是还是有必要了解一下,也是对Migration掌握的必须掌握的东西,代码不是我写的,来自与http://snippets.dzone.com/posts/show/4601,我怕时间按久了在那里找不到,所以干脆贴过来。
    \n
    \nMigration的Ruby代码
    \n
    \n class ChangeTableTypes < ActiveRecord::Migration  
    \n     
    \n   def self.up  
    \n     ActiveRecord::Migration::say 'Setting all tables to InnoDB engine (excluding schema_info table)...'  
    \n     result = ActiveRecord::Migration::execute 'show tables'  
    \n     while table = result.fetch_row  
    \n       execute("ALTER TABLE \#{table.to_s} TYPE = InnoDB") unless table.to_s == 'schema_info'  
    \n     end  
    \n   end  
    \n   
    \n   def self.down  
    \n     raise ActiveRecord::IrreversibleMigration  
    \n   end  
    \n end  
    \n

    \n", "_id"=>136}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正在筹备给技能云进行一次大改版~", "body"=>"

    有些地方使用起来不是很顺,需要大改一下,目前可能会修改的地方有:

    \n

    角色的规则(可能改成和技能一样的处理方式,可以随便用户自动添加,就像技能一样)

    \n

    显示方式(可能会使用tab的方式,进行显示)

    \n

    其他的部分正在一步步的想。

    ", "created_at"=>2007-10-08 04:18:03 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    有些地方使用起来不是很顺,需要大改一下,目前可能会修改的地方有:
    \n角色的规则(可能改成和技能一样的处理方式,可以随便用户自动添加,就像技能一样)
    \n显示方式(可能会使用tab的方式,进行显示)
    \n其他的部分正在一步步的想。

    \n", "_id"=>137}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate :分页不可或缺的插件", "body"=>"

    Rails以前的版本中包含了一个分页的方法,我使用的使用做了一些扩充,一直用到现在,看到很多人介绍Will Paginate,偶也不感兴趣,后来发现一个消息说Rails2.0将祛除内置的Paginate,于是就看看这个Will Paginate。

    \n

    参考资料:

    \n\n

    附录:基本步骤和过程

    \n

    \n

    \n
    安装will_paginate
    \n
      \n
    1. ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate  
      \n
    2. \n
    \n
    \n

    \n\n
    \n
    \n
    在Model中使用will_paginate
    \n
      \n
    1. # models/product.rb    
    2. \n
    3. def self.search(search, page)    
    4. \n
    5.   paginate :per_page => 5, :page => page,    
    6. \n
    7.            :conditions => ['name like ?'"%\#{search}%"],    
    8. \n
    9.            : order => 'name'    
    10. \n
    11. nd   
      \n
    12. \n
    \n
    \n
    \n\n
    \n
    \n
    在controller中使用search
    \n
      \n
    1. # products_controller.rb    
    2. \n
    3. def index    
    4. \n
    5.   @products = Product.search(params[:search], params[:page])    
    6. \n
    7. end   
      \n
    8. \n
    \n
    \n
    \n
    在页面中使用will_paginate
    \n
      \n
    1. <!-- products/index.rhtml -->    
    2. \n
    3.  <%= will_paginate @products %>    
    4. \n
    \n
    \n
    \n", "created_at"=>2007-10-10 07:08:55 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Rails以前的版本中包含了一个分页的方法,我使用的使用做了一些扩充,一直用到现在,看到很多人介绍Will Paginate,偶也不感兴趣,后来发现一个消息说Rails2.0将祛除内置的Paginate,于是就看看这个Will Paginate。
    \n参考资料:
    \n
    \n http://dev.rubyonrails.org/changeset/6993
    \n http://errtheblog.com/post/4791
    \n http://agilewebdevelopment.com/plugins/will_paginate
    \n http://mattrobinson.net/2007/6/26/rails-plugins-scope_out-and-will_paginate
    \n http://www.dcmanges.com/blog/21
    \n http://www.lycom.de/past/2007/7/12/rails_will_paginate20070712_200741/
    \n http://www.javaeye.com/topic/108118
    \n http://railscasts.com/episodes/51
    \n
    \n附录:基本步骤和过程
    \n
    \n
    \n安装will_paginate
    \n
    \n ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate  
    \n
    \n
    \n
    \n
    \nrender_code();
    \n
    \n
    \n在Model中使用will_paginate
    \n
    \n # models/product.rb    
    \n def self.search(search, page)    
    \n   paginate :per_page => 5, :page => page,    
    \n            :conditions => ['name like ?', "%\#{search}%"],    
    \n            : order => 'name'    
    \n nd   
    \n
    \n
    \n
    \n
    \nrender_code();
    \n
    \n
    \n在controller中使用search
    \n
    \n # products_controller.rb    
    \n def index    
    \n   @products = Product.search(params[:search], params[:page])    
    \n end   
    \n
    \n
    \n
    \n
    \n在页面中使用will_paginate
    \n
    \n # <!-- products/index.rhtml -->    
    \n  <%= will_paginate @products %>    
    \n
    \n
    \n
    \nrender_code();

    \n", "_id"=>138}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"抓取在线网页图像的方法~", "body"=>"

    在考虑给技能云添加一个特色的功能,就是给动态抓取提交项目的页面图片,google了一些方法,记录如下:

    \n

    1、http://thumbnailspro.com/网站

    \n
    \n
    Website Thumbnails - Screenshots captured in seconds - Over 1000 sizes!
    \n
      \n
    1. <a href="http://thumbnailspro.com" title="website thumbnails">  
    2. \n
    3. <img src="http://thumbnailspro.com/thumb.php?url=http://www.itechtag.com&S=150" border="0" alt="website thumbnails">  
    4. \n
    5. </a>  
    6. \n
    \n
    \n

    这个网站号称Screenshots captured in seconds,我在本地测试了几个,感觉速度还不错,我们可以直接使用,或者第一次把这个图片保存到本地即可。

    \n

    2、http://webthumb.bluga.net/home.php
    \n按照http://snippets.dzone.com/posts/show/3621上面的代码,抓取,采用ruby代码,用webservice连接到做snap的网站获得jpg文件,但是需要注册,申请API的key,免费有限制每月250次。

    \n

    3、www.artviper.net

    \n

    第3种比较简单和第一种web service相似
    \n不过不用ruby而是纯html img的tag, 有点慢
    \n

    \n
    XML/HTML代码
    \n
      \n
    1. <img src="http://www.artviper.net/screenshots/screener.php?&url=www.meinedomain.com&q=xx&h=hh&w=ww&sdx=xxx&sdy=xxx" alt="artViper designstudio website thumbnail "/>  
    2. \n
    \n
    \nThe parameters as following:
    \n    * q = quality level ( 30-70% )
    \n    * h = output height
    \n    * w = output width
    \n    * sdx = crop area horizontally
    \n    * sdy = crop area vertically
    \n
    \nIf you omit the sdx & sdy values, the whole page gets snapped.
    \nDon't forget to add a backlink to www.artviper.net or www.artviper.de ( textlink is enough ) but please place the link good visible.
    \nhttp://www.artviper.net/screenshots/screener.php?&url=http://www.itechtag.com&q=70&h=180&w=360

    \n

    \"\"

    ", "created_at"=>2007-10-12 09:39:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在考虑给技能云添加一个特色的功能,就是给动态抓取提交项目的页面图片,google了一些方法,记录如下:
    \n1、http://thumbnailspro.com/网站
    \n
    \nWebsite Thumbnails - Screenshots captured in seconds - Over 1000 sizes!
    \n
    \n <a href="http://thumbnailspro.com" title="website thumbnails">  
    \n <img src="http://thumbnailspro.com/thumb.php?url=http://www.itechtag.com&S=150;" border="0" alt="website thumbnails">  
    \n </a>  
    \n
    \n
    \n这个网站号称Screenshots captured in seconds,我在本地测试了几个,感觉速度还不错,我们可以直接使用,或者第一次把这个图片保存到本地即可。
    \n2、http://webthumb.bluga.net/home.php
    \n按照http://snippets.dzone.com/posts/show/3621上面的代码,抓取,采用ruby代码,用webservice连接到做snap的网站获得jpg文件,但是需要注册,申请API的key,免费有限制每月250次。
    \n3、www.artviper.net
    \n第3种比较简单和第一种web service相似
    \n不过不用ruby而是纯html img的tag, 有点慢
    \n
    \nXML/HTML代码
    \n
    \n <img src="http://www.artviper.net/screenshots/screener.php?&url=www.meinedomain.com&q=xx&h=hh&w=ww&sdx=xxx&sdy=xxx;" alt="artViper designstudio website thumbnail "/>  
    \n
    \n
    \nThe parameters as following:
    \n    * q = quality level ( 30-70% )
    \n    * h = output height
    \n    * w = output width
    \n    * sdx = crop area horizontally
    \n    * sdy = crop area vertically
    \n
    \nIf you omit the sdx & sdy values, the whole page gets snapped.
    \nDon't forget to add a backlink to www.artviper.net or www.artviper.de ( textlink is enough ) but please place the link good visible.
    \nhttp://www.artviper.net/screenshots/screener.php?&url=http://www.itechtag.com&q=70&h=180&w=360;

    \n", "_id"=>139}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)功能需求归纳", "body"=>"

    1、修改角色云的添加方式
    \n说明:按照技能云的模式修改角色云,可以让用户自己随意添加角色;

    \n

    2、添加项目的时候的检查

    \n

    说明:检查项目名称、项目简介等信息,如果以上两个为空,则不能添加;

    \n

    3、添加项目时对公司、行业等的添加方式~

    \n

    说明:这个需要更改下添加方式,现在的方式在公司多了的时候那个下拉列表会很长;

    \n

    4、界面优化

    \n

    说明:需要对界面进行一些优化,现在的界面有的地方看上去很丑~

    \n

    5、重构

    \n

    说明:有些地方很不合理,需要重构下代码。

    \n

    6、评价的时候有个bug

    \n

    说明:我第一次评价时,明明评价了一次,却显示评价了2次。

    \n

    7、后台管理功能

    \n

    说明:后台现在还缺少很多的管理功能,需要加上部分管理功能。

    \n

    8、评价的显示

    \n

    说明:修改为按照tab的模式进行显示,不再把项目成员的信息显示在侧边栏,侧边栏可以放诸如类似性质的项目或者同一个行业的项目;或者同一个公司的项目;

    \n

    9、展示最新消息

    \n

    说明:为了使得网站看上去是持续的改进,需要把最新的动态告诉大家, 后台发布信息的已经有了,但是需要在前台找个地方展示出来。

    \n

    10、抓取网页图片

    \n

    说明:按照提交项目的地址抓取用户的页面图片。

    ", "created_at"=>2007-10-12 09:44:22 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    1、修改角色云的添加方式
    \n说明:按照技能云的模式修改角色云,可以让用户自己随意添加角色;
    \n2、添加项目的时候的检查
    \n说明:检查项目名称、项目简介等信息,如果以上两个为空,则不能添加;
    \n3、添加项目时对公司、行业等的添加方式~
    \n说明:这个需要更改下添加方式,现在的方式在公司多了的时候那个下拉列表会很长;
    \n4、界面优化
    \n说明:需要对界面进行一些优化,现在的界面有的地方看上去很丑~
    \n5、重构
    \n说明:有些地方很不合理,需要重构下代码。
    \n6、评价的时候有个bug
    \n说明:我第一次评价时,明明评价了一次,却显示评价了2次。
    \n7、后台管理功能
    \n说明:后台现在还缺少很多的管理功能,需要加上部分管理功能。
    \n8、评价的显示
    \n说明:修改为按照tab的模式进行显示,不再把项目成员的信息显示在侧边栏,侧边栏可以放诸如类似性质的项目或者同一个行业的项目;或者同一个公司的项目;
    \n9、展示最新消息
    \n说明:为了使得网站看上去是持续的改进,需要把最新的动态告诉大家, 后台发布信息的已经有了,但是需要在前台找个地方展示出来。
    \n10、抓取网页图片
    \n说明:按照提交项目的地址抓取用户的页面图片。

    \n", "_id"=>140}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Will Paginate的扩充使用~", "body"=>"

    Will Paginate真的很容易使用,看他自带的readme就能明白,但是其他的一些东西可以看看代码就明白了,比如你想显示一共多少页?当前是第几页?已经一共多少个item,都是可以做到的,看一个我在技能云上用的例子,代码如下:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <!--分页导航 -->  
    2. \n
    3. <table>  
    4. \n
    5.   <tr>  
    6. \n
    7.     <td><%= will_paginate @projects %></td>  
    8. \n
    9.       <td>  
    10. \n
    11.       <div class="pagination">  
    12. \n
    13.         <span class="lable">  
    14. \n
    15.           <b>页面信息: </b><%=@projects.total_entries %></b>个, 共<b><%=@projects.page_count %></b>页,  当前第<b><%= @projects.current_page%></b>页.  
    16. \n
    17.         </span>  
    18. \n
    19.       </div>  
    20. \n
    21.       
    22. \n
    23.   </tr>  
    24. \n
    25. </table> 
      \n
    26. \n
    \n
    \n

    其他的用法,比如显示的页数什么的,以及是否支持ajax等都是可以找到相关资料的,我就不多说了,参考如下资料:

    \n

    http://errtheblog.com/post/929

    ", "created_at"=>2007-10-13 02:04:17 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Will Paginate真的很容易使用,看他自带的readme就能明白,但是其他的一些东西可以看看代码就明白了,比如你想显示一共多少页?当前是第几页?已经一共多少个item,都是可以做到的,看一个我在技能云上用的例子,代码如下:
    \n
    \nXML/HTML代码
    \n
    \n <!--分页导航 -->  
    \n <table>  
    \n   <tr>  
    \n     <td><%= will_paginate @projects %></td>  
    \n       <td>  
    \n       <div class="pagination">  
    \n         <span class="lable">  
    \n           <b>页面信息: </b>总<%=@projects.total_entries %></b>个, 共<b><%=@projects.page_count %></b>页,  当前第<b><%= @projects.current_page%></b>页.  
    \n         </span>  
    \n       </div>  
    \n       
    \n   </tr>  
    \n </table> 
    \n
    \n
    \n
    \n其他的用法,比如显示的页数什么的,以及是否支持ajax等都是可以找到相关资料的,我就不多说了,参考如下资料:
    \nhttp://errtheblog.com/post/929

    \n", "_id"=>141}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Html/css/js"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Html/css/js", "updated_at"=>2012-06-24 15:53:12 UTC, "created_at"=>2012-06-24 15:53:12 UTC, "_id"=>10}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Introducing the AJAX Feed API FeedControl", "body"=>" 这篇文章是我很早前写的,放在原来的blog上的,无奈那个blog坏掉了,幸好还有”百度快照 “(http://cache.baidu.com/c?word=feedcontrol&url=http%3A//weblog% 2E1ster%2Ecn/%3Faction%3Dshow%26id%3D112&p=98769a45dcd011a05be7d3284c0096& user=baidu),找回来了,呵呵。以下是原文。\r\n\r\nGoogle放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:\r\n其API都很简单,详细的可以看这个页面上的介绍:\r\nhttp://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl\r\n只有一个构造器:FeedControl\r\n四个函数:\r\n1.addFeed(url, label) //添加需要显示的FEED的URL\r\n2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:\r\n\r\nfeedControl.draw(\r\ndocument.getElementById(\"feedControl\"),\r\n{\r\ndrawMode : google.feeds.FeedControl.DRAW_MODE_TABBED\r\n});\r\n\r\nfeedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.\r\n\r\n3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)\r\n4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下:\r\n\r\n* google.feeds.LINK_TARGET_BLANK - links will open in a new window\r\n* google.feeds.LINK_TARGET_SELF - links will open in the current window\r\n* google.feeds.LINK_TARGET_TOP - links will open in the topmost frame\r\n* google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame.\r\n* anything-else - the value of target in the resulting anchor element is set to linkTarget\r\n\r\n附录其网站上的说明:\r\n---------------\r\nThis morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:\r\n\r\nvar feedControl = new google.feeds.FeedControl();\r\nfeedControl.addFeed(\"http://www.digg.com/rss/index.xml\", \"Digg\");\r\nfeedControl.addFeed(\"http://feeds.feedburner.com/Techcrunch\", \"TechCrunch\");\r\nfeedControl.draw(document.getElementById(\"feedControl\"));\r\n\r\nIn addition to the formal documentation, we have put together a few samples to help you quickly come up to speed.\r\n\r\n另外,补充一点东西,如果你需要定制他的CSS样式表,可以按照这个模式定制,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <!-- The Feed Control Class (Note: Linear Mode is Shown) -->  
    2. \r\n\t
    3. <div class=\"gfc-control\">  
    4. \r\n\t
    5.   
    6. \r\n\t
    7.   <!-- Per Feed Container -->  
    8. \r\n\t
    9.   <div class=\"gfc-resultsRoot\">  
    10. \r\n\t
    11.   
    12. \r\n\t
    13.     <!-- Per Feed Header -->  
    14. \r\n\t
    15.     <!-- .gfc-title holds Feed's Label -->  
    16. \r\n\t
    17.     <div class=\"gfc-resultsHeader\">  
    18. \r\n\t
    19.       <div class=\"gfc-title\"></div>  
    20. \r\n\t
    21.     </div>  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.     <!-- Collection of Entries -->  
    26. \r\n\t
    27.     <div class=\"gfc-results\">  
    28. \r\n\t
    29.   
    30. \r\n\t
    31.       <!-- One .gfc-result per entry -->  
    32. \r\n\t
    33.       <div class=\"gfc-result\">  
    34. \r\n\t
    35.   
    36. \r\n\t
    37.         <!-- One .gf-result per entry -->  
    38. \r\n\t
    39.         <div class=\"gf-result\">  
    40. \r\n\t
    41.   
    42. \r\n\t
    43.           <!-- Hyperlinked Entry Title -->  
    44. \r\n\t
    45.           <div class=\"gf-title\">  
    46. \r\n\t
    47.             <a class=\"gf-title\"></a>  
    48. \r\n\t
    49.           </div>  
    50. \r\n\t
    51.   
    52. \r\n\t
    53.           <!-- Author (Only if entry.author is present -->  
    54. \r\n\t
    55.           <div class=\"gf-author\"></div>  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.           <!-- Published Date (Only if entry.publishedDate is present -->  
    60. \r\n\t
    61.           <div class=\"gf-relativePublishedDate\"></div>  
    62. \r\n\t
    63.   
    64. \r\n\t
    65.           <!-- Snippet entry.contentSnippet -->  
    66. \r\n\t
    67.           <div class=\"gf-snippet\"></div>  
    68. \r\n\t
    69.   
    70. \r\n\t
    71.         </div>  
    72. \r\n\t
    73.       </div>  
    74. \r\n\t
    75.       ...  
    76. \r\n\t
    77.       <div class=\"gfc-result\"></div>  
    78. \r\n\t
    79.     </div>  
    80. \r\n\t
    81.   </div>  
    82. \r\n\t
    83.   ...  
    84. \r\n\t
    85.   <div class=\"gfc-resultsRoot\"></div>  
    86. \r\n\t
    87.   
    88. \r\n\t
    89. </div>  
    90. \r\n
    \r\n
    \r\n参考Google文档:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl", "created_at"=>2007-10-14 02:55:28 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

     这篇文章是我很早前写的,放在原来的blog上的,无奈那个blog坏掉了,幸好还有”百度快照 “(http://cache.baidu.com/c?word=feedcontrol&url=http%3A//weblog%; 2E1ster%2Ecn/%3Faction%3Dshow%26id%3D112&p=98769a45dcd011a05be7d3284c0096& user=baidu),找回来了,呵呵。以下是原文。

    \n\n

    Google放出来的AJAX feed API我老早就关注到了,也试用了一些,感觉还真的不错,现在又添加了一些东西,如下:
    \n其API都很简单,详细的可以看这个页面上的介绍:
    \nhttp://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl
    \n只有一个构造器:FeedControl
    \n四个函数:
    \n1.addFeed(url, label) //添加需要显示的FEED的URL
    \n2.addFeed(element, opt_options?);//这个其实就是draw方法,指定显示的方式,例如:

    \n\n

    feedControl.draw(
    \ndocument.getElementById("feedControl"),
    \n{
    \ndrawMode : google.feeds.FeedControl.DRAW_MODE_TABBED
    \n});

    \n\n

    feedControl这个是页面的DOM的ID名称,google.feeds.FeedControl.DRAW_MODE_TABBED 就是指定的显示方式,默认值是:google.feeds.FeedControl.DRAW_MODE_LINEAR.

    \n\n

    3.setNumEntries(num); //设定显示的条数(貌似只能统一指定,不能为各个FEED单独指定)
    \n4.setLinkTarget(linkTarget) //设定链接的打开方式,其值分别如下:

    \n\n
      \n
    • google.feeds.LINK_TARGET_BLANK - links will open in a new window
    • \n
    • google.feeds.LINK_TARGET_SELF - links will open in the current window
    • \n
    • google.feeds.LINK_TARGET_TOP - links will open in the topmost frame
    • \n
    • google.feeds.LINK_TARGET_PARENT - links will open in either the topmost frame, or replace the current frame.
    • \n
    • anything-else - the value of target in the resulting anchor element is set to linkTarget
    • \n
    \n\n

    附录其网站上的说明:

    \n\n

    This morning we added a new class to the Google AJAX Feed API designed to allow you to more easily add a collection of feeds to your pages. The FeedControl is pretty simple:

    \n\n

    var feedControl = new google.feeds.FeedControl();
    \nfeedControl.addFeed("http://www.digg.com/rss/index.xml", "Digg");
    \nfeedControl.addFeed("http://feeds.feedburner.com/Techcrunch", "TechCrunch");
    \nfeedControl.draw(document.getElementById("feedControl"));

    \n\n

    In addition to the formal documentation, we have put together a few samples to help you quickly come up to speed.
    \n
    \n Basic FeedControl - feedcontrol.html
    \n Tabbed FeedControl - tabbed.html
    \n Sidebar Style FeedControl - sidebar.html
    \n AJAX Feed API Playground Blog
    \n
    \n另外,补充一点东西,如果你需要定制他的CSS样式表,可以按照这个模式定制,如下:
    \n
    \nXML/HTML代码
    \n
    \n <!-- The Feed Control Class (Note: Linear Mode is Shown) -->  
    \n <div class="gfc-control">  
    \n   
    \n   <!-- Per Feed Container -->  
    \n   <div class="gfc-resultsRoot">  
    \n   
    \n     <!-- Per Feed Header -->  
    \n     <!-- .gfc-title holds Feed's Label -->  
    \n     <div class="gfc-resultsHeader">  
    \n       <div class="gfc-title"></div>  
    \n     </div>  
    \n   
    \n     <!-- Collection of Entries -->  
    \n     <div class="gfc-results">  
    \n   
    \n       <!-- One .gfc-result per entry -->  
    \n       <div class="gfc-result">  
    \n   
    \n         <!-- One .gf-result per entry -->  
    \n         <div class="gf-result">  
    \n   
    \n           <!-- Hyperlinked Entry Title -->  
    \n           <div class="gf-title">  
    \n             <a class="gf-title"></a>  
    \n           </div>  
    \n   
    \n           <!-- Author (Only if entry.author is present -->  
    \n           <div class="gf-author"></div>  
    \n   
    \n           <!-- Published Date (Only if entry.publishedDate is present -->  
    \n           <div class="gf-relativePublishedDate"></div>  
    \n   
    \n           <!-- Snippet entry.contentSnippet -->  
    \n           <div class="gf-snippet"></div>  
    \n   
    \n         </div>  
    \n       </div>  
    \n       ...  
    \n       <div class="gfc-result"></div>  
    \n     </div>  
    \n   </div>  
    \n   ...  
    \n   <div class="gfc-resultsRoot"></div>  
    \n   
    \n </div>  
    \n
    \n
    \n参考Google文档:http://code.google.com/apis/ajaxfeeds/documentation/reference.html#FeedControl

    \n", "_id"=>142}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"随笔有用的Ruby的函数~", "body"=>"

     

    \n

    经常查一些比较有用的Ruby函数,时间久了就忘记了,随手记录下,以备忘,如果你有不错的函数,欢迎分享,如果顺便附带上一些实例代码就更好了。

    \n

    \n

    \n
    ActiveSupport::CoreExtensions::String::StartsEndsWith
    \n
      \n
    1. starts_with?  
    2. \n
    3.   
    4. \n
    5. Description  
    6. \n
    7. starts_with?(prefix)   
    8. \n
    9. Does the string start with the specified prefix?   
    10. \n
    \n
    \n例如如下代码检测上传的文件是否是图片:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. ( params[:asset][:uploaded_data].content_type.to_s.starts_with?  "image" )  
    2. \n
    \n
    \n

    ", "created_at"=>2007-10-14 15:28:36 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

     
    \n经常查一些比较有用的Ruby函数,时间久了就忘记了,随手记录下,以备忘,如果你有不错的函数,欢迎分享,如果顺便附带上一些实例代码就更好了。
    \n
    \n
    \nActiveSupport::CoreExtensions::String::StartsEndsWith
    \n
    \n starts_with?  
    \n   
    \n Description  
    \n starts_with?(prefix)   
    \n Does the string start with the specified prefix?   
    \n
    \n
    \n例如如下代码检测上传的文件是否是图片:
    \n
    \n
    \nRuby代码
    \n
    \n ( params[:asset][:uploaded_data].content_type.to_s.starts_with?  "image" )  
    \n
    \n

    \n", "_id"=>143}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 1.2.5: Security and maintenance release", "body"=>"

    This release closes a JSON XSS vulnerability, fixes a couple of minor regressions introduced in 1.2.4, and backports a handful of features and fixes from the 2.0 preview release.

    \n

    All users of Rails 1.2.4 or earlier are advised to upgrade to 1.2.5, though it isn’t strictly necessary if you aren’t working with JSON. For more information the JSON vulnerability, see CVE-2007-3227.

    \n

    Summary of changes:

    \n
      \n
    • acts_as_list: fixed an edge case where removing an item from the list then destroying the item leads to incorrect item positioning
    • \n
    • deprecated calling .create on has_many associations with an unsaved owner (like post = Post.new; post.comments.create)
    • \n
    • backport array and hash query parameters
    • \n
    • fix in place editor’s setter action with non-string fields
    • \n
    • updated config/boot.rb to correctly recognize RAILS_GEM_VERSION
    • \n
    \n

    To upgrade, `gem install rails`, set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and `rake rails:update:configs`.

    ", "created_at"=>2007-10-15 03:23:17 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    This release closes a JSON XSS vulnerability, fixes a couple of minor regressions introduced in 1.2.4, and backports a handful of features and fixes from the 2.0 preview release.
    \nAll users of Rails 1.2.4 or earlier are advised to upgrade to 1.2.5, though it isn’t strictly necessary if you aren’t working with JSON. For more information the JSON vulnerability, see CVE-2007-3227.
    \nSummary of changes:
    \n
    \n acts_as_list: fixed an edge case where removing an item from the list then destroying the item leads to incorrect item positioning
    \n deprecated calling .create on has_many associations with an unsaved owner (like post = Post.new; post.comments.create)
    \n backport array and hash query parameters
    \n fix in place editor’s setter action with non-string fields
    \n updated config/boot.rb to correctly recognize RAILS_GEM_VERSION
    \n
    \nTo upgrade, gem install rails, set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and rake rails:update:configs.

    \n", "_id"=>144}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails URL Validation", "body"=>"

    从上看到的,随手记录如下,可能需要用到。

    \n
    \n
    Rails URL Validation
    \n
      \n
    1. validates_each :href:on => :create do |record, attr, value|  
    2. \n
    3.   begin  
    4. \n
    5.     uri = URI.parse(value)  
    6. \n
    7.     if uri.class != URI::HTTP  
    8. \n
    9.       record.errors.add(attr, 'Only HTTP protocol addresses can be used')  
    10. \n
    11.     end  
    12. \n
    13.   rescue URI::InvalidURIError  
    14. \n
    15.     record.errors.add(attr, 'The format of the url is not valid.')  
    16. \n
    17.   end  
    18. \n
    19. end  
    20. \n
    \n
    \n

    以前我判断的时候都是按照是不是http://开头等做的判断,感觉好傻,这样的判断才更加专业和准确。

    ", "created_at"=>2007-10-16 05:31:31 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    从上看到的,随手记录如下,可能需要用到。
    \n
    \nRails URL Validation
    \n
    \n validates_each :href, :on => :create do |record, attr, value|  
    \n   begin  
    \n     uri = URI.parse(value)  
    \n     if uri.class != URI::HTTP  
    \n       record.errors.add(attr, 'Only HTTP protocol addresses can be used')  
    \n     end  
    \n   rescue URI::InvalidURIError  
    \n     record.errors.add(attr, 'The format of the url is not valid.')  
    \n   end  
    \n end  
    \n
    \n
    \n以前我判断的时候都是按照是不是http://开头等做的判断,感觉好傻,这样的判断才更加专业和准确。

    \n", "_id"=>145}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"image_tag with popup for alt attribute", "body"=>"

    firefox不能显示alt指定的文字,只能显示title 指定的,以前的做法是每个地方都写两个,真是够麻烦的,在rails中可以扩充下这个helper,使用起来方便多了,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. module ApplicationHelper  
    2. \n
    3.   def image_tag(location, options)  
    4. \n
    5.     options[:title] ||= options[:alt]  
    6. \n
    7.     super(location, options)  
    8. \n
    9.   end  
    10. \n
    11. end  
    12. \n
    \n
    \n感谢互联网~

    ", "created_at"=>2007-10-16 05:39:50 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    firefox不能显示alt指定的文字,只能显示title 指定的,以前的做法是每个地方都写两个,真是够麻烦的,在rails中可以扩充下这个helper,使用起来方便多了,如下:
    \n
    \n
    \nRuby代码
    \n
    \n module ApplicationHelper  
    \n   def image_tag(location, options)  
    \n     options[:title] ||= options[:alt]  
    \n     super(location, options)  
    \n   end  
    \n end  
    \n
    \n
    \n感谢互联网~

    \n", "_id"=>146}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"软件架构的十大错误", "body"=>"

    在infoQ上看到一篇关于软件构架的文章,说了一个软件构架中可能存在的一些错误,有些错误在现有的软件,项目构架中是普遍存在的问题,转载记录一二。

    \n

    虽然我不是构架师,但是在做RoR项目的时候,这些角色都是混杂起来的,必须是全部了解,因为没有那么多的空闲资源,所以了解还是很有必要的。

    \n

    原文开始:

    \n

    IASA成员Eoin Woods发表了一篇文章讲述他所认为的十大软件架构错误——常常要碰得头破血流才会得到的一些教训。这十大错误简要总结如下:

    \n
      \n
    1. 不能界定项目范围。“在这种情况发生时,一个简单的出差登记系统结果变成内建了完整的花费报销管理系统,项目费用、时间跨度和质量都留下不可避免的烂摊子……除了简单的登录真的不需要安全措施了?用户登录系统后真的不能够执行任何系统操作吗?”
    2. \n
    3. 网撒得不够宽。“我们都曾经犯过的一个错误是,只关注系统所有利益相关者中的一两方——通常受让人(为系统出钱的人)和最终用户得到了全部的关注。”
    4. \n
    5. 只关注功能。“……除非系统表现出了全面的高质量(诸如性能、安全、可维护性等等),否则不太可能成功。”
    6. \n
    7. 用方框和线条来描述。“[一个无所不包的]巨大的Visio图无法成为有效的架构描述,有两个原因:第一,它试图在单一表示中呈现太多信息;第二,没人真正清楚地知道你画的各种符号到底表示什么意思。”
    8. \n
    9. 忘了需要培养的过程。“在建造系统的时候常常需要小心的事物包括:开发者和测试者没法真正理解设计,他们不热衷或者没时间学习技术,以及还没有很好的工具支持的新技术,或者新技术会强迫人们以新的不熟悉的方式工作。”
    10. \n
    11. 平台定义不精确。“光用‘需要Unix和Oracle’来描述你的平台是不足够的。你需要精确地说明每一部分具体的版本和配置,才能保证得到你所需的平台。不然如果有人好心为平台的某一部分升级了一个库,就可能导致某些东西停止运作。精确定义平台你才能在部署中避免这样的情形。”
    12. \n
    13. 对性能和伸缩能力想当然。“及早开始考虑性能和伸缩性,构建性能模型尝试预测关键的性能指标并定位瓶颈,在设计逐渐成型的同时投入到一些实际的验证性工作中去。这会帮助你提高对设计中不存在严重性能和伸缩性缺陷的信心。”
    14. \n
    15. 自己发明安全技术。“多 年来许多系统所犯的一个错误是试图加入自己发明的安全技术来提高系统安全性。比如定制的加密算法,开发者自己编写的审核系统,甚至完全DIY的访问控制系 统。自家开发的安全方案基本上都是不明智的。虽然很多人都以为自己可以马上搞出一些聪明的安全技术,但通常都只是自作聪明。”
    16. \n
    17. 没有灾难恢复。“要想得到资源来实现系统的灾难恢复机制,其关键在于在若干真实的场景中,具体衡量系统不可用所导致的损失。如果你还能估算这些场景发生的概率,你就可以用这两组数据去说服人们灾难恢复的重要性,并获得合理的预算去实现它。”
    18. \n
    19. 没有撤退计划。“确保无论在系统部署或升级的过程中发生任何事,你都有一份书面的、经过审查的、一致同意的撤退计划,允许你将整个环境恢复到部署之前的状态。”
    20. \n
    \n

    Eoin Woods是UBS Investment Bank的软件及企业架构师。

    \n

    查看英文原文:Top Ten Software Architecture Mistakes

    ", "created_at"=>2007-10-19 01:22:23 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在infoQ上看到一篇关于软件构架的文章,说了一个软件构架中可能存在的一些错误,有些错误在现有的软件,项目构架中是普遍存在的问题,转载记录一二。
    \n虽然我不是构架师,但是在做RoR项目的时候,这些角色都是混杂起来的,必须是全部了解,因为没有那么多的空闲资源,所以了解还是很有必要的。
    \n原文开始:
    \nIASA成员Eoin Woods发表了一篇文章讲述他所认为的十大软件架构错误——常常要碰得头破血流才会得到的一些教训。这十大错误简要总结如下:
    \n
    \n 不能界定项目范围。“在这种情况发生时,一个简单的出差登记系统结果变成内建了完整的花费报销管理系统,项目费用、时间跨度和质量都留下不可避免的烂摊子……除了简单的登录真的不需要安全措施了?用户登录系统后真的不能够执行任何系统操作吗?”
    \n 网撒得不够宽。“我们都曾经犯过的一个错误是,只关注系统所有利益相关者中的一两方——通常受让人(为系统出钱的人)和最终用户得到了全部的关注。”
    \n 只关注功能。“……除非系统表现出了全面的高质量(诸如性能、安全、可维护性等等),否则不太可能成功。”
    \n 用方框和线条来描述。“[一个无所不包的]巨大的Visio图无法成为有效的架构描述,有两个原因:第一,它试图在单一表示中呈现太多信息;第二,没人真正清楚地知道你画的各种符号到底表示什么意思。”
    \n 忘了需要培养的过程。“在建造系统的时候常常需要小心的事物包括:开发者和测试者没法真正理解设计,他们不热衷或者没时间学习技术,以及还没有很好的工具支持的新技术,或者新技术会强迫人们以新的不熟悉的方式工作。”
    \n 平台定义不精确。“光用‘需要Unix和Oracle’来描述你的平台是不足够的。你需要精确地说明每一部分具体的版本和配置,才能保证得到你所需的平台。不然如果有人好心为平台的某一部分升级了一个库,就可能导致某些东西停止运作。精确定义平台你才能在部署中避免这样的情形。”
    \n 对性能和伸缩能力想当然。“及早开始考虑性能和伸缩性,构建性能模型尝试预测关键的性能指标并定位瓶颈,在设计逐渐成型的同时投入到一些实际的验证性工作中去。这会帮助你提高对设计中不存在严重性能和伸缩性缺陷的信心。”
    \n 自己发明安全技术。“多 年来许多系统所犯的一个错误是试图加入自己发明的安全技术来提高系统安全性。比如定制的加密算法,开发者自己编写的审核系统,甚至完全DIY的访问控制系 统。自家开发的安全方案基本上都是不明智的。虽然很多人都以为自己可以马上搞出一些聪明的安全技术,但通常都只是自作聪明。”
    \n 没有灾难恢复。“要想得到资源来实现系统的灾难恢复机制,其关键在于在若干真实的场景中,具体衡量系统不可用所导致的损失。如果你还能估算这些场景发生的概率,你就可以用这两组数据去说服人们灾难恢复的重要性,并获得合理的预算去实现它。”
    \n 没有撤退计划。“确保无论在系统部署或升级的过程中发生任何事,你都有一份书面的、经过审查的、一致同意的撤退计划,允许你将整个环境恢复到部署之前的状态。”
    \n
    \nEoin Woods是UBS Investment Bank的软件及企业架构师。
    \n查看英文原文:Top Ten Software Architecture Mistakes

    \n", "_id"=>147}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云:两人两周的Web 2.0网站", "body"=>"

    本文是infoQ中文站的采访帖,版权归infoQ所有,如需要查看原文,请到这里

    \n

    作者 \t\t\t霍泰稳 \t\t\t发布于 \t\t\t2007年10月17日 上午3时7分

    \n
    社区Architecture,Ruby
    主题Web 2.0,Ruby on Rails
    \n

    编者按:因 为Ruby on Rails的出现,借用互联网创业的人越来越多,虽然不能说全是RoR的功劳,但至少说明技术门槛的降低加速了互联网的发展。从前从一个点子的产生到实现 可能要耗费少则几个月,多则几年的时间,而现在,只要你的点子够新,有实践的可能,几天几周就可以看到原型。而后面的维护也比较方便,几乎可以说是实时进 行。本文通过采访技能云网站的策划人熊节和主设计师Iceskysl就是想证明前文所述,据两人介绍,这两个到现在还没有见过面的年轻人通过网络,在不到两周的时间里,将一个创意点子变成了现实。

    \n

    InfoQ中文站:这个项目发布后,你被人问到的最多的三个问题是什么?

    \n

    InfoQ中文站:介绍一下你自己和你的团队?

    \n

    IceskYsl:我是IceskYsl,目前还是靠Java吃饭,ROR是暂时还是业余活动,很享受这种方 式;1sters!暂时还是个虚拟的、我自己心中理想中的团队模式,也正一步步的走向成熟。我接触RoR有一段时间了,期间被它的灵活吸引,有事没事的就 会写写代码,时间不多,写了好几个像模像样的系统如:

    \n
      \n
    1. byeloo.cn(毕业咯):一个开源的多班级同学录系统,趴在床上用笔画出大概的模块以及基本的数据结构后;利用一个通宵写完了整个框架,而后就上线使用,根据同学们的要求,主键完善。目前功能都很实用;
    2. \n
    3. 然后是1stlog,一个针对国内用户的基于ROR的blog程序,功能强大可定制,方便扩展,已经发布两个版本,马上即将发布第三个版本;
    4. \n
    5. 1sters.com:一个集新闻,产品展示,官方blog,已经产品缺陷跟踪管理于一体的CMS系统;
    6. \n
    7. 1stimes:第一次是一个分享你我第一次经历的Web 2.0的系统;
    8. \n
    9. itechtag:技能云。
    10. \n
    \n

    熊节:我是熊节,网名叫"透明"的。先后干过媒体、程序员、咨询师三种职业,所以有一堆Web 2.0的点子。可惜每天忙忙叨叨的,这些点子落地的很少。

    \n

    InfoQ中文站:技能云的创意是从何而来?

    \n

    IceskYsl:项目的创意随着时间逐步演化,起初只是为程序员及其相关的人提供一个展现自我的平台,为国内的程序员赢得更多的他曾被无形剥夺的东西;进而发展为项目展示、交流、经验分享及其人脉的一个平台。

    \n

    熊节:这个东西的想法很简单:我要有一个widget挂 在我的blog上,告诉别人我有些什么技能,譬如说我Ruby很不错、Java很不错、JavaScript也有经验,等等。为什么我想给别人show这 些呢?因为我觉得骄傲,为自己骄傲。我在过去的8年里一直在编程,我掌握了那么多的技能,我觉得很骄傲。说白了就是,我要向别人炫耀自己的技能。

    \n

    东西很简单,但背后可以有引申。这个炫耀的widget一展开,就引出了别的东西,那就是从哪里得到这些技能的信息。当然了,只有从项目经验里来。 只有真正在项目里做过,用过一种技术,你才能说你掌握了这种技能。而且一般来说,技能掌握的熟练程度还是和使用的时间成正比的。所以iTechTag是以 项目为基础的。你不能说自己"精通"、"熟练掌握"什么技能,你必须证明,证据就是真实的项目经验。

    \n

    那么有了一个炫耀的widget,有了一堆项目经验,就可以很方便的导出简历了。(这是我们下一步的重点功能。)技能-经验-简历,这个三位一体就 构成了一个程序员的声望(reputation)。谁对这些声望感兴趣呢?当然是正在招人的潜在雇主。换句话说iTechTag的注册用户在炫耀的同时顺 手得到了直接面对潜在雇主的机会。这就是我一开始说的,“释放程序员声望的价值”。如果说开源软件是把源代码的价值还给程序员(和用户),那么 iTechTag这个模式就像是人才招聘领域的开源,把程序员的价值还给程序员(和潜在雇主)。

    \n

    InfoQ中文站:为什么会采用 RoR实现,用RoR开发你们体味到什么特殊之处?
    \nInfoQ中文站:这个项目的开发过程是怎么样子的,比如时间、人力等?
    \nInfoQ中文站:敏捷开发方法在你们的开发过程中有没有得到什么实践?
    \nInfoQ中文站:类似于用RoR开发技能云这样的项目,有什么经验和教训和大家分享?

    \n

    IceskYsl:Idea一定要足够的好,且你自己对这个Idea有充分的兴趣,自己必须是这个Idea的超级拥护者和使用者。必须脱离传统的类似外包项目的模式,否则其中的乐趣你肯定体会不到。

    ", "created_at"=>2007-10-19 02:06:21 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    本文是infoQ中文站的采访帖,版权归infoQ所有,如需要查看原文,请到这里:
    \n作者 霍泰稳 发布于 2007年10月17日 上午3时7分
    \n社区Architecture,Ruby主题Web 2.0,Ruby on Rails
    \n编者按:因 为Ruby on Rails的出现,借用互联网创业的人越来越多,虽然不能说全是RoR的功劳,但至少说明技术门槛的降低加速了互联网的发展。从前从一个点子的产生到实现 可能要耗费少则几个月,多则几年的时间,而现在,只要你的点子够新,有实践的可能,几天几周就可以看到原型。而后面的维护也比较方便,几乎可以说是实时进 行。本文通过采访技能云网站的策划人熊节和主设计师Iceskysl就是想证明前文所述,据两人介绍,这两个到现在还没有见过面的年轻人通过网络,在不到两周的时间里,将一个创意点子变成了现实。
    \nInfoQ中文站:这个项目发布后,你被人问到的最多的三个问题是什么?
    \nInfoQ中文站:介绍一下你自己和你的团队?
    \nIceskYsl:我是IceskYsl,目前还是靠Java吃饭,ROR是暂时还是业余活动,很享受这种方 式;1sters!暂时还是个虚拟的、我自己心中理想中的团队模式,也正一步步的走向成熟。我接触RoR有一段时间了,期间被它的灵活吸引,有事没事的就 会写写代码,时间不多,写了好几个像模像样的系统如:
    \n
    \n byeloo.cn(毕业咯):一个开源的多班级同学录系统,趴在床上用笔画出大概的模块以及基本的数据结构后;利用一个通宵写完了整个框架,而后就上线使用,根据同学们的要求,主键完善。目前功能都很实用;
    \n 然后是1stlog,一个针对国内用户的基于ROR的blog程序,功能强大可定制,方便扩展,已经发布两个版本,马上即将发布第三个版本;
    \n 1sters.com:一个集新闻,产品展示,官方blog,已经产品缺陷跟踪管理于一体的CMS系统;
    \n 1stimes:第一次是一个分享你我第一次经历的Web 2.0的系统;
    \n itechtag:技能云。
    \n
    \n熊节:我是熊节,网名叫"透明"的。先后干过媒体、程序员、咨询师三种职业,所以有一堆Web 2.0的点子。可惜每天忙忙叨叨的,这些点子落地的很少。
    \nInfoQ中文站:技能云的创意是从何而来?
    \nIceskYsl:项目的创意随着时间逐步演化,起初只是为程序员及其相关的人提供一个展现自我的平台,为国内的程序员赢得更多的他曾被无形剥夺的东西;进而发展为项目展示、交流、经验分享及其人脉的一个平台。
    \n熊节:这个东西的想法很简单:我要有一个widget挂 在我的blog上,告诉别人我有些什么技能,譬如说我Ruby很不错、Java很不错、JavaScript也有经验,等等。为什么我想给别人show这 些呢?因为我觉得骄傲,为自己骄傲。我在过去的8年里一直在编程,我掌握了那么多的技能,我觉得很骄傲。说白了就是,我要向别人炫耀自己的技能。
    \n东西很简单,但背后可以有引申。这个炫耀的widget一展开,就引出了别的东西,那就是从哪里得到这些技能的信息。当然了,只有从项目经验里来。 只有真正在项目里做过,用过一种技术,你才能说你掌握了这种技能。而且一般来说,技能掌握的熟练程度还是和使用的时间成正比的。所以iTechTag是以 项目为基础的。你不能说自己"精通"、"熟练掌握"什么技能,你必须证明,证据就是真实的项目经验。
    \n那么有了一个炫耀的widget,有了一堆项目经验,就可以很方便的导出简历了。(这是我们下一步的重点功能。)技能-经验-简历,这个三位一体就 构成了一个程序员的声望(reputation)。谁对这些声望感兴趣呢?当然是正在招人的潜在雇主。换句话说iTechTag的注册用户在炫耀的同时顺 手得到了直接面对潜在雇主的机会。这就是我一开始说的,“释放程序员声望的价值”。如果说开源软件是把源代码的价值还给程序员(和用户),那么 iTechTag这个模式就像是人才招聘领域的开源,把程序员的价值还给程序员(和潜在雇主)。
    \nInfoQ中文站:为什么会采用 RoR实现,用RoR开发你们体味到什么特殊之处?
    \nInfoQ中文站:这个项目的开发过程是怎么样子的,比如时间、人力等?
    \nInfoQ中文站:敏捷开发方法在你们的开发过程中有没有得到什么实践?
    \nInfoQ中文站:类似于用RoR开发技能云这样的项目,有什么经验和教训和大家分享?
    \nIceskYsl:Idea一定要足够的好,且你自己对这个Idea有充分的兴趣,自己必须是这个Idea的超级拥护者和使用者。必须脱离传统的类似外包项目的模式,否则其中的乐趣你肯定体会不到。

    \n", "_id"=>148}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu下出现缺少openssl的解决", "body"=>"

    MissingSourceFile in PeopleController#invite

    \n

    no such file to load -- openssl

    \n``解决:
    $ sudo apt-get install libopenssl-ruby1.8```", "created_at"=>2007-10-21 13:11:55 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    MissingSourceFile in PeopleController#invite
    \nno such file to load -- openssl
    \n<font size="3"><strong>解决:</strong><br /></font>$ sudo apt-get install libopenssl-ruby1.8`

    \n", "_id"=>149}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"请freeze你的Rails!", "body"=>"

    早上起了一个大早,打开电脑,打开技能云,寒~出错了,信息如下:

    \n

    Rails application failed to start properly"RewriteCond %{HTTP_REFERER} !^http://1stimes.liquidchinaware.com/.*$ [NC]

    \n

    看来有点问题,赶紧打开log看看,没有任何错误,看来还没到这步,奇怪,感觉应该是.htaccess的问题,但是我没改过呀,copy一个好的过去,还是不行,郁闷!

    \n

    赶紧./script/server 试试,提示找不到1.2.3版本的rails,接着rails -v 看下,我靠,咋成1.2.5了,看来是Bl自己升级了,也不通知下,囧~

    \n

    找到问题就好办了,修改配置文件environment.rb,把rails版本改成1.2.5即可!

    \n

    引出另外一个话题,需要freeze你的Rails么?答案是肯定的,转另外一个老外写的一段话,如下:

    \n

    "Freezing Rails is recommended if you are using a Rails application for a business site or another production environment where stability is the most important concern (if you don't freeze your application, there is a small possibility that your application might stop working due to compatibility problems when a new version of Rails is installed on our servers)."

    \n

    方法很简单:rake rails:freeze:gems等几个命令就ok,会把rails单独拷贝到你的 vender下,而rails启动的时候先看这个目录,如果有就加载,没有的话再加载系统的。

    \n

    至于为什么这么做,你可以参考他写的文章:http://support.tigertech.net/freeze-rails

    \n

    参考命令:

    \n``rake rails:freeze:gems
    rake rails:freeze:edge
    rake rails:freeze:edge TAG=rel_1-1-6
    rake rails:unfreeze```\n

     

    ", "created_at"=>2007-10-22 03:31:32 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    早上起了一个大早,打开电脑,打开技能云,寒~出错了,信息如下:
    \nRails application failed to start properly"RewriteCond %{HTTP_REFERER} !^http://1stimes.liquidchinaware.com/.*$ [NC]
    \n看来有点问题,赶紧打开log看看,没有任何错误,看来还没到这步,奇怪,感觉应该是.htaccess的问题,但是我没改过呀,copy一个好的过去,还是不行,郁闷!
    \n赶紧./script/server 试试,提示找不到1.2.3版本的rails,接着rails -v 看下,我靠,咋成1.2.5了,看来是Bl自己升级了,也不通知下,囧~
    \n找到问题就好办了,修改配置文件environment.rb,把rails版本改成1.2.5即可!
    \n引出另外一个话题,需要freeze你的Rails么?答案是肯定的,转另外一个老外写的一段话,如下:
    \n"Freezing Rails is recommended if you are using a Rails application for a business site or another production environment where stability is the most important concern (if you don't freeze your application, there is a small possibility that your application might stop working due to compatibility problems when a new version of Rails is installed on our servers)."
    \n方法很简单:rake rails:freeze:gems等几个命令就ok,会把rails单独拷贝到你的 vender下,而rails启动的时候先看这个目录,如果有就加载,没有的话再加载系统的。
    \n至于为什么这么做,你可以参考他写的文章:http://support.tigertech.net/freeze-rails
    \n参考命令:
    \n<a name="freezing-to-a-different">rake rails:freeze:gems<br />rake rails:freeze:edge<br /></a><a name="freezing-to-a-different">rake rails:freeze:edge TAG=rel_1-1-6<br /></a><a name="unfreezing-thawing-rails">rake rails:unfreeze</a>`
    \n 

    \n", "_id"=>150}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留神你的session文件~", "body"=>"

    早上6点半起床,打开电脑,打开技能云,一切正常,开始写Gtalk的发送消息的ruby代码,很顺利,全部搞定,准备关机的时候,刷新了下技能云,显示启动错误!

    \n

    晕,哪里出问题了呢?我刚才没有更新代码上去呀,看来是系统的问题,SSH上去,看日志没有任何有用的信息,调试一把,可以启动,难道是 sessions的问题(我的session还是保存在文件系统里面的),转到tmp/sessions下wc -l 了一下,寒,7W多个文件,恐怖,貌似我忘记清理了,直接rm * (保存密码的人别骂我哈),显示参数过长,郁闷,看来文件数太多了,文件貌似也没有什么规律,总不能一个一个删吧(傻瓜才这个干),于是寻找解决办法。

    \n

    Google到这段代码,试了下可以正常工作,共享给大家:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'find'   
    2. \n
    3. namespace :tmp do    
    4. \n
    5.     namespace :sessions do    
    6. \n
    7.         desc 'Clear expired sessions'    
    8. \n
    9.         task :clear_expired => :environment do    
    10. \n
    11.             ctime = (ENV['ctime'] || 120).to_i    
    12. \n
    13.             atime = (ENV['atime'] || 20).to_i    
    14. \n
    15.             Find.find(RAILS_ROOT + "/tmp/sessions/"do |path|   
    16. \n
    17.                 if FileTest.directory?(path)    
    18. \n
    19.                     if File.basename(path)[0] == ?.    
    20. \n
    21.                         Find.prune    
    22. \n
    23.                     else    
    24. \n
    25.                         next   
    26. \n
    27.                     end    
    28. \n
    29.                 else    
    30. \n
    31.                 File.delete(path) if File.ctime(path) < ctime.minutes.ago or File.atime(path) < atime.minutes.ago    
    32. \n
    33.                 end    
    34. \n
    35.             end    
    36. \n
    37.         end    
    38. \n
    39.     end   
    40. \n
    41. end   
    42. \n
    \n
    \n按照作者给出的用法,如下:

    \n

    It can be run with 2 optional parameters: “atime”, which defines the time in minutes that will be compared against the last access time of a session file and “ctime” which defines the time in minutes that will be compared against the creation time of a session file. The default values are: ctime = 120 (minutes) and atime = 20 (miuntes) which means that the session files not accessed in the last 20 minutes and created earlier than 2 hours ago will be removed when the script runs.

    \n

    保存到你的lib/tasks目录下,然后用rake -T就可以看到这个rake命令,可以接受两个参数,举个例子,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. rake tmp:sessions:clear_expired atime=15 ctime=60  
    2. \n
    \n
    \n另外,还google到一段直接配置的脚本,如下:

    \n

    Here's a cron-only one liner which, every 30 min, removes all session files that haven't been accessed in 4 hours. 10,40 * * * * /usr/bin/find /u/apps/*/current/tmp/sessions -name "ruby_sess*" -amin +240 -exec rm {} \\;

    \n

    如果你有更优雅的方法,请分享给我,谢谢~

    \n

    参考地址:
    \nhttp://www.taknado.com/2007/7/25/rake-task-to-clear-expired-session-files

    ", "created_at"=>2007-10-25 01:59:53 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    早上6点半起床,打开电脑,打开技能云,一切正常,开始写Gtalk的发送消息的ruby代码,很顺利,全部搞定,准备关机的时候,刷新了下技能云,显示启动错误!
    \n晕,哪里出问题了呢?我刚才没有更新代码上去呀,看来是系统的问题,SSH上去,看日志没有任何有用的信息,调试一把,可以启动,难道是 sessions的问题(我的session还是保存在文件系统里面的),转到tmp/sessions下wc -l 了一下,寒,7W多个文件,恐怖,貌似我忘记清理了,直接rm * (保存密码的人别骂我哈),显示参数过长,郁闷,看来文件数太多了,文件貌似也没有什么规律,总不能一个一个删吧(傻瓜才这个干),于是寻找解决办法。
    \nGoogle到这段代码,试了下可以正常工作,共享给大家:
    \n
    \nRuby代码
    \n
    \n require 'find'   
    \n namespace :tmp do    
    \n     namespace :sessions do    
    \n         desc 'Clear expired sessions'    
    \n         task :clear_expired => :environment do    
    \n             ctime = (ENV['ctime'] || 120).to_i    
    \n             atime = (ENV['atime'] || 20).to_i    
    \n             Find.find(RAILS_ROOT + "/tmp/sessions/") do |path|   
    \n                 if FileTest.directory?(path)    
    \n                     if File.basename(path)[0] == ?.    
    \n                         Find.prune    
    \n                     else    
    \n                         next   
    \n                     end    
    \n                 else    
    \n                 File.delete(path) if File.ctime(path) < ctime.minutes.ago or File.atime(path) < atime.minutes.ago    
    \n                 end    
    \n             end    
    \n         end    
    \n     end   
    \n end   
    \n
    \n
    \n按照作者给出的用法,如下:
    \nIt can be run with 2 optional parameters: “atime”, which defines the time in minutes that will be compared against the last access time of a session file and “ctime” which defines the time in minutes that will be compared against the creation time of a session file. The default values are: ctime = 120 (minutes) and atime = 20 (miuntes) which means that the session files not accessed in the last 20 minutes and created earlier than 2 hours ago will be removed when the script runs.
    \n保存到你的lib/tasks目录下,然后用rake -T就可以看到这个rake命令,可以接受两个参数,举个例子,如下:
    \n
    \n
    \nRuby代码
    \n
    \n rake tmp:sessions:clear_expired atime=15 ctime=60  
    \n
    \n
    \n另外,还google到一段直接配置的脚本,如下:
    \nHere's a cron-only one liner which, every 30 min, removes all session files that haven't been accessed in 4 hours. 10,40 * * * * /usr/bin/find /u/apps//current/tmp/sessions -name "ruby_sess" -amin +240 -exec rm {} \\;
    \n如果你有更优雅的方法,请分享给我,谢谢~
    \n参考地址:
    \nhttp://www.taknado.com/2007/7/25/rake-task-to-clear-expired-session-files

    \n", "_id"=>151}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我的一个域名丢了", "body"=>"

    去年买的一个我比较喜欢的域名,前几天到期了,找原来的代理找不到了,于是没有办法续费,还抱着侥幸的心理准备等他重新投入注册的时候再次注册,但是让人郁闷的事情发生了。

    \n

    今天早上起来,发现被人抢注了,真TMD郁闷,真有这些鸟公司专门敢这样的事情,丫的把我郁闷的不行。

    \n

    但是没有办法,忘记他吧。把手上的域名保护好。这个无论如何也不能再丢了。最后还鄙视下那个抢我域名的鸟公司。

    ", "created_at"=>2007-10-29 14:04:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    去年买的一个我比较喜欢的域名,前几天到期了,找原来的代理找不到了,于是没有办法续费,还抱着侥幸的心理准备等他重新投入注册的时候再次注册,但是让人郁闷的事情发生了。
    \n今天早上起来,发现被人抢注了,真TMD郁闷,真有这些鸟公司专门敢这样的事情,丫的把我郁闷的不行。
    \n但是没有办法,忘记他吧。把手上的域名保护好。这个无论如何也不能再丢了。最后还鄙视下那个抢我域名的鸟公司。

    \n", "_id"=>152}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ruby GB2312和UTF-8编码转换", "body"=>"

    今天CFC测试技能云的时候,在导出简历的时候,报错,跟了下log发现,错误如下:

    \n

    Iconv::IllegalSequence ("閫欐槸涓€鍊嬪皣\\345"...):

    \n

    就是代码转换老是报错,原来CFC的输入的是繁体中文的,原来如此,一定要加上IGNORE参数,就好了。记录一下。\n

    \n
    Ruby代码
    \n
      \n
    1. Iconv.iconv("UTF-8//IGNORE","GB2312//IGNORE",text)  
    2. \n
    \n
    \n

    \n

    最后感谢写CFC同学~

    ", "created_at"=>2007-10-30 02:33:37 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    今天CFC测试技能云的时候,在导出简历的时候,报错,跟了下log发现,错误如下:
    \nIconv::IllegalSequence ("閫欐槸涓€鍊嬪皣\\345"...):
    \n就是代码转换老是报错,原来CFC的输入的是繁体中文的,原来如此,一定要加上IGNORE参数,就好了。记录一下。
    \n
    \nRuby代码
    \n
    \n Iconv.iconv("UTF-8//IGNORE","GB2312//IGNORE",text)  
    \n
    \n
    \n
    \n最后感谢写CFC同学~

    \n", "_id"=>153}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"导回以前的blog内容~", "body"=>"

    很早前在51boo的时候,在1ster.cn上的一个专题博客,由于51boo的最后down机,最后没办法恢复就一直放在那里了;前段时间51boo恢复了一阵子,我正好上去把这个内容做了下备份,当时图省事,直接备份了RSS,也就是XML格式的内容;

    \n

    昨天正好试试sablog后台的一个导入数据功能,说可以导入RSS文件,于是试着导入了一下以前备份下来的数据,比较幸运的是,很顺利,你现在可以看到很多我以前的写的、记录的文章了,虽然文字格式还有点问题,不过不影响阅读,就先这样吧。

    \n

    值得高兴一下,这次资料终于没有丢失。

    \n

    PS:1ster.cn被人抢注了,不是我的了,大家不用去那里看了:(

    ", "created_at"=>2007-10-30 05:00:48 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很早前在51boo的时候,在1ster.cn上的一个专题博客,由于51boo的最后down机,最后没办法恢复就一直放在那里了;前段时间51boo恢复了一阵子,我正好上去把这个内容做了下备份,当时图省事,直接备份了RSS,也就是XML格式的内容;
    \n昨天正好试试sablog后台的一个导入数据功能,说可以导入RSS文件,于是试着导入了一下以前备份下来的数据,比较幸运的是,很顺利,你现在可以看到很多我以前的写的、记录的文章了,虽然文字格式还有点问题,不过不影响阅读,就先这样吧。
    \n值得高兴一下,这次资料终于没有丢失。
    \nPS:1ster.cn被人抢注了,不是我的了,大家不用去那里看了:(

    \n", "_id"=>154}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails中使用oracle", "body"=>"

    1.安装驱动
    \nhttp://rubyforge.org/projects/ruby-oci8/
    \n下载并运行(双击)ruby-oci8-mswin里面的*.rb
    \n
    \n2.更改database.yml

    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \nor
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: 192.168.0.50/examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \n没有用到database字段;exampleuser可以用tns来代替;
    \n
    \n我的oracle装在另外一台机器上,所以配置如下
    \ndevelopment:
    \n  adapter: oci
    \n  host: MyTnsName
    \n  username: system
    \n  password: manager

    \n

    参考地址:http://www.oracle.com/technology/global/cn/pub/articles/haefel-oracle-ruby.html

    ", "created_at"=>2007-11-07 01:26:17 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    1.安装驱动
    \nhttp://rubyforge.org/projects/ruby-oci8/
    \n下载并运行(双击)ruby-oci8-mswin里面的*.rb
    \n
    \n2.更改database.yml
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \nor
    \n
    \ndevelopment:
    \n  adapter: oci
    \n  host: 192.168.0.50/examplesid
    \n  username: exampleuser
    \n  password: examplepass
    \n
    \n没有用到database字段;exampleuser可以用tns来代替;
    \n
    \n我的oracle装在另外一台机器上,所以配置如下
    \ndevelopment:
    \n  adapter: oci
    \n  host: MyTnsName
    \n  username: system
    \n  password: manager
    \n参考地址:http://www.oracle.com/technology/global/cn/pub/articles/haefel-oracle-ruby.html

    \n", "_id"=>155}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"准备搬迁技能云,麻烦各地的朋友测试下速度~", "body"=>"

    首先感谢http://www.duxoo.com/的慷慨和大度,给技能云提供服务器,非常感谢。

    \n

    前几天做了搬迁预演,可以实现完全搬迁,不会遗失资料或者其他的什么,请各地的朋友帮忙测试下您所在位置的速度差异。

    \n

    请比较:
    \nhttp://www.itechtag.com/

    \n

    http://itechtag.i410.cn/

    \n

    这两个地址的响应速度,直接贴在下面即可,我好参考着看速度是否满意,谢谢各位参与者~

    ", "created_at"=>2007-11-08 02:56:38 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    首先感谢http://www.duxoo.com/的慷慨和大度,给技能云提供服务器,非常感谢。
    \n前几天做了搬迁预演,可以实现完全搬迁,不会遗失资料或者其他的什么,请各地的朋友帮忙测试下您所在位置的速度差异。
    \n请比较:
    \nhttp://www.itechtag.com/
    \nhttp://itechtag.i410.cn/
    \n这两个地址的响应速度,直接贴在下面即可,我好参考着看速度是否满意,谢谢各位参与者~

    \n", "_id"=>156}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"lunix操作技巧(二):系统负载情况估算相关", "body"=>"

    --显示Linux内核版本号
    \n[root@CentOS4 ~]# uname -a
    \nLinux CentOS4.5 2.6.9-55.ELsmp #1 SMP Wed May 2 14:28:44 EDT 2007 i686 i686 i386 GNU/Linux
    \n语  法:uname [-amnrsv][--help][--version]
    \n补充说明:uname可显示电脑以及操作系统的相关信息。
    \n参  数:
    \n-a或--all  显示全部的信息。
    \n-m或--machine  显示电脑类型。
    \n-n或-nodename  显示在网络上的主机名称。
    \n-r或--release  显示操作系统的发行编号。
    \n-s或--sysname  显示操作系统名称。
    \n-V  显示操作系统的版本。
    \n--help  显示帮助。
    \n--version  显示版本信息。

    \n

    --查看Linux内存使用情况
    \n[root@CentOS4 ~]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       1034584      71752     962832          0       3740      35260
    \n-/+ buffers/cache:      32752    1001832
    \nSwap:      1052248          0    1052248
    \n
    \n
    \n语  法: free [-bkmotV][-s <间隔秒数>]
    \n free指令会显示内存的使用情况,包括实体内存,虚拟的交换文件内存,共享内存区段,以及系统核心使用的缓冲区等。
    \n参  数:
    \n-b  以Byte为单位显示内存使用情况。
    \n-k  以KB为单位显示内存使用情况。
    \n-m  以MB为单位显示内存使用情况。
    \n-o  不显示缓冲区调节列。
    \n-s<间隔秒数>  持续观察内存使用状况。
    \n-t  显示内存总和列。
    \n-V  显示版本信息。
    \n如MB为单位显示内存使用情况:
    \n[root@CentOS4 ~]# free -m
    \n             total       used       free     shared    buffers     cached
    \nMem:          1010         70        940          0          3         34
    \n-/+ buffers/cache:         31        978
    \nSwap:         1027          0       1027

    \n

    附录:free的详细解释:

    \n

    [root@Linux /tmp]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       4149156    4130412      18744          0      13220    2720160
    \n-/+ buffers/cache:    1397032    2752124
    \nSwap:      6289408        144    6289264第1行
    \ntotal 内存总数: 4149156
    \nused 已经使用的内存数: 4130412
    \nfree 空闲的内存数: 18744
    \nshared 当前已经废弃不用,总是0
    \nbuffers Buffer Cache内存数: 13220
    \ncached Page Cache内存数: 2720160
    \n
    \n关系:total = used + free
    \n
    \n第2行:
    \n-/+ buffers/cache的意思相当于:
    \n-buffers/cache 的内存数:1397032 (等于第1行的 used - buffers - cached)
    \n+buffers/cache 的内存数: 2752124 (等于第1行的 free + buffers + cached)
    \n
    \n可见-buffers/cache反映的是被程序实实在在吃掉的内存,而+buffers/cache反映的是可以挪用的内存总数。
    \n
    \n第三行单独针对交换分区, 就不用再说了.
    \n
    \n为了提高磁盘存取效率, Linux做了一些精心的设计, 除了对dentry进行缓存(用于VFS,加速文件路径名到inode的转换), 还采取了两种主要Cache方式:Buffer Cache和Page Cache。前者针对磁盘块的读写,后者针对文件inode的读写。这些Cache有效缩短了 I/O系统调用(比如read,write,getdents)的时间。
    \n
    \n如果感兴趣可以进一步参考文件/proc/meminfo,free命令就是根据它的信息生成的。free命令的源码可从procps-xxx-.src.rpm获取,xxx为版本号,比如procps-3.2.3-5.3.src.rpm。
    \n
    \n参考内核代码:
    \n
    \narch/i386/mm/init.c
    \nfs/proc/proc_misc.c
    \ninclude/linux/swap.h
    \nmm/filemap.c
    \nfs/buffer.c
    \n
    \n另外还可以参考O'REILLY的书《Understanding the LINUX KERNEL》。

    ", "created_at"=>2007-11-09 07:13:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    --显示Linux内核版本号
    \n[root@CentOS4 ~]# uname -a
    \nLinux CentOS4.5 2.6.9-55.ELsmp #1 SMP Wed May 2 14:28:44 EDT 2007 i686 i686 i386 GNU/Linux
    \n语  法:uname [-amnrsv][--help][--version]
    \n补充说明:uname可显示电脑以及操作系统的相关信息。
    \n参  数:
    \n-a或--all  显示全部的信息。
    \n-m或--machine  显示电脑类型。
    \n-n或-nodename  显示在网络上的主机名称。
    \n-r或--release  显示操作系统的发行编号。
    \n-s或--sysname  显示操作系统名称。
    \n-V  显示操作系统的版本。
    \n--help  显示帮助。
    \n--version  显示版本信息。
    \n--查看Linux内存使用情况
    \n[root@CentOS4 ~]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       1034584      71752     962832          0       3740      35260
    \n-/+ buffers/cache:      32752    1001832
    \nSwap:      1052248          0    1052248
    \n
    \n
    \n语  法: free [-bkmotV][-s <间隔秒数>]
    \n free指令会显示内存的使用情况,包括实体内存,虚拟的交换文件内存,共享内存区段,以及系统核心使用的缓冲区等。
    \n参  数:
    \n-b  以Byte为单位显示内存使用情况。
    \n-k  以KB为单位显示内存使用情况。
    \n-m  以MB为单位显示内存使用情况。
    \n-o  不显示缓冲区调节列。
    \n-s<间隔秒数>  持续观察内存使用状况。
    \n-t  显示内存总和列。
    \n-V  显示版本信息。
    \n如MB为单位显示内存使用情况:
    \n[root@CentOS4 ~]# free -m
    \n             total       used       free     shared    buffers     cached
    \nMem:          1010         70        940          0          3         34
    \n-/+ buffers/cache:         31        978
    \nSwap:         1027          0       1027
    \n附录:free的详细解释:
    \n[root@Linux /tmp]# free
    \n             total       used       free     shared    buffers     cached
    \nMem:       4149156    4130412      18744          0      13220    2720160
    \n-/+ buffers/cache:    1397032    2752124
    \nSwap:      6289408        144    6289264第1行
    \ntotal 内存总数: 4149156
    \nused 已经使用的内存数: 4130412
    \nfree 空闲的内存数: 18744
    \nshared 当前已经废弃不用,总是0
    \nbuffers Buffer Cache内存数: 13220
    \ncached Page Cache内存数: 2720160
    \n
    \n关系:total = used + free
    \n
    \n第2行:
    \n-/+ buffers/cache的意思相当于:
    \n-buffers/cache 的内存数:1397032 (等于第1行的 used - buffers - cached)
    \n+buffers/cache 的内存数: 2752124 (等于第1行的 free + buffers + cached)
    \n
    \n可见-buffers/cache反映的是被程序实实在在吃掉的内存,而+buffers/cache反映的是可以挪用的内存总数。
    \n
    \n第三行单独针对交换分区, 就不用再说了.
    \n
    \n为了提高磁盘存取效率, Linux做了一些精心的设计, 除了对dentry进行缓存(用于VFS,加速文件路径名到inode的转换), 还采取了两种主要Cache方式:Buffer Cache和Page Cache。前者针对磁盘块的读写,后者针对文件inode的读写。这些Cache有效缩短了 I/O系统调用(比如read,write,getdents)的时间。
    \n
    \n如果感兴趣可以进一步参考文件/proc/meminfo,free命令就是根据它的信息生成的。free命令的源码可从procps-xxx-.src.rpm获取,xxx为版本号,比如procps-3.2.3-5.3.src.rpm。
    \n
    \n参考内核代码:
    \n
    \narch/i386/mm/init.c
    \nfs/proc/proc_misc.c
    \ninclude/linux/swap.h
    \nmm/filemap.c
    \nfs/buffer.c
    \n
    \n另外还可以参考O'REILLY的书《Understanding the LINUX KERNEL》。

    \n", "_id"=>157}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云迁移时遇到一点意外", "body"=>"

    迁移过程比较顺利,最后解析域名的时候出现一些问题,导致现在域名解析不了,只能等到明天早上才能恢复了,这段时间请大家使用 http://itechtag.i410.cn/ 访问技能云,谢谢。

    \n

    我们将尽快恢复,给大家带来的不便,还请海涵》。

    ", "created_at"=>2007-11-09 17:43:48 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    迁移过程比较顺利,最后解析域名的时候出现一些问题,导致现在域名解析不了,只能等到明天早上才能恢复了,这段时间请大家使用 http://itechtag.i410.cn/ 访问技能云,谢谢。
    \n我们将尽快恢复,给大家带来的不便,还请海涵》。

    \n", "_id"=>158}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)服务器迁移顺利完成", "body"=>"

    各位朋友,很高兴的告诉大家,技能云迁移工作顺利完成,期间遇到一些意外(域名迁移比较诡异,域名解析时间比我们预期的时间要长),不过还好,总算顺利迁移完成。

    \n

    经过很多热心朋友的测试,我们确定新服务器比起原来的服务器速度方面更加令人满意,各方限制(包括带宽、内存等)基本上都不存在了。

    \n

    以后我们会逐渐完善很多用户反馈的问题,力求这朵“技能云”开的更加艳丽\"\"

    \n

    各位朋友如果发现什么问题,请联系我们解决,谢谢~

    \n

    联系方式:iceskysl@1sers.com

    ", "created_at"=>2007-11-11 09:29:56 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    各位朋友,很高兴的告诉大家,技能云迁移工作顺利完成,期间遇到一些意外(域名迁移比较诡异,域名解析时间比我们预期的时间要长),不过还好,总算顺利迁移完成。
    \n经过很多热心朋友的测试,我们确定新服务器比起原来的服务器速度方面更加令人满意,各方限制(包括带宽、内存等)基本上都不存在了。
    \n以后我们会逐渐完善很多用户反馈的问题,力求这朵“技能云”开的更加艳丽。
    \n各位朋友如果发现什么问题,请联系我们解决,谢谢~
    \n联系方式:iceskysl@1sers.com

    \n", "_id"=>159}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"unix定时JOB随笔", "body"=>"

    0 0 * * * /home/iceskysl/itechtag/backup/automysqlbackup.sh
    \n(每天凌晨0点执行automysqlbackup.sh进行数据备份)

    ", "created_at"=>2007-11-11 10:56:38 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    0 0 * * * /home/iceskysl/itechtag/backup/automysqlbackup.sh
    \n(每天凌晨0点执行automysqlbackup.sh进行数据备份)

    \n", "_id"=>160}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby的Hash和Array的遍历", "body"=>"

    Hach遍历:
    \n   h = { "我" =>" 谁呀" , "b" => 200 }
    \n   h.each {|key, value| puts "\#{key} is \#{value}" }

    \n

    数组遍历:

    \n

       b = [ "a", "b", "c" ]
    \n   b.each_with_index{|value, index| puts index.to_s + " - " + value.to_s}
    \n  
    \n   for i in 0...b.size
    \n   puts i.to_s + '---'  + b[i].to_s
    \n   end

    ", "created_at"=>2007-11-12 08:25:59 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    Hach遍历:
    \n   h = { "我" =>" 谁呀" , "b" => 200 }
    \n   h.each {|key, value| puts "\#{key} is \#{value}" }
    \n数组遍历:
    \n   b = [ "a", "b", "c" ]
    \n   b.each_with_index{|value, index| puts index.to_s + " - " + value.to_s}
    \n  
    \n   for i in 0...b.size
    \n   puts i.to_s + '---'  + b[i].to_s
    \n   end

    \n", "_id"=>161}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Hpricot解析XML示例~", "body"=>"

    来源:http://errtheblog.com/post/8
    \nGiven a piece of XML:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <Export>  
    2. \n
    3.   <Product>  
    4. \n
    5.     <SKU>403276</SKU>  
    6. \n
    7.     <ItemName>Trivet</ItemName>  
    8. \n
    9.     <CollectionNo>0</CollectionNo>  
    10. \n
    11.     <Pages>0</Pages>  
    12. \n
    13.   </Product>  
    14. \n
    15. </Export>  
    16. \n
    \n
    \n

    One might assume that REXML is the way to parse it, but we all know how slow it is.
    \n
    \nEnter _why’s HTML parser, Hpricot. It’s written in C and since XHTML is a subset of XML, there’s no reason it shouldn’t be able to parse my file.
    \n
    \nTurns out it does, it’s really fast, and the code is dead simple.

    \n
    \n
    Ruby代码
    \n
      \n
    1. FIELDS = %w[SKU ItemName CollectionNo Pages]  
    2. \n
    3.   
    4. \n
    5. doc = Hpricot.parse(File.read("my.xml"))  
    6. \n
    7. (doc/:product).each do |xml_product|  
    8. \n
    9.   product = Product.new  
    10. \n
    11.   for field in FIELDS  
    12. \n
    13.     product[field] = (xml_product/field.intern).first.innerHTML  
    14. \n
    15.   end  
    16. \n
    17.   product.save  
    18. \n
    19. end  
    20. \n
    \n
    \n

    Update: Slight refactoring of the code above. Chris figured out last night that you can use innerHTML which eliminated the only ugly part of the code.

    ", "created_at"=>2007-11-13 05:53:29 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    来源:http://errtheblog.com/post/8
    \nGiven a piece of XML:
    \n
    \nXML/HTML代码
    \n
    \n <Export>  
    \n   <Product>  
    \n     <SKU>403276</SKU>  
    \n     <ItemName>Trivet</ItemName>  
    \n     <CollectionNo>0</CollectionNo>  
    \n     <Pages>0</Pages>  
    \n   </Product>  
    \n </Export>  
    \n
    \n
    \nOne might assume that REXML is the way to parse it, but we all know how slow it is.
    \n
    \nEnter _why’s HTML parser, Hpricot. It’s written in C and since XHTML is a subset of XML, there’s no reason it shouldn’t be able to parse my file.
    \n
    \nTurns out it does, it’s really fast, and the code is dead simple.
    \n
    \nRuby代码
    \n
    \n FIELDS = %w[SKU ItemName CollectionNo Pages]  
    \n   
    \n doc = Hpricot.parse(File.read("my.xml"))  
    \n (doc/:product).each do |xml_product|  
    \n   product = Product.new  
    \n   for field in FIELDS  
    \n     product[field] = (xml_product/field.intern).first.innerHTML  
    \n   end  
    \n   product.save  
    \n end  
    \n
    \n
    \nUpdate: Slight refactoring of the code above. Chris figured out last night that you can use innerHTML which eliminated the only ugly part of the code.

    \n", "_id"=>162}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"统计本星期~", "body"=>"

    raecoo问有没有办法统计一个星期中最受欢迎的文章,我问是’标准星期?还是最近7天‘,他说要的是标准星期,于是感觉这么杨貌似可以,

    \n

    where scores.updated_at beteen Time.now.moday ... Time.now.sunday order by score

    \n

    上面只是一个思路示意,开始翻API找相应的函数,无奈的是翻遍API也没找到合适的函数,最后raecoo从MYSQL的函数库中找到几个,给了我一段代码:
    \nwhere TO_DAYS(NOW()) - TO_DAYS(updated_at) <= 7

    \n

    MYSQL的TO_DAYS(DATE)函数是这样说明的: 传回DATE到公元0年的总日数

    \n

    貌似不满足需要嘛~这个取出来的还是最近几天的呀,再想想~
    \n

    ", "created_at"=>2007-11-14 05:09:06 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    raecoo问有没有办法统计一个星期中最受欢迎的文章,我问是’标准星期?还是最近7天‘,他说要的是标准星期,于是感觉这么杨貌似可以,
    \nwhere scores.updated_at beteen Time.now.moday ... Time.now.sunday order by score
    \n上面只是一个思路示意,开始翻API找相应的函数,无奈的是翻遍API也没找到合适的函数,最后raecoo从MYSQL的函数库中找到几个,给了我一段代码:
    \nwhere TO_DAYS(NOW()) - TO_DAYS(updated_at) <= 7
    \nMYSQL的TO_DAYS(DATE)函数是这样说明的: 传回DATE到公元0年的总日数
    \n貌似不满足需要嘛~这个取出来的还是最近几天的呀,再想想~

    \n", "_id"=>163}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"查看Linux版本命令", "body"=>"

    时间久了以后,想找出Linux 版本信息来看看,有2个文件里面有保存。
    \n
    \ncat /etc/redhat-release
    \nFedora Core release 5 (Bordeaux)
    \n
    \ncat /etc/issue
    \nFedora Core release 5 (Bordeaux)
    \nKernel \\r on an \\m
    \n
    \n还有内核的版本信息在这里:
    \ncat /proc/version
    \n
    \nLinux version 2.6.17-1.2145_FC5smp (brewbuilder@hs20-bc2-2.build.redhat.com) (gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)) #1 SMP Sat Jul 1 13:19:14 EDT 2006

    ", "created_at"=>2007-11-14 09:29:08 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    时间久了以后,想找出Linux 版本信息来看看,有2个文件里面有保存。
    \n
    \ncat /etc/redhat-release
    \nFedora Core release 5 (Bordeaux)
    \n
    \ncat /etc/issue
    \nFedora Core release 5 (Bordeaux)
    \nKernel \\r on an \\m
    \n
    \n还有内核的版本信息在这里:
    \ncat /proc/version
    \n
    \nLinux version 2.6.17-1.2145_FC5smp (brewbuilder@hs20-bc2-2.build.redhat.com) (gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)) #1 SMP Sat Jul 1 13:19:14 EDT 2006

    \n", "_id"=>164}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RoR中操作时间和日期", "body"=>"

    time = Date.today
    \n
    \nputs "Date.today:" + time.to_s
    \n
    \nputs "----"*20
    \nputs   "time.cwday():" + time.cwday().to_s  
    \nputs   "time.cweek():" + time.cweek().to_s  
    \nputs   "time.cwyear():" + time.cwyear().to_s  
    \nputs   "time.mon() :" + time.mon().to_s  
    \nputs   "time.day():" + time.day().to_s  
    \nputs "----"*20
    \n
    \n===
    \nselected_mon = params[:mon].to_date.mon()
    \n@tasks = Task.find(:all, :conditions =>[ "MONTH(created_at) = ?",selected_mon]) 

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File src/rails-1.2.3/activesupport/lib/active_support/core_ext/string/conversions.rb, line 13  
    2. \n
    3.         def to_date  
    4. \n
    5.           ::Date.new(*ParseDate.parsedate(self)[0..2])  
    6. \n
    7.         end 
      \n
    8. \n
    \n
    \n

    \n

     参考:http://fanqiang.chinaunix.net/a2/b1/20010705/150000802.html

    ", "created_at"=>2007-11-16 07:34:21 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    time = Date.today
    \n
    \nputs "Date.today:" + time.to_s
    \n
    \nputs "----"*20
    \nputs   "time.cwday():" + time.cwday().to_s  
    \nputs   "time.cweek():" + time.cweek().to_s  
    \nputs   "time.cwyear():" + time.cwyear().to_s  
    \nputs   "time.mon() :" + time.mon().to_s  
    \nputs   "time.day():" + time.day().to_s  
    \nputs "----"*20
    \n
    \n===
    \nselected_mon = params[:mon].to_date.mon()
    \n@tasks = Task.find(:all, :conditions =>[ "MONTH(created_at) = ?",selected_mon]) 
    \n
    \n
    \nRuby代码
    \n
    \n # File src/rails-1.2.3/activesupport/lib/active_support/core_ext/string/conversions.rb, line 13  
    \n         def to_date  
    \n           ::Date.new(*ParseDate.parsedate(self)[0..2])  
    \n         end 
    \n
    \n
    \n
    \n
    \n 参考:http://fanqiang.chinaunix.net/a2/b1/20010705/150000802.html

    \n", "_id"=>165}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"理解.bash_profile和.bashrc", "body"=>"

    .bash_profile和.bashrc的什么区别
    \n /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.
    \n并从/etc/profile.d目录的配置文件中搜集shell的设置.
    \n/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
    \n~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.
    \n~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该
    \n该文件被读取.
    \n~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
    \n另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.
    \n~/.bash_profile 是交互式、login 方式进入 bash 运行的
    \n~/.bashrc 是交互式 non-login 方式进入 bash 运行的
    \n通常二者设置大致相同,所以通常前者会调用后者。

    \n

    编辑.bash_profile
    \n编辑你主目录下的.bash_profile文件@"
    \n加上:
    \nalias ls='ls -laF'
    \n保存退出
    \n最后source .bash_profile 使变动生效

    ", "created_at"=>2007-11-22 06:26:29 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    .bash_profile和.bashrc的什么区别
    \n /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.
    \n并从/etc/profile.d目录的配置文件中搜集shell的设置.
    \n/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
    \n~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.
    \n~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该
    \n该文件被读取.
    \n~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
    \n另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.
    \n~/.bash_profile 是交互式、login 方式进入 bash 运行的
    \n~/.bashrc 是交互式 non-login 方式进入 bash 运行的
    \n通常二者设置大致相同,所以通常前者会调用后者。
    \n编辑.bash_profile
    \n编辑你主目录下的.bash_profile文件@"
    \n加上:
    \nalias ls='ls -laF'
    \n保存退出
    \n最后source .bash_profile 使变动生效

    \n", "_id"=>166}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"自动FTP下载多个文件", "body"=>"

    \n

    \n
    SHELL代码
    \n
      \n
    1. ftp -i -n 10.1.1.1 <<YSL  
    2. \n
    3. user username password  
    4. \n
    5. bin  
    6. \n
    7. hash  
    8. \n
    9. cd some/path/here/datas/  
    10. \n
    11. #prompt  
    12. \n
    13. mget *$1*  
    14. \n
    15. quit  
    16. \n
    17. YSL  
    18. \n
    \n
    \n

    ", "created_at"=>2007-11-22 09:41:10 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    SHELL代码
    \n
    \n ftp -i -n 10.1.1.1 <<YSL  
    \n user username password  
    \n bin  
    \n hash  
    \n cd some/path/here/datas/  
    \n #prompt  
    \n mget $1  
    \n quit  
    \n YSL  
    \n
    \n

    \n", "_id"=>167}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"删除所有.svn目录", "body"=>"

    当使用了svn版本控制系统后每个目录下都会有一个.svn目录存在,开发完当交付产品或者上传到服务器时一般要把这些目录删除,这里总结了一下在linux和win下的办法。

    \n

    一、在linux下

    \n

    删除这些目录是很简单的,命令如下
    \n
    \nfind . -type d -name ".svn"|xargs rm -rf

    \n

    或者

    \n

    find . -type d -iname ".svn" -exec rm -rf {} \\;  

    \n

    全部搞定。(http://tech.techweb.com.cn/redirect.php?fid=26&tid=205673&goto=nextnewset)

    \n

     

    \n

    二、在windows下用以下法子:

    \n
    1、在项目平级的目录,执行dos命令:
    \nxcopy project_dir project_dir_1 /s /i
    \n

     

    \n
    2、或者在项目根目录执行以下dos命令
    \nfor /r . %%a in (.) do @if exist "%%a\\.svn" rd /s /q "%%a\\.svn"
    \n

    其实第二种方法可以用来干很多事的,比如把代码中的.svn替换为任意其他文件名并在硬盘根目录下执行,就可以从硬盘上删除所有的这个文件啦。

    \n

    3、加注册表

    \n

    Jon Galloway提供了一段注册表代码,可以将”Delete SVN Folders”命名增加到资源管理器的右键上,这样,鼠标点两下就能把选中目录下的所有.svn目录干掉了。Works just great!

    \n

    代码为:

    \n``Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN]@=”Delete SVN Folders

    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN\\command]@=”cmd.exe /c \\”TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \\”%1\\” %%f IN (.svn) DO RD /s /q \\”%%f\\” \\”“```\n

    将这段代码保存为一个.reg文件,双击确认导入注册表即可。

    ", "created_at"=>2007-11-27 13:19:59 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    当使用了svn版本控制系统后每个目录下都会有一个.svn目录存在,开发完当交付产品或者上传到服务器时一般要把这些目录删除,这里总结了一下在linux和win下的办法。
    \n一、在linux下
    \n删除这些目录是很简单的,命令如下
    \n
    \nfind . -type d -name ".svn"|xargs rm -rf
    \n或者
    \nfind . -type d -iname ".svn" -exec rm -rf {} \\;  
    \n全部搞定。(http://tech.techweb.com.cn/redirect.php?fid=26&tid=205673&goto=nextnewset;)
    \n 
    \n二、在windows下用以下法子:
    \n1、在项目平级的目录,执行dos命令:
    \nxcopy project_dir project_dir_1 /s /i
    \n 
    \n2、或者在项目根目录执行以下dos命令
    \nfor /r . %%a in (.) do @if exist "%%a.svn" rd /s /q "%%a.svn"
    \n其实第二种方法可以用来干很多事的,比如把代码中的.svn替换为任意其他文件名并在硬盘根目录下执行,就可以从硬盘上删除所有的这个文件啦。
    \n3、加注册表
    \nJon Galloway提供了一段注册表代码,可以将”Delete SVN Folders”命名增加到资源管理器的右键上,这样,鼠标点两下就能把选中目录下的所有.svn目录干掉了。Works just great!
    \n代码为:
    \nWindows Registry Editor Version 5.00<br /><br />[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN]@=&rdquo;<span style="color: rgb(139, 0, 0);">Delete SVN Folders</span>&ldquo;<br /><br />[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\DeleteSVN\\command]@=&rdquo;<span style="color: rgb(139, 0, 0);">cmd.exe /c \\&rdquo;TITLE Removing SVN Folders in %1 &amp;&amp; COLOR 9A &amp;&amp; FOR /r \\&rdquo;%1\\&rdquo; %%f IN (.svn) DO RD /s /q \\&rdquo;%%f\\&rdquo; \\&rdquo;</span>&ldquo;`
    \n将这段代码保存为一个.reg文件,双击确认导入注册表即可。

    \n", "_id"=>168}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加Feeds抓起功能", "body"=>"

    为了让大家了解我们的成员都在干什么,也为了反应成员的动态,我们为1sters.com开发了Feeds抓取、展示的功能,会定时刷新,取每个成员的blog内容,详细的大家可以到1sters.com站的,点击上面的“Feeds”标签。
    \n也就是如下这个地址:http://www.1sters.com/feeds
    \n有什么建议啥的,情告诉我。
    \n我们正准备给技能云(iTechTag)加上这个功能,用来展示每个用户写的blog、文章等。。

    ", "created_at"=>2007-12-04 15:58:36 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    为了让大家了解我们的成员都在干什么,也为了反应成员的动态,我们为1sters.com开发了Feeds抓取、展示的功能,会定时刷新,取每个成员的blog内容,详细的大家可以到1sters.com站的,点击上面的“Feeds”标签。
    \n也就是如下这个地址:http://www.1sters.com/feeds
    \n有什么建议啥的,情告诉我。
    \n我们正准备给技能云(iTechTag)加上这个功能,用来展示每个用户写的blog、文章等。。

    \n", "_id"=>169}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RSS和ATOM的版本和规范", "body"=>"

    由于需要在技能云(iTechTag.com)添加mash-up用户写过的文章(blog),于是写了一个自动探测用户提供的地址的RSS地址以及其附带的一些属性和其下的blog内容,由于之前只看了RSS2.0的规范,所以写的都是兼容RSS2.0的,测试了一把也相当顺利;

    \n

    然后再测试透明的blog内容,无奈的是什么都检测不到,后来看了下他的塬,发现是ATOM的,以前倒是晓得RSS和ATOM,也晓得其不是很兼容,但不晓得差别这么大,看来还需要写一份解析ATOM的了。

    \n

    附录几个问题:

    \n

    1、怎么判断RSS是RSS2.0规范还是微软的SSE,还是Atom的XML格式?

    \n

    文件头部 
    \nRSS   2.0 判断<rss   version="2.0"> 
    \natom  判断<feed   xmlns="http://www.w3.org/2005/Atom">

    \n

    2、几个有用的文章

    \n

    RSS 简介:http://www.ibm.com/developerworks/cn/xml/x-rssintro/

    \n

    Atom 规范及中文翻译 附:ATOM规范英文原版  http://hi.baidu.com/liberty88/blog/item/f5dd1db3decde1a7d8335a12.html

    ", "created_at"=>2007-12-06 01:37:54 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    由于需要在技能云(iTechTag.com)添加mash-up用户写过的文章(blog),于是写了一个自动探测用户提供的地址的RSS地址以及其附带的一些属性和其下的blog内容,由于之前只看了RSS2.0的规范,所以写的都是兼容RSS2.0的,测试了一把也相当顺利;
    \n然后再测试透明的blog内容,无奈的是什么都检测不到,后来看了下他的塬,发现是ATOM的,以前倒是晓得RSS和ATOM,也晓得其不是很兼容,但不晓得差别这么大,看来还需要写一份解析ATOM的了。
    \n附录几个问题:
    \n1、怎么判断RSS是RSS2.0规范还是微软的SSE,还是Atom的XML格式?
    \n文件头部 
    \nRSS   2.0 判断<rss   version="2.0"> 
    \natom  判断<feed   xmlns="http://www.w3.org/2005/Atom">
    \n2、几个有用的文章
    \nRSS 简介:http://www.ibm.com/developerworks/cn/xml/x-rssintro/
    \nAtom 规范及中文翻译 附:ATOM规范英文原版  http://hi.baidu.com/liberty88/blog/item/f5dd1db3decde1a7d8335a12.html

    \n", "_id"=>170}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Ruby实现抓取ATOM格式的feed~", "body"=>"

    前几天写完了技能云上抓取用户RSS2.0的feed的功能,紧接着需要实现抓取ATOM格式的,如下是随手做的几个小测试,代码如下:

    \n

     require 'hpricot'
    \n require 'open-uri'
    \n 
    \ndoc = open("http://gigix.thoughtworkers.org/feed/atom.xml") do |f|
    \n   Hpricot.XML(f)
    \n end
    \n 
    \nputs rel = doc.search("//feed").first[:xmlns].downcase
    \n 
    \n puts root = doc.root.name
    \n 
    \nputs feed_title = (doc/:feed/:title).first.inner_html
    \nputs feed_id = (doc/:feed/:id).first.inner_html
    \nputs rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \nputs rel = doc.search("//link[@rel='self']").first[:href].downcase
    \nputs feed_generator = (doc/:feed/:generator).first.inner_html
    \nputs feed_rights = (doc/:feed/:rights).first.inner_html
    \n
    \nputs feed_updated = (doc/:feed/:updated).first.inner_html
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \n 
    \n
    \n (doc/:entry).each do |item|
    \n #puts author = (item/:author/:name).inner_html
    \n   #puts title = (item/:title).inner_html
    \n   #puts link = (item/:link).first[:href].downcase
    \n  # rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \n   #puts id = (item/:id).inner_html
    \n   #puts date = (item/:published).inner_html
    \n   #puts updated = (item/:updated).inner_html
    \n   #puts content = (item/:content).inner_html
    \n end

    ", "created_at"=>2007-12-07 05:47:12 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    前几天写完了技能云上抓取用户RSS2.0的feed的功能,紧接着需要实现抓取ATOM格式的,如下是随手做的几个小测试,代码如下:
    \n require 'hpricot'
    \n require 'open-uri'
    \n 
    \ndoc = open("http://gigix.thoughtworkers.org/feed/atom.xml";) do |f|
    \n   Hpricot.XML(f)
    \n end
    \n 
    \nputs rel = doc.search("//feed").first[:xmlns].downcase
    \n 
    \n puts root = doc.root.name
    \n 
    \nputs feed_title = (doc/:feed/:title).first.inner_html
    \nputs feed_id = (doc/:feed/:id).first.inner_html
    \nputs rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \nputs rel = doc.search("//link[@rel='self']").first[:href].downcase
    \nputs feed_generator = (doc/:feed/:generator).first.inner_html
    \nputs feed_rights = (doc/:feed/:rights).first.inner_html
    \n
    \nputs feed_updated = (doc/:feed/:updated).first.inner_html
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \nputs feed_link = (doc/:feed/:link).first[:href].downcase
    \n 
    \n
    \n (doc/:entry).each do |item|
    \n #puts author = (item/:author/:name).inner_html
    \n   #puts title = (item/:title).inner_html
    \n   #puts link = (item/:link).first[:href].downcase
    \n  # rel = doc.search("//link[@rel='alternate']").first[:href].downcase
    \n   #puts id = (item/:id).inner_html
    \n   #puts date = (item/:published).inner_html
    \n   #puts updated = (item/:updated).inner_html
    \n   #puts content = (item/:content).inner_html
    \n end

    \n", "_id"=>171}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定期清理垃圾数据", "body"=>"

    linux上用来清除长时不用的session的cron命令:
    \n$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")
    \n
    \n参考:
    \nhttp://rubyasylum.com/articles/2006/06/04/cron-job-tips-for-rails
    \nhttp://www.cslog.cn/articles/search?q=sessions

    ", "created_at"=>2007-12-08 15:54:19 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    linux上用来清除长时不用的session的cron命令:
    \n$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")
    \n
    \n参考:
    \nhttp://rubyasylum.com/articles/2006/06/04/cron-job-tips-for-rails
    \nhttp://www.cslog.cn/articles/search?q=sessions

    \n", "_id"=>172}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails中的定期JOB的实现方式。", "body"=>"

    大概总结一下,有如下几种方式:

    \n

    1、Thread based scheduler(sleep)

    \n

    2、Flexible scheduling in Ruby(OpenWFEru

    \n

    3、BackgrounDRB

    \n

    参考:

    \n

    http://www.igvita.com/blog/2007/03/29/scheduling-tasks-in-ruby-rails/

    ", "created_at"=>2007-12-08 15:57:56 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    大概总结一下,有如下几种方式:
    \n1、Thread based scheduler(sleep)
    \n2、Flexible scheduling in Ruby(OpenWFEru )
    \n3、BackgrounDRB
    \n参考:
    \nhttp://www.igvita.com/blog/2007/03/29/scheduling-tasks-in-ruby-rails/

    \n", "_id"=>173}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将会试试FeedTools的功能", "body"=>"

    由于需要抽时间重新1st的站点,按照我设想的模式,会抓取指定的RSS功能,以前都是自己写的,前些日志看到ruby有个gem,可以找时间试试,

    \n

    FeedTools is a simple Ruby library for handling rss, atom, and cdf parsing, generation, and translation as well as caching. It attempts to adhere to Postel’s law—i.e. a liberal parsing and conservative generation policy.

    \n

    参考如下2篇文章:

    \n

    http://sporkmonger.com/projects/feedtools/

    \n

    http://sporkmonger.com/2005/08/11/tutorial

    ", "created_at"=>2007-12-12 05:03:29 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    由于需要抽时间重新1st的站点,按照我设想的模式,会抓取指定的RSS功能,以前都是自己写的,前些日志看到ruby有个gem,可以找时间试试,
    \nFeedTools is a simple Ruby library for handling rss, atom, and cdf parsing, generation, and translation as well as caching. It attempts to adhere to Postel’s law—i.e. a liberal parsing and conservative generation policy.
    \n参考如下2篇文章:
    \nhttp://sporkmonger.com/projects/feedtools/
    \nhttp://sporkmonger.com/2005/08/11/tutorial

    \n", "_id"=>174}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scrot -- ubuntu/Linux 下一个很好用抓屏截图工具", "body"=>"

    ubuntu 下 gnome 自带的截图工具其实也还不错,有快捷键,可以在命令行下用 --window 的方式指定对某窗进行截图,也可以使用 --border 来指定是否包含窗体边框,甚至可以有阴影。但我还是不满意,因为我经常需要用鼠标划定一个范围来截图,GNOME自带的就没法做到了。
    \n
    \n      Scrot,也是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
    \n
    \n      * 其他非 ubuntu 系统,你可以在 [这里] 下载到这款截图工具。
    \n
    \n      安装:
    \n      可以打开新立得搜索 scrot 并安装,也可以在终端:
    \n      sudo apt-get install scrot
    \n      来进行安装。
    \n
    \n Scrot 使用:
    \n-----------------------------------------------------------------------------------------------------------------------
    \n概要
    \nscrot [options] [file]
    \n
    \n描述
    \nscrot 是一个使用 imlib2 库截取屏幕和保存图像的的工具。
    \n选项 [file] 指定截图保存的文件名。 如果 [file] 没有指定,
    \n截图就会以当前的日期和时间为文件名保存在当前目录中。
    \n
    \n选项
    \n-h, --help
    \n显示帮助并且退出
    \n-v, --version
    \n显示版本信息并且退出
    \n-b, --border
    \n当选择一个窗口时,同时包含窗口边框。
    \n-c, --count
    \n延时时的显示倒计时
    \n-d, --delay NUM
    \n延时 NUM 秒
    \n-e, --exec APP
    \n对保存的图像执行程序 APP
    \n-q, --quality NUM
    \n图像质量 (1-100) 值大意味着文件大, 压缩率低。
    \n-m, --multidisp
    \n对多个显示设备分别截图并且连接在一起。
    \n-s, --select
    \n用鼠标交互式的选择一个窗口或者区域。
    \n-t, --thumb NUM
    \n同时生成缩略图。 NUM 是缩略图的百分比。
    \n
    \n说明符
    \n--exec 和 文件名可以使用可以被 scrot 扩充的格式说明符。有两种类型的
    \n说明符。 '%' 前导的说明符由 strfile(2) 来解释。例程可以查看 strftile
    \n手册。这些选项用来引用当前的日期。第二种说明符由 scort 内部解释并且
    \n使用前缀 '$'. 可以识别的说明符如下:
    \n$f 图像的路径/文件名 (如果在文件名中就会忽略)
    \n$n 图像文件名 (如果在文件名中会被忽略)
    \n$s 图像大小(字节数) (如果在文件名会被忽略)
    \n$p 图像像素大小
    \n$w 图像宽度
    \n$h 图像高度
    \n$t 图像格式
    \n$$ 打印字符 '$'
    \nn 打印新行 (如果在文件名中会被忽略)

    \n-----------------------------------------------------------------------------------------------------------------------
    \n
    \n     例子(~ 用户主目录):
    \n1、对全屏截图并保存文件名:
    \n      scrot ~/abc.png
    \n
    \n2、抓取窗口,b 参数表示带边框窗体,s 用户可以指定窗口:
    \n      scrot -bs ~/abc.png
    \n
    \n3、抓取鼠标选定区域:
    \n
          scrot -s ~/abc.png
    \n
    \n4、延时抓取,d 表示延时,c 倒计时,10 是秒,抓菜单等其他东西时很好用:
    \n
          scrot -cd 10 ~/abc.png
    \n
    \n5、生成缩略图,t 表示要生成缩略图, 20% 表示缩略图的比例, s 表示截取用户划定区域:
    \n
          scrot -t 20% -s ~/abc.png
    \n
    \n6、启用某项操作 s 划定截图,-e 采用某项行为,这里用 gimp 打开截图图片,
    \n      scrot -s ~/abc.png -e 'gimp $f'

    ", "created_at"=>2007-12-15 15:54:42 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    ubuntu 下 gnome 自带的截图工具其实也还不错,有快捷键,可以在命令行下用 --window 的方式指定对某窗进行截图,也可以使用 --border 来指定是否包含窗体边框,甚至可以有阴影。但我还是不满意,因为我经常需要用鼠标划定一个范围来截图,GNOME自带的就没法做到了。
    \n
    \n      Scrot,也是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
    \n
    \n      * 其他非 ubuntu 系统,你可以在 [这里] 下载到这款截图工具。
    \n
    \n      安装:
    \n      可以打开新立得搜索 scrot 并安装,也可以在终端:
    \n      sudo apt-get install scrot
    \n      来进行安装。
    \n
    \n Scrot 使用:
    \n-----------------------------------------------------------------------------------------------------------------------
    \n概要
    \nscrot [options] [file]
    \n
    \n描述
    \nscrot 是一个使用 imlib2 库截取屏幕和保存图像的的工具。
    \n选项 [file] 指定截图保存的文件名。 如果 [file] 没有指定,
    \n截图就会以当前的日期和时间为文件名保存在当前目录中。
    \n
    \n选项
    \n-h, --help
    \n显示帮助并且退出
    \n-v, --version
    \n显示版本信息并且退出
    \n-b, --border
    \n当选择一个窗口时,同时包含窗口边框。
    \n-c, --count
    \n延时时的显示倒计时
    \n-d, --delay NUM
    \n延时 NUM 秒
    \n-e, --exec APP
    \n对保存的图像执行程序 APP
    \n-q, --quality NUM
    \n图像质量 (1-100) 值大意味着文件大, 压缩率低。
    \n-m, --multidisp
    \n对多个显示设备分别截图并且连接在一起。
    \n-s, --select
    \n用鼠标交互式的选择一个窗口或者区域。
    \n-t, --thumb NUM
    \n同时生成缩略图。 NUM 是缩略图的百分比。
    \n
    \n说明符
    \n--exec 和 文件名可以使用可以被 scrot 扩充的格式说明符。有两种类型的
    \n说明符。 '%' 前导的说明符由 strfile(2) 来解释。例程可以查看 strftile
    \n手册。这些选项用来引用当前的日期。第二种说明符由 scort 内部解释并且
    \n使用前缀 '$'. 可以识别的说明符如下:
    \n$f 图像的路径/文件名 (如果在文件名中就会忽略)
    \n$n 图像文件名 (如果在文件名中会被忽略)
    \n$s 图像大小(字节数) (如果在文件名会被忽略)
    \n$p 图像像素大小
    \n$w 图像宽度
    \n$h 图像高度
    \n$t 图像格式
    \n$$ 打印字符 '$'
    \nn 打印新行 (如果在文件名中会被忽略)
    \n-----------------------------------------------------------------------------------------------------------------------
    \n
    \n     例子(~ 用户主目录):
    \n1、对全屏截图并保存文件名:
    \n      scrot ~/abc.png
    \n
    \n2、抓取窗口,b 参数表示带边框窗体,s 用户可以指定窗口:
    \n      scrot -bs ~/abc.png
    \n
    \n3、抓取鼠标选定区域:
    \n      scrot -s ~/abc.png
    \n
    \n4、延时抓取,d 表示延时,c 倒计时,10 是秒,抓菜单等其他东西时很好用:
    \n      scrot -cd 10 ~/abc.png
    \n
    \n5、生成缩略图,t 表示要生成缩略图, 20% 表示缩略图的比例, s 表示截取用户划定区域:
    \n      scrot -t 20% -s ~/abc.png
    \n
    \n6、启用某项操作 s 划定截图,-e 采用某项行为,这里用 gimp 打开截图图片,
    \n      scrot -s ~/abc.png -e 'gimp $f'

    \n", "_id"=>175}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"技能云(iTechTag)完成重大升级", "body"=>"

    这个周末是个疯狂的周末,我自己都不记得给技能云增加了多少新功能;完善了多少个不如意的地方,让我大概的回想一下吧:
    \n1、增加站内导航条的设计和实现(这个方法实在太棒了,重用了页面的一块区域,相当不错)
    \n2、增加了feed内容查看功能,也就是说,可以在技能云直接查看您提交的feed上的blos内容了,完成定时同步功能,相当漂亮。
    \n3、完善了用户界面的展示内容,现在展示的内容更加丰富合理了。
    \n4、添加公司(企业)信息维护,展示页面,社区话题等,可以维护企业的信息,和大家讨论的话题了,更清晰的认识这个企业。
    \n5、还有什么?想不起来了,貌似还有不少,这就是这个周末的劳动成果,真的,相当不错。
    \n现在的技能云,内容更加丰富,从多个方面展示一个软件开发者和企业、技能、角色等方面。目前来看,正在一步步的影响着软件开发者社区,希望有一天,技能云可以成长为参天大树。
    \n一个软件开发者的展示个人技能,其他相关信息分享的大平台。。

    ", "created_at"=>2007-12-16 14:42:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这个周末是个疯狂的周末,我自己都不记得给技能云增加了多少新功能;完善了多少个不如意的地方,让我大概的回想一下吧:
    \n1、增加站内导航条的设计和实现(这个方法实在太棒了,重用了页面的一块区域,相当不错)
    \n2、增加了feed内容查看功能,也就是说,可以在技能云直接查看您提交的feed上的blos内容了,完成定时同步功能,相当漂亮。
    \n3、完善了用户界面的展示内容,现在展示的内容更加丰富合理了。
    \n4、添加公司(企业)信息维护,展示页面,社区话题等,可以维护企业的信息,和大家讨论的话题了,更清晰的认识这个企业。
    \n5、还有什么?想不起来了,貌似还有不少,这就是这个周末的劳动成果,真的,相当不错。
    \n现在的技能云,内容更加丰富,从多个方面展示一个软件开发者和企业、技能、角色等方面。目前来看,正在一步步的影响着软件开发者社区,希望有一天,技能云可以成长为参天大树。
    \n一个软件开发者的展示个人技能,其他相关信息分享的大平台。。

    \n", "_id"=>176}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ubuntu下配置使用nginx+mogrel跑Rails集群.", "body"=>"

    很早前就曾经关注过nginx(一个俄罗斯人开发的HTTP服务器),看过一些中文和英文文档,觉得相当棒的一个服务器,但是一直没亲自试试其威力如何,这个周末写了不少代码,自己也都很满意,于是周日晚上准备休息下,顺便亲自试试nginx。

    \n

    按照我对rails服务构架部署的理解,在我本本上是ubuntu系统,由于一直订阅了mogrel的邮件列表,所以对其相当看好和喜欢,于是这次就把这两个接合起来。

    \n

    大概的架构是nginx在前面充当HTTP代理,同时处理一些静态的资源文件(比如图片,JS,CSS等),WEB请求直接到nginx后,将ruby的内容转到后端的mogrel处理;而mogrel采取集群的方式,可以自己设定需要启动的进程数(虽然以前说mogrel是非多线程的,但是从我现在跑的技能云的效果来看,一个实例都可以支撑相当的请求了),这样就形成一个前端nginx,后端mogrel的部署构架。

    \n

    其他不在多说,网上资源相当丰富,从我试验的效果看,虽然没有刻意调优的等操作,但是其配置等都相当简介明了,用起来也相当放心。

    \n

    如果以后有了自己的服务器,我肯定选择这个方式跑Rails应用。

    \n

    如下是我在这个过程中google到的参考资料,各有侧重,请需要的朋友自己筛选需要的信息:

    \n

    1、http://blackanger.blog.51cto.com/140924/40089

    \n

    2、nginx官方:http://nginx.net/

    \n

    3、英文wiki:http://wiki.codemongers.com/NginxGettingStarted

    \n

    4、javaeye上有一篇:http://yangzx.javaeye.com/blog/105869

    \n

    5、有部分中文wiki:http://wiki.codemongers.com/NginxChsWhyUseIt

    \n

    如果您对nginx、rails、mogrel等有自己的见解,欢迎分享。

    ", "created_at"=>2007-12-16 14:57:52 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    很早前就曾经关注过nginx(一个俄罗斯人开发的HTTP服务器),看过一些中文和英文文档,觉得相当棒的一个服务器,但是一直没亲自试试其威力如何,这个周末写了不少代码,自己也都很满意,于是周日晚上准备休息下,顺便亲自试试nginx。
    \n按照我对rails服务构架部署的理解,在我本本上是ubuntu系统,由于一直订阅了mogrel的邮件列表,所以对其相当看好和喜欢,于是这次就把这两个接合起来。
    \n大概的架构是nginx在前面充当HTTP代理,同时处理一些静态的资源文件(比如图片,JS,CSS等),WEB请求直接到nginx后,将ruby的内容转到后端的mogrel处理;而mogrel采取集群的方式,可以自己设定需要启动的进程数(虽然以前说mogrel是非多线程的,但是从我现在跑的技能云的效果来看,一个实例都可以支撑相当的请求了),这样就形成一个前端nginx,后端mogrel的部署构架。
    \n其他不在多说,网上资源相当丰富,从我试验的效果看,虽然没有刻意调优的等操作,但是其配置等都相当简介明了,用起来也相当放心。
    \n如果以后有了自己的服务器,我肯定选择这个方式跑Rails应用。
    \n如下是我在这个过程中google到的参考资料,各有侧重,请需要的朋友自己筛选需要的信息:
    \n1、http://blackanger.blog.51cto.com/140924/40089
    \n2、nginx官方:http://nginx.net/
    \n3、英文wiki:http://wiki.codemongers.com/NginxGettingStarted
    \n4、javaeye上有一篇:http://yangzx.javaeye.com/blog/105869
    \n5、有部分中文wiki:http://wiki.codemongers.com/NginxChsWhyUseIt
    \n如果您对nginx、rails、mogrel等有自己的见解,欢迎分享。

    \n", "_id"=>177}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"DH要升级Rails了。", "body"=>"

    早上看RSS订阅的时候,发现DH有一则公告,仔细看了下,原来其准备升级到Rails2.0.2版本了,看来Rails2的时代以及来临了,引起原话如下:

    \n
    \n
    \n
    \n

    Just when I thought it was safe to upgrade, another version appears!

    \n

    I’m going to start upgrading our servers to Rails 2.0.2. This involves packaging, testing, and then slowly rolling it out. The jump is to a 2.x version from 1.2.6, so I’m going to take my time with this one to make sure nothing goes horribly wrong, so it might be right after the new year when it’s all done, just to be safe.

    \n

    For your new year’s resolution, you will freeze your rails! Login via shell, and in your rails directory, run “rake freeze_gems” - that should do the trick!

    \n

    Please contact support if you have any questions or concerns.

    \n
    \n
    \n
    \n

     

    ", "created_at"=>2007-12-18 01:18:51 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    早上看RSS订阅的时候,发现DH有一则公告,仔细看了下,原来其准备升级到Rails2.0.2版本了,看来Rails2的时代以及来临了,引起原话如下:
    \n
    \n
    \n
    \n“Just when I thought it was safe to upgrade, another version appears!
    \nI’m going to start upgrading our servers to Rails 2.0.2. This involves packaging, testing, and then slowly rolling it out. The jump is to a 2.x version from 1.2.6, so I’m going to take my time with this one to make sure nothing goes horribly wrong, so it might be right after the new year when it’s all done, just to be safe.
    \nFor your new year’s resolution, you will freeze your rails! Login via shell, and in your rails directory, run “rake freeze_gems” - that should do the trick!
    \nPlease contact support if you have any questions or concerns.”
    \n
    \n
    \n
    \n 

    \n", "_id"=>178}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart Gem", "body"=>"

    ruby的世界真的很活跃,前不久,在infoQ上看到有人介绍了google的chart功能,自己也花了点点时间,给技能云加上这个功能,可以 在这里(http://www.itechtag.com/widget/index)看到效果,也在想,可以把这个包装成一个gem,由于最近技能云进 行不少功能的开发,就暂时搁浅了;

    \n

    中午看RSS发现,已经有人做了这个事情,而且做的相当棒,和我当初想法一样,而且有2个,呵呵,大家可以参考:

    \n

    http://railsontherun.com/2007/12/10/google-chart-gem

    \n

    http://code.google.com/p/gchartrb/

    \n

    这个小功能真的相当好用,极力推荐~

    ", "created_at"=>2007-12-21 05:24:01 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    ruby的世界真的很活跃,前不久,在infoQ上看到有人介绍了google的chart功能,自己也花了点点时间,给技能云加上这个功能,可以 在这里(http://www.itechtag.com/widget/index)看到效果,也在想,可以把这个包装成一个gem,由于最近技能云进 行不少功能的开发,就暂时搁浅了;
    \n中午看RSS发现,已经有人做了这个事情,而且做的相当棒,和我当初想法一样,而且有2个,呵呵,大家可以参考:
    \nhttp://railsontherun.com/2007/12/10/google-chart-gem
    \nhttp://code.google.com/p/gchartrb/
    \n这个小功能真的相当好用,极力推荐~

    \n", "_id"=>179}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中定制logger", "body"=>"

    需要定制一些log格式等,都说rails的log比较简单,但是其基本功能还是满足了的,例如如下技巧等。

    \n

    控制日志文件大小,保留10个历史文件,文件大小最大为1024000字节:

    \n
    \n
      \n
    1. logger = Logger.new('foo.log', 10, 1024000) 
      \n
    2. \n
    \n每日/星期/月一个日志文件
    \n
      \n
    1. logger = Logger.new('foo.log', 'daily')  
    2. \n
    3. logger = Logger.new('foo.log', 'weekly')  
    4. \n
    5. logger = Logger.new('foo.log', 'monthly') 
      \n
    6. \n
    \n而后就可以这么用了。
    \n
    \n
      \n
    1. logger.fatal { "Argument 'foo' not given." }  
    2. \n
    3. logger.error "Argument \#{ @foo } mismatch."  
    4. \n
    5. logger.info('initialize') { "Initializing..." }  
    6. \n
    7. logger.add(Logger::FATAL) { 'Fatal error!' }
      \n
    8. \n
    \n其他:按日期来分开存储web日志文件和sql日志
    \n
    \n

    1、简单做法
    \n首先,在log/目录下新建sql文件夹,sql文件夹用来保存sql日志
    \n接着,修改config\\environment.rb代码,需注意代码顺序。

    \n

    #web访问日志
    \nRAILS_DEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}_\#{Date.today.to_s}.log", "daily")

    \n

    #rails的初始化
    \nRails::Initializer.run do |config|
    \n#...
    \nend

    \n

    #sql日志
    \nActiveRecord::Base.logger = Logger.new("\#{RAILS_ROOT}/log/sql/\#{RAILS_ENV}_\#{Date.today.to_s}.log", "daily")

    \n

    2、使用unix的cron做定时转存。

    \n
    ", "created_at"=>2007-12-23 17:41:09 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    需要定制一些log格式等,都说rails的log比较简单,但是其基本功能还是满足了的,例如如下技巧等。
    \n控制日志文件大小,保留10个历史文件,文件大小最大为1024000字节:
    \n
    \n
    \n logger = Logger.new('foo.log', 10, 1024000) 
    \n
    \n
    \n每日/星期/月一个日志文件
    \n
    \n logger = Logger.new('foo.log', 'daily')  
    \n logger = Logger.new('foo.log', 'weekly')  
    \n logger = Logger.new('foo.log', 'monthly') 
    \n
    \n
    \n而后就可以这么用了。
    \n
    \n
    \n logger.fatal { "Argument 'foo' not given." }  
    \n logger.error "Argument \#{ @foo } mismatch."  
    \n logger.info('initialize') { "Initializing..." }  
    \n logger.add(Logger::FATAL) { 'Fatal error!' }
    \n
    \n
    \n其他:按日期来分开存储web日志文件和sql日志
    \n
    \n1、简单做法
    \n首先,在log/目录下新建sql文件夹,sql文件夹用来保存sql日志
    \n接着,修改config\\environment.rb代码,需注意代码顺序。
    \n#web访问日志
    \nRAILSDEFAULT_LOGGER = Logger.new("\#{RAILS_ROOT}/log/\#{RAILS_ENV}\#{Date.today.to_s}.log", "daily")
    \n#rails的初始化
    \nRails::Initializer.run do |config|

    \n\n

    ...

    \n\n

    end
    \n#sql日志
    \nActiveRecord::Base.logger = Logger.new("\#{RAILSROOT}/log/sql/\#{RAILS_ENV}\#{Date.today.to_s}.log", "daily")
    \n2、使用unix的cron做定时转存。

    \n", "_id"=>180}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"YAML Configuration File", "body"=>"

     

    \n

    Application configuration shouldn't be spread throughout your code base. Instead a much better place to put it is an external YAML file. See how to do that in this episode.

    \n
    \n
    \n``[code]
    # config/initializers/load_config.rb

    APP_CONFIG = YAML.load_file("\#{RAILS_ROOT}/config/config.yml")[RAILS_ENV]

    # application.rb
    def authenticate
    if APP_CONFIG['perform_authentication']
    authenticate_or_request_with_http_basic do |username, password|
    username == APP_CONFIG['username'] && password == APP_CONFIG['password']
    end
    end
    end
    [/code]
    ---
    [code]
    # config/config.yml
    development:
    perform_authentication: false

    test:
    perform_authentication: false

    production:
    perform_authentication: true
    username: admin
    password: secret
    [/code]
    来源:http://railscasts.com/episodes/85```\n
    \n
    ", "created_at"=>2007-12-28 04:44:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

     
    \nApplication configuration shouldn't be spread throughout your code base. Instead a much better place to put it is an external YAML file. See how to do that in this episode.
    \n
    \n
    \n<span class="c">[code]<br /># config/initializers/load_config.rb</span><br /><span class="co">APP_CONFIG</span> = <span class="co">YAML</span>.load_file(<span class="s"><span class="dl">&quot;</span><span class="il"><span class="idl">\#{</span><span class="co">RAILS_ROOT</span><span class="idl">}</span></span><span class="k">/config/config.yml</span><span class="dl">&quot;</span></span>)[<span class="co">RAILS_ENV</span>]<br /><br /><span class="c"># application.rb</span><br /><span class="r">def</span> <span class="fu">authenticate</span><br /> <span class="r">if</span> <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">perform_authentication</span><span class="dl">'</span></span>]<br /> authenticate_or_request_with_http_basic <span class="r">do</span> |username, password|<br /> username == <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">username</span><span class="dl">'</span></span>] &amp;&amp; password == <span class="co">APP_CONFIG</span>[<span class="s"><span class="dl">'</span><span class="k">password</span><span class="dl">'</span></span>]<br /> <span class="r">end</span><br /> <span class="r">end</span><br /><span class="r">end<br /></span><span class="c">[/code]</span><br /><span class="r">---<br /></span><span class="c">[code]</span><br /># config/config.yml<br />development:<br /> perform_authentication: false<br /><br />test:<br /> perform_authentication: false<br /><br />production:<br /> perform_authentication: true<br /> username: admin<br /> password: secret<br /><span class="c">[/code]</span><br />来源:http://railscasts.com/episodes/85`
    \n

    \n", "_id"=>181}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Web 2.0 ,有文化的网站做不大", "body"=>"

    这个文章从一个层面上讲述了这个现象。
    \n原文:http://china.digitalwall.com/scripts/display.asp?UID=403
    \n摘要:

    \n

    为什么会造成这种市场局面?笔者以前说过,Web 2.0 的发展基础是 社会学,因此一个Web 2.0 网站的用户数多寡,完全看它占领了那个 社会阶层(或者文化阶层)而定,那个阶层直接决定了用户数的上限。

    \n

    因为Web 2.0 网站几乎是靠著人拉人发展起来。每个用户会拉动的人 都是他生活上熟悉的圈子,不管陌生人或熟人。当同一种阶层的人在 这个网站越积越多的时候,其他阶层的人也越难以加入到这里。

    \n

    等到网站有第一批用户,为了牢牢抓住他们,及利用他们带更多用户 进来,必须更加揣摩他们的心思甚或社交习惯。结果更深化了这样的 发展,更加走向某一种文化氛围或者社会阶层,再也无法回头。

    \n

     

    ", "created_at"=>2007-12-28 04:47:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    这个文章从一个层面上讲述了这个现象。
    \n原文:http://china.digitalwall.com/scripts/display.asp?UID=403
    \n摘要:
    \n为什么会造成这种市场局面?笔者以前说过,Web 2.0 的发展基础是 社会学,因此一个Web 2.0 网站的用户数多寡,完全看它占领了那个 社会阶层(或者文化阶层)而定,那个阶层直接决定了用户数的上限。
    \n因为Web 2.0 网站几乎是靠著人拉人发展起来。每个用户会拉动的人 都是他生活上熟悉的圈子,不管陌生人或熟人。当同一种阶层的人在 这个网站越积越多的时候,其他阶层的人也越难以加入到这里。
    \n等到网站有第一批用户,为了牢牢抓住他们,及利用他们带更多用户 进来,必须更加揣摩他们的心思甚或社交习惯。结果更深化了这样的 发展,更加走向某一种文化氛围或者社会阶层,再也无法回头。
    \n 

    \n", "_id"=>182}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Oracle中的截取字符更新", "body"=>"

    update bizobj_extend_value t
    \nset t.extend_value = substr(t.extend_value,1,10)
    \nwhere extend_key = 'BOSSID'  and  lengthb(trim(t.extend_value) )> 20  

    ", "created_at"=>2007-12-29 03:57:41 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    update bizobj_extend_value t
    \nset t.extend_value = substr(t.extend_value,1,10)
    \nwhere extend_key = 'BOSSID'  and  lengthb(trim(t.extend_value) )> 20  

    \n", "_id"=>183}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"见到了传说中的透明同学", "body"=>"

    透明(http://gigix.thoughtworkers.org/)同学也算是界内大名鼎鼎的了哈,虽然一起完成了伟大的‘技能云’网站,但是一直没有见过真人,实在遗憾;碰巧他来深圳做项目,赶在元旦节终于见到一面。

    \n

    做为一个技术人员,我本人不是很喜欢社交活动,但是偶然见见几个朋友,还是很不错的:)

    \n

    说到技能云,我们觉得还是大有前途的。

    ", "created_at"=>2008-01-02 13:25:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    透明(http://gigix.thoughtworkers.org/)同学也算是界内大名鼎鼎的了哈,虽然一起完成了伟大的‘技能云’网站,但是一直没有见过真人,实在遗憾;碰巧他来深圳做项目,赶在元旦节终于见到一面。
    \n做为一个技术人员,我本人不是很喜欢社交活动,但是偶然见见几个朋友,还是很不错的:)
    \n说到技能云,我们觉得还是大有前途的。

    \n", "_id"=>184}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"2008年都来了,该盘点下去年的历程了", "body"=>"

    好像真的好快,转眼间,我毕业都快2年了,2007年又悄悄的过完了,回首看看,我貌似也干了不少‘看上去’了不起的事情,该坐下来稍微盘点下下拉。

    \n

    本职工作,公司的项目我貌似完成的相当不错,开发和运维做的都不错的,电信级的产品让自己也学到了不少东西,虽然都是点点滴滴的,但每每需要用到什么东西的时候,我都可以搞定的差不多。有些机会,没有真正抓住,但是也促使了其他的一些新的机会,貌似很不错。

    \n

    课余活动,貌似真的很丰富,我能用Rails实现了很多自己以前想到却无法实现的东西,做了一批我心目中的网站,虽然没有取得巨大的成功,但是看看技能云(iTechTag)、1.s.t,以及byeloo1stlog第一次等等,我自己都不敢相信,这些都是我做的。构建自己理想的团队模式和氛围1sters.com,做为国内第一批专业的ROR技术团队,虽然我们不曾实际运转,但其让我积累足够的经验。

    \n

    晓得了什么是敏捷开发,什么是rails,什么是mogrel,ngnix等等等。。晓得了代码还可以这么优雅和舒服。

    \n

    继续了天马行空的梦想,虽然遇到了不少困难和挫折,但是我们挺过来了,还是有那么多的安全爱好者兄弟,浪子,小A,丰初,心雨以及其他几个朋友,让我保持了对安全领域兴趣和爱好。

    \n

    协助Tudou编辑nohack杂志,nohack中我还算是元老吧,从创办到现在,风风雨雨,虽然我不曾尽全力,但是始终关注,尽自己的一份绵薄之力,虽然还不成见过那群很神秘的TUdou、裤子,LCX等等。对nohack的热爱,使得自己也对网络安全保存自己的特有视觉。

    \n

    另外认识了一些创业界的朋友,看着朋友的网站“圈内”,“公益街”,“recity”,“善学”,“菜盘子”等等,看着他们为自己的理想工作,实在不错;接触到ROR世界中的一些活跃者,看到未来的趋势。认识了一起扯蛋、讨论的reacoo,公益街那个心怀梦想的monty,上海recity的创者,透明、infoQ的老霍(泰稳)、不曾见面却提供很多帮助的fengbo,给我很多建议cash.zhao,一起讨论问题的tails, 在我故乡的创建自己善学的jouy、来自德国的maxime、在家过着我向往的节奏生活的snowzhang,javaeye的robbin前辈,国内ROR实践的先行者dongbing、rails的布道者caiwangqin、道喜以及程序员杂志社的朋友们。

    \n

    还有伴着我已经5年风雨的shine,虽然没有多少惊喜,但是我们一起走过,琐碎的生活,让我们学会更多,虽然也曾惹你生气、流泪,但请相信,我们的未来肯定是美好的,相伴一生。

    \n

    一年时间不算太长,我忙忙碌碌的没有停歇,回首过去,点点滴滴。

    \n

    已经到来的2008,是充满希望的一年,虽然说不上雄伟的计划,但是2008中还是心怀梦想的,希望2008年,我们的’技能云‘能爆发全面的威力;希望朋友们的梦想都能成真,还有诸多暂时不能说的秘密。

    \n

    期待我们完美的2008..还没有盘点的XDJM该盘点下再前行啦。。

    \n

     

    \n

     

    ", "created_at"=>2008-01-02 13:54:57 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    好像真的好快,转眼间,我毕业都快2年了,2007年又悄悄的过完了,回首看看,我貌似也干了不少‘看上去’了不起的事情,该坐下来稍微盘点下下拉。
    \n本职工作,公司的项目我貌似完成的相当不错,开发和运维做的都不错的,电信级的产品让自己也学到了不少东西,虽然都是点点滴滴的,但每每需要用到什么东西的时候,我都可以搞定的差不多。有些机会,没有真正抓住,但是也促使了其他的一些新的机会,貌似很不错。
    \n课余活动,貌似真的很丰富,我能用Rails实现了很多自己以前想到却无法实现的东西,做了一批我心目中的网站,虽然没有取得巨大的成功,但是看看技能云(iTechTag)、1.s.t,以及byeloo,1stlog,第一次等等,我自己都不敢相信,这些都是我做的。构建自己理想的团队模式和氛围1sters.com,做为国内第一批专业的ROR技术团队,虽然我们不曾实际运转,但其让我积累足够的经验。
    \n晓得了什么是敏捷开发,什么是rails,什么是mogrel,ngnix等等等。。晓得了代码还可以这么优雅和舒服。
    \n继续了天马行空的梦想,虽然遇到了不少困难和挫折,但是我们挺过来了,还是有那么多的安全爱好者兄弟,浪子,小A,丰初,心雨以及其他几个朋友,让我保持了对安全领域兴趣和爱好。
    \n协助Tudou编辑nohack杂志,nohack中我还算是元老吧,从创办到现在,风风雨雨,虽然我不曾尽全力,但是始终关注,尽自己的一份绵薄之力,虽然还不成见过那群很神秘的TUdou、裤子,LCX等等。对nohack的热爱,使得自己也对网络安全保存自己的特有视觉。
    \n另外认识了一些创业界的朋友,看着朋友的网站“圈内”,“公益街”,“recity”,“善学”,“菜盘子”等等,看着他们为自己的理想工作,实在不错;接触到ROR世界中的一些活跃者,看到未来的趋势。认识了一起扯蛋、讨论的reacoo,公益街那个心怀梦想的monty,上海recity的创者,透明、infoQ的老霍(泰稳)、不曾见面却提供很多帮助的fengbo,给我很多建议cash.zhao,一起讨论问题的tails, 在我故乡的创建自己善学的jouy、来自德国的maxime、在家过着我向往的节奏生活的snowzhang,javaeye的robbin前辈,国内ROR实践的先行者dongbing、rails的布道者caiwangqin、道喜以及程序员杂志社的朋友们。
    \n还有伴着我已经5年风雨的shine,虽然没有多少惊喜,但是我们一起走过,琐碎的生活,让我们学会更多,虽然也曾惹你生气、流泪,但请相信,我们的未来肯定是美好的,相伴一生。
    \n一年时间不算太长,我忙忙碌碌的没有停歇,回首过去,点点滴滴。
    \n已经到来的2008,是充满希望的一年,虽然说不上雄伟的计划,但是2008中还是心怀梦想的,希望2008年,我们的’技能云‘能爆发全面的威力;希望朋友们的梦想都能成真,还有诸多暂时不能说的秘密。
    \n期待我们完美的2008..还没有盘点的XDJM该盘点下再前行啦。。
    \n 
    \n 

    \n", "_id"=>185}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Nano简单就是美的基础指南", "body"=>"

    使用的DH上的crontab的默认编辑器是nano,我以前在家里的电脑上貌似也看到过,但是当时觉得不会有,也懒得看DOCs,于是就按照google到的文档将其设定为vim了,今天在DH上配置crontab的时候,再次发现这个东西,决定好好看看到底是什么东西。

    \n

    google到2篇文章,稍微看了下,在结合实例试了下,果然简洁好用,相当不错,使用起来也很简单,摘抄点放下面:

    \n

    NANO中有这么几种特殊的输入方式,当你按下Ctrl键(用^表示)的同时再按其它键,或者连续按两下ESC键再按其它键,你就可以使用NANO的特殊功能。比如:
    \n^Y 向前翻一页
    \n^V 向后翻一页
    \n^X 退出编辑器
    \n^G 获得在线帮助 这是最重要的功能,请大家一定时常使用
    \n^O 存储文件
    \n^W 搜索
    \n^C 获得当前鼠标位置
    \n^K 删掉光标所在行
    \n还有好多好多特殊功能,大家可以^G通过在线帮助来学习,这里就不详述了。

    \n

    其他的请参考我google到的2篇文章:

    \n

    Nano基础指南:http://www.gentoo.org/doc/zh_cn/nano-basics-guide.xml

    \n

    NANO,简单就是美:http://www.linuxer.cn/?uid-2-action-viewspace-itemid-9

    \n

    Nano官方:http://www.nano-editor.org

    ", "created_at"=>2008-01-03 07:04:31 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    使用的DH上的crontab的默认编辑器是nano,我以前在家里的电脑上貌似也看到过,但是当时觉得不会有,也懒得看DOCs,于是就按照google到的文档将其设定为vim了,今天在DH上配置crontab的时候,再次发现这个东西,决定好好看看到底是什么东西。
    \ngoogle到2篇文章,稍微看了下,在结合实例试了下,果然简洁好用,相当不错,使用起来也很简单,摘抄点放下面:
    \nNANO中有这么几种特殊的输入方式,当你按下Ctrl键(用^表示)的同时再按其它键,或者连续按两下ESC键再按其它键,你就可以使用NANO的特殊功能。比如:
    \n^Y 向前翻一页
    \n^V 向后翻一页
    \n^X 退出编辑器
    \n^G 获得在线帮助 这是最重要的功能,请大家一定时常使用
    \n^O 存储文件
    \n^W 搜索
    \n^C 获得当前鼠标位置
    \n^K 删掉光标所在行
    \n还有好多好多特殊功能,大家可以^G通过在线帮助来学习,这里就不详述了。
    \n其他的请参考我google到的2篇文章:
    \nNano基础指南:http://www.gentoo.org/doc/zh_cn/nano-basics-guide.xml
    \nNANO,简单就是美:http://www.linuxer.cn/?uid-2-action-viewspace-itemid-9
    \nNano官方:http://www.nano-editor.org

    \n", "_id"=>186}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google SOAP Search API不在提供服务", "body"=>"

    其实很早前我就用过这个,貌似还是在读书的时候吧,现在技能云上我突然感觉这个相当不错的一个功能,可惜的是,在其站上发现,已经不在提供了,看到其公告如下:
    \n
    \nf December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.
    \n

    \n

    Depending on your application, the AJAX Search API may be a better choice for you instead. It tends to be better suited for search-based web applications and supports additional features like Video, News, Maps, and Blog search results.

    \n

    For developers who are already using the SOAP Search API, we've kept the documentation live on this site.

    \n

    \n

    唉,按照其意思是推荐大家使用更强大的AJAX Search API,但是我不觉得其好用,也不符合我的需要,可惜了哦。
    \n还是贴一段代码吧,如下:
    \nrequire 'soap/wsdlDriver'
    \n$KCODE = "UTF8"
    \nkey = 'LVJnAm5QFHblahblahblah your key here'
    \n
    \n#create driver
    \nwsdl = "http://api.google.com/GoogleSearch.wsdl"
    \ndriver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    \nquery = "your query string here"
    \nstart = 0
    \nmax = 10
    \n 
    \n# see http://dev.ctor.org/soap4r/browser/trunk/sample/wsdl/googleSearch/wsdlDriver.rb
    \n@results = driver.doGoogleSearch( key, query, start, max, true, "", true, 'lang_en', '','')
    \nsnippets = @results.resultElements.collect { |r| r.snippet } # you can get all kinds'a' info here
    \nself.update_attribute(:html, snippets.join("\\n")) # or whatever
    \n
    \n===================================
    \ndef search
    \n require 'soap/wsdlDriver'
    \n @title = 'Search Results'
    \n key = 'YOUR GOOGLE API KEY HERE'
    \n yoursite = 'YOUR SITE ADDRESS HERE'
    \n driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl").createDriver
    \n @results = driver.doGoogleSearch(key, @params['term']+" site:\#{yoursite}", 0, 10, true, " ", false, " ", " ", " ")
    \nend
    \n
    \n
    \n<% for result in @results.resultElements %>
    \n <h2><%= result.title %></h2>
    \n <p><%= result.snippet %></p>
    \n <p><a href="<%= result.URL %>"><%= result.URL %></a></p>
    \n<% end %>

    ", "created_at"=>2008-01-03 15:58:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    其实很早前我就用过这个,貌似还是在读书的时候吧,现在技能云上我突然感觉这个相当不错的一个功能,可惜的是,在其站上发现,已经不在提供了,看到其公告如下:
    \n“
    \nf December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.
    \n
    \nDepending on your application, the AJAX Search API may be a better choice for you instead. It tends to be better suited for search-based web applications and supports additional features like Video, News, Maps, and Blog search results.
    \nFor developers who are already using the SOAP Search API, we've kept the documentation live on this site.
    \n”
    \n唉,按照其意思是推荐大家使用更强大的AJAX Search API,但是我不觉得其好用,也不符合我的需要,可惜了哦。
    \n还是贴一段代码吧,如下:
    \nrequire 'soap/wsdlDriver'
    \n$KCODE = "UTF8"
    \nkey = 'LVJnAm5QFHblahblahblah your key here'

    \n\n

    create driver

    \n\n

    wsdl = "http://api.google.com/GoogleSearch.wsdl"
    \ndriver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    \nquery = "your query string here"
    \nstart = 0
    \nmax = 10
    \n 

    \n\n

    see http://dev.ctor.org/soap4r/browser/trunk/sample/wsdl/googleSearch/wsdlDriver.rb

    \n\n

    @results = driver.doGoogleSearch( key, query, start, max, true, "", true, 'lang_en', '','')
    \nsnippets = @results.resultElements.collect { |r| r.snippet } # you can get all kinds'a' info here
    \nself.update_attribute(:html, snippets.join("\\n")) # or whatever
    \n
    \n===================================
    \ndef search
    \n require 'soap/wsdlDriver'
    \n @title = 'Search Results'
    \n key = 'YOUR GOOGLE API KEY HERE'
    \n yoursite = 'YOUR SITE ADDRESS HERE'
    \n driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl".createDriver;)
    \n @results = driver.doGoogleSearch(key, @params['term']+" site:\#{yoursite}", 0, 10, true, " ", false, " ", " ", " ")
    \nend
    \n
    \n
    \n<% for result in @results.resultElements %>
    \n <h2><%= result.title %></h2>
    \n <p><%= result.snippet %></p>
    \n <p><a href="<%= result.URL %>"><%= result.URL %></a></p>
    \n<% end %>

    \n", "_id"=>187}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"测试ruby中的gsub和scan等找到需要的字符串", "body"=>"

    测试一些ruby中的字符匹配方法,如下是源代码。

    \n

    <code class=java>

    \n

     

    \n

    puts "----1、 使用gsub找到需要的字符串 存在$1中-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.*)"/,"---")}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.*)"/,"---")
    \nputs $1
    \n
    \nputs "---------------------------"
    \n
    \nputs "----2、在gsub里面可以使用区块?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.*)")/){|c| c.upcase}}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.*)")/){|c| c.upcase}
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \n
    \nputs "----3、看看匹配到的是什么?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.*)")/,'\\2')}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.*)")/,'\\2')
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \nputs "----4、使用scan来扫描符合正则的字符串-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.*)"/).first.first}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.*)"/).first.first
    \nputs $1
    \n</code>

    \n


    \n输出结果:
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.*)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n----3、看看匹配到的是什么?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.*)")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk
    \n
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n----1、 使用gsub找到需要的字符串 存在$1中-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(encoding="(.*)"/,"---")
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.*)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----3、看看匹配到的是什么?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.*)")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk

    ", "created_at"=>2008-01-07 02:38:25 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    测试一些ruby中的字符匹配方法,如下是源代码。
    \n<code class=java>
    \n 
    \nputs "----1、 使用gsub找到需要的字符串 存在$1中-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.)"/,"---")}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\bencoding="(.
    )"/,"---")
    \nputs $1
    \n
    \nputs "---------------------------"
    \n
    \nputs "----2、在gsub里面可以使用区块?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.)")/){|c| c.upcase}}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(/\\b(encoding="(.
    )")/){|c| c.upcase}
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \n
    \nputs "----3、看看匹配到的是什么?-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.)")/,'\\2')}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub(/\\b(encoding="(.
    )")/,'\\2')
    \nputs $1
    \nputs $2
    \n
    \nputs "---------------------------"
    \nputs "----4、使用scan来扫描符合正则的字符串-----------------------"
    \nputs %Q{puts  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.)"/).first.first}
    \n
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(/\\bencoding="(.
    )"/).first.first
    \nputs $1
    \n</code>
    \n
    \n输出结果:
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n----3、看看匹配到的是什么?-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.
    )")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \n'<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.)"/).first.first
    \ngbk
    \ngbk
    \n
    \nE:\\Ysl\\Test>ruby encoding.rb
    \n----1、 使用gsub找到需要的字符串 存在$1中-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub(encoding="(.
    )"/,"---")
    \n<?xml version="1.0" --- fff?>
    \ngbk
    \n---------------------------
    \n----2、在gsub里面可以使用区块?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.gsub((encoding="(.)")/){|c| c.upcase}
    \n<?xml version="1.0" ENCODING="GBK" fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----3、看看匹配到的是什么?-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.sub((encoding="(.
    )")/,'\u0002')
    \n<?xml version="1.0" gbk fff?>
    \nencoding="gbk"
    \ngbk
    \n---------------------------
    \n----4、使用scan来扫描符合正则的字符串-----------------------
    \nputs  '<?xml version="1.0" encoding="gbk" fff?> '.scan(encoding="(.*)"/).first.first
    \ngbk
    \ngbk

    \n", "_id"=>188}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何完成非utf8格式的RSS转换", "body"=>"

    技能云的开发过程中,由于提供了抓取用户提交的Feed上的文章的功能,于是乎,遭受到编码问题的困扰,按照一般的规范,RSS或者ATOM都应该使用UTF-8的编码吧,无奈的是总有些人不遵守,比较baid空间的RSS就是gb2312编码的。
    \n
    \n没办法,竟然用户提出来,我也只能想办法搞定它了。其实原理也很简单,读取该feed的编码,然后在入库前先做此编码转换。
    \n至于如何取得该feed的编码,可以参考我前面写的这篇文章(http://iceskysl.1sters.com/?action=show&id=184)。

    \n

    PS:新版本的firefox3b2对我这个blog的编辑器支持不是很好,无法弹出加链接等等的框,比较不爽。。

    ", "created_at"=>2008-01-07 02:46:35 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在技能云的开发过程中,由于提供了抓取用户提交的Feed上的文章的功能,于是乎,遭受到编码问题的困扰,按照一般的规范,RSS或者ATOM都应该使用UTF-8的编码吧,无奈的是总有些人不遵守,比较baid空间的RSS就是gb2312编码的。
    \n
    \n没办法,竟然用户提出来,我也只能想办法搞定它了。其实原理也很简单,读取该feed的编码,然后在入库前先做此编码转换。
    \n至于如何取得该feed的编码,可以参考我前面写的这篇文章(http://iceskysl.1sters.com/?action=show&id=184)。;
    \nPS:新版本的firefox3b2对我这个blog的编辑器支持不是很好,无法弹出加链接等等的框,比较不爽。。

    \n", "_id"=>189}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag增加圈子编辑和其分类添加编辑功能", "body"=>"

    技能云 添加新功能 和完善以前的功能,已经成为习惯了,每天每天没事的时候就想想哪些地方需要改进?哪些地方还需要加强等.

    \n

    现在是凌晨0:30分,我把刚才完成的新功能升级上去了,虽然是轻车熟路,不免还是心潮澎湃,看着技能云 一天天的成长,是我最欣慰的事情。

    \n

    今天添加功能有:

    \n
      \n
    1. 圈子 的编辑功能,开通圈子的人默认为其管理者,可以修改完善圈子的名字、描述和规则;
    2. \n
    3. 另外,还可以针对自己的圈子添加适当的分类以更好的将话题分类,以方便浏览。
    4. \n
    5. 按照分类来浏览其Group中的话题。
    6. \n
    \n

    以上功能你在浏览社区的时候应该都可以看到,我就不截图了。。

    \n

    如有建议和意见,欢迎联系我。

    ", "created_at"=>2008-01-08 16:42:21 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    给技能云 添加新功能 和完善以前的功能,已经成为习惯了,每天每天没事的时候就想想哪些地方需要改进?哪些地方还需要加强等.
    \n现在是凌晨0:30分,我把刚才完成的新功能升级上去了,虽然是轻车熟路,不免还是心潮澎湃,看着技能云 一天天的成长,是我最欣慰的事情。
    \n今天添加功能有:
    \n
    \n 圈子 的编辑功能,开通圈子的人默认为其管理者,可以修改完善圈子的名字、描述和规则;
    \n 另外,还可以针对自己的圈子添加适当的分类以更好的将话题分类,以方便浏览。
    \n 按照分类来浏览其Group中的话题。
    \n
    \n以上功能你在浏览社区的时候应该都可以看到,我就不截图了。。
    \n如有建议和意见,欢迎联系我。

    \n", "_id"=>190}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Proc.new vs Lambda in Ruby", "body"=>"

    一直都不是很能把ruby的Proc运用自由,今天看一个gem的时候,又发现另外一个比较让我迷惑的东西Lambda ,好读书不求甚解,先找到一篇相关的文章,如下:

    \n

    http://samdanielson.com/2007/3/19/proc-new-vs-lambda-in-ruby

    \n

    原作者是这么说的:

    \n
    \n

    I found the following lines of code on Wikipedia today. It’s a very succinct description of one important difference between a lambda and a Proc. Try printing the return value of f.call for more insight.

    \n
    \n

    摘录部分内容如下:

    \n``
    def foo
    f = Proc.new { return "return from foo from inside proc" }
    f.call # control leaves foo here
    return "return from foo"
    end

    def bar
    f = lambda { return "return from lambda" }
    f.call # control does not leave bar here
    return "return from bar"
    end

    puts foo # prints "return from foo from inside proc"
    puts bar # prints "return from bar"

    在wiki上也有,地址如下:http://en.wikipedia.org/wiki/Closure_(computer_science)``````", "created_at"=>2008-01-09 04:37:23 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一直都不是很能把ruby的Proc运用自由,今天看一个gem的时候,又发现另外一个比较让我迷惑的东西Lambda ,好读书不求甚解,先找到一篇相关的文章,如下:
    \nhttp://samdanielson.com/2007/3/19/proc-new-vs-lambda-in-ruby
    \n原作者是这么说的:
    \n
    \nI found the following lines of code on Wikipedia today. It’s a very succinct description of one important difference between a lambda and a Proc. Try printing the return value of f.call for more insight.
    \n
    \n摘录部分内容如下:
    \n<code class="ruby"><br /><span class="keywords">def</span> foo<br /> f = <span class="constants">Proc</span><span class="method">.new</span> <span class="brackets">{</span> return <span class="string">&quot;return from foo from inside proc&quot;</span> <span class="brackets">}</span><br /> f<span class="method">.call</span> <span class="comment"># control leaves foo here</span><br /> return <span class="string">&quot;return from foo&quot;</span> <br /><span class="keywords">end</span><br /><br /><span class="keywords">def</span> bar<br /> f = lambda <span class="brackets">{</span> return <span class="string">&quot;return from lambda&quot;</span> <span class="brackets">}</span><br /> f<span class="method">.call</span> <span class="comment"># control does not leave bar here</span><br /> return <span class="string">&quot;return from bar&quot;</span> <br /><span class="keywords">end</span><br /><br />puts foo <span class="comment"># prints &quot;return from foo from inside proc&quot; </span><br />puts bar <span class="comment"># prints &quot;return from bar&quot; </span><br /><br />在wiki上也有,地址如下:http://en.wikipedia.org/wiki/Closure_(computer_science)````

    \n", "_id"=>191}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RubyOnRails + S3 + EC2 = ?", "body"=>"

    最近关注了下Amazon S3EC2,加上一直比较看好的Rails,联系在一起想想,真是前景无限呀。
    \nS3提供了海量存储和安全备份,我们再不需要为机器故障、硬盘坏道等担忧了,我也也不需要去买服务器,定时备份了,因为使用S3的海量存储,数据是安全的,容量是无限的,而且价格也是低廉的;
    \nok?相当好,不是么?
    \n别急,还有更好的,EC2这种解决方案更加让人兴奋,看其名字````Elastic Computer Cloud ```就可以就让人无限联想了,不是么?Cloud。。。
    \nEC2是一种基于Xen的虚拟单元,可以自己按照需要购买适当的配置,支持无限扩展,而且价格也比较合理,其他的自己去Amazon 看,我就不罗嗦了。
    \n加上一直很火的RubyOnRails,真的很难想象,以后的互联网会是怎么样的,有时间我写篇文章,幻想一下。
    \n
    \n但是在EC2上跑Rails,操作起来,不是很方便,所以有些插件就出来了。如下收集一些比较不错的资源,有兴趣的朋友自行研究。
    \n体验Amazon EC2:(目前为止看到的唯一一篇中文介绍)
    \nhttp://cookoo.javaeye.com/blog/105510
    \nEC2 on Rails:(插件)
    \nhttp://ec2onrails.rubyforge.org/
    \nDeploying Rails App On Ec2:(slideshare上的一个PPT,写的相当好)
    \nhttp://static.slideshare.net/bansalakhil/deploying-rails-app-on-ec2/
    \nAmazon S3 Firefox Organizer(S3Fox)(火狐的一个用于S3传输的插件,cool)
    \nhttps://addons.mozilla.org/en-US/firefox/addon/3247
    \nUtilizing Amazon S3 and EC2 in Rails(说了常见的几个问题)
    \nhttp://blog.centopeia.com/railsconf-europe-2007-notes/utilizing-amazon-s3-and-ec2-in-rails/
    \nDeploying Rails on EC2
    \nhttp://railspikes.com/2007/4/5/rails-on-ec2
    \n
    \n我已经使用S3了,有机会试试EC2...

    ", "created_at"=>2008-01-10 08:58:56 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    最近关注了下Amazon 的S3和EC2,加上一直比较看好的Rails,联系在一起想想,真是前景无限呀。
    \nS3提供了海量存储和安全备份,我们再不需要为机器故障、硬盘坏道等担忧了,我也也不需要去买服务器,定时备份了,因为使用S3的海量存储,数据是安全的,容量是无限的,而且价格也是低廉的;
    \nok?相当好,不是么?
    \n别急,还有更好的,EC2这种解决方案更加让人兴奋,看其名字`Elastic Computer Cloud就可以就让人无限联想了,不是么?Cloud。。。
    \nEC2是一种基于Xen的虚拟单元,可以自己按照需要购买适当的配置,支持无限扩展,而且价格也比较合理,其他的自己去Amazon 看,我就不罗嗦了。
    \n加上一直很火的RubyOnRails,真的很难想象,以后的互联网会是怎么样的,有时间我写篇文章,幻想一下。
    \n
    \n但是在EC2上跑Rails,操作起来,不是很方便,所以有些插件就出来了。如下收集一些比较不错的资源,有兴趣的朋友自行研究。
    \n体验Amazon EC2:(目前为止看到的唯一一篇中文介绍)
    \nhttp://cookoo.javaeye.com/blog/105510
    \nEC2 on Rails:(插件)
    \nhttp://ec2onrails.rubyforge.org/
    \nDeploying Rails App On Ec2:(slideshare上的一个PPT,写的相当好)
    \nhttp://static.slideshare.net/bansalakhil/deploying-rails-app-on-ec2/
    \nAmazon S3 Firefox Organizer(S3Fox)(火狐的一个用于S3传输的插件,cool)
    \nhttps://addons.mozilla.org/en-US/firefox/addon/3247
    \nUtilizing Amazon S3 and EC2 in Rails(说了常见的几个问题)
    \nhttp://blog.centopeia.com/railsconf-europe-2007-notes/utilizing-amazon-s3-and-ec2-in-rails/
    \nDeploying Rails on EC2
    \nhttp://railspikes.com/2007/4/5/rails-on-ec2
    \n
    \n我已经使用S3了,有机会试试EC2...

    \n", "_id"=>192}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"刚刚注册完域名OriginalCopyright.com", "body"=>"

    经过一番的思考和推敲,最终选定了http://www.originalcopyright.com/ 这个域名; 尽管长了点,但是容易记,且意思很丰富,不是么?

    \n

    刚刚开始这个Idea,希望大家多多支持..

    ", "created_at"=>2008-01-10 16:31:04 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    经过一番的思考和推敲,最终选定了http://www.originalcopyright.com/ 这个域名; 尽管长了点,但是容易记,且意思很丰富,不是么?
    \n刚刚开始这个Idea,希望大家多多支持..

    \n", "_id"=>193}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"一个很不错的在线分析网站Clicky", "body"=>"

    \"Clicky
    \n一个很不错的在线分析网站,

    \n

    功能相当强大,需要的朋友可以试试看,比我以前是的GA要好很多。。比51.la和51yes都好用。。

    ", "created_at"=>2008-01-10 16:37:24 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    一个很不错的在线分析网站,
    \n功能相当强大,需要的朋友可以试试看,比我以前是的GA要好很多。。比51.la和51yes都好用。。

    \n", "_id"=>194}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"vsftpd下显示的时间与系统时间不一致问题", "body"=>"

    最近老是遇到FTP上去看到的文件时间和实际登录上去查看得到的文件生成时间不一致的现象,找了下原因,是因为默认情况下,vsftpd 是用gmt做为它的时间的,所以和系统的时间可能会不一致,修改也很简单:
    \n
    \nvi /etc/vsftpd/vsftpd.conf

    \n

    在最后加入一行:

    \n

    use_localtime=yes

    \n

    存盘后,重启vsftpd即可:

    \n

    service vsftpd restart

    ", "created_at"=>2008-01-15 04:35:19 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    最近老是遇到FTP上去看到的文件时间和实际登录上去查看得到的文件生成时间不一致的现象,找了下原因,是因为默认情况下,vsftpd 是用gmt做为它的时间的,所以和系统的时间可能会不一致,修改也很简单:
    \n
    \nvi /etc/vsftpd/vsftpd.conf
    \n在最后加入一行:
    \nuse_localtime=yes
    \n存盘后,重启vsftpd即可:
    \nservice vsftpd restart

    \n", "_id"=>195}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Mysql的连接数问题始末", "body"=>"

    看到“海阳”在chinaonrails上问一个关于在Rails的线程中使用mysql链接的问题(http://chinaonrails.com/topic/view/1201/1.html#replyForm),老是出现异常:

    \n

    ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:

    \n

    我以前在写技能云的时候,在后台定时跑的一个并发job的时候,也遇到过类似的问题,个人感觉是线程数的问题,找到几篇资料,证明我的猜测,如下:

    \n

    MySQL最大连接数设置:http://spaces.huash.com/86932/viewspace-223435.html

    \n

    MySQL服务维护笔记 :http://www.chedong.com/tech/mysql.html

    \n

    加大mysql的最大连接数:http://www.21ds.net/article/56/547

    ", "created_at"=>2008-01-15 04:40:55 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    看到“海阳”在chinaonrails上问一个关于在Rails的线程中使用mysql链接的问题(http://chinaonrails.com/topic/view/1201/1.html#replyForm),老是出现异常:
    \nActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:
    \n我以前在写技能云的时候,在后台定时跑的一个并发job的时候,也遇到过类似的问题,个人感觉是线程数的问题,找到几篇资料,证明我的猜测,如下:
    \nMySQL最大连接数设置:http://spaces.huash.com/86932/viewspace-223435.html
    \nMySQL服务维护笔记 :http://www.chedong.com/tech/mysql.html
    \n加大mysql的最大连接数:http://www.21ds.net/article/56/547

    \n", "_id"=>196}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用消息队列的策略", "body"=>"

    开始的时候,有人说Rails没有队列机制,无法达到企业级的需求,时间没多久,现在再来看看Rails有没有队列机制吧。

    \n

    \"\"

    \n

    别看一组可行的列表,如下:

    \n

    beanstalkd

    \n

    Fast, simple, designed to mirror the style of memcached. Rails plugin available, or usable with a simple Ruby-based API. Server written in C, but is very easy to install. Memory only…jobs are not persistent. New, so the internal protocol may change. Workers may be difficult to manage.

    \n

    bj

    \n

    Rails plugin. Self-spawning. Can only send shell commands. Jobs start a full copy of your Rails app on every execution.

    \n

    BackgroundRB

    \n

    Ruby-based. Can be polled for incremental feedback on the progress of a job. Recently rewritten.

    \n

    Amazon SQS

    \n

    Runs on Amazon’s cluster, so it can handle a ton of traffic. Operated by Amazon, so it doesn’t run locally. Not open source.

    \n

    Apache ActiveMQ

    \n

    Well-known. Persistent. Requires several installation steps and database tables.

    \n

    ActiveMessaging

    \n

    Rails plugin. Works with ActiveMQ and others. Requires external job server.

    \n

    BBQ

    \n

    Nothing to install…involves only a single line of code! Doesn’t work on Windows NT4.

    \n

    如下是几篇介绍的文章:

    \n

    http://www.thewebfellas.com/blog/2008/1/17/queues

    \n

    http://nubyonrails.com/articles/about-this-blog-beanstalk-messaging-queue

    ", "created_at"=>2008-01-18 06:48:07 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    开始的时候,有人说Rails没有队列机制,无法达到企业级的需求,时间没多久,现在再来看看Rails有没有队列机制吧。
    \n
    \n别看一组可行的列表,如下:
    \nbeanstalkd
    \nFast, simple, designed to mirror the style of memcached. Rails plugin available, or usable with a simple Ruby-based API. Server written in C, but is very easy to install. Memory only…jobs are not persistent. New, so the internal protocol may change. Workers may be difficult to manage.
    \nbj
    \nRails plugin. Self-spawning. Can only send shell commands. Jobs start a full copy of your Rails app on every execution.
    \nBackgroundRB
    \nRuby-based. Can be polled for incremental feedback on the progress of a job. Recently rewritten.
    \nAmazon SQS
    \nRuns on Amazon’s cluster, so it can handle a ton of traffic. Operated by Amazon, so it doesn’t run locally. Not open source.
    \nApache ActiveMQ
    \nWell-known. Persistent. Requires several installation steps and database tables.
    \nActiveMessaging
    \nRails plugin. Works with ActiveMQ and others. Requires external job server.
    \nBBQ
    \nNothing to install…involves only a single line of code! Doesn’t work on Windows NT4.
    \n如下是几篇介绍的文章:
    \nhttp://www.thewebfellas.com/blog/2008/1/17/queues
    \nhttp://nubyonrails.com/articles/about-this-blog-beanstalk-messaging-queue

    \n", "_id"=>197}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用backgroundrb任务队列", "body"=>"

    svn co      http://svn.devjavu.com/backgroundrb/trunk      backgroundrb
    \nrake backgroundrb:setup
    \n或者:script/plugin install svn://rubyforge.org//var/svn/backgroundrb

    \n

    可用资源:
    \nhttp://www.infoq.com/cn/articles/BackgrounDRb
    \nhttp://backgroundrb.rubyforge.org/
    \nhttp://warpspire.com/tipsresources/programming/long-running-tasks-in-rails-backgroundrb/

    ", "created_at"=>2008-01-20 08:20:13 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    svn co      http://svn.devjavu.com/backgroundrb/trunk      backgroundrb
    \nrake backgroundrb:setup
    \n或者:script/plugin install svn://rubyforge.org//var/svn/backgroundrb
    \n可用资源:
    \nhttp://www.infoq.com/cn/articles/BackgrounDRb
    \nhttp://backgroundrb.rubyforge.org/
    \nhttp://warpspire.com/tipsresources/programming/long-running-tasks-in-rails-backgroundrb/

    \n", "_id"=>198}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何把用到的gems附到verdor中", "body"=>"

    在本地装多少gems都无所谓,但是当在服务器上或者是 share host的时候,有的时候并不是您需要的gems都有安装的,这个时候,我们在想最好是在本地把需要的gems打包到vendor里面去,这样怎么迁移都不怕了。

    \n

    于是google了一番,发现老外们已经实践过了,方法其实也不难,主要是要区分一些gems是无法做大的,但是其他的貌似都是可以的。

    \n

    具体做法请参考如下这几个文章:

    \n

    1、http://hideto.javaeye.com/blog/82235(中文介绍的,比较简短)

    \n

    2、http://rubygems.org/read/chapter/10(介绍gem命令的)

    \n

    3、http://errtheblog.com/posts/50-vendor-everything(具体实现的)

    \n

    如上三篇文章。用到的命令主要就是gem,所以附带了上面那篇gem的参考:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack uuidtools  
    2. \n
    3. Unpacked gem: 'uuidtools-1.0.1'  
    4. \n
    5.   
    6. \n
    7. E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack rio  
    8. \n
    9. Unpacked gem: 'rio-0.4.1'  
    10. \n
    11.   
    12. \n
    13. E:\\Ysl\\dev\\1ster\\vendor\\gems>ls  
    14. \n
    15. rio-0.4.1        uuidtools-1.0.1  
    16. \n
    17.   
    18. \n
    19. E:\\Ysl\\dev\\1ster\\vendor\\gems> 
      \n
    20. \n
    \n
    \n

    ", "created_at"=>2008-01-21 08:46:15 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    在本地装多少gems都无所谓,但是当在服务器上或者是 share host的时候,有的时候并不是您需要的gems都有安装的,这个时候,我们在想最好是在本地把需要的gems打包到vendor里面去,这样怎么迁移都不怕了。
    \n于是google了一番,发现老外们已经实践过了,方法其实也不难,主要是要区分一些gems是无法做大的,但是其他的貌似都是可以的。
    \n具体做法请参考如下这几个文章:
    \n1、http://hideto.javaeye.com/blog/82235(中文介绍的,比较简短)
    \n2、http://rubygems.org/read/chapter/10gem命令的)(介绍
    \n3、http://errtheblog.com/posts/50-vendor-everything(具体实现的)
    \n如上三篇文章。用到的命令主要就是gem,所以附带了上面那篇gem的参考:
    \n
    \n
    \nRuby代码
    \n
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack uuidtools  
    \n Unpacked gem: 'uuidtools-1.0.1'  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>gem unpack rio  
    \n Unpacked gem: 'rio-0.4.1'  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems>ls  
    \n rio-0.4.1        uuidtools-1.0.1  
    \n   
    \n E:\\Ysl\\dev\\1ster\\vendor\\gems> 
    \n
    \n
    \n

    \n", "_id"=>199}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Open Flash Chart Plugin for Ruby on Rails - Graphs", "body"=>"

    刚刚写完上一篇文章Open flash chart 生成动态有一些交互效果的图表 ,因为其实用PHP做为例子来演示的,偶还想用RubyOnRails来改写一把,down下他的zip包,发现有两个ruby的类库,一个是作者自己写的,比较简陋;而另外一个是pullmonkey 写的,看了下代码和readme,发现他已经用RoR实现了。 去他的网站上看看,果然又有更新,看下其效果,相当不错。 \"\"

    \n

    \"\"

    \n

    \"\"

    \n
    \n

    I ported the php code for open flash chart to ruby and so far it has worked quite well with Rails. Just ported the latest 1.9.6 version – see the many graph examples below. To install and use the open flash chart plugin for Rails do the following:

    \n
    \n
      \n
    1. script/plugin install http://svn.pullmonkey.com/plugins/trunk/open_flash_chart/
    2. \n
    3. Move the open_flash_chart.swf file into your RAILS_ROOT/public directory
    4. \n
    5. Create a controller and a view as in my examples below.
    6. \n
    \n

    可以在http://pullmonkey.com/projects/open_flash_chart 查看详细的代码和示例。

    \n

    看一段3D bar的代码,如下:````
    \n

    \n
    Ruby代码
    \n
      \n
    1. def view  
    2. \n
    3.   @graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/bar_3d'false'/projects/')             
    4. \n
    5. end  
    6. \n
    7. def bar_3d  
    8. \n
    9.         bar_red = Bar3d.new(75, '#D54C78')  
    10. \n
    11.         bar_red.key('2006', 10)  
    12. \n
    13.         bar_blue = Bar3d.new(75, '#3334AD')  
    14. \n
    15.         bar_blue.key('2007', 10)  
    16. \n
    17.   
    18. \n
    19.         10.times do |t|  
    20. \n
    21.                 bar_red.data << rand(3) + 2  
    22. \n
    23.                 bar_blue.data << rand(4) + 5  
    24. \n
    25.         end  
    26. \n
    27.   
    28. \n
    29.         g = Graph.new  
    30. \n
    31.         g.title("3D Bar Chart""{font-size:20px; color: #FFFFFF; margin: 5px;background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}")  
    32. \n
    33.         g.data_sets << bar_red  
    34. \n
    35.         g.data_sets << bar_blue  
    36. \n
    37.   
    38. \n
    39.         g.set_x_axis_3d(12)  
    40. \n
    41.         g.set_x_axis_color('#ffffff''#fDB5C7')  
    42. \n
    43.         g.set_y_axis_color('#ffffff''#fDB5C7')  
    44. \n
    45.   
    46. \n
    47.         g.set_x_labels(%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct))  
    48. \n
    49.         g.set_y_max(10)  
    50. \n
    51.         g.set_y_label_steps(5)  
    52. \n
    53.         g.set_y_legend("OPEN FLASH CHART", 12, "#736AFF")  
    54. \n
    55.         render :text => g.render  
    56. \n
    57. end  
    58. \n
    \n
    \n```

    ", "created_at"=>2008-01-24 02:54:00 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    刚刚写完上一篇文章Open flash chart 生成动态有一些交互效果的图表 ,因为其实用PHP做为例子来演示的,偶还想用RubyOnRails来改写一把,down下他的zip包,发现有两个ruby的类库,一个是作者自己写的,比较简陋;而另外一个是pullmonkey 写的,看了下代码和readme,发现他已经用RoR实现了。 去他的网站上看看,果然又有更新,看下其效果,相当不错。
    \n
    \n
    \n
    \nI ported the php code for open flash chart to ruby and so far it has worked quite well with Rails. Just ported the latest 1.9.6 version – see the many graph examples below. To install and use the open flash chart plugin for Rails do the following:
    \n
    \n
    \n script/plugin install http://svn.pullmonkey.com/plugins/trunk/open_flash_chart/
    \n Move the open_flash_chart.swf file into your RAILS_ROOT/public directory
    \n Create a controller and a view as in my examples below.
    \n
    \n可以在http://pullmonkey.com/projects/open_flash_chart 查看详细的代码和示例。
    \n看一段3D bar的代码,如下:`<br />
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol start="1" class="dp-rb">
    \n <li class="alt"><span><span class="keyword">def</span><span>&nbsp;view&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;<span class="variable">@graph</span><span>&nbsp;=&nbsp;open_flash_chart_object(500,250,&nbsp;</span><span class="string">'/projects/open_flash_chart/bar_3d'</span><span>,&nbsp;</span><span class="keyword">false</span><span>,&nbsp;</span><span class="string">'/projects/'</span><span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span><span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span><span class="keyword">def</span><span>&nbsp;bar_3d&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red&nbsp;=&nbsp;Bar3d.<span class="keyword">new</span><span>(75,&nbsp;</span><span class="string">'#D54C78'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red.key(<span class="string">'2006'</span><span>,&nbsp;10)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue&nbsp;=&nbsp;Bar3d.<span class="keyword">new</span><span>(75,&nbsp;</span><span class="string">'#3334AD'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue.key(<span class="string">'2007'</span><span>,&nbsp;10)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.times&nbsp;<span class="keyword">do</span><span>&nbsp;|t|&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_red.data&nbsp;&lt;&lt;&nbsp;rand(3)&nbsp;+&nbsp;2&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar_blue.data&nbsp;&lt;&lt;&nbsp;rand(4)&nbsp;+&nbsp;5&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g&nbsp;=&nbsp;Graph.<span class="keyword">new</span><span>&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.title(<span class="string">&quot;3D&nbsp;Bar&nbsp;Chart&quot;</span><span>,&nbsp;</span><span class="string">&quot;{font-size:20px;&nbsp;color:&nbsp;#FFFFFF;&nbsp;margin:&nbsp;5px;background-color:&nbsp;#505050;&nbsp;padding:5px;&nbsp;padding-left:&nbsp;20px;&nbsp;padding-right:&nbsp;20px;}&quot;</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.data_sets&nbsp;&lt;&lt;&nbsp;bar_red&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.data_sets&nbsp;&lt;&lt;&nbsp;bar_blue&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_axis_3d(12)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_axis_color(<span class="string">'#ffffff'</span><span>,&nbsp;</span><span class="string">'#fDB5C7'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_axis_color(<span class="string">'#ffffff'</span><span>,&nbsp;</span><span class="string">'#fDB5C7'</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_x_labels(%w(Jan&nbsp;Feb&nbsp;Mar&nbsp;Apr&nbsp;May&nbsp;Jun&nbsp;Jul&nbsp;Aug&nbsp;Sep&nbsp;Oct))&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_max(10)&nbsp;&nbsp;</span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_label_steps(5)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.set_y_legend(<span class="string">&quot;OPEN&nbsp;FLASH&nbsp;CHART&quot;</span><span>,&nbsp;12,&nbsp;</span><span class="string">&quot;#736AFF&quot;</span><span>)&nbsp;&nbsp;</span></span></li>
    \n <li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render&nbsp;<span class="symbol">:text</span><span>&nbsp;=&gt;&nbsp;g.render&nbsp;&nbsp;</span></span></li>
    \n <li class="alt"><span><span class="keyword">end</span><span>&nbsp;&nbsp;</span></span></li>
    \n</ol>
    \n</div>
    \n

    \n", "_id"=>200}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"突然感觉到picasaweb的速度好快!", "body"=>"

    我很早前就开始使用picasaweb,但是以前老觉得速度慢,加上上传速度都比较一般,所以用的时间不是很多。

    \n

    但是最近发现(特别是今天),上传的时候相当快,而且在其他页面引用显示的时候也相当快的,前些时间,看到很多人说google日历、gmail都加速了,加上现在我感觉的picasaweb的加速,google又要有所大的举动了,难道。。

    \n

    加速当然是好事,以后我在技能云发文章的时候,都是把需要的图片upload到picasaweb上,再引用的,这样很好。

    \n

    一来可以保存自我图片到google,比较安全;

    \n

    二来不用在技能云上传图片啥的,节省空间不说,也减少维护的繁琐。

    ", "created_at"=>2008-01-24 03:16:43 UTC, "updated_at"=>2012-06-24 15:53:12 UTC, "body_html"=>"

    我很早前就开始使用picasaweb,但是以前老觉得速度慢,加上上传速度都比较一般,所以用的时间不是很多。
    \n但是最近发现(特别是今天),上传的时候相当快,而且在其他页面引用显示的时候也相当快的,前些时间,看到很多人说google日历、gmail都加速了,加上现在我感觉的picasaweb的加速,google又要有所大的举动了,难道。。
    \n加速当然是好事,以后我在技能云上发文章的时候,都是把需要的图片upload到picasaweb上,再引用的,这样很好。
    \n一来可以保存自我图片到google,比较安全;
    \n二来不用在技能云上传图片啥的,节省空间不说,也减少维护的繁琐。

    \n", "_id"=>201}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遇到一个很奇怪Rails logger的问题~", "body"=>"

    最近技能云遇到一个很奇怪的问题,每天凌晨的时候,转换日志的时候都会出现一些问题,导致应用程序无法访问,每次都是重启后才能恢复,相当怪异。

    \n

    理了下,应该是从我使用backgroundrb任务队列以后开始的,原来是没有问题的,每天凌晨的时候会自动切换日志文件名称。

    \n

    而我在backgroundrb里面是定时的同步用户的Feeds用的,会调用相关的model中的方法解析RSS,入库等操作,自然这个过程中也是有日志的。

    \n

    看到报的错误如下:

    \n

     

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag/config/../log/sql/production_2008-01-24.log.20080124' already exists.):  
    2. \n
    3.     /usr/lib/ruby/1.8/logger.rb:501:in `write'  
    4. \n
    5.     /usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'  
    6. \n
    7.     /usr/lib/ruby/1.8/logger.rb:496:in `write'  
    8. \n
    9.     /usr/lib/ruby/1.8/logger.rb:326:in `add'  
    10. \n
    11.     /usr/lib/ruby/1.8/logger.rb:348:in `debug'  
    12. \n
    13.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:134:in `log_info'  
    14. \n
    15.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:127:in `log'  
    16. \n
    17.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:in `execute'  
    18. \n
    19.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:399:in `select'  
    20. \n
    21.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one'  
    22. \n
    23.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value'  
    24. \n
    25.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:212:in `execute_simple_calculation'  
    26. \n
    27.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:121:in `calculate'  
    28. \n
    29.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `catch'  
    30. \n
    31.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `calculate'  
    32. \n
    33.     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:45:in `count'  
    34. \n
    35.     /app/models/motto.rb:9:in `get_rand'  
    36. \n
    37.     /app/controllers/application.rb:35:in `get_rand_motto'  
    38. \n
    \n
    \n

    看到的提示是“Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag

    \n

     

    \n
    /config/../log/sql/production_2008-01-24.log.20080124' already exists.):”
    \n
    看上去感觉是在1.25号凌晨的时候,将原来的日志改名为production_2008-01-24.log.20080124,而此时已经存在名字为“production_2008-01-24.log.20080124”的文件,导致改名失败的。
    \n但是这个“production_2008-01-24.log.20080124”是哪里来的呢?backgroundrb应该是没有进行改名操作的。
    \n
    \n于是乎开始google,找到有类似问题的文章如下:
    \n1、Rails application not working, no error displayed, just error code 500
    \n错误基本上是一样的,但是这个文章没有仔细说是什么原因,只说了:
    \n
    And the problem was almost solved - problem with log rotation.
    \nSo, if you face the same problem, try to perform few operations in your rails console... and if you are lucky, you will find the bug.
    \n
    也就是说是日志rotation的时候的问题。
    \n2、Rails Logging Tips
    \n这篇文章说了一些Rails中使用logger的技巧,没有说到这个问题,只是让我更清楚logg的机制。
    \n3、Strange logger rotation failure
    \n这个邮件列表说了基本上类似的问题,他的原因是由于配置了多个cronb,而导致的,说的比较详细。
    \n
    \n以上只是我的分析过程,而我遇到的这个问题,还有待进一步的分析和排查,有后续进展再补充。
    \n如果有遇到类似问题的朋友,还请指教一二,别让我重复造轮子,谢谢!
    ", "created_at"=>2008-01-25 02:19:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近技能云遇到一个很奇怪的问题,每天凌晨的时候,转换日志的时候都会出现一些问题,导致应用程序无法访问,每次都是重启后才能恢复,相当怪异。
    \n理了下,应该是从我使用backgroundrb任务队列以后开始的,原来是没有问题的,每天凌晨的时候会自动切换日志文件名称。
    \n而我在backgroundrb里面是定时的同步用户的Feeds用的,会调用相关的model中的方法解析RSS,入库等操作,自然这个过程中也是有日志的。
    \n看到报的错误如下:
    \n 
    \n
    \nXML/HTML代码
    \n
    \n Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag/config/../log/sql/production_2008-01-24.log.20080124' already exists.):  
    \n     /usr/lib/ruby/1.8/logger.rb:501:in write'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/1.8/monitor.rb:238:in&nbsp;
    synchronize'  
    \n     /usr/lib/ruby/1.8/logger.rb:496:in write'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/1.8/logger.rb:326:in&nbsp;
    add'  
    \n     /usr/lib/ruby/1.8/logger.rb:348:in debug'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:134:in&nbsp;
    log_info'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:127:in log'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:in&nbsp;
    execute'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:399:in select'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in&nbsp;
    select_one'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in select_value'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:212:in&nbsp;
    execute_simple_calculation'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:121:in calculate'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in&nbsp;
    catch'  
    \n     /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in calculate'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:45:in&nbsp;
    count'  
    \n     /app/models/motto.rb:9:in get_rand'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;/app/controllers/application.rb:35:in&nbsp;
    get_rand_motto'  
    \n
    \n
    \n看到的提示是“Logger::ShiftingError (Shifting failed. '/home/iceskysl/itechtag
    \n 
    \n/config/../log/sql/production_2008-01-24.log.20080124' already exists.):”
    \n看上去感觉是在1.25号凌晨的时候,将原来的日志改名为production_2008-01-24.log.20080124,而此时已经存在名字为“production_2008-01-24.log.20080124”的文件,导致改名失败的。
    \n但是这个“production_2008-01-24.log.20080124”是哪里来的呢?backgroundrb应该是没有进行改名操作的。
    \n
    \n于是乎开始google,找到有类似问题的文章如下:
    \n1、Rails application not working, no error displayed, just error code 500
    \n错误基本上是一样的,但是这个文章没有仔细说是什么原因,只说了:
    \n And the problem was almost solved - problem with log rotation.
    \nSo, if you face the same problem, try to perform few operations in your rails console... and if you are lucky, you will find the bug.
    \n也就是说是日志rotation的时候的问题。
    \n2、Rails Logging Tips
    \n这篇文章说了一些Rails中使用logger的技巧,没有说到这个问题,只是让我更清楚logg的机制。
    \n3、Strange logger rotation failure
    \n这个邮件列表说了基本上类似的问题,他的原因是由于配置了多个cronb,而导致的,说的比较详细。
    \n
    \n以上只是我的分析过程,而我遇到的这个问题,还有待进一步的分析和排查,有后续进展再补充。
    \n如果有遇到类似问题的朋友,还请指教一二,别让我重复造轮子,谢谢!

    \n", "_id"=>202}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"升级本地Rails到2.02版本", "body"=>"

    Rails2版本出来已经有一段时间了,一直没来得及细看,也没有时间把以前写的几个APP升级到Rails2,今天突然心血来潮,就把本地的Rails升级到Rails2.02版本了。

    \n

    并最先把1.s.t的系统升级调试过了,途中遇到几个小问题,记录如下:

    \n

    1、升级Rails2.02的时候遇到的

    \n

    升级前,版本如下:

    \n
    iceskysl@IceskYsl:~$ gem -v
    \n0.93
    \niceskysl@IceskYsl:~$ rails -v
    \nRails 1.2.5
    \niceskysl@IceskYsl:~$ ruby -v
    \nruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
    \n
    \n

    升级命令如下:

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. iceskysl@IceskYsl:~$ gem update --system  
    2. \n
    3. iceskysl@IceskYsl:~$ gem update rails --include-dependencies   
    4. \n
    \n
    \n升级完,看下版本
    \niceskysl@IceskYsl:~$ gem -v: 1.0.1
    \niceskysl@IceskYsl:~$ rails -v

    \n

    出现rubygems.rb:379:in `report_activate_error': RubyG
    \nem version error: activesupport(1.4.2 not = 2.0.2) (Gem::LoadError)错误,看来有点问题。

    \n

    紧接着执行:gem update activesupport即可。

    \n

    2、出现View的问题

    \n

    \n

    \n
    XML/RHTML代码
    \n
      \n
    1. <%=link_to h(@topic.title),group_topic_path(:group_id => @topic.group, :id => @topic),{:class=>"notify_title"}%>  
    2. \n
    \n
    \n 必须是group_topic_path这样的,不能象Rails1.2.5时候topic_path这样的,其他类似。

    \n

    3、插件问题

    \n

    类似auto_complete_for这个不在包含在Rails核心中,而是以插件的发布,需要安装一下,如下:

    \n

    \n

    \n
    SHELL代码
    \n
      \n
    1. iceskysl@IceskYsl:/opt/devroot/1sters.net$ ./script/plugin  install http://dev.rubyonrails.org/svn/rails/plugins/auto_complete/  
    2. \n
    \n
    \n 还没发现其他问题,貌似没想像的那么多问题,可能是我代码写的比较好吧,:)
    \n

    ", "created_at"=>2008-01-26 12:13:28 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Rails2版本出来已经有一段时间了,一直没来得及细看,也没有时间把以前写的几个APP升级到Rails2,今天突然心血来潮,就把本地的Rails升级到Rails2.02版本了。
    \n并最先把1.s.t的系统升级调试过了,途中遇到几个小问题,记录如下:
    \n1、升级Rails2.02的时候遇到的
    \n升级前,版本如下:
    \niceskysl@IceskYsl:~$ gem -v
    \n0.93
    \niceskysl@IceskYsl:~$ rails -v
    \nRails 1.2.5
    \niceskysl@IceskYsl:~$ ruby -v
    \nruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
    \n
    \n升级命令如下:
    \n
    \n
    \nShell代码
    \n
    \n iceskysl@IceskYsl:~$ gem update --system  
    \n iceskysl@IceskYsl:~$ gem update rails --include-dependencies   
    \n
    \n
    \n升级完,看下版本
    \niceskysl@IceskYsl:~$ gem -v: 1.0.1
    \niceskysl@IceskYsl:~$ rails -v
    \n出现rubygems.rb:379:in `report_activate_error': RubyG
    \nem version error: activesupport(1.4.2 not = 2.0.2) (Gem::LoadError)错误,看来有点问题。
    \n紧接着执行:gem update activesupport即可。
    \n2、出现View的问题
    \n
    \n
    \nXML/RHTML代码
    \n
    \n <%=link_to h(@topic.title),group_topic_path(:group_id => @topic.group, :id => @topic),{:class=>"notify_title"}%>  
    \n
    \n
    \n 必须是group_topic_path这样的,不能象Rails1.2.5时候topic_path这样的,其他类似。
    \n 3、插件问题
    \n 类似auto_complete_for这个不在包含在Rails核心中,而是以插件的发布,需要安装一下,如下:
    \n
    \n
    \n SHELL代码
    \n
    \n iceskysl@IceskYsl:/opt/devroot/1sters.net$ ./script/plugin  install http://dev.rubyonrails.org/svn/rails/plugins/auto_complete/  
    \n
    \n
    \n 还没发现其他问题,貌似没想像的那么多问题,可能是我代码写的比较好吧,:)
    \n

    \n", "_id"=>203}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"MySQL设置编码", "body"=>"

    1、在my.ini文件的中设置所有数据库编码
    \ndefault-character-set=utf8
    \n
    \n 2、
    单独设置某个数据库:
    \n
    alter database testdb character set utf8;
    \n

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. mysql> alter database impsp character set utf8;  
    2. \n
    3. Query OK, 1 row affected (0.00 sec) 
      \n
    4. \n
    \n
    \n

    \n

    3、查看mysql支持的编码:
    \nshow character set;

    ", "created_at"=>2008-01-27 13:17:33 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    1、在my.ini文件的中设置所有数据库编码
    \ndefault-character-set=utf8
    \n
    \n 2、单独设置某个数据库:
    \n alter database testdb character set utf8;
    \n
    \n
    \n
    \nShell代码
    \n
    \n mysql> alter database impsp character set utf8;  
    \n Query OK, 1 row affected (0.00 sec) 
    \n
    \n
    \n
    \n
    \n 3、查看mysql支持的编码:
    \nshow character set;

    \n", "_id"=>204}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Upgrading your views to Rails 2.0", "body"=>"

    升级后VIEW的后缀有改变,可以使用如下命令改.

    \n
    \n
    Shell代码
    \n
      \n
    1. for old in `find app/views -name *.rhtml`; do    
    2. \n
    3.  svn mv $old `dirname $old`/`basename $old .rhtml`.html.erb; done    
    4. \n
    \n
    \n

    http://softiesonrails.com/2007/7/11/upgrading-your-views-to-rails-2-0

    ", "created_at"=>2008-01-28 12:57:10 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    升级后VIEW的后缀有改变,可以使用如下命令改.
    \n
    \nShell代码
    \n
    \n for old in find&nbsp;app/views&nbsp;-name&nbsp;*.rhtml; do    
    \n  svn mv $old dirname&nbsp;</span><span class="variable">$old</span><span>/basename&nbsp;</span><span class="variable">$old</span><span>&nbsp;.rhtml.html.erb; done    
    \n
    \n
    \nhttp://softiesonrails.com/2007/7/11/upgrading-your-views-to-rails-2-0

    \n", "_id"=>205}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"attachment_fu中callbacks_for方法出错解决!", "body"=>"

    前天晚上,把‘技能云’升级到Rails2.02版本后,只是大概的测试了下功能,把发现的问题予以修复,但是由于时间比肩紧急,没能全部覆盖到,昨天发现了不少遗留问题,都陆续的解决了,只有一个使用attachment_fu上传用户头像的地方还有些问题,下面是具体的分析和过程。

    \n

    \n

    \n
    错误日志
    \n
      \n
    1. Parameters: {"commit"=>"涓婁紶..", "action"=>"upload_user_pic", "controller"=>"user", "asset"=>{"uploaded_data"=>#<ActionController::UploadedStringIO:0xb6435ee8>, "user_id"=>"1"}}  
    2. \n
    3. Error:undefined method `callbacks_for' for #<Asset:0xb643149c>銆傘€?  
    4. \n
    \n
    \n从上面的作物日志可以看到,是调用callbacks_for的时候出的问题,而我当时使用的attachment_fu是比较老的版本,作者在后面更新过一次,于是:

    \n

    1、首先更新版本,发现依然无法使用,还是类似的错误

    \n

    2、在COR上发个帖子,大家都说自己的rmagick没有问题,奇怪的很。

    \n

    3、Google下,找到有人遇到类似问题,如下:

    \n\n

    而上面两个地址都给了另外一个页面的链接地址“Edge callback refactorings && attachment_fu" ,看来找到问题了,在其页面上说到:\n

    \n
    引用
    \n
      \n
    1. Edge changeset 8664 introduces ActiveSupport::Callbacks.  
    2. \n
    3. This currently breaks attachment_fu's callback internals and may affect other plugins as well ...  
    4. \n
    \n
    \n

    \n

    哦,原来是Rails中的改动影响了这个插件,\n

    \n
    改动message说明
    \n
      \n
    1. Extract ActiveSupport::Callbacks from Active Record, test case setup and teardown, and ActionController::Dispatcher. Closes #10727.   
    2. \n
    \n
    \n

    \n

    详细的你可以参考这个页面,我就不多说了,下面主要说说怎么解决。

    \n

    按照上面给出的俄那个页面上的方法,做如下处理,将下面这段代码中的三个方法copy到attachment_fu中的attachment_fu.rb 中,覆盖其原来的callback_with_args方法。

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. module Technoweenie  
    2. \n
    3.   module AttachmentFu  
    4. \n
    5.   
    6. \n
    7.     module InstanceMethods  
    8. \n
    9.   
    10. \n
    11.       def self.included( base )  
    12. \n
    13.         base.define_callbacks *[:after_resize:after_attachment_saved:before_thumbnail_saved]  
    14. \n
    15.       end    
    16. \n
    17.   
    18. \n
    19.       def callback_with_args(method, arg = self)  
    20. \n
    21.          notify(method)  
    22. \n
    23.   
    24. \n
    25.           result = run_callbacks(method, { :object => arg }) { |result, object| result == false }  
    26. \n
    27.   
    28. \n
    29.           if result != false && respond_to_without_attributes?(method)  
    30. \n
    31.             result = send(method)  
    32. \n
    33.           end  
    34. \n
    35.   
    36. \n
    37.           return result  
    38. \n
    39.       end        
    40. \n
    41.   
    42. \n
    43.       def run_callbacks(kind, options = {}, &block)  
    44. \n
    45.         options.reverse_merge!( :object => self )  
    46. \n
    47.         ::ActiveSupport::Callbacks::Callback.run(self.class.send("\#{kind}_callback_chain"), options[:object], options, &block)  
    48. \n
    49.       end        
    50. \n
    51.     end  
    52. \n
    53.   end  
    54. \n
    55. end  
    56. \n
    \n
    \n而后,需要确认下您的图片存放目录是可读写的,且其attachment_fu的申明需要指明图片处理器的名字,如下:\n
    \n
    Ruby代码
    \n
      \n
    1. has_attachment  :storage => :file_system,     
    2. \n
    3.   :max_size => 1.megabytes,    
    4. \n
    5.   :size => 1..1.megabyte,  
    6. \n
    7.   :content_type =>  :image,  
    8. \n
    9.   :processor => :MiniMagick,  
    10. \n
    11.   :thumbnails => { :main => '100x100>':thumb => '60x60>':tiny => '40x40>' },    
    12. \n
    13.   :path_prefix=>'public/upload/user_pics'  
    14. \n
    \n
    \n

    \n

    其他应该就没什么问题了,到此完毕。

    ", "created_at"=>2008-01-30 05:34:50 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前天晚上,把‘技能云’升级到Rails2.02版本后,只是大概的测试了下功能,把发现的问题予以修复,但是由于时间比肩紧急,没能全部覆盖到,昨天发现了不少遗留问题,都陆续的解决了,只有一个使用attachment_fu上传用户头像的地方还有些问题,下面是具体的分析和过程。
    \n
    \n
    \n错误日志
    \n
    \n Parameters: {"commit"=>"涓婁紶..", "action"=>"upload_user_pic", "controller"=>"user", "asset"=>{"uploaded_data"=>#<ActionController::UploadedStringIO:0xb6435ee8>, "user_id"=>"1"}}  
    \n Error:undefined method `callbacks_for' for #<Asset:0xb643149c>銆傘€?  
    \n
    \n
    \n从上面的作物日志可以看到,是调用callbacks_for的时候出的问题,而我当时使用的attachment_fu是比较老的版本,作者在后面更新过一次,于是:
    \n1、首先更新版本,发现依然无法使用,还是类似的错误
    \n2、在COR上发个帖子,大家都说自己的rmagick没有问题,奇怪的很。
    \n3、Google下,找到有人遇到类似问题,如下:
    \n
    \n attachment_fu: undefined method 'callbacks_for': updated
    \n Побился attachment_fu
    \n
    \n而上面两个地址都给了另外一个页面的链接地址“Edge callback refactorings && attachment_fu" ,看来找到问题了,在其页面上说到:
    \n
    \n引用
    \n
    \n Edge changeset 8664 introduces ActiveSupport::Callbacks.  
    \n This currently breaks attachment_fu's callback internals and may affect other plugins as well ...  
    \n
    \n
    \n
    \n哦,原来是Rails中的改动影响了这个插件,
    \n
    \n改动message说明
    \n
    \n Extract ActiveSupport::Callbacks from Active Record, test case setup and teardown, and ActionController::Dispatcher. Closes #10727.   
    \n
    \n
    \n
    \n详细的你可以参考这个页面,我就不多说了,下面主要说说怎么解决。
    \n按照上面给出的俄那个页面上的方法,做如下处理,将下面这段代码中的三个方法copy到attachment_fu中的attachment_fu.rb 中,覆盖其原来的callback_with_args方法。
    \n
    \n
    \nRuby代码
    \n
    \n module Technoweenie  
    \n   module AttachmentFu  
    \n   
    \n     module InstanceMethods  
    \n   
    \n       def self.included( base )  
    \n         base.define_callbacks *[:after_resize, :after_attachment_saved, :before_thumbnail_saved]  
    \n       end    
    \n   
    \n       def callback_with_args(method, arg = self)  
    \n          notify(method)  
    \n   
    \n           result = run_callbacks(method, { :object => arg }) { |result, object| result == false }  
    \n   
    \n           if result != false && respond_to_without_attributes?(method)  
    \n             result = send(method)  
    \n           end  
    \n   
    \n           return result  
    \n       end        
    \n   
    \n       def run_callbacks(kind, options = {}, &block)  
    \n         options.reverse_merge!( :object => self )  
    \n         ::ActiveSupport::Callbacks::Callback.run(self.class.send("\#{kind}_callback_chain"), options[:object], options, &block)  
    \n       end        
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n而后,需要确认下您的图片存放目录是可读写的,且其attachment_fu的申明需要指明图片处理器的名字,如下:
    \n
    \nRuby代码
    \n
    \n has_attachment  :storage => :file_system,     
    \n   :max_size => 1.megabytes,    
    \n   :size => 1..1.megabyte,  
    \n   :content_type =>  :image,  
    \n   :processor => :MiniMagick,  
    \n   :thumbnails => { :main => '100x100>', :thumb => '60x60>', :tiny => '40x40>' },    
    \n   :path_prefix=>'public/upload/user_pics'  
    \n
    \n
    \n
    \n其他应该就没什么问题了,到此完毕。

    \n", "_id"=>206}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"link_to中的小甜点", "body"=>"

    升级後技能云的公司展示页面出现一个很奇怪的问题,一直报告说:

    \n``ActionView::TemplateError (undefined method `[]' for nil:NilClass)
    on line #57 of companies/_cannot_edit_item.rhtml:
    而这行却是没有代码的,真的奇怪的很。翻遍这个文件也没有发现什么可疑的地方,最后
    没有办法就挨个的测试,发现有的公司展示页面是可以的,进数据库比较不同,发现有些
    字段是没有值的,难道这个问题,于是挨个的加上值,测试,果然通过,后来再仔细看看
    错误信息:
    错误日志
    1. vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:96:in `rewrite_url'  
    2. vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:82:in `rewrite'  
    3. vendor/rails/actionpack/lib/action_controller/base.rb:620:in `url_for'  
    4. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in `send'  
    5. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in `url_for'  
    6. vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:144:in `link_to'  
    7. app/views/companies/_cannot_edit_item.rhtml:57:in  
    8. n_erb_47app47views47companies47_cannot_edit_item46rhtml'  
    看到url_for的身影,突然感觉到是那个公司地址的问题,再测,果然,如此,看看我的代码是这么写的》
    XML/HTML代码
    1. <%= link_to website.link_url, website.link_url %>  
    也就是,生成链接地址,但是当遇到这个字段为空的时候,就挂了,也就是上面这个错误的原因了。

    查看了下link_to 的源代码,如下:
    link_to代码
    1. 137       def link_to(name, options = {}, html_options = nil)  
    2. 138         url = case options  
    3. 139           when String  
    4. 140             options  
    5. 141           when :back  
    6. 142             @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()'  
    7. 143           else  
    8. 144             self.url_for(options)  
    9. 145           end  
    10. 146   
    11. 147         if html_options  
    12. 148           html_options = html_options.stringify_keys  
    13. 149           href = html_options['href']  
    14. 150           convert_options_to_javascript!(html_options, url)  
    15. 151           tag_options = tag_options(html_options)  
    16. 152         else  
    17. 153           tag_options = nil  
    18. 154         end  
    19. 155   
    20. 156         href_attr = "href=\\"\#{url}\\"" unless href  
    21. 157         "<a \#{href_attr}\#{tag_options}>\#{name || url}</a>"  
    22. 158       end  
    接着跟,如下:
    url_for代码
    1. 65       def url_for(options = {})  
    2. 66         case options  
    3. 67         when Hash  
    4. 68           show_path =  options[:host].nil? ? true : false  
    5. 69           options = { :only_path => show_path }.update(options.symbolize_keys)  
    6. 70           escape  = options.key?(:escape) ? options.delete(:escape) : true  
    7. 71           url     = @controller.send(:url_for, options)  
    8. 72         when String  
    9. 73           escape = true  
    10. 74           url    = options  
    11. 75         when NilClass  
    12. 76           url = @controller.send(:url_fornil)  
    13. 77         else  
    14. 78           escape = false  
    15. 79           url    = polymorphic_path(options)  
    16. 80         end  
    17. 81   
    18. 82         escape ? escape_once(url) : url  
    19. 83       end  
    原来如此,豁然开朗。另外还看到:back这样的link_to用法,:)```", "created_at"=>2008-01-30 06:56:27 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    升级後技能云的公司展示页面出现一个很奇怪的问题,一直报告说:
    \n`ActionView::TemplateError (undefined method[]' for nil:NilClass)on line #57 of companies/_cannot_edit_item.rhtml:而这行却是没有代码的,真的奇怪的很。翻遍这个文件也没有发现什么可疑的地方,最后没有办法就挨个的测试,发现有的公司展示页面是可以的,进数据库比较不同,发现有些字段是没有值的,难道这个问题,于是挨个的加上值,测试,果然通过,后来再仔细看看错误信息:错误日志vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:96:in rewrite_url'&nbsp;&nbsp;</span></span></li><li class=""><span>vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:82:in&nbsp;rewrite'  vendor/rails/actionpack/lib/action_controller/base.rb:620:in url_for'&nbsp;&nbsp;</span></li><li class=""><span>vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in&nbsp;send'  vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:76:in url_for'&nbsp;&nbsp;</span></li><li class=""><span>vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:144:in&nbsp;link_to'  app/views/companies/_cannot_edit_item.rhtml:57:in  n_erb_47app47views47companies47_cannot_edit_item46rhtml'  看到url_for的身影,突然感觉到是那个公司地址的问题,再测,果然,如此,看看我的代码是这么写的》XML/HTML代码<%= link_to website.link_url, website.link_url %>  也就是,生成链接地址,但是当遇到这个字段为空的时候,就挂了,也就是上面这个错误的原因了。查看了下link_to 的源代码,如下:link_to代码137       def link_to(name, options = {}, html_options = nil)  138         url = case options  139           when String  140             options  141           when :back  142             @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()'  143           else  144             self.url_for(options)  145           end  146   147         if html_options  148           html_options = html_options.stringify_keys  149           href = html_options['href']  150           convert_options_to_javascript!(html_options, url)  151           tag_options = tag_options(html_options)  152         else  153           tag_options = nil  154         end  155   156         href_attr = "href=&quot;\#{url}&quot;" unless href  157         "<a \#{href_attr}\#{tag_options}>\#{name || url}</a>"  158       end  接着跟,如下:url_for代码65       def url_for(options = {})  66         case options  67         when Hash  68           show_path =  options[:host].nil? ? true : false  69           options = { :only_path => show_path }.update(options.symbolize_keys)  70           escape  = options.key?(:escape) ? options.delete(:escape) : true  71           url     = @controller.send(:url_for, options)  </

    \n\n

    li>72         when String  73           escape = true  74           url    = options  75         when NilClass  76           url = @controller.send(:url_for, nil)  77         else  78           escape = false  79           url    = polymorphic_path(options)  80         end  81   82         escape ? escape_once(url) : url  83       end  原来如此,豁然开朗。另外还看到:back这样的link_to用法,:)```

    \n", "_id"=>207}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用XMPP4r在RubyOnRails中集成IM功能", "body"=>"

    受到Frank文章的感染,决定把我使用XMPP4r在RubyOnRails中集成IM的过程按照其写的两篇文章的流程整理、分享给大家,谢谢Frank。

    \n

    本文根据Frank的风格,结合我在“技能云”中使用的实际过程写的,分成如下几个大的章节:

    \n

    一、XMPP概念以及原理简介
    \n二、实现方法篇
    \n三、结合“技能云”演示

    \n

    本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:

    \n

     使用XMPP4r在RubyOnRails中集成IM功能

    \n

    如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    ", "created_at"=>2008-01-31 02:53:08 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    受到Frank文章的感染,决定把我使用XMPP4r在RubyOnRails中集成IM的过程按照其写的两篇文章的流程整理、分享给大家,谢谢Frank。
    \n本文根据Frank的风格,结合我在“技能云”中使用的实际过程写的,分成如下几个大的章节:
    \n一、XMPP概念以及原理简介
    \n二、实现方法篇
    \n三、结合“技能云”演示
    \n本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:
    \n 使用XMPP4r在RubyOnRails中集成IM功能
    \n如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    \n", "_id"=>208}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"下午开始尝试回长沙的可能性!", "body"=>"
    下午我将去深圳火车站挤火车,如果形式良好,挤上火车,将离开深圳一段时间,到重灾区“长沙”慰问考察,指导工作。。
    \n
     
    \n
    期间水、电得不到保障,更没法连到互联网。。会尽量带上手机和充电器,抓住可能存在的机会充电,
    \n
    在 移动信号 不中断的情况下,可以保持手机联通,如果有我可以效劳的,还请酌情搔扰,多谢合作!
    ", "created_at"=>2008-02-02 02:15:10 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    下午我将去深圳火车站挤火车,如果形式良好,挤上火车,将离开深圳一段时间,到重灾区“长沙”慰问考察,指导工作。。
    \n 
    \n期间水、电得不到保障,更没法连到互联网。。会尽量带上手机和充电器,抓住可能存在的机会充电,
    \n在 移动信号 不中断的情况下,可以保持手机联通,如果有我可以效劳的,还请酌情搔扰,多谢合作!

    \n", "_id"=>209}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"离开这几天?我是怎么度过的?", "body"=>"

    本来没有打算回老家过年的,拿着1.31号的车票抱着试试看得心态2.2号去深圳火车站赶到长沙的火车,在地铁上,就想着肯定上不了车,这样赶去试试,如果人太多就退票留深圳过年了,甚至和Shine计划着以后几天在深圳的行程和安排,什么巴西烤肉啦,电影啦,花展啦啥的。

    \n

    可是,不幸的是我们竟然一路狂奔过去,竟然恰巧赶上火车,于是踏上回长沙的旅程,看着窗外皑皑白雪,火车摇摇晃晃,跑了15个小时终于到站:长沙。

    \n

    在长沙呆了一天,逛步行街的时候,不幸的事情发生了,买了不久的手机被小贼扒去了,虽然及时冻结了手机号码,无奈的是手机上的通讯录和拍的照片啥的全部丢失,可恶的小贼。(请各位朋友注意,以防欺骗!

    \n

    (目前,挂失的号码,已经重新开通,号码不变,正在物色新的手机,希望我的朋友们把自己的号码发到我邮箱吧 iceskysl@gmail.com)

    \n

    2.5号赶上长沙会合肥的飞机,第一次坐飞机,好小的的飞机哦,呵呵,天上飞的果然比地上跑的快,1个小时10分钟就降落在合肥机场,快!

    \n

    在合肥找到前天晚上到合肥的哥哥,坐上比平时价格翻了三倍的汽车,2.5号下午6.30分终于到家了。

    \n

    家里都还挺好,新盖的房子也挺好的,希望父母能住着舒服安心,我也可以安心了。

    \n

    好心的同时帮我预定了2.10号合肥到深圳的机票,一大早从家里出发,赶车到合肥,走的比较快,遭到了3个小时,竟然不能提前办理登机手续,又没吃饭,可恶的机场里面一盒大饼都要25元,真是强盗。寄存了行李,坐上一块钱的公交回合肥市找东西吃,路上遇到一个超市,下车买了填肚子的东西,真便宜,再BS下机场里面卖东西的。

    \n

    2.10下午5点抵达深圳机场,这次飞机好大,大的有点恐怖,呵呵。。

    \n

    我终于回来了,尽管背了本本,无奈没有网络,只能处于离网状态,回来后,一切恢复,新年新气象,本命年的我,今年要实现哪些目标呢?

    \n

    嘻嘻~流水帐~~

    ", "created_at"=>2008-02-11 13:26:36 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    本来没有打算回老家过年的,拿着1.31号的车票抱着试试看得心态2.2号去深圳火车站赶到长沙的火车,在地铁上,就想着肯定上不了车,这样赶去试试,如果人太多就退票留深圳过年了,甚至和Shine计划着以后几天在深圳的行程和安排,什么巴西烤肉啦,电影啦,花展啦啥的。
    \n可是,不幸的是我们竟然一路狂奔过去,竟然恰巧赶上火车,于是踏上回长沙的旅程,看着窗外皑皑白雪,火车摇摇晃晃,跑了15个小时终于到站:长沙。
    \n在长沙呆了一天,逛步行街的时候,不幸的事情发生了,买了不久的手机被小贼扒去了,虽然及时冻结了手机号码,无奈的是手机上的通讯录和拍的照片啥的全部丢失,可恶的小贼。(请各位朋友注意,以防欺骗!)
    \n(目前,挂失的号码,已经重新开通,号码不变,正在物色新的手机,希望我的朋友们把自己的号码发到我邮箱吧 iceskysl@gmail.com)
    \n2.5号赶上长沙会合肥的飞机,第一次坐飞机,好小的的飞机哦,呵呵,天上飞的果然比地上跑的快,1个小时10分钟就降落在合肥机场,快!
    \n在合肥找到前天晚上到合肥的哥哥,坐上比平时价格翻了三倍的汽车,2.5号下午6.30分终于到家了。
    \n家里都还挺好,新盖的房子也挺好的,希望父母能住着舒服安心,我也可以安心了。
    \n好心的同时帮我预定了2.10号合肥到深圳的机票,一大早从家里出发,赶车到合肥,走的比较快,遭到了3个小时,竟然不能提前办理登机手续,又没吃饭,可恶的机场里面一盒大饼都要25元,真是强盗。寄存了行李,坐上一块钱的公交回合肥市找东西吃,路上遇到一个超市,下车买了填肚子的东西,真便宜,再BS下机场里面卖东西的。
    \n2.10下午5点抵达深圳机场,这次飞机好大,大的有点恐怖,呵呵。。
    \n我终于回来了,尽管背了本本,无奈没有网络,只能处于离网状态,回来后,一切恢复,新年新气象,本命年的我,今年要实现哪些目标呢?
    \n嘻嘻~流水帐~~

    \n", "_id"=>210}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"xfce4面板丢失问题的解决", "body"=>"

    本本上的Ubuntu一直都是使用的xfce桌面系统,突然发现面板不见了,赶紧找时间找找原因,找到相关的文章,其解决的方法是:

    \n

    \n

    \n
    引用
    \n
      \n
    1. 由于Xfce是模块化的,所以所有的元素都有独立的进程。你只需重启那些进程即可。如果你想确认他们会在下次登录是自行启动的话,检查注销对话框中的”为下次登录保存会话”选项有无选中。  
    2. \n
    3. Panel————————xfce4-panel  
    4. \n
    5. Taskbar———————xftaskbar4 (Xfce 4.2 only)  
    6. \n
    7. Window Manager———xfwm4  
    8. \n
    9. Desktop———————xfdesktop (can depend on the dbus service, Xfce 4.4 only)  
    10. \n
    11. Desktop menus————xfdesktop  
    12. \n
    \n
    \nxfce4-panel&

    \n

    1、http://www.linuxfans.org/bbs/viewthread.php?tid=93633

    \n

    2、http://forum.ubuntu.org.cn/viewtopic.php?t=57203&sid=e4c2459767a54961ee8c7e142e043da7

    ", "created_at"=>2008-02-11 16:17:13 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    本本上的Ubuntu一直都是使用的xfce桌面系统,突然发现面板不见了,赶紧找时间找找原因,找到相关的文章,其解决的方法是:
    \n
    \n
    \n引用
    \n
    \n 由于Xfce是模块化的,所以所有的元素都有独立的进程。你只需重启那些进程即可。如果你想确认他们会在下次登录是自行启动的话,检查注销对话框中的”为下次登录保存会话”选项有无选中。  
    \n Panel————————xfce4-panel  
    \n Taskbar———————xftaskbar4 (Xfce 4.2 only)  
    \n Window Manager———xfwm4  
    \n Desktop———————xfdesktop (can depend on the dbus service, Xfce 4.4 only)  
    \n Desktop menus————xfdesktop  
    \n
    \n
    \nxfce4-panel&
    \n1、http://www.linuxfans.org/bbs/viewthread.php?tid=93633
    \n2、http://forum.ubuntu.org.cn/viewtopic.php?t=57203&sid=e4c2459767a54961ee8c7e142e043da7;

    \n", "_id"=>211}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"手机掉了,选购中...", "body"=>"

    春节回家时,在逛街的时候,才买了4个月的手机丢了(联想i908),回来后第一件事情就是再选一款合适的手机,说实在的,选手机我真不是行家,上次买i908的时候就选了好久,最后还是买贵了不少,呵呵。这次按照我的需要关注了如下几个手机。

    \n

    一、个人需求

    \n

    个人对手机的需求不是很赶“潮流”,认为够用就可以了,价格自然是越低越好,第一次用的是联想的i716,折叠的,而后就是丢掉的i908,直板的。目前认为直板的比较方便,不喜欢滑盖的。喜欢简约大气的类型,不喜欢花里胡哨的。

    \n

    个人喜欢在坐公交车的时候看看电子书(以前就是把PDF转成TXT直接看了不少技术文档)或者做些行程规划事务处理(最好是联网的,以前手机不支持,非常喜欢这个功能),处理电子邮件(用的是Gmail,需要只是SSLXHTML,以前的i908就不支持)。最好是有个拍照功能,喜欢随手拍些东西。最好有音乐功能(这两个貌似一般手机都支持了)。

    \n

    我还是比较看重手机品牌的,联想的我用过两个,质量还行,诺基亚的市场份额说明其质量不错。

    \n

    二、筛选过程

    \n

    1、联想i908

    \n

     

    \n

    \"\"

    \n

    最先看的是丢掉的那款,联想i908,我买的时候是1500多,现在商场报价大概在1100左右,网络报价有的只有900的样子,价格降了不少。加上我还剩余其配件(电板一块,耳机,充电器啥的都还在),选择这款的原因是这些配件不会浪费掉(因为都还比较新,浪费了实在可惜)。

    \n

    2、诺基亚N70

    \n

    \"\"

    \n

    这款机子我哥哥在用,试了下还是不错的,布局和功能都基本符合我的需求,且是一款智能手机(虽然不晓得用到的有多少,有朋友说 智能只是玩具,呵呵),价格大概在1700的样子,性价比还是挺不错的,

    \n

    3、诺基亚N73

    \n

    \"\"

    \n

    这款机子应该是很经典的啦,号称街机王,目前报价应该是2K以上,功能相当强大,也是一款智能手机。虽然上市有一段时间了,但是依然相当火爆。

    \n

    4、诺基亚 5310 XpressMusic

    \n

    \"\"

    \n

    这个手机我昨天在卖场看了下,商场给的价格还是2K以上,不过网上已经给出1900的价格,可是感觉太薄了,容易丢失。

    \n

    5、联想i909

    \n

    \"\"

    \n

    这个和i908差不多,估计原来的电池啥的还可以使用,屏幕大小也差不多,但是其定位是在“游戏手机”,我玩的不多。

    \n

    6、联想i968

    \n

    \"\"

    \n

    号称可以和N73相抗衡的手机,但是那个 蓝色的颜色我不是很喜欢。

    \n

    7、iphone

    \n

    \"\"

    \n

    这个只有看看的份,比较贵,且对其中文支持不放心,我不是mac迷,呵呵。

    \n

    其他的都还没来得及看,也没没有最终确定,有谁使用过如上手机的,说说感受哈,也希望能有人推荐其他的哈。

    \n

     

    ", "created_at"=>2008-02-13 03:39:12 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    春节回家时,在逛街的时候,才买了4个月的手机丢了(联想i908),回来后第一件事情就是再选一款合适的手机,说实在的,选手机我真不是行家,上次买i908的时候就选了好久,最后还是买贵了不少,呵呵。这次按照我的需要关注了如下几个手机。
    \n一、个人需求
    \n个人对手机的需求不是很赶“潮流”,认为够用就可以了,价格自然是越低越好,第一次用的是联想的i716,折叠的,而后就是丢掉的i908,直板的。目前认为直板的比较方便,不喜欢滑盖的。喜欢简约大气的类型,不喜欢花里胡哨的。
    \n个人喜欢在坐公交车的时候看看电子书(以前就是把PDF转成TXT直接看了不少技术文档)或者做些行程规划、事务处理(最好是联网的,以前手机不支持,非常喜欢这个功能),处理电子邮件(用的是Gmail,需要只是SSL和XHTML,以前的i908就不支持)。最好是有个拍照功能,喜欢随手拍些东西。最好有音乐功能(这两个貌似一般手机都支持了)。
    \n我还是比较看重手机品牌的,联想的我用过两个,质量还行,诺基亚的市场份额说明其质量不错。
    \n二、筛选过程
    \n1、联想i908
    \n 
    \n
    \n最先看的是丢掉的那款,联想i908,我买的时候是1500多,现在商场报价大概在1100左右,网络报价有的只有900的样子,价格降了不少。加上我还剩余其配件(电板一块,耳机,充电器啥的都还在),选择这款的原因是这些配件不会浪费掉(因为都还比较新,浪费了实在可惜)。
    \n2、诺基亚N70
    \n
    \n这款机子我哥哥在用,试了下还是不错的,布局和功能都基本符合我的需求,且是一款智能手机(虽然不晓得用到的有多少,有朋友说 智能只是玩具,呵呵),价格大概在1700的样子,性价比还是挺不错的,
    \n3、诺基亚N73
    \n
    \n这款机子应该是很经典的啦,号称街机王,目前报价应该是2K以上,功能相当强大,也是一款智能手机。虽然上市有一段时间了,但是依然相当火爆。
    \n4、诺基亚 5310 XpressMusic
    \n
    \n这个手机我昨天在卖场看了下,商场给的价格还是2K以上,不过网上已经给出1900的价格,可是感觉太薄了,容易丢失。
    \n5、联想i909
    \n
    \n这个和i908差不多,估计原来的电池啥的还可以使用,屏幕大小也差不多,但是其定位是在“游戏手机”,我玩的不多。
    \n6、联想i968
    \n
    \n号称可以和N73相抗衡的手机,但是那个 蓝色的颜色我不是很喜欢。
    \n7、iphone
    \n
    \n这个只有看看的份,比较贵,且对其中文支持不放心,我不是mac迷,呵呵。
    \n其他的都还没来得及看,也没没有最终确定,有谁使用过如上手机的,说说感受哈,也希望能有人推荐其他的哈。
    \n 

    \n", "_id"=>212}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加iTechTag的XSS防护功能", "body"=>"

    XSS目前越来越疯狂,虽然Rails提供了h()辅助方法用来防护,但是万一忘记了,就有可能被XSS了,技能云开发的时间比较零碎,没有全部考虑、过滤,比较危险,今天采用xss_terminate用来搞定。

    \n

    安装方法:
    \nscript/plugin install http://xssterminate.googlecode.com/svn/trunk/xss_terminate

    ", "created_at"=>2008-02-13 15:23:10 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    XSS目前越来越疯狂,虽然Rails提供了h()辅助方法用来防护,但是万一忘记了,就有可能被XSS了,技能云开发的时间比较零碎,没有全部考虑、过滤,比较危险,今天采用xss_terminate用来搞定。
    \n安装方法:
    \nscript/plugin install http://xssterminate.googlecode.com/svn/trunk/xss_terminate

    \n", "_id"=>213}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RubyOnRails中实现syntax highlighter", "body"=>"

    在我们平时开发基于WEB的系统时,有的时候需要对需要展示的源代码做些格式化、语法分析和高亮着色,比如在blog程序中贴技术文章时,在论坛中 讨论问 题的时候,不可避免的会贴出一些代码加以辅助说明,而如果能对该代码段进行语法分析和着色,效果会更加一目了然;Rails世界向来以选择的多样性著称, 如下列举几个可行的syntax highlighter,希望对您有所帮助。

    \n

    一、什么是Syntax_highlighting
    \n二、Syntax_highlighting的原理
    \n三、几个可用的实现方法
    \n    1、GeSHi
    \n    2、Syntax_Highlighter
    \n    3、Highlight.js
    \n    4、Ultraviolet
    \n    5、ColourCode
    \n    6、CodeRay
    \n    7、SHJS
    \n    8、google-code-prettify
    \n四、总结

    \n

    本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:

    \n

     在RubyOnRails中实现syntax highlighter

    \n

    如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    ", "created_at"=>2008-02-15 02:48:30 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在我们平时开发基于WEB的系统时,有的时候需要对需要展示的源代码做些格式化、语法分析和高亮着色,比如在blog程序中贴技术文章时,在论坛中 讨论问 题的时候,不可避免的会贴出一些代码加以辅助说明,而如果能对该代码段进行语法分析和着色,效果会更加一目了然;Rails世界向来以选择的多样性著称, 如下列举几个可行的syntax highlighter,希望对您有所帮助。
    \n一、什么是Syntax_highlighting
    \n二、Syntax_highlighting的原理
    \n三、几个可用的实现方法
    \n    1、GeSHi
    \n    2、Syntax_Highlighter
    \n    3、Highlight.js
    \n    4、Ultraviolet
    \n    5、ColourCode
    \n    6、CodeRay
    \n    7、SHJS
    \n    8、google-code-prettify
    \n四、总结
    \n本文采用Google在线文档编写、发布的,格式比较简洁,且能随时更新和完善,就不在重复贴在这里了,文章地址如下,请自行查看:
    \n 在RubyOnRails中实现syntax highlighter
    \n如果对文章有疑问或者有错误的地方,请在这里回复指出,我将尽快给予回复和完善,谢谢!

    \n", "_id"=>214}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Five Balls of Life", "body"=>"

    偶然看到几个图片,虽然映像中以前见过,但是当再一次仔细的看的时候,我还是有些感慨,记录下来,希望看到此文的朋友,都能注意,共勉。

    \n

    最开始是一张做的很难看,但是说的很对的PPT图片

    \n

     

    \n

    \"\"

    \n

     

    \n


    \n然后找找来源,很快找到两张相关的图片,如下:
    \n\"\"

    \n

     

    \n

    \"\"

    \n

    几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩·戴森讲到工作与其他义务的关系:

    \n

    想象生命是一场不停丢掷五个球于空中的游戏。这五个球分别为工作家庭健康朋友心灵,而且你很努力地掷着这五个球,不让它们落地。很快地你会了解工作是一个橡皮球。如果你不幸失手落下它,它还是会弹回来。

    \n

    但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下,它们可能会少了一角,留下无法挽回的记号、刻痕、损坏甚至碎落一地。它们将永远不会跟以前一样。你必须了解这个道理,并且为平衡你的生命而努力。但要怎么才做得到呢?

    \n

    别拿自己和他人比较,这只会降低了你原有的价值。因为我们都是独一无二的,因为我们每一个人都很特别。

    \n

    别人认为重要的事不一定是你的目标,只有你才知道什么最适合你。

    ", "created_at"=>2008-02-18 02:34:33 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    偶然看到几个图片,虽然映像中以前见过,但是当再一次仔细的看的时候,我还是有些感慨,记录下来,希望看到此文的朋友,都能注意,共勉。
    \n最开始是一张做的很难看,但是说的很对的PPT图片
    \n 
    \n
    \n 
    \n
    \n然后找找来源,很快找到两张相关的图片,如下:
    \n
    \n 
    \n
    \n几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩·戴森讲到工作与其他义务的关系:
    \n想象生命是一场不停丢掷五个球于空中的游戏。这五个球分别为工作、家庭、健康、朋友和心灵,而且你很努力地掷着这五个球,不让它们落地。很快地你会了解工作是一个橡皮球。如果你不幸失手落下它,它还是会弹回来。
    \n但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下,它们可能会少了一角,留下无法挽回的记号、刻痕、损坏甚至碎落一地。它们将永远不会跟以前一样。你必须了解这个道理,并且为平衡你的生命而努力。但要怎么才做得到呢?
    \n别拿自己和他人比较,这只会降低了你原有的价值。因为我们都是独一无二的,因为我们每一个人都很特别。
    \n别人认为重要的事不一定是你的目标,只有你才知道什么最适合你。

    \n", "_id"=>215}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux之rm命令详解", "body"=>"

    [1sters@ iceskysl]$ rm --help
    \n用法:rm [选项]... 目录...
    \n删除指定的<文件>(即解除链接)。
    \n
    \n  -d, --directory       删除可能仍有数据的目录 (只限超级用户)
    \n  -f, --force           略过不存在的文件,不显示任何信息
    \n  -i, --interactive     进行任何删除操作前必须先确认
    \n  -r, -R, --recursive   同时删除该目录下的所有目录层
    \n  -v, --verbose         详细显示进行的步骤
    \n      --help     显示此帮助信息并离开
    \n      --version  显示版本信息并离开
    \n
    \n要删除第一个字符为‘-’的文件 (例如‘-foo’),请使用以下其中一种方法:
    \n  rm -- -foo
    \n
    \n  rm ./-foo
    \n
    \n请注意,如果使用 rm 来删除文件,通常仍可以将该文件恢复原状。如果想保证
    \n该文件的内容无法还原,请考虑使用 shred。

    \n

    范例:

    \n

    删除所有rb语言程序档;删除前逐一询问确认 :
    \nrm -i *.rb
    \n
    \n将 Finished 子目录及子目录中所有档案删除 :
    \nrm -r Finished

    ", "created_at"=>2008-02-20 01:28:55 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    [1sters@ iceskysl]$ rm --help
    \n用法:rm [选项]... 目录...
    \n删除指定的<文件>(即解除链接)。
    \n
    \n  -d, --directory       删除可能仍有数据的目录 (只限超级用户)
    \n  -f, --force           略过不存在的文件,不显示任何信息
    \n  -i, --interactive     进行任何删除操作前必须先确认
    \n  -r, -R, --recursive   同时删除该目录下的所有目录层
    \n  -v, --verbose         详细显示进行的步骤
    \n      --help     显示此帮助信息并离开
    \n      --version  显示版本信息并离开
    \n
    \n要删除第一个字符为‘-’的文件 (例如‘-foo’),请使用以下其中一种方法:
    \n  rm -- -foo
    \n
    \n  rm ./-foo
    \n
    \n请注意,如果使用 rm 来删除文件,通常仍可以将该文件恢复原状。如果想保证
    \n该文件的内容无法还原,请考虑使用 shred。
    \n范例:
    \n删除所有rb语言程序档;删除前逐一询问确认 :
    \nrm -i *.rb
    \n
    \n将 Finished 子目录及子目录中所有档案删除 :
    \nrm -r Finished

    \n", "_id"=>216}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"保持SSH客户端不掉线", "body"=>"

    不管我是使用linux的的SSH还是windows下的putty、SecureCRT还是AbsoluteTelnet,当我连接到服务器端 后,离开一会或者做点其他的事情,再回到SSH的时候,常常发现客户端自动掉出来了;有的时候甚至跑一个需要时间比较长的JOB的时候,还没跑完就掉出来 了,导致JOB跑了一半,等等。。

    \n

    所以一直在找解决这个问题的办法,今天在googleReader上找到了一个解决办法,如下:

    \n
    \n

    Do you get annoyed when you have a SSH session open, visit your browser for a while, and then return only to find you were disconnected? Most home NAT routers are the cause of this. If your router doesn’t offer an option to not shut off idle connections, you are probably better off by setting a keep-alive setting.

    \n

    To do this, just open /etc/ssh/ssh_config on your home (client) computer. Add the following line:

    \n

     

    \n
    \n
    配置代码
    \n
      \n
    1. ServerAliveInterval 180  
    2. \n
    \n
    \nThere you have it! Just remember now, if you leave SSH open accidentally, anyone else can get on it. Remember to close your session when finished.PS:If you’re using AbsoluteTelnet (for Windows), you can do this from the Options->Properties->Connection page. There is an option there to enable keepalives and you can specify the duration between them.
    ", "created_at"=>2008-02-21 03:16:17 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    不管我是使用linux的的SSH还是windows下的putty、SecureCRT还是AbsoluteTelnet,当我连接到服务器端 后,离开一会或者做点其他的事情,再回到SSH的时候,常常发现客户端自动掉出来了;有的时候甚至跑一个需要时间比较长的JOB的时候,还没跑完就掉出来 了,导致JOB跑了一半,等等。。
    \n所以一直在找解决这个问题的办法,今天在googleReader上找到了一个解决办法,如下:
    \n
    \nDo you get annoyed when you have a SSH session open, visit your browser for a while, and then return only to find you were disconnected? Most home NAT routers are the cause of this. If your router doesn’t offer an option to not shut off idle connections, you are probably better off by setting a keep-alive setting.
    \nTo do this, just open /etc/ssh/ssh_config on your home (client) computer. Add the following line:
    \n 
    \n
    \n配置代码
    \n
    \n ServerAliveInterval 180  
    \n
    \n
    \nThere you have it! Just remember now, if you leave SSH open accidentally, anyone else can get on it. Remember to close your session when finished.PS:If you’re using AbsoluteTelnet (for Windows), you can do this from the Options->Properties->Connection page. There is an option there to enable keepalives and you can specify the duration between them.

    \n", "_id"=>217}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"这会是Gphone?", "body"=>"

    今天在GSeeker上看到一篇文章说三星可能会和Google合作在今年推出Gphone,还给了一个“假想图”,如下:

    \n

    \"\"

    \n

    据engadget的报道, 小道消息称三星在今年内将推出两款Google Phone,并且是打上Google品牌的,而不是三星自家品牌。该消息指三星将首先在9月份发布第一款Google Phone,然后在圣诞节期间再发布第二款。其中9月份所发布的Google Phone将会是高端产品,同时具备触控屏及全键盘,外型和黑莓相似(详见文章开头的假想图)。而圣诞节所发布的Google Phone则属于低价版(低于100美元)。

    \n

    不过我倒觉得这个Google的风格,qwerty风格的键盘我实在不觉得方便,偶觉得Google肯定不会这样滴,因为我不喜欢,呵呵。。 :)

    ", "created_at"=>2008-02-21 13:55:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    今天在GSeeker上看到一篇文章说三星可能会和Google合作在今年推出Gphone,还给了一个“假想图”,如下:
    \n
    \n据engadget的报道, 小道消息称三星在今年内将推出两款Google Phone,并且是打上Google品牌的,而不是三星自家品牌。该消息指三星将首先在9月份发布第一款Google Phone,然后在圣诞节期间再发布第二款。其中9月份所发布的Google Phone将会是高端产品,同时具备触控屏及全键盘,外型和黑莓相似(详见文章开头的假想图)。而圣诞节所发布的Google Phone则属于低价版(低于100美元)。
    \n不过我倒觉得这个Google的风格,qwerty风格的键盘我实在不觉得方便,偶觉得Google肯定不会这样滴,因为我不喜欢,呵呵。。 :)

    \n", "_id"=>218}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"iTechTag && Ohloh", "body"=>"

    今天无意在Google订阅里面看到了人评价说“itechtag 纯粹靠自我声明或者相互吹捧的是没有办法 建立creditibility(可信度) 如果像ohloh.net那种有真凭实据的还差不多”。

    \n

    哦,有人这样评价技能云,还提到了ohloh.net,这个是什么网站呢?赶紧瞧瞧去。

    \n

    Ohloh is an open source network that connects people through the software they create and use.

    \n

     

    \n

    wowo,和我们的技能云的定位有些神似呀,有时间好好研究下:(

    \n

     

    ", "created_at"=>2008-02-21 14:03:01 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    今天无意在Google订阅里面看到了人评价说“itechtag 纯粹靠自我声明或者相互吹捧的是没有办法 建立creditibility(可信度) 如果像ohloh.net那种有真凭实据的还差不多”。
    \n哦,有人这样评价技能云,还提到了ohloh.net,这个是什么网站呢?赶紧瞧瞧去。
    \nOhloh is an open source network that connects people through the software they create and use.
    \n 
    \nwowo,和我们的技能云的定位有些神似呀,有时间好好研究下:(
    \n 

    \n", "_id"=>219}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"增加通过IM(GoogleTalk)更新ING功能", "body"=>"

    刚刚吃完泡面,接着上午的工作,一鼓作气完成通过IM(googletalk)发布自己的ING的功能,如下:
    \n\"\"

    \n

     

    \n

    使用方法是:
    \n1、添加”itechtag@gmail.com”为自己GoogleTalk的好友;
    \n2、发送”h”到”itechtag@gmail.com”查看帮助信息;
    \n3、输入”who”查看自己googletalk绑定的账户;
    \n4、输入”link email:password”绑定当前GoogleTalk至您指定的账号;
    \n5、输入”@Ing内容”添加ING内容到自己的ing.

    \n

     

    \n

    其他内容,请添加”itechtag@gmail.com”为自己GoogleTalk的好友后,输入h查看帮助信息。

    \n

     

    \n

    该机器人还在不断的完善中,如果遇到什么问题,请及时通知我;如果您有更好的建议,还请告诉我。

    ", "created_at"=>2008-02-23 06:34:00 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    刚刚吃完泡面,接着上午的工作,一鼓作气完成通过IM(googletalk)发布自己的ING的功能,如下:
    \n
    \n 
    \n使用方法是:
    \n1、添加”itechtag@gmail.com”为自己GoogleTalk的好友;
    \n2、发送”h”到”itechtag@gmail.com”查看帮助信息;
    \n3、输入”who”查看自己googletalk绑定的账户;
    \n4、输入”link email:password”绑定当前GoogleTalk至您指定的账号;
    \n5、输入”@Ing内容”添加ING内容到自己的ing.
    \n 
    \n其他内容,请添加”itechtag@gmail.com”为自己GoogleTalk的好友后,输入h查看帮助信息。
    \n 
    \n该机器人还在不断的完善中,如果遇到什么问题,请及时通知我;如果您有更好的建议,还请告诉我。

    \n", "_id"=>220}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"键盘快速启动工具 :Launchy", "body"=>"

    由于逐渐习惯了linux下的操作方式和基于命令的使用习惯,在windows上的时候,我也越来越觉得不习惯了,一直想找一个类似MAC下的QuickSilver的可以快速找到我需要的东西,进而启动的小工具。

    \n

    今天找到了,其就是Launchy,安装后,每次启动都驻留后台运行,按 ALT+空格可以跳出输入框,输入需要用到的程序名称(支持模糊匹配,显示个数等可以配置),还可以打开其他的东西,可以参考其安装目录下的Readme.pdf。

    \n

    \"\"

    \n

    另外,看到另外一款类似的程序 TypeAndRun,可以参考如下链接,选择自己需要的。

    \n

    【1】http://calon.weblogs.us/duibi_launchy_he_tar/

    ", "created_at"=>2008-02-25 02:02:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    由于逐渐习惯了linux下的操作方式和基于命令的使用习惯,在windows上的时候,我也越来越觉得不习惯了,一直想找一个类似MAC下的QuickSilver的可以快速找到我需要的东西,进而启动的小工具。
    \n今天找到了,其就是Launchy,安装后,每次启动都驻留后台运行,按 ALT+空格可以跳出输入框,输入需要用到的程序名称(支持模糊匹配,显示个数等可以配置),还可以打开其他的东西,可以参考其安装目录下的Readme.pdf。
    \n
    \n另外,看到另外一款类似的程序 TypeAndRun,可以参考如下链接,选择自己需要的。
    \n【1】http://calon.weblogs.us/duibi_launchy_he_tar/

    \n", "_id"=>221}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"制作视频教程的工具", "body"=>"

    经常看一些视频教程,觉得视频教程简单易懂,相当不错,如下两个文章列了一些制作视频教程的工具,被点名的有:

    \n

    AviScreen - As the name would imply, this capture program records the video into AVI files, but can also do BMP photos. It’s Windows only and does not record audio.

    \n

    CamStudio.org - An open source program for capturing your on-screen video and audio as AVI files. Windows only, and absolutely free.

    \n

    Copernicus - A free program for Macs that focuses heavily on making quick and speedy films by recording the video to your RAM for quicker access. Does not include any support for audio.

    \n

    JingProject.com - Beyond recording video, Jing allows you to take a picture of any portion fo your desktop, draw on it, add a message, and immediately upload your media to a free hosting account. You are then given a small URL that you can give to whomever needs to see the image or video. Works with Macs and Windows machines.

    \n

    Screencast-O-Matic.com - A Java-based screencasting tool that requires no downloads and will allow you to automatically upload to hosting. According to their site it works well with Macs and Windows machines, but does have some issues with Linux.

    \n

    Wink - Screencasting software that focuses on making tutorials with audio and text annotation abilities. Outputs to Flash, PDF, HTML, EXE files and more.
    \n
    \n以及在ubuntu下的xvidcap

    \n

    【1】http://www.freecharity.org.uk/2007/04/12/the-secret-to-screencasting-with-ubuntu-and-free-software/
    \n【2】http://mashable.com/2008/02/21/screencasting-video-tutorials/

    ", "created_at"=>2008-02-25 02:18:37 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    经常看一些视频教程,觉得视频教程简单易懂,相当不错,如下两个文章列了一些制作视频教程的工具,被点名的有:
    \nAviScreen - As the name would imply, this capture program records the video into AVI files, but can also do BMP photos. It’s Windows only and does not record audio.
    \nCamStudio.org - An open source program for capturing your on-screen video and audio as AVI files. Windows only, and absolutely free.
    \nCopernicus - A free program for Macs that focuses heavily on making quick and speedy films by recording the video to your RAM for quicker access. Does not include any support for audio.
    \nJingProject.com - Beyond recording video, Jing allows you to take a picture of any portion fo your desktop, draw on it, add a message, and immediately upload your media to a free hosting account. You are then given a small URL that you can give to whomever needs to see the image or video. Works with Macs and Windows machines.
    \nScreencast-O-Matic.com - A Java-based screencasting tool that requires no downloads and will allow you to automatically upload to hosting. According to their site it works well with Macs and Windows machines, but does have some issues with Linux.
    \nWink - Screencasting software that focuses on making tutorials with audio and text annotation abilities. Outputs to Flash, PDF, HTML, EXE files and more.
    \n
    \n以及在ubuntu下的xvidcap。
    \n【1】http://www.freecharity.org.uk/2007/04/12/the-secret-to-screencasting-with-ubuntu-and-free-software/
    \n【2】http://mashable.com/2008/02/21/screencasting-video-tutorials/

    \n", "_id"=>222}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"50 Questions to Evaluate the Quality of Your Website", "body"=>"

    作为一个互联网人,你对自己的网站有多少理解和把握,对其前途是否能看好,能否认识到目前的现况和不足,都是十分重要的。

    \n

    CarstenCumbrowski from SearchEngineJournal has come up with a great and pretty detailed list of 50 questions that a website owner should asked himself about his own website.

    \n

    If the answer to every question that follows below was answered with yes, you can be very pleased with yourself and consider yourself the top of the crop, because most websites have flaws for a number of different reasons, mostly related to the limitation of resources and sacrifices that must be made as a direct result of the shortage.

    \n

    These questions are divided into following main categories: Accessibility, Navigation, Design, Content, Security, Other Technical Considerations, Other Marketing Considerations and Legal Stuff/Re-Assurance/Legitimization.

    \n

    【1】http://www.searchenginejournal.com/50-questions-to-evaluate-the-quality-of-your-website/6400/

    ", "created_at"=>2008-02-25 02:25:27 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    作为一个互联网人,你对自己的网站有多少理解和把握,对其前途是否能看好,能否认识到目前的现况和不足,都是十分重要的。
    \nCarstenCumbrowski from SearchEngineJournal has come up with a great and pretty detailed list of 50 questions that a website owner should asked himself about his own website.
    \nIf the answer to every question that follows below was answered with yes, you can be very pleased with yourself and consider yourself the top of the crop, because most websites have flaws for a number of different reasons, mostly related to the limitation of resources and sacrifices that must be made as a direct result of the shortage.
    \nThese questions are divided into following main categories: Accessibility, Navigation, Design, Content, Security, Other Technical Considerations, Other Marketing Considerations and Legal Stuff/Re-Assurance/Legitimization.
    \n【1】http://www.searchenginejournal.com/50-questions-to-evaluate-the-quality-of-your-website/6400/

    \n", "_id"=>223}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu Mobile Edition:这个世界太疯狂了", "body"=>"

    虽然我使用Ubuntu工作已经很长一段时间,虽然我也使用过Kubuntu、Xubuntu,虽然我也对ubuntu的前途比较看好,虽然。。
    \nN多的虽然,但当我第一次看到Ubuntu Mobile Edition的时候,还是不免呢喃了一句“世界太疯狂了!”难道不是么。
    \n\"\"
    \n自从iphone的成功,到Google的潜力修行,加上nokia的大半市场和windowmobile的无可奈何,现在又多了Ubuntu Mobile Edition。

    \n
    \n

    “Ubuntu Mobile Edition 是 Ubuntu 家族的又一新成员。与 Kubuntu、Xubuntu、Edubuntu 这些版本相同的是,Ubuntu Mobile 一样基于 Ubuntu;不同的是,Ubuntu Mobile 是专门为 MID (Mobile Internet Devices,移动互联网设备) 而设计的。”

    \n

    “Ubuntu Mobile 不仅包含丰富的应用软件,而且集成了流行的 Web 2.0 服务,如 Facebook、MySpace、YouTube 等。使用者通过 Ubuntu Mobile 能够执行诸如网络浏览、收发邮件、分享视频/音乐/照片、即时通讯、撰写博客、玩游戏等常见操作。”

    \n
    \n

    其他的介绍:

    \n

    http://linuxtoy.org/archives/ubuntu-mobile-edition.html

    \n

    http://moblin.org/

    ", "created_at"=>2008-02-25 14:07:25 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    虽然我使用Ubuntu工作已经很长一段时间,虽然我也使用过Kubuntu、Xubuntu,虽然我也对ubuntu的前途比较看好,虽然。。
    \nN多的虽然,但当我第一次看到Ubuntu Mobile Edition的时候,还是不免呢喃了一句“世界太疯狂了!”难道不是么。
    \n
    \n自从iphone的成功,到Google的潜力修行,加上nokia的大半市场和windowmobile的无可奈何,现在又多了Ubuntu Mobile Edition。
    \n
    \n“Ubuntu Mobile Edition 是 Ubuntu 家族的又一新成员。与 Kubuntu、Xubuntu、Edubuntu 这些版本相同的是,Ubuntu Mobile 一样基于 Ubuntu;不同的是,Ubuntu Mobile 是专门为 MID (Mobile Internet Devices,移动互联网设备) 而设计的。”
    \n“Ubuntu Mobile 不仅包含丰富的应用软件,而且集成了流行的 Web 2.0 服务,如 Facebook、MySpace、YouTube 等。使用者通过 Ubuntu Mobile 能够执行诸如网络浏览、收发邮件、分享视频/音乐/照片、即时通讯、撰写博客、玩游戏等常见操作。”
    \n
    \n其他的介绍:
    \nhttp://linuxtoy.org/archives/ubuntu-mobile-edition.html
    \nhttp://moblin.org/

    \n", "_id"=>224}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"正则真的很强大", "body"=>"

    毋庸置疑,正则表达式真的相当的博大精深,不要看懂几个正则的元字符就认为自己掌握了正则表达式,那连皮毛都没东呢,呵呵。

    \n

    年前买了一本《精通正则表达式》,没事的时候喜欢慢慢的读,才晓得原来如此神奇和精妙,如果能按照正则的思维去解决问题,显得如此的舒服和优雅。强烈推荐我行的人有时间可以仔细阅读。

    \n

    如下举个小例子,在一些社区、论坛上有些代码段还是挺不错的,但是常常被格式化后,复制下来就带有行号,如果你曾经一行一行的删掉这些行号的话,也不足为奇,因为我以前也这么干的,其实不用那么麻烦,那我最喜欢的文本编辑器Emeditor来看,这样就可搞定。\"\"

    \n

     

    ", "created_at"=>2008-02-26 01:40:23 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    毋庸置疑,正则表达式真的相当的博大精深,不要看懂几个正则的元字符就认为自己掌握了正则表达式,那连皮毛都没东呢,呵呵。
    \n年前买了一本《精通正则表达式》,没事的时候喜欢慢慢的读,才晓得原来如此神奇和精妙,如果能按照正则的思维去解决问题,显得如此的舒服和优雅。强烈推荐我行的人有时间可以仔细阅读。
    \n如下举个小例子,在一些社区、论坛上有些代码段还是挺不错的,但是常常被格式化后,复制下来就带有行号,如果你曾经一行一行的删掉这些行号的话,也不足为奇,因为我以前也这么干的,其实不用那么麻烦,那我最喜欢的文本编辑器Emeditor来看,这样就可搞定。
    \n 

    \n", "_id"=>225}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在CSDN的blog中添加技能云", "body"=>"

    有段时间没有使用CSDN的blog了,其实在是不够稳定,呵呵,但是不可否认的是其实目前国内比较大的程序员汇集区,而技能云针对的就是程序员,于是看了下如何在CSDN的blog中添加显示其在技能云上的widget。

    \n

    1、在CSDN的个人blog管理后台选择“配置”选项卡

    \n

    \"\"

    \n

    2、在“公告”的地方加上技能云的个人widget的引用,保存即可。

    \n

    \"\"

    \n

    3、前台即可正常显示个人的“技能云”,如下,还挺不错的。

    \n

    \"\"

    \n

    可以看我的CSDN上显示的效果

    \n

     

    ", "created_at"=>2008-02-26 01:49:46 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有段时间没有使用CSDN的blog了,其实在是不够稳定,呵呵,但是不可否认的是其实目前国内比较大的程序员汇集区,而技能云针对的就是程序员,于是看了下如何在CSDN的blog中添加显示其在技能云上的widget。
    \n1、在CSDN的个人blog管理后台选择“配置”选项卡
    \n
    \n2、在“公告”的地方加上技能云的个人widget的引用,保存即可。
    \n
    \n3、前台即可正常显示个人的“技能云”,如下,还挺不错的。
    \n
    \n可以看我的CSDN上显示的效果
    \n 

    \n", "_id"=>226}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail版Gtalk终于出现“隐身功能”", "body"=>"

    Gtalk虽然不及MSN普及,但是我周围的一些人还是很喜欢的,简洁、漂亮等是对其的评价,我也为此放弃了其他的IM工具,比如不喜欢QQ的商业气味和花哨,不喜欢MSN的莫名其妙的问题等等。

    \n

    作为一个技术人,我还是喜欢基于XMPP的Gtalk(我也在技能云中增加了对XMPP机器人的支持),当你工作的时候,还是不希望被人打扰到的,现在Gmail版本的Gtalk已经增加了“隐身”功能。

    \n

     

    \n

    \"\"

    \n

    但是桌面版及插件(gadget;网页)版的Gtalk还没有这个功能,也很久没有发布新版本了,还是慢慢等待吧。

    \n

    其他报道:http://www.gseeker.com/50226711/gtalkeeeaeie_139633.php

    \n

     

    ", "created_at"=>2008-02-27 01:06:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Gtalk虽然不及MSN普及,但是我周围的一些人还是很喜欢的,简洁、漂亮等是对其的评价,我也为此放弃了其他的IM工具,比如不喜欢QQ的商业气味和花哨,不喜欢MSN的莫名其妙的问题等等。
    \n作为一个技术人,我还是喜欢基于XMPP的Gtalk(我也在技能云中增加了对XMPP机器人的支持),当你工作的时候,还是不希望被人打扰到的,现在Gmail版本的Gtalk已经增加了“隐身”功能。
    \n 
    \n
    \n但是桌面版及插件(gadget;网页)版的Gtalk还没有这个功能,也很久没有发布新版本了,还是慢慢等待吧。
    \n其他报道:http://www.gseeker.com/50226711/gtalkeeeaeie_139633.php
    \n 

    \n", "_id"=>227}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"真的,个人在线声望越来越重要!", "body"=>"

    个人在线声望真的越来越被看重了,我一直在做的“技能云”的目的就是建立良好的个人声望,虽然目前国内的很多人还没有意识到这点,但毋庸置疑的是,真的越来越重要了,前段时间MR.6就写过一篇文章,几天又发现了一个文章专门说这个问题的,我也顺着这个思路说说看。

    \n

    先来看这篇文章“How To Manage Your Online Reputation”,文章中说到:You've spent a lot of time building up your reputation and image both online and off, so it's important to make sure that someone isn't out there dragging it through the mud. The latest tool for reputation management is Trackur, but its bottom-level price is $88/month, so the question on my mind, is: "Is it worth it?" There are already many different ways to monitor your online reputation as it is. Let's see how they stack up. 

    \n

    而后列举了几个可以使用的工具(网站)来管理自己的在线声望,其中提到了一个网站http://www.trackur.com/竟然是收费的,而且还不便宜,最便宜的还88美刀/月,另外还有像google通知等。详细的可以去看这篇文章:http://www.readwriteweb.com/archives/how_to_manage_your_online_reputation.php

    \n

    接着看上面说到的这个收费的网站,真的是个监视、管理个人在线声望的网站,价格也真不便宜,呵呵,看看他是怎么说个人声望的:

    \n

    Did you know that 52% of individuals put their trust in what others have to say about you?
    \n
    \nDid you know that 87% of consumers look at the reputation of your CEO, when judging your company's reputation?
    \n
    \nDid you know that 59% of hiring managers are influenced by your online reputation?
    \n
    \nDid you know that Trackur will monitor the web 24/7 and alert you whenever your reputation is being discussed?( 这条是宣传自己网站的)

    \n

    看看上面列举的几个数据,怎么来的,我们无法得知,但是其在一定程度上说明了个人声望是如何的重要,可能国外会更普及一点;但是对于国内来说,其他行业我不了解,至少和互联网沾边的,不如软件开发行业等,会比较看重的。

    \n

    都说国内什么都要落后老外们几年时间,但是值得我们高兴的事,我们这次我们的意识并没有晚,我们与2007年中开始做的”技能云“正是在这个方面的体现,我们希望的是通过用户的努力,创建良好的个人声望,并勇敢的把自己的声望show出去;此外,我们还将创建公司和项目的声望。

    \n

    虽然我们才刚刚起步,虽然很多人还不能意识到这点的重要性,但是我们相信,随着时间的推移,随着个人不断的体会和经历,加上技能云平台的不断完善,我们肯定会让所有的对自己声望在意的朋友建立起自己的”技能云“。

    ", "created_at"=>2008-02-27 07:33:01 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    个人在线声望真的越来越被看重了,我一直在做的“技能云”的目的就是建立良好的个人声望,虽然目前国内的很多人还没有意识到这点,但毋庸置疑的是,真的越来越重要了,前段时间MR.6就写过一篇文章,几天又发现了一个文章专门说这个问题的,我也顺着这个思路说说看。
    \n先来看这篇文章“How To Manage Your Online Reputation”,文章中说到:You've spent a lot of time building up your reputation and image both online and off, so it's important to make sure that someone isn't out there dragging it through the mud. The latest tool for reputation management is Trackur, but its bottom-level price is $88/month, so the question on my mind, is: "Is it worth it?" There are already many different ways to monitor your online reputation as it is. Let's see how they stack up. 
    \n而后列举了几个可以使用的工具(网站)来管理自己的在线声望,其中提到了一个网站http://www.trackur.com/竟然是收费的,而且还不便宜,最便宜的还88美刀/月,另外还有像google通知等。详细的可以去看这篇文章:http://www.readwriteweb.com/archives/how_to_manage_your_online_reputation.php
    \n接着看上面说到的这个收费的网站,真的是个监视、管理个人在线声望的网站,价格也真不便宜,呵呵,看看他是怎么说个人声望的:
    \nDid you know that 52% of individuals put their trust in what others have to say about you?
    \n
    \nDid you know that 87% of consumers look at the reputation of your CEO, when judging your company's reputation?
    \n
    \nDid you know that 59% of hiring managers are influenced by your online reputation?
    \n
    \nDid you know that Trackur will monitor the web 24/7 and alert you whenever your reputation is being discussed?( 这条是宣传自己网站的)
    \n看看上面列举的几个数据,怎么来的,我们无法得知,但是其在一定程度上说明了个人声望是如何的重要,可能国外会更普及一点;但是对于国内来说,其他行业我不了解,至少和互联网沾边的,不如软件开发行业等,会比较看重的。
    \n都说国内什么都要落后老外们几年时间,但是值得我们高兴的事,我们这次我们的意识并没有晚,我们与2007年中开始做的”技能云“正是在这个方面的体现,我们希望的是通过用户的努力,创建良好的个人声望,并勇敢的把自己的声望show出去;此外,我们还将创建公司和项目的声望。
    \n虽然我们才刚刚起步,虽然很多人还不能意识到这点的重要性,但是我们相信,随着时间的推移,随着个人不断的体会和经历,加上技能云平台的不断完善,我们肯定会让所有的对自己声望在意的朋友建立起自己的”技能云“。

    \n", "_id"=>228}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"FriendFeed高明在哪里?", "body"=>"

    最近比较清闲,就到处转悠,然后写些自己的感受,今天要说的是FriendFeed,FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends.

    \n

    注册试用了下,感觉比以前试用的那几个好点,比如facebook我一进去就晕,校内也差不多的模式,其他的什么占座之类的就看几眼就再不会去了。而FriendFeed有点点不一样,可能是由于其”亲缘“关系的缘故(大多数人都死来自Google成员)做事风格也和Google比较类似,简洁明了。其主要的抓取功能还是挺强大的,速度相当的快。

    \n

    应该是在Google中积累的经验,使得这个项目在Google排名等都表现相当不错,在改进”技能云“的时候可以学习下他的表现形式,再琢磨下Google的一些规则。

    \n

    我向来不是很喜欢这类SNS的东西,不过这个FriendFeed倒让我觉得可以忍受。

    \n

    慢慢的,我也学会了冷静的观察~

    ", "created_at"=>2008-02-28 02:44:31 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近比较清闲,就到处转悠,然后写些自己的感受,今天要说的是FriendFeed,FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends.
    \n注册试用了下,感觉比以前试用的那几个好点,比如facebook我一进去就晕,校内也差不多的模式,其他的什么占座之类的就看几眼就再不会去了。而FriendFeed有点点不一样,可能是由于其”亲缘“关系的缘故(大多数人都死来自Google成员)做事风格也和Google比较类似,简洁明了。其主要的抓取功能还是挺强大的,速度相当的快。
    \n应该是在Google中积累的经验,使得这个项目在Google排名等都表现相当不错,在改进”技能云“的时候可以学习下他的表现形式,再琢磨下Google的一些规则。
    \n我向来不是很喜欢这类SNS的东西,不过这个FriendFeed倒让我觉得可以忍受。
    \n慢慢的,我也学会了冷静的观察~

    \n", "_id"=>229}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用Active Merchant快速支付", "body"=>"

    采用Google在线文档书写和维护,请自行查看,如果有建议和意见,请在这里提出,谢谢~
    \n在Rails中使用Active Merchant快速支付

    \n

    尚未写完,有愿意的朋友可以一起写,谢谢!

    ", "created_at"=>2008-02-28 06:11:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    采用Google在线文档书写和维护,请自行查看,如果有建议和意见,请在这里提出,谢谢~
    \n在Rails中使用Active Merchant快速支付
    \n尚未写完,有愿意的朋友可以一起写,谢谢!

    \n", "_id"=>230}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"IP地址到物理地址的转化", "body"=>"

    以前我也写过一个类似的,找不到了,刚才看到axgle写了一个,挺轻巧的。

    \n
    \n
    Ruby代码
    \n
      \n
    1. 1. require 'net/http'    
    2. \n
    3. 2. require "uri"    
    4. \n
    5. 3.     
    6. \n
    7. 4. def ip2addr(ip="google.com")    
    8. \n
    9. 5. url=URI.parse("http://ip138.com/ips8.asp")    
    10. \n
    11. 6. res=Net::HTTP.post_form(url,:ip=>ip,:action=>2)    
    12. \n
    13. 7. res.body.scan(/<ul class="ul1">(.*)<\\/ul>/).to_s.scan(/<li>(.*?)<\\/li>/)    
    14. \n
    15. 8. end    
    16. \n
    17. 9.     
    18. \n
    19. 0. puts ip2addr    
    20. \n
    \n
    \n

    结果 \"\"
    \n
    \n本站主数据:美国
    \n查询结果2:美国
    \n查询结果3:美国 加利福尼亚州Mountain
    \n
    \nhttp://chinaonrails.com/topic/view/216.html

    \n

     

    ", "created_at"=>2008-03-07 05:05:12 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    以前我也写过一个类似的,找不到了,刚才看到axgle写了一个,挺轻巧的。
    \n
    \nRuby代码
    \n
    \n 1. require 'net/http'    
    \n 2. require "uri"    
    \n 3.     
    \n 4. def ip2addr(ip="google.com")    
    \n 5. url=URI.parse("http://ip138.com/ips8.asp")    
    \n 6. res=Net::HTTP.post_form(url,:ip=>ip,:action=>2)    
    \n 7. res.body.scan(/<ul class="ul1">(.)<\\/ul>/).to_s.scan(/<li>(.?)<\\/li>/)    
    \n 8. end    
    \n 9.     
    \n 0. puts ip2addr    
    \n
    \n
    \n结果
    \n
    \n本站主数据:美国
    \n查询结果2:美国
    \n查询结果3:美国 加利福尼亚州Mountain
    \n
    \nhttp://chinaonrails.com/topic/view/216.html
    \n 

    \n", "_id"=>231}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于Ruby中对正则表达式中的特殊字符转义的疑惑", "body"=>"

    转义正则表达式中的特殊字符
    \n===========================================
    \n使用Regexp.escape方法(别名方法是Regexp.quote),可以把正则表达式中的特殊字符统统转义:
    \nstr1 = "[*?]"
    \nstr2 = Regexp.escape(str1) # "\\[\\*\\?\\]"
    \n
    \nescape会转义掉[*?]这几个特殊的字符,但是其没有对另外一个字符‘/’进行任何处理,这个作为正则表达式的分隔符(//)中的字符难道不是特殊字符么。
    \n
    \n 看个例子:
    \npages="http://www.taojer.com/id=1&name=help"
    \nputs Regexp.escape(pages)
    \n
    \n 输出:
    \nE:\\Ysl\\Test>ruby exp.rb
    \nhttp://www\\.taojer\\.com/id=1&name=help
    \n
    \n可以看到其对/字符是没有进行处理的。
    \n
    \n这个可能会给如下这个需求带来一些问题:
    \n我想在一段String中找到所有以一个指定的URL开头的链接地址,程序大概是这样的:
    \nurl="http://www.taojer.com"
    \n按照我们的思路,可能会这么写:
    \ne_url = Regexp.escape(url)
    \n==》http://www\\.taojer\\.com
    \nstr.scan(/<a href="(e_url)">(.+?)<\\/a>/m)
    \n但是这样就会因为/字符存在而异常咯?
    \n
    \n正确是应该是:
    \nstr.scan(/<a href="(http:\\/\\/www\\.taojer\\.com)">(.+?)<\\/a>/m).each do |list|
    \n#do something
    \nend
    \n
    \n按照规定:
    \n特殊字符包括^、$、?、.、/、\\、[、]、{、}、(、)、+、*、
    \n为什么这个方法不转义/呢?
    \n有啥子高招,解决这个问题?
    \n参考:
    \nhttp://chinaonrails.com/topic/view/1418.html
    \nhttp://www.ruby-doc.org/core/classes/Regexp.html#M001227

    \n

    http://lzj520.javaeye.com/blog/143223

    ", "created_at"=>2008-03-12 07:51:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    转义正则表达式中的特殊字符
    \n===========================================
    \n使用Regexp.escape方法(别名方法是Regexp.quote),可以把正则表达式中的特殊字符统统转义:
    \nstr1 = "[?]"
    \nstr2 = Regexp.escape(str1) # "[
    \\?]"
    \n
    \nescape会转义掉[*?]这几个特殊的字符,但是其没有对另外一个字符‘/’进行任何处理,这个作为正则表达式的分隔符(//)中的字符难道不是特殊字符么。
    \n
    \n 看个例子:
    \npages="http://www.taojer.com/id=1&name=help;"
    \nputs Regexp.escape(pages)
    \n
    \n 输出:
    \nE:\\Ysl\\Test>ruby exp.rb
    \nhttp://www.taojer.com/id=1&name=help
    \n
    \n可以看到其对/字符是没有进行处理的。
    \n
    \n这个可能会给如下这个需求带来一些问题:
    \n我想在一段String中找到所有以一个指定的URL开头的链接地址,程序大概是这样的:
    \nurl="http://www.taojer.com"
    \n按照我们的思路,可能会这么写:
    \ne_url = Regexp.escape(url)
    \n==》http://www.taojer.com
    \nstr.scan(/<a href="(e_url)">(.+?)<\\/a>/m)
    \n但是这样就会因为/字符存在而异常咯?
    \n
    \n正确是应该是:
    \nstr.scan(/<a href="(http:\\/\\/www.taojer.com)">(.+?)<\\/a>/m).each do |list|

    \n\n

    do something

    \n\n

    end
    \n
    \n按照规定:
    \n特殊字符包括^、$、?、.、/、\\、[、]、{、}、(、)、+、*、
    \n为什么这个方法不转义/呢?
    \n有啥子高招,解决这个问题?
    \n参考:
    \nhttp://chinaonrails.com/topic/view/1418.html
    \nhttp://www.ruby-doc.org/core/classes/Regexp.html#M001227
    \nhttp://lzj520.javaeye.com/blog/143223

    \n", "_id"=>232}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"linux和windows之间的压缩包乱码", "body"=>"

    这个问题搞了我一晚上,到现在也没找到合适的方法,真是郁闷呀,记录下找到的东西,如下:

    \n

    问题:
    \n我在rails中使用fasterCSV导出DB里面的东西,编码为UTF-8,在linux上查看一切正常,但是我先后采用了zip,gzip,tar,7zip,rar,以及biz等压缩后传送给windows,打开发现是乱码。

    \n

    具体表现为:

    \n

    1、zip,tar,gzip,biz等压缩出来的,中文文件名和数据文件均乱码;

    \n

    2、用7zip和rar打包出来的,在windows下打开,中文名正常,但是内部的数据文件还是乱码。

    \n

     

    \n

    在linux与windows平台间交换压缩包文件,如果文件名中含有中文,有时候就会遇到乱码问题,给平台间的文件交换带来麻烦。今天仔细研究了一下,总结下面一些经验,供大家分享

    \n

    1. 7zip和rar(我用的是3.50,好像rar的旧版本不行)会对文件名编码进行转换,内部文件名编码使用

    \n

    unicode,所以使用这两种格式在linux和windows平台间交换不会有乱码问题,其他格式(比如tar.gz, tar.bz2)似乎不进行转换,所以不适合平台间交换。但鉴于linux的自由精神,不推荐使用商业软件rar,而推荐自由的7zip。但是,我发现用 Ubuntu中(我的是Edge)file-roller处理7zip文件还是会存在问题,而用命令行就没有问题,所以推荐大家用命令行的7zip。

    \n


    \n按照找到的资料,应该只有文件名会出现乱码,正文内容不会乱码的呀,真是奇怪。
    \n
    \n我本地测试用7zip或者rar压缩以后,中文的文件名正常了,但是内部的数据文件中的中文还是乱码,奇怪呀。。。

    \n

    有高手指点一下,多谢了哦。

    \n


    \n相关资料:
    \nhttp://linux.chinaitlab.com/administer/735727.html
    \nhttp://www.zdnet.com.cn/server/2008/0228/744257.shtml
    \nhttp://www.linuxidc.com/Linux/2007-12/9951.htm

    ", "created_at"=>2008-03-15 15:02:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    这个问题搞了我一晚上,到现在也没找到合适的方法,真是郁闷呀,记录下找到的东西,如下:
    \n问题:
    \n我在rails中使用fasterCSV导出DB里面的东西,编码为UTF-8,在linux上查看一切正常,但是我先后采用了zip,gzip,tar,7zip,rar,以及biz等压缩后传送给windows,打开发现是乱码。
    \n具体表现为:
    \n1、zip,tar,gzip,biz等压缩出来的,中文文件名和数据文件均乱码;
    \n2、用7zip和rar打包出来的,在windows下打开,中文名正常,但是内部的数据文件还是乱码。
    \n 
    \n在linux与windows平台间交换压缩包文件,如果文件名中含有中文,有时候就会遇到乱码问题,给平台间的文件交换带来麻烦。今天仔细研究了一下,总结下面一些经验,供大家分享
    \n1. 7zip和rar(我用的是3.50,好像rar的旧版本不行)会对文件名编码进行转换,内部文件名编码使用
    \nunicode,所以使用这两种格式在linux和windows平台间交换不会有乱码问题,其他格式(比如tar.gz, tar.bz2)似乎不进行转换,所以不适合平台间交换。但鉴于linux的自由精神,不推荐使用商业软件rar,而推荐自由的7zip。但是,我发现用 Ubuntu中(我的是Edge)file-roller处理7zip文件还是会存在问题,而用命令行就没有问题,所以推荐大家用命令行的7zip。
    \n
    \n按照找到的资料,应该只有文件名会出现乱码,正文内容不会乱码的呀,真是奇怪。
    \n
    \n我本地测试用7zip或者rar压缩以后,中文的文件名正常了,但是内部的数据文件中的中文还是乱码,奇怪呀。。。
    \n有高手指点一下,多谢了哦。
    \n
    \n相关资料:
    \nhttp://linux.chinaitlab.com/administer/735727.html
    \nhttp://www.zdnet.com.cn/server/2008/0228/744257.shtml
    \nhttp://www.linuxidc.com/Linux/2007-12/9951.htm

    \n", "_id"=>233}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中发送大文件", "body"=>"

    有个需求是需要在程序里生成压缩文件,并通过浏览器下载,在rails中发送文件的方式有2中,分别是send_data和send_file,两者还是有些区别的,详细的可以参考Rails的API文档(http://api.rubyonrails.com/classes/ActionController/Streaming.html),这里简单的记录2个方式,如下:

    \n``send_file '/path/to.zip'```\n
    (Sends the file by streaming it 4096 bytes at a time. This way the whole
    \nfile doesn‘t need to be read into memory at once. This makes it
    \nfeasible to send even large files.)
    \n
    \n``恩,我的需求差不多也是这样的,需要发送的文件比较大,大概在10M左右的大小,按照上
    面的这个说明,15M的文件差不多需要下载一分钟(理论速度,和实际的网速还是有关系的);
    挺方便了。
    参考:
    http://api.rubyonrails.com/classes/ActionController/Streaming.html
    http://www.javaeye.com/post/219997```", "created_at"=>2008-03-17 07:53:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有个需求是需要在程序里生成压缩文件,并通过浏览器下载,在rails中发送文件的方式有2中,分别是send_data和send_file,两者还是有些区别的,详细的可以参考Rails的API文档(http://api.rubyonrails.com/classes/ActionController/Streaming.html2个方式,如下:),这里简单的记录
    \n<strong>send_file '/path/to.zip'</strong>
    \n<blockquote>(Sends the file by streaming it <strong>4096 </strong>bytes at a time. This way the whole<br />
    \nfile doesn&lsquo;t need to be read into memory at once. This makes it<br />
    \nfeasible to send even large files.)<br />
    \n</blockquote>
    \n
    恩,我的需求差不多也是这样的,需要发送的文件比较大,大概在10M左右的大小,按照上<br />面的这个说明,15M的文件差不多需要下载一分钟(理论速度,和实际的网速还是有关系的);<br />挺方便了。<br />参考:<br />http://api.rubyonrails.com/classes/ActionController/Streaming.html<br />http://www.javaeye.com/post/219997``

    \n", "_id"=>234}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"别想馅饼啦,小心掉到陷阱里面去", "body"=>"

    最近,老是收到一封名字为“spam轉寄^_^”的邮件,内容相当老套,和以往的思路差不多,这次是鼓吹“比尔盖茨”多NB,说起在施舍自己的财富啥的,只要转发那个邮件就可以自动汇入多少多少美金。。

    \n

    对于这类的馅饼,偶从来就不放心上的,搞过计算机安全,偶也懂得一点的”社会工程学“的,利用社会学的例子,在不知不觉中,有些人就得到了其需要的东西而不会被人发觉。这就是社工的魅力和内涵。

    \n

    来看下这个邮件,其诱惑点有如下几个:

    \n

    1、有英文及其对应的翻译(繁体字),让人觉得有那么点可信;

    \n

    2、开始有几个炒作的,都说收到钱了,等等,让人稍微动心了;

    \n

    3、反正不费事,于是很多人就开始抱着试试看的心情大量转发咯;

    \n

    那么这样会给开始策划的人带来什么好处呢?

    \n

    具体的我不知道,有可能是测试中国人的心里;有可能是闹着玩等等,但是偶认为其还可以收集大家的工作邮箱,想想这么多人的真实、活跃邮箱,这可是比较珍贵的东西呀。

    \n

    抑或在某些版本的邮件接收中有类似跨站,取cookie、溢出下载等等的漏洞,这样就可以有更多的用处了。

    \n

    哎,对于这类”馅饼“,大家还是小心为妙,不要为了”馅饼“调到”陷阱“里啦。

    \n

    附:原文:

    \n

    請不要管它是真還是假,試一下! 如下文章的意思是:(水平有限,可能翻譯得不是很正確,班門弄斧了!)
    \n
    Dear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.

    \n
    親愛的朋友們,
    \n
    請不要把此郵件當作是垃圾郵件。比爾.蓋茨正在施捨他的財富。如果你無視此封郵件稍後你將會追悔莫及.Microsoft and AOL 是現今最大的因特網公司並致力於確保因特網Windows資源管理器依然是使用最廣的程序,Microsoft and AOL 正在進行E-mail第二個階段的測試。
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.

    \n
    噹你把此e-mail轉送給你的朋友時,微軟將跟在兩周內蹤它(如果你是Microsoft Windows 的使用者)。
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque.

    \n
    對於每一個轉發此mail給朋友的人,微軟將會付給你$245。對於每一個你轉發了的人,別人又繼續轉發的人,微軟將付給你$243並且每三個人收到此mail,你將會得及$241的付款。在兩周內,微軟將會聯繫你的地址並給你一張支票! 
    \n
    Dont Know True Or False, Just Have  a   Try
    \n
     
    \n
    Dear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque. 

    \n

    ", "created_at"=>2008-03-18 06:39:05 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近,老是收到一封名字为“spam轉寄^_^”的邮件,内容相当老套,和以往的思路差不多,这次是鼓吹“比尔盖茨”多NB,说起在施舍自己的财富啥的,只要转发那个邮件就可以自动汇入多少多少美金。。
    \n对于这类的馅饼,偶从来就不放心上的,搞过计算机安全,偶也懂得一点的”社会工程学“的,利用社会学的例子,在不知不觉中,有些人就得到了其需要的东西而不会被人发觉。这就是社工的魅力和内涵。
    \n来看下这个邮件,其诱惑点有如下几个:
    \n1、有英文及其对应的翻译(繁体字),让人觉得有那么点可信;
    \n2、开始有几个炒作的,都说收到钱了,等等,让人稍微动心了;
    \n3、反正不费事,于是很多人就开始抱着试试看的心情大量转发咯;
    \n那么这样会给开始策划的人带来什么好处呢?
    \n具体的我不知道,有可能是测试中国人的心里;有可能是闹着玩等等,但是偶认为其还可以收集大家的工作邮箱,想想这么多人的真实、活跃邮箱,这可是比较珍贵的东西呀。
    \n抑或在某些版本的邮件接收中有类似跨站,取cookie、溢出下载等等的漏洞,这样就可以有更多的用处了。
    \n哎,对于这类”馅饼“,大家还是小心为妙,不要为了”馅饼“调到”陷阱“里啦。
    \n附:原文:
    \n請不要管它是真還是假,試一下! 如下文章的意思是:(水平有限,可能翻譯得不是很正確,班門弄斧了!)
    \nDear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n親愛的朋友們,
    \n請不要把此郵件當作是垃圾郵件。比爾.蓋茨正在施捨他的財富。如果你無視此封郵件稍後你將會追悔莫及.Microsoft and AOL 是現今最大的因特網公司並致力於確保因特網Windows資源管理器依然是使用最廣的程序,Microsoft and AOL 正在進行E-mail第二個階段的測試。
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n噹你把此e-mail轉送給你的朋友時,微軟將跟在兩周內蹤它(如果你是Microsoft Windows 的使用者)。
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque.
    \n對於每一個轉發此mail給朋友的人,微軟將會付給你$245。對於每一個你轉發了的人,別人又繼續轉發的人,微軟將付給你$243並且每三個人收到此mail,你將會得及$241的付款。在兩周內,微軟將會聯繫你的地址並給你一張支票! 
    \nDon’t Know True Or False, Just Have  a   Try
    \n 
    \nDear Friends,
    \nPlease do not take this for a junk letter. Bill Gates is sharing his fortune. If you ignore this you will repent later. Microsoft and AOL are now the largest Internet companies and in an effort to make sure that Internet Explorer remains the most widely used program, Microsoft and AOL are running an e-mail beta test.
    \n
    \nWhen you forward this e-mail to friends, Microsoft can and will track it (if you are a Microsoft Windows user) for a two week time period.
    \n
    \nFor every person that you forward this e-mail to, Microsoft will pay you $245.00, for every person that you sent it to that forwards it on, Microsoft will pay you $243.00 and for every third person that receives it, you will be paid $241.00. Within two week! s, Microsoft will contact you for your address and then send you a cheque. 

    \n", "_id"=>235}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Chart API去除流量限制 增加新特性", "body"=>"

    Google Chart API由于功能强大及使用简便,受到了大范围的好评。但用户也有强烈不满的地方,那便是Chart API有个流量限制,每用户每天最多只能执行5万次查询。为了满足大站用户的需求,Google今天去除了这个限制。
    \n
    \n此外,Chart API也对原有的一些特性进行了扩展,以及增加了新的特性。新的特性包括了支持了地图、雷达图等:

    \n

    \"\"
    \n详细的更新可进入Chart API主页查看(标准有extended或new的)。同样地,如果觉得这些文档不易阅读,也可参阅中文版,以及使用图形化的生成工具

    ", "created_at"=>2008-03-19 04:42:52 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Google Chart API由于功能强大及使用简便,受到了大范围的好评。但用户也有强烈不满的地方,那便是Chart API有个流量限制,每用户每天最多只能执行5万次查询。为了满足大站用户的需求,Google今天去除了这个限制。
    \n
    \n此外,Chart API也对原有的一些特性进行了扩展,以及增加了新的特性。新的特性包括了支持了地图、雷达图等:
    \n
    \n详细的更新可进入Chart API主页查看(标准有extended或new的)。同样地,如果觉得这些文档不易阅读,也可参阅中文版,以及使用图形化的生成工具。

    \n", "_id"=>236}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中调用系统的rar来打包文件包", "body"=>"

    由于项目需求,用户可以定制,下载一些数据和图片,于是乎就需要实现的功能有:打包,中文,以及下载等,这里大概的说一下,我也是测试了好久,查了好多资料踩搞明白一些问题,首先BS下window所谓的国际化.真是FT.

    \n

    先看如果压缩文件,看代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. pwd = Dir.pwd  
    2. \n
    3. logger.info("Dir.pwd=\#{pwd}")  
    4. \n
    5. Dir.chdir("\#{cp_dir}"do  
    6. \n
    7.   system "rar a  \#{local_dir_name} \#{local_dir_name}"  
    8. \n
    9. end   
    10. \n
    \n
    \n

    \n

    使用了Ruby的Dir及其代码块的临时切换目录的功能,实在是棒,开始的时候,我还在想使用Tar或者rar用-C参数来去掉打包后的文件夹路径;

    \n

    至于这里为什么使用rar而没有使用比较传统的tar或者gzip,zip或则7zip等,主要是乱码的问题,详细的大家可以查看我以前的文章<linux和windows之间的压缩包乱码>.

    \n

    而后下载的过程中,再次感觉WIn下IE的可恶,乱码,呵呵,没关系,我们可以这样做,如下: 
    \n

    \n
    Ruby代码
    \n
      \n
    1. res = Resource.find(params[:id])  
    2. \n
    3. res.update_attribute(:downed_count, res.downed_count + 1)  
    4. \n
    5. user_agent = request.user_agent.downcase  
    6. \n
    7. filename = File.basename(res.path)  
    8. \n
    9. if user_agent  =~ /msie/i  
    10. \n
    11.   send_file(RAILS_ROOT + res.path,:buffer =>  
    12. \n
    13.       "16384",:filename=>CGI::escape(filename))  
    14. \n
    15. else  
    16. \n
    17.   send_file(RAILS_ROOT + res.path,:buffer => "16384")  
    18. \n
    19. end   
    20. \n
    \n
    \n

    \n

    差不多这些都是关键,搞明白了,就基本上无敌了,呵呵.

    ", "created_at"=>2008-03-23 14:36:47 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    由于项目需求,用户可以定制,下载一些数据和图片,于是乎就需要实现的功能有:打包,中文,以及下载等,这里大概的说一下,我也是测试了好久,查了好多资料踩搞明白一些问题,首先BS下window所谓的国际化.真是FT.
    \n先看如果压缩文件,看代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n pwd = Dir.pwd  
    \n logger.info("Dir.pwd=\#{pwd}")  
    \n Dir.chdir("\#{cp_dir}") do  
    \n   system "rar a  \#{local_dir_name} \#{local_dir_name}"  
    \n end   
    \n
    \n
    \n
    \n使用了Ruby的Dir及其代码块的临时切换目录的功能,实在是棒,开始的时候,我还在想使用Tar或者rar用-C参数来去掉打包后的文件夹路径;
    \n至于这里为什么使用rar而没有使用比较传统的tar或者gzip,zip或则7zip等,主要是乱码的问题,详细的大家可以查看我以前的文章<linux和windows之间的压缩包乱码>.
    \n而后下载的过程中,再次感觉WIn下IE的可恶,乱码,呵呵,没关系,我们可以这样做,如下: 
    \n
    \nRuby代码
    \n
    \n res = Resource.find(params[:id])  
    \n res.update_attribute(:downed_count, res.downed_count + 1)  
    \n user_agent = request.user_agent.downcase  
    \n filename = File.basename(res.path)  
    \n if user_agent  =~ /msie/i  
    \n   send_file(RAILS_ROOT + res.path,:buffer =>  
    \n       "16384",:filename=>CGI::escape(filename))  
    \n else  
    \n   send_file(RAILS_ROOT + res.path,:buffer => "16384")  
    \n end   
    \n
    \n
    \n
    \n差不多这些都是关键,搞明白了,就基本上无敌了,呵呵.

    \n", "_id"=>237}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调优:大量的CLOSE_WAIT状态连接", "body"=>"

    这几天,项目上遇到一个很奇怪的问题,由于项目比较庞大,使用了3台独立的主机做服务器,前端用了硬件的radware采用轮询算法做了三台服务器的负载均衡,每台服务上部署了一台weblogic和一个前置apache做proxy,并且启用了apache的支持weblogic的集群功能,二次向三台weblogic做负载均衡(虽然这里我觉得没啥必要,但是原先他们就这么做了,我就不改了)。

    \n

    apache使用的是prefork模块,开了800个最大连接,配置了超时机制;后端的weblogic除了线程池和队列,文件句柄等做了修改外,其他的貌似没怎么修改。

    \n

    出现的问题的现象是,apache的线程全部用完(802个),weblogic相对比较空闲,内存消耗一般,CPU(4颗的)的idea也在50%左右;前端表现是页面打开速度相当慢,基本不可用。

    \n

    问题的分析过程是,先看到apache的error的log里面很多“文件找不到”错误,由于编辑做的页面上引了一些并不存在的资源,导致的,怀疑此类错误太多,会影响性能,于是找出错误页面,让编辑修复其中巍峨文件引用。但是效果不是很明显,虽然error少了很多。

    \n

    继续分析,使用netstat -an看到很多端口被占用,且很多处于CLOSE_WAIT状态,找个脚本统计下,如下:

    \n

    [wwwpps@IceskYsl]$ netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
    \nLAST_ACK 1
    \nSYN_RECV 15
    \nCLOSE_WAIT 7729
    \nESTABLISHED 471
    \nFIN_WAIT1 3
    \nFIN_WAIT2 52
    \nSYN_SENT 1
    \nTIME_WAIT 725

    \n

    可以看到,确实很多,感觉这里是有问题,google得到一些资料,说到这个问题会导致:“大量的CLOSE_WAIT连接,直接占满TCP队列,导致Apache失去响应。”

    \n

    解决这个问题的方法是修改系统的参数,系统默认超时时间的是7200秒,也就是2小时,这个太大了,对于我们这样的负荷来说,于是修改如下几个参数:

    \n

    sysctl -w net.ipv4.tcp_keepalive_time=30
    \nsysctl -w net.ipv4.tcp_keepalive_probes=2
    \nsysctl -w net.ipv4.tcp_keepalive_intvl=2

    \n

    然后,执行sysctl命令使修改生效,基本上就算完成了。目前正在观察中,看看下午高峰时候效果如何,就可以基本上得出结论了。

    \n

    参考文章:

    \n

    1、解释apache的几种模式的差别:http://www.servertechnology.cn/archives/314.html

    \n

    2、解释“CLOSE_WAIT生成的原因及其系统参数的意义”:http://haka.sharera.com/blog/BlogTopic/32309.htm

    \n

    3、解释如何修复:http://luobuwa.cn/tag.php?tag=apache&mode=1

    \n


    \n

    ", "created_at"=>2008-03-24 05:34:17 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    这几天,项目上遇到一个很奇怪的问题,由于项目比较庞大,使用了3台独立的主机做服务器,前端用了硬件的radware采用轮询算法做了三台服务器的负载均衡,每台服务上部署了一台weblogic和一个前置apache做proxy,并且启用了apache的支持weblogic的集群功能,二次向三台weblogic做负载均衡(虽然这里我觉得没啥必要,但是原先他们就这么做了,我就不改了)。
    \napache使用的是prefork模块,开了800个最大连接,配置了超时机制;后端的weblogic除了线程池和队列,文件句柄等做了修改外,其他的貌似没怎么修改。
    \n出现的问题的现象是,apache的线程全部用完(802个),weblogic相对比较空闲,内存消耗一般,CPU(4颗的)的idea也在50%左右;前端表现是页面打开速度相当慢,基本不可用。
    \n问题的分析过程是,先看到apache的error的log里面很多“文件找不到”错误,由于编辑做的页面上引了一些并不存在的资源,导致的,怀疑此类错误太多,会影响性能,于是找出错误页面,让编辑修复其中巍峨文件引用。但是效果不是很明显,虽然error少了很多。
    \n继续分析,使用netstat -an看到很多端口被占用,且很多处于CLOSE_WAIT状态,找个脚本统计下,如下:
    \n[wwwpps@IceskYsl]$ netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
    \nLAST_ACK 1
    \nSYN_RECV 15
    \nCLOSE_WAIT 7729
    \nESTABLISHED 471
    \nFIN_WAIT1 3
    \nFIN_WAIT2 52
    \nSYN_SENT 1
    \nTIME_WAIT 725
    \n可以看到,确实很多,感觉这里是有问题,google得到一些资料,说到这个问题会导致:“大量的CLOSE_WAIT连接,直接占满TCP队列,导致Apache失去响应。”
    \n解决这个问题的方法是修改系统的参数,系统默认超时时间的是7200秒,也就是2小时,这个太大了,对于我们这样的负荷来说,于是修改如下几个参数:
    \nsysctl -w net.ipv4.tcp_keepalive_time=30
    \nsysctl -w net.ipv4.tcp_keepalive_probes=2
    \nsysctl -w net.ipv4.tcp_keepalive_intvl=2
    \n然后,执行sysctl命令使修改生效,基本上就算完成了。目前正在观察中,看看下午高峰时候效果如何,就可以基本上得出结论了。
    \n参考文章:
    \n1、解释apache的几种模式的差别:http://www.servertechnology.cn/archives/314.html
    \n2、解释“CLOSE_WAIT生成的原因及其系统参数的意义”:http://haka.sharera.com/blog/BlogTopic/32309.htm
    \n3、解释如何修复:http://luobuwa.cn/tag.php?tag=apache&mode=1;
    \n

    \n", "_id"=>238}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"RESTClient:Web开发测试助手", "body"=>"
    RESTClient is a Java platform client application to test RESTful webservices. It can be used to test variety of HTTP communications.

    \"\"
    使用很方便,但是需要java环境,如下:
    $ java
    -jar restclient-2.1-jar-with-dependencies.jar```\n

    关于这个的实现,可以参考这个文章:http://justtalkaboutweb.com/2008/01/25/building-restful-application-in-rails-20-step-by-step/

    ", "created_at"=>2008-03-25 03:47:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    RESTClient is a Java platform client application to test RESTful webservices. It can be used to test variety of HTTP communications.使用很方便,但是需要java环境,如下:$ java -jar restclient-2.1-jar-with-dependencies.jar```
    \n关于这个的实现,可以参考这个文章:http://justtalkaboutweb.com/2008/01/25/building-restful-application-in-rails-20-step-by-step/

    \n", "_id"=>239}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"好久没有回到Windows下了", "body"=>"

    很久了,记不得什么时候开始使用ubuntu的,只记得当时还是7.04版本刚刚出来的时候,转眼间,ubuntu的8.04版本都快发布了,哦,这么算下来,差不多一年了吧。

    \n

    这么一年来的时间,在家工作或者学习、娱乐的时候都在ubuntu下完成的,感觉不到什么别扭,甚至觉得更加的习惯和舒服,一点点都不怀念Window,今天回到windows下,面对一些曾经熟悉的界面,竟然有点不晓得做什么,好在浏览器还是FF,多少还比较习惯。

    \n

    一年多的ubuntu,让我觉得lunix,非常适合我的需要,对一个不打游戏,不咋看电影,天天沉浸在coding的世界里,天天打交道的是IDE,SSH等等。这些都成为我工作之余的大部分内容,真的,ubuntu或者其他的发行版lunix,对程序员或者做互联网的人,非常的适合。

    \n

    一年来,系统再也没有出过啥问题,最多的一次就是xfec的面板不见了,google下,非常简单的一条命令即可搞定;虽然我在windows下也很少中毒,虽然我也不装杀毒软件,但是免不了,偶尔还要用iceword检查下系统是否安全;在ubuntu下,这都免了。

    \n

    我的本本上的window还没有彻底删除,主要是嫌转移资料,整理比较麻烦,反正ubuntu里面,可以直接读windows里的资料,就那么放着吧,有时间再重启进来瞧瞧,呵呵。

    \n

     

    ", "created_at"=>2008-03-29 12:27:25 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很久了,记不得什么时候开始使用ubuntu的,只记得当时还是7.04版本刚刚出来的时候,转眼间,ubuntu的8.04版本都快发布了,哦,这么算下来,差不多一年了吧。
    \n这么一年来的时间,在家工作或者学习、娱乐的时候都在ubuntu下完成的,感觉不到什么别扭,甚至觉得更加的习惯和舒服,一点点都不怀念Window,今天回到windows下,面对一些曾经熟悉的界面,竟然有点不晓得做什么,好在浏览器还是FF,多少还比较习惯。
    \n一年多的ubuntu,让我觉得lunix,非常适合我的需要,对一个不打游戏,不咋看电影,天天沉浸在coding的世界里,天天打交道的是IDE,SSH等等。这些都成为我工作之余的大部分内容,真的,ubuntu或者其他的发行版lunix,对程序员或者做互联网的人,非常的适合。
    \n一年来,系统再也没有出过啥问题,最多的一次就是xfec的面板不见了,google下,非常简单的一条命令即可搞定;虽然我在windows下也很少中毒,虽然我也不装杀毒软件,但是免不了,偶尔还要用iceword检查下系统是否安全;在ubuntu下,这都免了。
    \n我的本本上的window还没有彻底删除,主要是嫌转移资料,整理比较麻烦,反正ubuntu里面,可以直接读windows里的资料,就那么放着吧,有时间再重启进来瞧瞧,呵呵。
    \n 

    \n", "_id"=>240}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"修复OpenOffice中打开Word文档行距很大", "body"=>"

    平时用word的机会越来越少,虽然OpenOffice也挺不错,但是我还是习惯了Google的在线文档,简洁好用;但是偶尔也需要用OpenOffice打开以前的Word文档,发现其行距总是很宽,比较看着不舒服,查了下,原因及其解决办法为:

    \n

    Q: 为什么我在OpenOffice.org中打开Word文档,总是行距很宽?而且调整行距不起作用。
    \n
    \nA: 这是OpenOffice.org Writer里面一个选项造成的。在[格式]菜单里面选择[页面],在[文字网格]选项卡中选择[不使用网格],你的文档就回到正常状态啦!似乎 OpenOffice碰见亚洲字符的文档,就会自动给他加上网格,目前不太清楚如何自动关掉。

    \n

     

    ", "created_at"=>2008-03-30 00:14:37 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    平时用word的机会越来越少,虽然OpenOffice也挺不错,但是我还是习惯了Google的在线文档,简洁好用;但是偶尔也需要用OpenOffice打开以前的Word文档,发现其行距总是很宽,比较看着不舒服,查了下,原因及其解决办法为:
    \nQ: 为什么我在OpenOffice.org中打开Word文档,总是行距很宽?而且调整行距不起作用。
    \n
    \nA: 这是OpenOffice.org Writer里面一个选项造成的。在[格式]菜单里面选择[页面],在[文字网格]选项卡中选择[不使用网格],你的文档就回到正常状态啦!似乎 OpenOffice碰见亚洲字符的文档,就会自动给他加上网格,目前不太清楚如何自动关掉。
    \n 

    \n", "_id"=>241}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用缓存(码表)的方式", "body"=>"

    搞过Java的应该都晓得,经常会定义一些字典,然后将这些字典缓存带内存中以提高查询的效率和速度,也就是常说的缓存,有人叫码表.

    \n

    今天看看如何在Rails中实现类似的功能,思路是一样的,可以缓存在数组或者Hash里面,这里为了查找方便,我们选择使用Hash.

    \n

    也就是:如何创建一个变量从rails开始运行时初始化,一直维持到rails终止,而且对于每一个request都能共享的变量?

    \n

    1,首先在environment.rb里面(如果您使用的Rails2以上版本,建议放在initializers目录里面,自己创建一个文件即可)定义一个ruby中的全局变量即可,例如$actions_in_mem在ruby里面,以$开头的变量即自动申明为全局变量)。在rails启动的时候,执行在environment.rb和initializers里面的文件,初始化$actions_in_mem,这样$actions_in_mem即可持续使用了,如:

    \n
    \n
    Ruby代码
    \n
      \n
    1. $actions_in_mem = Hash.new 
      \n
    2. \n
    \n
    \n

     

    \n

    2,然后在controller或者model或者view里面都是可用的了,比如在model里面实现刷新:

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. #刷新缓存  
    2. \n
    3. def Action.refresh  
    4. \n
    5.   Action.get_actions(1).each do |ac|  
    6. \n
    7.     put_into_hash(ac.controller+"_"+ac.action,ac.id)  
    8. \n
    9.   end  
    10. \n
    11. end  
    12. \n
    13.   
    14. \n
    15. def Action.put_into_hash(key,value)  
    16. \n
    17.   $actions_in_mem.store(key, value)  
    18. \n
    19.   logger.info("@@actions_in_mem.size=\#{$actions_in_mem.size}---\#{key}=>\#{value}")  
    20. \n
    21. end 
      \n
    22. \n
    \n
    \n

    3,当然,你可以在controller中定义一个方法手工刷新这个全局变量,或者定时刷新即可,如下代码实现手工刷新.

    \n

     

    \n

     

    \n
    \n
    Ruby代码
    \n
      \n
    1. #刷新缓存数据  
    2. \n
    3. def refresh_actions  
    4. \n
    5.   Action.refresh  
    6. \n
    7. end 
      \n
    8. \n
    \n
    \n

     

    \n

    4,最后是在view里面显示或者维护,如下代码段:

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <ul>  
    2. \n
    3.   <% $actions_in_mem.each do |key,value|%>  
    4. \n
    5.     <li><%=key%>=><%=value%></li>  
    6. \n
    7.   <%end%>  
    8. \n
    9. </ul>  
    10. \n
    \n
    \n

    如上,就可以理解的差不多啦..

    \n

     

    \n

    关于如何查找,等下再写一篇说说.

    \n

     其他参考文档:

    \n

    1.http://blog.waynedeng.com/article.asp?id=628

    \n

    2.http://www.cnblogs.com/hardrock/archive/2006/09/07/497554.html

    \n

     

    ", "created_at"=>2008-03-30 15:09:38 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    搞过Java的应该都晓得,经常会定义一些字典,然后将这些字典缓存带内存中以提高查询的效率和速度,也就是常说的缓存,有人叫码表.
    \n今天看看如何在Rails中实现类似的功能,思路是一样的,可以缓存在数组或者Hash里面,这里为了查找方便,我们选择使用Hash.
    \n也就是:如何创建一个变量从rails开始运行时初始化,一直维持到rails终止,而且对于每一个request都能共享的变量?
    \n1,首先在environment.rb里面(如果您使用的Rails2以上版本,建议放在initializers目录里面,自己创建一个文件即可)定义一个ruby中的全局变量即可,例如$actionsin_mem在ruby里面,以$开头的变量即自动申明为全局变量)。在rails启动的时候,执行在environment.rb和initializers里面的文件,初始化$actions_in_mem,这样$actions_in_mem即可持续使用了,如:
    \n
    \nRuby代码
    \n
    \n $actions_in_mem = Hash.new 
    \n
    \n
    \n
    \n 
    \n2,然后在controller或者model或者view里面都是可用的了,比如在model里面实现刷新:
    \n 
    \n
    \nRuby代码
    \n
    \n #刷新缓存  
    \n def Action.refresh  
    \n   Action.get_actions(1).each do |ac|  
    \n     put_into_hash(ac.controller+"
    "+ac.action,ac.id)  
    \n   end  
    \n end  
    \n   
    \n def Action.put_into_hash(key,value)  
    \n   $actions_in_mem.store(key, value)  
    \n   logger.info("@@actions_in_mem.size=\#{$actions_in_mem.size}---\#{key}=>\#{value}")  
    \n end 
    \n
    \n
    \n
    \n3,当然,你可以在controller中定义一个方法手工刷新这个全局变量,或者定时刷新即可,如下代码实现手工刷新.
    \n 
    \n 
    \n
    \nRuby代码
    \n
    \n #刷新缓存数据  
    \n def refresh_actions  
    \n   Action.refresh  
    \n end 
    \n
    \n
    \n
    \n 
    \n4,最后是在view里面显示或者维护,如下代码段:
    \n
    \nXML/HTML代码
    \n
    \n <ul>  
    \n   <% $actions_in_mem.each do |key,value|%>  
    \n     <li><%=key%>=><%=value%></li>  
    \n   <%end%>  
    \n </ul>  
    \n
    \n
    \n如上,就可以理解的差不多啦..
    \n 
    \n关于如何查找,等下再写一篇说说.
    \n 其他参考文档:
    \n1.http://blog.waynedeng.com/article.asp?id=628
    \n2.http://www.cnblogs.com/hardrock/archive/2006/09/07/497554.html
    \n 

    \n", "_id"=>242}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的集合对象的遍历技巧", "body"=>"

    前面一篇文章说到了在Rails中实现缓存(码表),接下来就说说如何度缓存的码表做查询,这里说的缓存有可能是数组,或者是Hash.

    \n

    1.先看数组的

    \n

    可以使用delect或者select方法来查找需要的那个元素,代码段如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def get_object_by_id(collections,id)  
    2. \n
    3.     collections.select{|c| c.step_id == id}  
    4. \n
    5. end  
    6. \n
    \n
    \n2.Hash的,待续

    ", "created_at"=>2008-03-30 15:16:13 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前面一篇文章说到了在Rails中实现缓存(码表),接下来就说说如何度缓存的码表做查询,这里说的缓存有可能是数组,或者是Hash.
    \n1.先看数组的
    \n可以使用delect或者select方法来查找需要的那个元素,代码段如下:
    \n
    \n
    \nRuby代码
    \n
    \n def get_object_by_id(collections,id)  
    \n     collections.select{|c| c.step_id == id}  
    \n end  
    \n
    \n
    \n2.Hash的,待续

    \n", "_id"=>243}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout是个挺有趣的tools", "body"=>"

    Scout是Highgroove Studios写的一个很有趣的应用,他提供了一个大的框架,使得其他人可以以插件(集成)的方式实现他的方法(run),进而按照他预定的格式,将采集到的数据发送到其中央服务器,进而可以存储,并以报表的形式展示出来。

    \n

    我大概了看了下起实现方式,和插件的编写方式,其实也挺简单的,其原理也就是在*unix上可以采用crob之类的做定时调度,采集数据(可以使用系统的一些命令,比如ps,top)等等,再把数据组合成他预定义的格式就可以了。

    \n

    看个插件的代码以及我的注释,就很清楚了:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # TODO: use alternate process open to catch STDOUT, STDERR for those   
    2. \n
    3. # processes that use  
    4. \n
    5. #分析: IceskYsl@1sters!(http://iceskysl.1sters.com)  
    6. \n
    7. #这个插件实现的是,定时监控指定的进程,需要的时候重启,并生成报告  
    8. \n
    9. class KeepProcessRunning < Scout::Plugin  
    10. \n
    11.   
    12. \n
    13.   def run  
    14. \n
    15.     #预定义返回的数据格式  
    16. \n
    17.     report = {:report => {}, :alerts => [], :memory => {}}  
    18. \n
    19.     #取需要监控的进程的名字和重启进程的命令  
    20. \n
    21.     process_to_monitor = @options[:process_name] || ""  
    22. \n
    23.     restart_action     = @options[:restart_action] || process_to_monitor  
    24. \n
    25.       
    26. \n
    27.     # Search all running processes for the process (do not match the grep   
    28. \n
    29.     # process nor the locally running scout client).  
    30. \n
    31.     #这就是调用系统的ps命令,并grep,看是否有指定的进程存在  
    32. \n
    33.     ps_output = `ps auxww | grep "\#{process_to_monitor}" | grep -v "grep" | grep -v "scout"`  
    34. \n
    35.     #如果不存在,则根据上面给的重启命令来重启  
    36. \n
    37.     unless process_match = ps_output.to_a.first  # process not found  
    38. \n
    39.       # attempt to restart the process  
    40. \n
    41.       restart_output = `\#{restart_action}`  
    42. \n
    43.       report[:alerts] << {:subject => "\#{process_to_monitor} is not running. Restart reported: \#{restart_output}"}  
    44. \n
    45.     else # process is running  
    46. \n
    47.       # if we wanted to parse fields we could:  
    48. \n
    49.       # fields = process_match.downcase.split  
    50. \n
    51.       report[:report][process_to_monitor] = 1  
    52. \n
    53.     end    
    54. \n
    55.     #返回报告  
    56. \n
    57.     return report    
    58. \n
    59.   rescue Exception  
    60. \n
    61.     { :error => { :subject => "Could not keep the process running.",  
    62. \n
    63.                   :body    => "An exception was thrown:  \#{$!.message}" } }  
    64. \n
    65.   end  
    66. \n
    67. end  
    68. \n
    \n
    \n

    \n

    他采取的“Client Key”来做唯一性校验,也就是说,你必须获得这个“Client Key”,而这个将来可以成为其卖点(可行的方法是分级售卖,比如多少钱的帐号可以监控几个服务器之类的)。

    \n

    仔细一想,这个Idea还真不赖,呵呵~

    \n

    其他的参考资料:

    \n

    1、Scout主页:http://scoutapp.com/

    \n

    2、插件编写手册:http://scoutapp.com/plugin_urls/static/creating_a_plugin

    \n

    3、rubyinside的报道:http://www.rubyinside.com/scout-a-ruby-powered-web-monitoring-and-reporting-service-825.html

    ", "created_at"=>2008-03-31 03:40:38 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Scout是Highgroove Studios写的一个很有趣的应用,他提供了一个大的框架,使得其他人可以以插件(集成)的方式实现他的方法(run),进而按照他预定的格式,将采集到的数据发送到其中央服务器,进而可以存储,并以报表的形式展示出来。
    \n我大概了看了下起实现方式,和插件的编写方式,其实也挺简单的,其原理也就是在*unix上可以采用crob之类的做定时调度,采集数据(可以使用系统的一些命令,比如ps,top)等等,再把数据组合成他预定义的格式就可以了。
    \n看个插件的代码以及我的注释,就很清楚了:
    \n
    \n
    \nRuby代码
    \n
    \n # TODO: use alternate process open to catch STDOUT, STDERR for those   
    \n # processes that use  
    \n #分析: IceskYsl@1sters!(http://iceskysl.1sters.com)  
    \n #这个插件实现的是,定时监控指定的进程,需要的时候重启,并生成报告  
    \n class KeepProcessRunning < Scout::Plugin  
    \n   
    \n   def run  
    \n     #预定义返回的数据格式  
    \n     report = {:report => {}, :alerts => [], :memory => {}}  
    \n     #取需要监控的进程的名字和重启进程的命令  
    \n     process_to_monitor = @options[:process_name] || ""  
    \n     restart_action     = @options[:restart_action] || process_to_monitor  
    \n       
    \n     # Search all running processes for the process (do not match the grep   
    \n     # process nor the locally running scout client).  
    \n     #这就是调用系统的ps命令,并grep,看是否有指定的进程存在  
    \n     ps_output = ps&nbsp;auxww&nbsp;|&nbsp;grep&nbsp;<span class="string">&quot;\#{process_to_monitor}&quot;</span><span>&nbsp;|&nbsp;grep&nbsp;-v&nbsp;</span><span class="string">&quot;grep&quot;</span><span>&nbsp;|&nbsp;grep&nbsp;-v&nbsp;</span><span class="string">&quot;scout&quot;</span><span>  
    \n     #如果不存在,则根据上面给的重启命令来重启  
    \n     unless process_match = ps_output.to_a.first  # process not found  
    \n       # attempt to restart the process  
    \n       restart_output = <span class="comment">\#{restart_action}  
    \n       report[:alerts] << {:subject => "\#{process_to_monitor} is not running. Restart reported: \#{restart_output}"}  
    \n     else # process is running  
    \n       # if we wanted to parse fields we could:  
    \n       # fields = process_match.downcase.split  
    \n       report[:report][process_to_monitor] = 1  
    \n     end    
    \n     #返回报告  
    \n     return report    
    \n   rescue Exception  
    \n     { :error => { :subject => "Could not keep the process running.",  
    \n                   :body    => "An exception was thrown:  \#{$!.message}" } }  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n他采取的“Client Key”来做唯一性校验,也就是说,你必须获得这个“Client Key”,而这个将来可以成为其卖点(可行的方法是分级售卖,比如多少钱的帐号可以监控几个服务器之类的)。
    \n仔细一想,这个Idea还真不赖,呵呵~
    \n其他的参考资料:
    \n1、Scout主页:http://scoutapp.com/
    \n2、插件编写手册:http://scoutapp.com/plugin_urls/static/creating_a_plugin
    \n3、rubyinside的报道:http://www.rubyinside.com/scout-a-ruby-powered-web-monitoring-and-reporting-service-825.html

    \n", "_id"=>244}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"支持Elastic IP Addresses,EC2越来越成熟了.", "body"=>"

    晚上写完手上的代码,正准备睡觉的时候,收到Amazon的一封mail,以为是S3EC2的账单呢,打开一看,原来是EC2的好消息.

    \n

    Greetings AWS Developers, \n

    Last week brought some exciting, highly requested new Amazon EC2 features to the community - Elastic IP Addresses, Availability Zones, and User Selectable Kernels.

    \n

    wowo,真是个好东西,EC2一直以来都被人诟病之一的就是其IP地址的动态的,也就是当你重启您"镜像"后,你的IP地址会变化,也就是说,你的域名需要才信修改IP指向,或者采用一个老外写的一个插件(忘记脚啥名字了)来动态解析,比较不爽的很.现在EC2终于推出了"静态IP"功能,我粗略的看了下,其和账户是绑定的,也就是你重启自己的"镜像"后,并不失效.

    \n

    好东西,EC2会越来越好的...
    \n

    \n

    还是直接看英语的吧,呵呵:

    \n

    Elastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it. Unlike traditional static IP addresses, however, Elastic IP addresses allow you to mask instance or availability zone failures by programmatically remapping your public IP addresses to any instance associated with your account. Rather than waiting on a data technician to reconfigure or replace your host, or waiting for DNS to propagate to all of your customers, Amazon EC2 enables you to engineer around problems with your instance or software by programmatically remapping your Elastic IP address to a replacement instance.

    \n

    详细情况请参考:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346

    \n

    ", "created_at"=>2008-04-01 15:00:29 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    晚上写完手上的代码,正准备睡觉的时候,收到Amazon的一封mail,以为是S3或EC2的账单呢,打开一看,原来是EC2的好消息.
    \nGreetings AWS Developers,
    \n Last week brought some exciting, highly requested new Amazon EC2 features to the community - Elastic IP Addresses, Availability Zones, and User Selectable Kernels.
    \nwowo,真是个好东西,EC2一直以来都被人诟病之一的就是其IP地址的动态的,也就是当你重启您"镜像"后,你的IP地址会变化,也就是说,你的域名需要才信修改IP指向,或者采用一个老外写的一个插件(忘记脚啥名字了)来动态解析,比较不爽的很.现在EC2终于推出了"静态IP"功能,我粗略的看了下,其和账户是绑定的,也就是你重启自己的"镜像"后,并不失效.
    \n好东西,EC2会越来越好的...
    \n
    \n还是直接看英语的吧,呵呵:
    \nElastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it. Unlike traditional static IP addresses, however, Elastic IP addresses allow you to mask instance or availability zone failures by programmatically remapping your public IP addresses to any instance associated with your account. Rather than waiting on a data technician to reconfigure or replace your host, or waiting for DNS to propagate to all of your customers, Amazon EC2 enables you to engineer around problems with your instance or software by programmatically remapping your Elastic IP address to a replacement instance.
    \n详细情况请参考:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346

    \n", "_id"=>245}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu的快捷键", "body"=>"

    毫无疑问,熟练的使用快捷键可以大大的提高工作效率,windows如此,lunix也是如此,下面收录一些ubuntu的快捷键,没事的时候看看,用用,就记得了.
    \n* 打开主菜单 = Alt + F1
    \n* 运行 = Alt + F2
    \n* 显示桌面 = Ctrl + Alt + d
    \n* 最小化当前窗口 = Alt + F9
    \n* 最大化当前窗口 = Alt + F10
    \n* 关闭当前窗口 = Alt + F4
    \n* 截取全屏 = Print Screen
    \n* 截取窗口 = Alt + Print Screen
    \n默认特殊快捷键
    \n* 展示所有窗口程序 = F10
    \n* 展示当前窗口最上层程序 = F11
    \n* 展示当前窗口所有程序 = F12
    \n* 切换窗口 = Alt + Tab
    \n* 旋转3D桌面 = Ctrl + Alt + 左/右箭头(也可以把鼠标放在标题栏或桌面使用滚轮切换)
    \n* 旋转3D桌面( 活动窗口跟随) = Ctrl + Shift + Alt + 左/右箭头
    \n* 手动旋转3D桌面 = Ctrl + Alt + 左键单击并拖拽桌面空白处
    \n* 窗口透明/不透明 = possible with the “transset” utility or Alt + 滚轮
    \n* 放大一次 = 超级键 + 右击
    \n* 手动放大 = 超级键 + 滚轮向上
    \n* 手动缩小 = 超级键 + 滚轮向下
    \n* 移动窗口 = Alt + 左键单击
    \n* 移动窗口时贴住边框 = 左键开始拖动后再 Ctrl + Alt
    \n* 调整窗口大小 = Alt + 中击
    \n* Bring up the window below the top window = Alt + middle-click
    \n* 动态效果减速 = Shift + F10
    \n* 水纹 = 按住 Ctrl+超级键
    \n* 雨点 = Shift-F9
    \n* 桌面展开= Ctrl + Alt + 下箭头,然后按住 Ctrl + Alt 和左/右箭头选择桌面

    \n

     

    ", "created_at"=>2008-04-01 15:21:12 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    毫无疑问,熟练的使用快捷键可以大大的提高工作效率,windows如此,lunix也是如此,下面收录一些ubuntu的快捷键,没事的时候看看,用用,就记得了.
    \n* 打开主菜单 = Alt + F1
    \n* 运行 = Alt + F2
    \n* 显示桌面 = Ctrl + Alt + d
    \n* 最小化当前窗口 = Alt + F9
    \n* 最大化当前窗口 = Alt + F10
    \n* 关闭当前窗口 = Alt + F4
    \n* 截取全屏 = Print Screen
    \n* 截取窗口 = Alt + Print Screen
    \n默认特殊快捷键
    \n* 展示所有窗口程序 = F10
    \n* 展示当前窗口最上层程序 = F11
    \n* 展示当前窗口所有程序 = F12
    \n* 切换窗口 = Alt + Tab
    \n* 旋转3D桌面 = Ctrl + Alt + 左/右箭头(也可以把鼠标放在标题栏或桌面使用滚轮切换)
    \n* 旋转3D桌面( 活动窗口跟随) = Ctrl + Shift + Alt + 左/右箭头
    \n* 手动旋转3D桌面 = Ctrl + Alt + 左键单击并拖拽桌面空白处
    \n* 窗口透明/不透明 = possible with the “transset” utility or Alt + 滚轮
    \n* 放大一次 = 超级键 + 右击
    \n* 手动放大 = 超级键 + 滚轮向上
    \n* 手动缩小 = 超级键 + 滚轮向下
    \n* 移动窗口 = Alt + 左键单击
    \n* 移动窗口时贴住边框 = 左键开始拖动后再 Ctrl + Alt
    \n* 调整窗口大小 = Alt + 中击
    \n* Bring up the window below the top window = Alt + middle-click
    \n* 动态效果减速 = Shift + F10
    \n* 水纹 = 按住 Ctrl+超级键
    \n* 雨点 = Shift-F9
    \n* 桌面展开= Ctrl + Alt + 下箭头,然后按住 Ctrl + Alt 和左/右箭头选择桌面
    \n 

    \n", "_id"=>246}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BaiDu之Hi体验~", "body"=>"

    向来喜欢体验些新东西,虽然GoogleTalk已经让我觉得非常满意,虽然在linux上无法使用Hi,虽然我对Baidu并不十分的喜欢,但是看到订阅的一些RSS里面屡屡出现Baidu的Hi的身影的时候,我还在会看看他到底有啥不同,有啥奇特的?

    \n

    看到白鸽和麦田等等的介绍,我也发了封申请,今天收到Baidu的回复,下载,安装,加了个好友,试试这个传说中可以和QQ对抗的IM到底是啥样子。

    \n

    1、界面不算简洁,比QQ有余,比Gtalk不足

    \n

    都说Hi的界面清爽,偶看了下,比起QQ或者MSN确实干净了不少,QQ的花里胡哨最让我受不了,用了一段时间TM后,还是觉得不爽,最后就不用QQ了;MSN的界面上的广告太嚣张,偶尔还会弹出来,哎,也不喜欢。Gtalk的节目最简洁,简洁到我一使用就喜欢上了。Hi的界面,有点MSN的风格,但是暂时没发现广告,不晓得还能干净多久。

    \n

    2、功能实用,但有不足

    \n

    IM作为最实用的工具(中国是这样的),有些功能是必须的,即时消息,文件传输这两个我觉得是必须的;语音和视频可有可无,如果能支持SMS就更好了,呵呵。Hi基本上具备了这些功能(SMS的没有)。但是我在使用过程发现,文件传输比较不正常,开始想试试传输速度,无奈的900K的东西,半天没反应,又自动断了,还提示双方“对方取消”,引起不少误解;后来试了一个小的图片,还是不行。看来这里有BUG..

    \n

    3、自身功能还有待加强

    \n

    我修改设定了自己的图片,无奈的是报告错误而无法完成,这应该也有Bug。

    \n

    其他的没兴趣试了,此次的Baidu的Hi体验,非常一般。

    ", "created_at"=>2008-04-02 06:37:00 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    向来喜欢体验些新东西,虽然GoogleTalk已经让我觉得非常满意,虽然在linux上无法使用Hi,虽然我对Baidu并不十分的喜欢,但是看到订阅的一些RSS里面屡屡出现Baidu的Hi的身影的时候,我还在会看看他到底有啥不同,有啥奇特的?
    \n看到白鸽和麦田等等的介绍,我也发了封申请,今天收到Baidu的回复,下载,安装,加了个好友,试试这个传说中可以和QQ对抗的IM到底是啥样子。
    \n1、界面不算简洁,比QQ有余,比Gtalk不足
    \n都说Hi的界面清爽,偶看了下,比起QQ或者MSN确实干净了不少,QQ的花里胡哨最让我受不了,用了一段时间TM后,还是觉得不爽,最后就不用QQ了;MSN的界面上的广告太嚣张,偶尔还会弹出来,哎,也不喜欢。Gtalk的节目最简洁,简洁到我一使用就喜欢上了。Hi的界面,有点MSN的风格,但是暂时没发现广告,不晓得还能干净多久。
    \n2、功能实用,但有不足
    \nIM作为最实用的工具(中国是这样的),有些功能是必须的,即时消息,文件传输这两个我觉得是必须的;语音和视频可有可无,如果能支持SMS就更好了,呵呵。Hi基本上具备了这些功能(SMS的没有)。但是我在使用过程发现,文件传输比较不正常,开始想试试传输速度,无奈的900K的东西,半天没反应,又自动断了,还提示双方“对方取消”,引起不少误解;后来试了一个小的图片,还是不行。看来这里有BUG..
    \n3、自身功能还有待加强
    \n我修改设定了自己的图片,无奈的是报告错误而无法完成,这应该也有Bug。
    \n其他的没兴趣试了,此次的Baidu的Hi体验,非常一般。

    \n", "_id"=>247}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Mongrel之cluster::restart vs. stop/start的区别", "body"=>"

    最近终于用上了我一直比较推荐的Rails部署方式(Nginx+Mongrel集群),感觉相当的不错,关于这方面的技巧和配置,以后有时间再说,今天主要说说Mongrel集群的时候,其start./stoprestart有啥区别。\n

    \n
    XML/HTML代码
    \n
      \n
    1. mongrel_rails cluster::start #启动  
    2. \n
    3. mongrel_rails cluster::restart #重启  
    4. \n
    5. mongrel_rails cluster::stop #停止   
    6. \n
    \n
    \n

    \n

    如上三条命令为启动,停止和重启的命令,找我们的理解,重启应该是和stop/start一样的效果,其实不然,主要区别就是:

    \n

    1、stop/start模式就是先stop掉,再启动,他会等到线程结束后stop,启动时会再次读取配置文件。

    \n

    2、restart模式和这个类似,但是其不会重新加载配置文件,也就是说你如果修改了配置文件,restart是不起作用的。

    \n

    以上是我的理解,有不对的地方,还望指出,谢谢~

    \n

    参考文章:

    \n

    1.http://rubyforge.org/pipermail/mongrel-users/2006-June/000438.html

    \n

    2.http://linux.ccidnet.com/art/302/20080327/1403439_1.html

    ", "created_at"=>2008-04-07 06:14:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近终于用上了我一直比较推荐的Rails部署方式(Nginx+Mongrel集群),感觉相当的不错,关于这方面的技巧和配置,以后有时间再说,今天主要说说Mongrel集群的时候,其start./stop和restart有啥区别。
    \n
    \nXML/HTML代码
    \n
    \n mongrel_rails cluster::start #启动  
    \n mongrel_rails cluster::restart #重启  
    \n mongrel_rails cluster::stop #停止   
    \n
    \n
    \n
    \n如上三条命令为启动,停止和重启的命令,找我们的理解,重启应该是和stop/start一样的效果,其实不然,主要区别就是:
    \n1、stop/start模式就是先stop掉,再启动,他会等到线程结束后stop,启动时会再次读取配置文件。
    \n2、restart模式和这个类似,但是其不会重新加载配置文件,也就是说你如果修改了配置文件,restart是不起作用的。
    \n以上是我的理解,有不对的地方,还望指出,谢谢~
    \n参考文章:
    \n1.http://rubyforge.org/pipermail/mongrel-users/2006-June/000438.html
    \n2.http://linux.ccidnet.com/art/302/20080327/1403439_1.html

    \n", "_id"=>248}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中捕获TimeOut异常及其处理", "body"=>"

    把应用迁移到新的服务器上以后,发现经常有”超时“的错误信息,如/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error),恩,应该是网络不稳定或者是服务器响应太慢的结果,需要捕获下这个异常并做些处理,记录如下:

    \n

    需要注意的是,Timeout::Error不是StandardError的子类, 而是继承至 Interrupt class,所以捕获的时候,需要格外注意,演示如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'net/pop3'  
    2. \n
    3. begin  
    4. \n
    5.   Net::POP3.auth_only(@server@port@username@password)  
    6. \n
    7. rescue => e  
    8. \n
    9.   write_error_to_logfile(e)  
    10. \n
    11.   do_something_sensible  
    12. \n
    13. end  
    14. \n
    \n
    \n看上面的这段代码,当POP3服务器不能及时响应的时候,所触发的异常并不能被下面捕获到,原因就是上面说的,再看正确的处理代码:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'net/pop3'  
    2. \n
    3. begin  
    4. \n
    5.   Net::POP3.auth_only(@server@port@username@password)  
    6. \n
    7. rescue => e  
    8. \n
    9.   write_error_to_logfile(e)  
    10. \n
    11.   do_something_sensible  
    12. \n
    13. rescue Timeout::Error => e  
    14. \n
    15.   write_error_to_logfile(e)  
    16. \n
    17.   do_something_sensible_for_timeout  
    18. \n
    19. end  
    20. \n
    \n
    \n这段代码可以正常工作,并按照我们的意愿来处理了。

    \n

     如果您知道对方的服务器会比较慢的响应,或者你知道网络状态不好,你可以单独设置这个TimeOut的时间,代码如下:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'timeout'  
    2. \n
    3.   
    4. \n
    5. ...  
    6. \n
    7. ...  
    8. \n
    9. begin  
    10. \n
    11.   timeout(60) do  
    12. \n
    13.      resp, body=3Dh.get('/index.html')  
    14. \n
    15.      puts body  
    16. \n
    17.   end  
    18. \n
    19. rescue TimeoutError  
    20. \n
    21.        puts "Timed Out"  
    22. \n
    23. end 
      \n
    24. \n
    \n
    \n

    \n

    或者这样:(来源:http://textsnippets.com/posts/show/868)\n

    \n
    Ruby代码
    \n
      \n
    1. http = Net::HTTP.new(url.host, url.port)  
    2. \n
    3. http.read_timeout=time_out  
    4. \n
    \n
    \n

    \n

    参考资料:

    \n

    1.'rbuf_fill': execution expired (Timeout::Error): http://lindsaar.net/2007/12/9/rbuf_filltimeout-error

    \n

    2.How to catch Timeout::ERROR ? : http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170394

    \n

    3.Ruby's Thread#raise, Thread#kill, timeout.rb, and net/protocol.rb libraries are broken: http://headius.blogspot.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html

    \n

    4.How to change the Timeout::Error threshold for open_uri : http://www.ruby-forum.com/topic/146676

    \n

    5.http://griffin.oobleyboo.com/archive/ruby-net-http-exceptions/

    ", "created_at"=>2008-04-07 07:17:41 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    把应用迁移到新的服务器上以后,发现经常有”超时“的错误信息,如/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error),恩,应该是网络不稳定或者是服务器响应太慢的结果,需要捕获下这个异常并做些处理,记录如下:
    \n需要注意的是,Timeout::Error不是StandardError的子类, 而是继承至 Interrupt class,所以捕获的时候,需要格外注意,演示如下:
    \n
    \n
    \nRuby代码
    \n
    \n require 'net/pop3'  
    \n begin  
    \n   Net::POP3.auth_only(@server, @port, @username, @password)  
    \n rescue => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible  
    \n end  
    \n
    \n
    \n看上面的这段代码,当POP3服务器不能及时响应的时候,所触发的异常并不能被下面捕获到,原因就是上面说的,再看正确的处理代码:
    \n
    \n
    \nRuby代码
    \n
    \n require 'net/pop3'  
    \n begin  
    \n   Net::POP3.auth_only(@server, @port, @username, @password)  
    \n rescue => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible  
    \n rescue Timeout::Error => e  
    \n   write_error_to_logfile(e)  
    \n   do_something_sensible_for_timeout  
    \n end  
    \n
    \n
    \n这段代码可以正常工作,并按照我们的意愿来处理了。
    \n 如果您知道对方的服务器会比较慢的响应,或者你知道网络状态不好,你可以单独设置这个TimeOut的时间,代码如下:
    \n
    \nRuby代码
    \n
    \n require 'timeout'  
    \n   
    \n ...  
    \n ...  
    \n begin  
    \n   timeout(60) do  
    \n      resp, body=3Dh.get('/index.html')  
    \n      puts body  
    \n   end  
    \n rescue TimeoutError  
    \n        puts "Timed Out"  
    \n end 
    \n
    \n
    \n
    \n
    \n或者这样:(来源:http://textsnippets.com/posts/show/868
    \n
    \nRuby代码
    \n
    \n http = Net::HTTP.new(url.host, url.port)  
    \n http.read_timeout=time_out  
    \n
    \n
    \n
    \n参考资料:
    \n1.'rbuf_fill': execution expired (Timeout::Error): http://lindsaar.net/2007/12/9/rbuf_filltimeout-error
    \n2.How to catch Timeout::ERROR ? : http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170394
    \n3.Ruby's Thread#raise, Thread#kill, timeout.rb, and net/protocol.rb libraries are broken: http://headius.blogspot.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html
    \n4.How to change the Timeout::Error threshold for open_uri : http://www.ruby-forum.com/topic/146676
    \n5.http://griffin.oobleyboo.com/archive/ruby-net-http-exceptions/

    \n", "_id"=>249}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ubuntu7.10上装rar/unrar", "body"=>"

    早在我开始使用Ubuntu的时候(7.04)就安装了linux下的rar,这几天在一台新的服务器上上安装的时候,竟然花了这么大的牛劲,呵呵。

    \n

     先看下版本,如下:

    \n

    1sters@IceskYsl:~/sources$ uname -a
    \nLinux taojer 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux

    \n

    然后使用“sudo apt-get install rar”,却发现出错,如下:

    \n
    \n

    1sters@IceskYsl:~/sources$ sudo apt-get install rar
    \nPassword:
    \nReading package lists... Done
    \nBuilding dependency tree... Done
    \nPackage rar is not available, but is referred to by another package.
    \nThis may mean that the package is missing, has been obsoleted, or
    \nis only available from another source
    \nE: Package rar has no installation candidate

    \n
    \n

    找不到相应的包,哦,因该是源的问题,查了下Google,很多人说是源的问题,于是乎,胡乱加了一大堆的源,试了下,貌似不好使,再查,找到相应的源,如下:

    \n

    \n

    \n
    Shell代码
    \n
      \n
    1. deb http://archive.ubuntu.com/ubuntu dapper universe multiverse  
    2. \n
    3. deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse  
    4. \n
    \n
    \n再使用:\n
    \n
    Shell代码
    \n
      \n
    1. sudo aptitude upgrade  
    2. \n
    3. sudo aptitude install rar unrar  
    4. \n
    \n
    \n

    \n

    然后就差不多OK了。

    \n

    参考资料:

    \n

    1、http://ubuntuforums.org/showthread.php?t=571440

    ", "created_at"=>2008-04-08 05:34:05 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    早在我开始使用Ubuntu的时候(7.04)就安装了linux下的rar,这几天在一台新的服务器上上安装的时候,竟然花了这么大的牛劲,呵呵。
    \n 先看下版本,如下:
    \n1sters@IceskYsl:~/sources$ uname -a
    \nLinux taojer 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux
    \n然后使用“sudo apt-get install rar”,却发现出错,如下:
    \n
    \n1sters@IceskYsl:~/sources$ sudo apt-get install rar
    \nPassword:
    \nReading package lists... Done
    \nBuilding dependency tree... Done
    \nPackage rar is not available, but is referred to by another package.
    \nThis may mean that the package is missing, has been obsoleted, or
    \nis only available from another source
    \nE: Package rar has no installation candidate
    \n
    \n找不到相应的包,哦,因该是源的问题,查了下Google,很多人说是源的问题,于是乎,胡乱加了一大堆的源,试了下,貌似不好使,再查,找到相应的源,如下:
    \n
    \n
    \nShell代码
    \n
    \n deb http://archive.ubuntu.com/ubuntu dapper universe multiverse;  
    \n deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse;  
    \n
    \n
    \n再使用:
    \n
    \nShell代码
    \n
    \n sudo aptitude upgrade  
    \n sudo aptitude install rar unrar  
    \n
    \n
    \n
    \n然后就差不多OK了。
    \n参考资料:
    \n1、http://ubuntuforums.org/showthread.php?t=571440

    \n", "_id"=>250}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"再次遭遇乱码侵袭~", "body"=>"

    经历了Java/Rails的乱码洗礼,经过Zip/RAR/7zip等等的搔扰,经过不懈的恶补,偶以为面对乱码问题可以应对自如了,然而不幸的是,这次又遇到了,下面看过程。

    \n

    问题现象:

    \n

    1、在Rails中,上传本地的文件到服务器,服务器接收到以后,保存到服务器并记录其所在的路径,然后使用Rails中的 send_file来实现下载功能。我在本地开发环境上一切正常,但是在服务器上发生“找不到文件”的错误,SSH连进去看了下,原来保存在硬盘上时,中文文件名出现乱码,类似“2008_03_25_07_54_27_娣樺疂瓒呯骇鐢ㄦ埛鎼滅储寮曟搸.rar”这样的。

    \n

    2、在Rails中使用Ruby的File.new()、File.open()函数创建的文件,在硬盘上显示的中文名也是乱码。(这个人和我发现的问题类似:http://www.javaeye.com/topic/66371)

    \n

    问题分析及其定位:

    \n

    经过查找和分析,偶认为这与系统的字符集设置有关,因为在我本地开发机器上是可以正常显示和查看的,但是在服务器上就不可以,着重了解字符集的设置。

    \n

    分析过程:

    \n

    1、先看看系统

    \n

    1sters@IceskYsl:~$ uname -a
    \nLinux 1sters 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux

    \n

    恩,是linux的系统。

    \n

    2、再看看目前的字符集

    \n

    1sters@IceskYsl:~$ locale
    \nLANG=
    \nLC_CTYPE="POSIX"
    \nLC_NUMERIC="POSIX"
    \nLC_TIME="POSIX"
    \nLC_COLLATE="POSIX"
    \nLC_MONETARY="POSIX"
    \nLC_MESSAGES="POSIX"
    \nLC_PAPER="POSIX"
    \nLC_NAME="POSIX"
    \nLC_ADDRESS="POSIX"
    \nLC_TELEPHONE="POSIX"
    \nLC_MEASUREMENT="POSIX"
    \nLC_IDENTIFICATION="POSIX"
    \nLC_ALL=

    \n

    这是默认的POSIX。

    \n

    3、查看下系统支持的字符集

    \n

    locale -a

    \n

    修改方法:

    \n

    在/etc/bashrc中加入
    \nexport LC_ALL="zh_CN.utf8"
    \nexport LANG="zh_CN.utf8"
    \n系统默认的locale变成了zh_CN.utf8

    \n

    参考资料:

    \n

    1、如何更改普通用户的locale??http://linux.chinaunix.net/bbs/viewthread.php?tid=715236
    \n2、更改默认locale http://blog.chinaunix.net/u/22117/showart_257343.html
    \n3、关于locale的设定 http://blog.csdn.net/whoopee/archive/2006/09/28/1299891.aspx

    ", "created_at"=>2008-04-08 05:57:32 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    经历了Java/Rails的乱码洗礼,经过Zip/RAR/7zip等等的搔扰,经过不懈的恶补,偶以为面对乱码问题可以应对自如了,然而不幸的是,这次又遇到了,下面看过程。
    \n问题现象:
    \n1、在Rails中,上传本地的文件到服务器,服务器接收到以后,保存到服务器并记录其所在的路径,然后使用Rails中的 send_file来实现下载功能。我在本地开发环境上一切正常,但是在服务器上发生“找不到文件”的错误,SSH连进去看了下,原来保存在硬盘上时,中文文件名出现乱码,类似“2008_03_25_07_54_27_娣樺疂瓒呯骇鐢ㄦ埛鎼滅储寮曟搸.rar”这样的。
    \n2、在Rails中使用Ruby的File.new()、File.open()函数创建的文件,在硬盘上显示的中文名也是乱码。(这个人和我发现的问题类似:http://www.javaeye.com/topic/66371
    \n问题分析及其定位:
    \n经过查找和分析,偶认为这与系统的字符集设置有关,因为在我本地开发机器上是可以正常显示和查看的,但是在服务器上就不可以,着重了解字符集的设置。
    \n分析过程:
    \n1、先看看系统
    \n1sters@IceskYsl:~$ uname -a
    \nLinux 1sters 2.6.18-xen #1 SMP Fri Nov 2 06:14:54 UTC 2007 x86_64 GNU/Linux
    \n恩,是linux的系统。
    \n2、再看看目前的字符集
    \n1sters@IceskYsl:~$ locale
    \nLANG=
    \nLC_CTYPE="POSIX"
    \nLC_NUMERIC="POSIX"
    \nLC_TIME="POSIX"
    \nLC_COLLATE="POSIX"
    \nLC_MONETARY="POSIX"
    \nLC_MESSAGES="POSIX"
    \nLC_PAPER="POSIX"
    \nLC_NAME="POSIX"
    \nLC_ADDRESS="POSIX"
    \nLC_TELEPHONE="POSIX"
    \nLC_MEASUREMENT="POSIX"
    \nLC_IDENTIFICATION="POSIX"
    \nLC_ALL=
    \n这是默认的POSIX。
    \n3、查看下系统支持的字符集
    \nlocale -a
    \n修改方法:
    \n在/etc/bashrc中加入
    \nexport LC_ALL="zh_CN.utf8"
    \nexport LANG="zh_CN.utf8"
    \n系统默认的locale变成了zh_CN.utf8
    \n参考资料:
    \n1、如何更改普通用户的locale??http://linux.chinaunix.net/bbs/viewthread.php?tid=715236
    \n2、更改默认locale http://blog.chinaunix.net/u/22117/showart_257343.html
    \n3、关于locale的设定 http://blog.csdn.net/whoopee/archive/2006/09/28/1299891.aspx

    \n", "_id"=>251}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中调用系统的shell命令的异常", "body"=>"

    最近有点蹊跷,老是遇到一些莫名其妙的问题,呵呵,折腾吧.今天要说的问题是,在ruby中调用系统(*UNIX)中的shell命令来做些事情,本来没啥难度的事情,我却遇到了一个费解的问题.

    \n

    问题描述:

    \n

    由于需要给用户打包下载一系列的文件(图片),为了方便,我在ruby中调用系统的rar来打包需要下载的资源,然后再send_file下载下去,但是这里却遇到了奇怪的问题,调用系统命令的那句出现问题.

    \n

    关于在RUby中调用系统的shell,大家可以参考如下文章( 6 Ways to Run Shell Commands in Ruby: http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886),我就不多废话了.直接看我的相关代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. local_dir_name=1207667932_2  
    2. \n
    3. logger.info("rar a \#{local_dir_name} \#{local_dir_name}")  
    4. \n
    5. oo= %x{rar a \#{local_dir_name} \#{local_dir_name}}  
    6. \n
    7. logger.info("oo=\#{oo}")  
    8. \n
    \n
    \n上面的那个变量是按照时间取的唯一标识.这里使用的 %x{}(`)来获取执行的结果,以方便查看及问题定位,在本地机器(Ubuntu 7.10)上,一切正常,输出如下:\n
    \n
    本地输出日志
    \n
      \n
    1. rar a 1207667932_2 1207667932_2  
    2. \n
    3. oo=  
    4. \n
    5. RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    6. \n
    7. Shareware version Type RAR -? for help  
    8. \n
    9.   
    10. \n
    11. Evaluation copy. Please register.  
    12. \n
    13.   
    14. \n
    15. Creating archive 1207667932_2.rar  
    16. \n
    17.   
    18. \n
    19. Adding 1207667932_2/datas.csv OK  
    20. \n
    21. Adding 1207667932_2/images OK  
    22. \n
    23. Adding 1207667932_2 OK  
    24. \n
    25. Done  
    26. \n
    \n
    \n

    \n

    但是在服务器上 (这里使用的是DH的PS服务器),其不能正常运行,如下:

    \n

    \n

    \n
    服务器输出日志
    \n
      \n
    1. rar a 1207666290_2 1207666290_2  
    2. \n
    3. oo=  
    4. \n
    5. Program aborted  
    6. \n
    \n
    \n可以看到,如上发生了异常,但是原因无法得知.

    \n

    问题分析:

    \n

    奇怪的很,查了下环境,没啥不一样的呀,唯一发现不一样的是rar的版本不咋一致,DH上的rar版本比较老,分别如下:\n

    \n
    RAR的版本信息
    \n
      \n
    1. Localhost rar version is :  
    2. \n
    3. RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    4. \n
    5.   
    6. \n
    7. DH's rar version is :  
    8. \n
    9. [iceskysl]$ rar  
    10. \n
    11.   
    12. \n
    13. RAR 3.30 Copyright (c) 1993-2004 Eugene Roshal 22 Jan 2004  
    14. \n
    \n
    \n

    \n

    这难道会是原因,还真搞不清?难道DH上对进程啥的有特殊要求,还是其他的啥原因呢?有知道的朋友,请赐教,多谢了.

    \n

    参考文章:http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886

    ", "created_at"=>2008-04-08 15:55:53 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近有点蹊跷,老是遇到一些莫名其妙的问题,呵呵,折腾吧.今天要说的问题是,在ruby中调用系统(*UNIX)中的shell命令来做些事情,本来没啥难度的事情,我却遇到了一个费解的问题.
    \n问题描述:
    \n由于需要给用户打包下载一系列的文件(图片),为了方便,我在ruby中调用系统的rar来打包需要下载的资源,然后再send_file下载下去,但是这里却遇到了奇怪的问题,调用系统命令的那句出现问题.
    \n关于在RUby中调用系统的shell,大家可以参考如下文章( 6 Ways to Run Shell Commands in Ruby: http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886),我就不多废话了.直接看我的相关代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n local_dir_name=1207667932_2  
    \n logger.info("rar a \#{local_dir_name} \#{local_dir_name}")  
    \n oo= %x{rar a \#{local_dir_name} \#{local_dir_name}}  
    \n logger.info("oo=\#{oo}")  
    \n
    \n
    \n上面的那个变量是按照时间取的唯一标识.这里使用的 %x{}(`)来获取执行的结果,以方便查看及问题定位,在本地机器(Ubuntu 7.10)上,一切正常,输出如下:
    \n
    \n本地输出日志
    \n
    \n rar a 1207667932_2 1207667932_2  
    \n oo=  
    \n RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    \n Shareware version Type RAR -? for help  
    \n   
    \n Evaluation copy. Please register.  
    \n   
    \n Creating archive 1207667932_2.rar  
    \n   
    \n Adding 1207667932_2/datas.csv OK  
    \n Adding 1207667932_2/images OK  
    \n Adding 1207667932_2 OK  
    \n Done  
    \n
    \n
    \n
    \n但是在服务器上 (这里使用的是DH的PS服务器),其不能正常运行,如下:
    \n
    \n
    \n服务器输出日志
    \n
    \n rar a 1207666290_2 1207666290_2  
    \n oo=  
    \n Program aborted  
    \n
    \n
    \n可以看到,如上发生了异常,但是原因无法得知.
    \n问题分析:
    \n奇怪的很,查了下环境,没啥不一样的呀,唯一发现不一样的是rar的版本不咋一致,DH上的rar版本比较老,分别如下:
    \n
    \nRAR的版本信息
    \n
    \n Localhost rar version is :  
    \n RAR 3.70 beta 1 Copyright (c) 1993-2007 Alexander Roshal 8 Jan 2007  
    \n   
    \n DH's rar version is :  
    \n [iceskysl]$ rar  
    \n   
    \n RAR 3.30 Copyright (c) 1993-2004 Eugene Roshal 22 Jan 2004  
    \n
    \n
    \n
    \n这难道会是原因,还真搞不清?难道DH上对进程啥的有特殊要求,还是其他的啥原因呢?有知道的朋友,请赐教,多谢了.
    \n参考文章:http://pasadenarb.com/2007/03/ruby-shell-commands.html#comment-1886

    \n", "_id"=>252}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"设置/美化SecureCRT让其更加适合自己", "body"=>"

    时常还是要在另外一台电脑上使用windows,也只能使用putty或者SecureCRT,连接到服务器上,但是一直以来,都存在一些小问题,这里以SecureCRT为例把解决方法汇总下。

    \n

    1、中文显示乱码的问题

    \n

    该问题的现象是用SecureCRT连接到服务器上,比如tail应用日志的时候,其日志中的中文不能很好的显示(也就是乱码)。这个问题的根本原因是双方的编码方式不一致,因为一般的来说,服务器上的编码是UTF-8(我的服务器是这样的,或者被我设定为这样的)你可以在服务器上使用locale 查看,而SecureCRT的默认设置的字符编码是保持系统一致的,在中文windows上就是GBK或者其他编码;

    \n

    知道原因修改起来就比较简单了,分为两个部分:

    \n

    1)修改远程linux机器的配置
    \nvim /etc/sysconfig/i18n
    \n把LANG改成支持UTF-8的字符集
    \n如:
    \nLANG=”zh_CN.UTF-8″
    \n或者是
    \nLANG=”en_US.UTF-8″

    \n

    或者是修改指定用户的locale,编辑.bashrc文件,导入以上的编码即可。

    \n

    2)然后再改Secure CRT的设置
    \nOptions -> Session Options ->  Apperance -> Fonts -> Character(选项->会话选项->外观->字符编码->uft-8)
    \n
    \n退出,再重新登录。发现utf8的文件都能正确读了,utf8的文件名也能正确显示了。

    \n

    2、显示颜色

    \n

    显示颜色是个好习惯,一来直观明了,二来增加美感,对视力也有好处,在Secure CRT中设置显示颜色也比较简单,如下:
    \nOptions -> Session Options ->Terminal ->Emulation ->ANSI Color 选中就可以了。

    \n

    3、字体选择

    \n

    选择不同的字体,可以显示不同的效果,按照个人喜好,比如我自己就喜欢细一点的,清晰一点的字体,而这个字体在Secure CRT是可以设置的,其默认的是vt100,我个人比较喜欢“新宋体”的显示效果。(PS.很多人喜欢fixedsys 字体)。设置方法也很简单,如下:Options -> Session Options ->  Apperance -> Fonts 选择你需要的字体即可。

    ", "created_at"=>2008-04-09 01:31:33 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    时常还是要在另外一台电脑上使用windows,也只能使用putty或者SecureCRT,连接到服务器上,但是一直以来,都存在一些小问题,这里以SecureCRT为例把解决方法汇总下。
    \n1、中文显示乱码的问题
    \n该问题的现象是用SecureCRT连接到服务器上,比如tail应用日志的时候,其日志中的中文不能很好的显示(也就是乱码)。这个问题的根本原因是双方的编码方式不一致,因为一般的来说,服务器上的编码是UTF-8(我的服务器是这样的,或者被我设定为这样的)你可以在服务器上使用locale 查看,而SecureCRT的默认设置的字符编码是保持系统一致的,在中文windows上就是GBK或者其他编码;
    \n知道原因修改起来就比较简单了,分为两个部分:
    \n1)修改远程linux机器的配置
    \nvim /etc/sysconfig/i18n
    \n把LANG改成支持UTF-8的字符集
    \n如:
    \nLANG=”zh_CN.UTF-8″
    \n或者是
    \nLANG=”en_US.UTF-8″
    \n或者是修改指定用户的locale,编辑.bashrc文件,导入以上的编码即可。
    \n2)然后再改Secure CRT的设置
    \nOptions -> Session Options ->  Apperance -> Fonts -> Character(选项->会话选项->外观->字符编码->uft-8)
    \n
    \n退出,再重新登录。发现utf8的文件都能正确读了,utf8的文件名也能正确显示了。
    \n2、显示颜色
    \n显示颜色是个好习惯,一来直观明了,二来增加美感,对视力也有好处,在Secure CRT中设置显示颜色也比较简单,如下:
    \nOptions -> Session Options ->Terminal ->Emulation ->ANSI Color 选中就可以了。
    \n3、字体选择
    \n选择不同的字体,可以显示不同的效果,按照个人喜好,比如我自己就喜欢细一点的,清晰一点的字体,而这个字体在Secure CRT是可以设置的,其默认的是vt100,我个人比较喜欢“新宋体”的显示效果。(PS.很多人喜欢fixedsys 字体)。设置方法也很简单,如下:Options -> Session Options ->  Apperance -> Fonts 选择你需要的字体即可。

    \n", "_id"=>253}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"谈谈我使用过的几个国外服务器提供商", "body"=>"

    今天在月光的blog上看到其对DreamHost的抱怨,说起存在“过度销售”的现象,具体的可以看这里(http://www.williamlong.info/archives/1301.html)。

    \n

    这里说说我自己使用过的和了解到的国外服务器提供商的个人感受,纯属个人感受,请不要乱扣帽子。我选空间的用途主要是有2个,其一是运行一些我开发的开源的系统(比如1stlog,byeloo!等)的Demo,用来演示或者流量不大的应用;其二是为客户选择的跑商业化的RoR应用。所以我选择的服务区必须可以支持RubyOnRails应用。

    \n

    我使用过的国外提供商有BlueHostDreamHostSliceHost,我试用过的有亚马逊的EC2RaislHost,hostingrailsrailsplayground;我了解过的有mtRailsmeches,如下分别说说个人感受:

    \n

    1、BlueHost:这个是我最开始使用的国外的服务器,当时是从朋友那分了一些空间过来使用的,因为最开始的时候,Rails的服务器并不多,貌似只有BH和DH吧,呵呵,BH虽然支持Rails,但是限制相当多,我记得当时我写的“技能云”就放上面,那次被InfoQ报道了下后,那天流量稍微大些,就撑不住了。且速度一般般,映像不咋好,后来就撤离了。

    \n

    2、DreamHost:这个我使用的时间比较长,包括现在这个blog也是放在上面的,总的来说,马马虎虎,只能用来放个人blog和一些Demo等,不适合做商业站点使用;我开始使用的是Share模式的,但是后来开发的一个系统需要在后台跑一些定时JOB,其不支持,就只能开通其PS服务(这个速度相当慢,我等了20多天,来来回回的交互了好多次邮件,他们都说申请开通PS的客户太多,他们忙不过来,需要耐心的等,后来最后我怒了,说再不搞好,我就给我所有的客户选择SliceHost,这招见效,立马搞定,推荐大家使用,哈哈)。

    \n

    其Share模式的用户非常的多,月光说他的那个服务器上有380个shell用户和1600多的FTP,都是很正常的,主要是其销售模式,带来巨量的用户群,而其宣称的500G空间和5T的月流量,无限子域名,无限MYSQL库等等,都是扯淡的,为了吸引眼球和骗那些新入手的朋友,他们对CPU和内存的限制非常严格(这就是他们的高明之处),一旦超过内存和CPU,你必须升级到PS模式。

    \n

    而升级到PS模式(最低是150M内存/150MHZCPU/15美刀/月,以此随自己调解,以10MHZcpu/10M内存/1美刀/月的价格)以后,他会再三提醒您,如果mem不够,请增加自己的内存等。

    \n

    虽然PS号称是”私有服务器“,其效果和许诺的CPU和MEM都可以得到保证,但是也不是很稳定,毕竟用户群那么大,出问题的小概率事件也会很多的。

    \n

    值得称道的是,他们的技术支持还是不错的,我每次发邮件问,基本上很快就给我比较明确的答复;另外,DH的网速还是不错的(就我使用的那个服务器看);其操作面板比较容易操作,也非常强大。付款比较方便,支持信用卡,paypal以及google checkout等。

    \n

    总的来说:DH的share模式比较适合流量小的和一些demo演示之类的应用,不适合商业化的服务;PS模式稍微好点,但是要做好down机的准备,呵呵。

    \n

    3、SliceHost:这个应该是最便宜的VPN提供商了,其比较专业,以VPN的方式提供服务,可以选择的种类最低是256M独立内存,可以自己选择操作系统类型,自己装web服务器等,其技术文档比较多且可操作性比较好,但是其技术支持不是很到位,我只在chat里和他们沟通过,没发过邮件。

    \n

    SliceHost我上次使用的是256M的ubuntu7.10+nginx+mogrel集群跑的一个Rails应用,用apache的ab压力测了下,效果还不错,且没有出现down机等不稳定现象的出现,比较令人满意。

    \n

    但是有个问题,需要注意,我当时需要在程序里么net/http 取国内一些网站上的资源,速度很让人郁闷,有时候竟然只有900B/秒,相当慢。我曾和他们的技术支持沟通,他们给的解释是“SliceHsot在美国,而您要取得资源在中国,这个网路上的事情,我们也无能为力”,所以,如果您有类似需求,请千万注意。

    \n

    其他几个,类似EC2和Mt等,由于我没有实际长时间使用过,这里就不评价了,最近会逐一试试,以后再补充这个文章。

    \n

    如果您使用过其他的国外的服务器,还请分享一二;或者想更多的了解我使用过的这些服务器,请留言即可。

    ", "created_at"=>2008-04-11 05:52:22 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    今天在月光的blog上看到其对DreamHost的抱怨,说起存在“过度销售”的现象,具体的可以看这里(http://www.williamlong.info/archives/1301.html)。
    \n这里说说我自己使用过的和了解到的国外服务器提供商的个人感受,纯属个人感受,请不要乱扣帽子。我选空间的用途主要是有2个,其一是运行一些我开发的开源的系统(比如1stlog,byeloo!等)的Demo,用来演示或者流量不大的应用;其二是为客户选择的跑商业化的RoR应用。所以我选择的服务区必须可以支持RubyOnRails应用。
    \n我使用过的国外提供商有BlueHost,DreamHost和SliceHost,我试用过的有亚马逊的EC2,RaislHost,hostingrails和railsplayground;我了解过的有mt和Railsmeches,如下分别说说个人感受:
    \n1、BlueHost:这个是我最开始使用的国外的服务器,当时是从朋友那分了一些空间过来使用的,因为最开始的时候,Rails的服务器并不多,貌似只有BH和DH吧,呵呵,BH虽然支持Rails,但是限制相当多,我记得当时我写的“技能云”就放上面,那次被InfoQ报道了下后,那天流量稍微大些,就撑不住了。且速度一般般,映像不咋好,后来就撤离了。
    \n2、DreamHost:这个我使用的时间比较长,包括现在这个blog也是放在上面的,总的来说,马马虎虎,只能用来放个人blog和一些Demo等,不适合做商业站点使用;我开始使用的是Share模式的,但是后来开发的一个系统需要在后台跑一些定时JOB,其不支持,就只能开通其PS服务(这个速度相当慢,我等了20多天,来来回回的交互了好多次邮件,他们都说申请开通PS的客户太多,他们忙不过来,需要耐心的等,后来最后我怒了,说再不搞好,我就给我所有的客户选择SliceHost,这招见效,立马搞定,推荐大家使用,哈哈)。
    \n其Share模式的用户非常的多,月光说他的那个服务器上有380个shell用户和1600多的FTP,都是很正常的,主要是其销售模式,带来巨量的用户群,而其宣称的500G空间和5T的月流量,无限子域名,无限MYSQL库等等,都是扯淡的,为了吸引眼球和骗那些新入手的朋友,他们对CPU和内存的限制非常严格(这就是他们的高明之处),一旦超过内存和CPU,你必须升级到PS模式。
    \n而升级到PS模式(最低是150M内存/150MHZCPU/15美刀/月,以此随自己调解,以10MHZcpu/10M内存/1美刀/月的价格)以后,他会再三提醒您,如果mem不够,请增加自己的内存等。
    \n虽然PS号称是”私有服务器“,其效果和许诺的CPU和MEM都可以得到保证,但是也不是很稳定,毕竟用户群那么大,出问题的小概率事件也会很多的。
    \n值得称道的是,他们的技术支持还是不错的,我每次发邮件问,基本上很快就给我比较明确的答复;另外,DH的网速还是不错的(就我使用的那个服务器看);其操作面板比较容易操作,也非常强大。付款比较方便,支持信用卡,paypal以及google checkout等。
    \n总的来说:DH的share模式比较适合流量小的和一些demo演示之类的应用,不适合商业化的服务;PS模式稍微好点,但是要做好down机的准备,呵呵。
    \n3、SliceHost:这个应该是最便宜的VPN提供商了,其比较专业,以VPN的方式提供服务,可以选择的种类最低是256M独立内存,可以自己选择操作系统类型,自己装web服务器等,其技术文档比较多且可操作性比较好,但是其技术支持不是很到位,我只在chat里和他们沟通过,没发过邮件。
    \nSliceHost我上次使用的是256M的ubuntu7.10+nginx+mogrel集群跑的一个Rails应用,用apache的ab压力测了下,效果还不错,且没有出现down机等不稳定现象的出现,比较令人满意。
    \n但是有个问题,需要注意,我当时需要在程序里么net/http 取国内一些网站上的资源,速度很让人郁闷,有时候竟然只有900B/秒,相当慢。我曾和他们的技术支持沟通,他们给的解释是“SliceHsot在美国,而您要取得资源在中国,这个网路上的事情,我们也无能为力”,所以,如果您有类似需求,请千万注意。
    \n其他几个,类似EC2和Mt等,由于我没有实际长时间使用过,这里就不评价了,最近会逐一试试,以后再补充这个文章。
    \n如果您使用过其他的国外的服务器,还请分享一二;或者想更多的了解我使用过的这些服务器,请留言即可。

    \n", "_id"=>254}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BB入手,跨入智能时代", "body"=>"

    毕业那年为了找工作方便,花了1250大洋,跑了一天在汉口买中联想i816手机,用了两年后,换了另外一款联想的手机i908,把i816放到抽屉保存了起来,可惜刚买的i908没3个月,就在长沙步行街被小贼盗去,于是又重新拿出原来的i816凑合着使用,然后慢慢选择自己适合的手机,随着i816的老化,通话都受到影响,还为此影响了一次重要的事情后,于是下定决心,换!

    \n

    选了好久,不求花哨,但求个性,不求昂贵,只求实惠,在Nokia,联想等几个手机直接徘徊了很久,最后竟然选择了黑莓,也就是传说中的BB。

    \n

    偶受不了太大的个,所以选了个最苗条的,又有个很帅的“轨迹球”的8100系列,刷了最新的4.5系统,可以很好的支持中文,显示效果非常的榜。

    \n

    昨天玩了一天,基本上都熟悉了,还在不断的熟悉,把那么多的快捷键都记住了,会相当方便滴,满意。show个网上的照片,呵呵。

    \n

     

    \n

    \"\"

    \n


    \n关于使用体会啥的,有时间再说。

    \n

    偶也终于跨入PDA的时代,hoho。。。

    ", "created_at"=>2008-04-13 15:59:33 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    毕业那年为了找工作方便,花了1250大洋,跑了一天在汉口买中联想i816手机,用了两年后,换了另外一款联想的手机i908,把i816放到抽屉保存了起来,可惜刚买的i908没3个月,就在长沙步行街被小贼盗去,于是又重新拿出原来的i816凑合着使用,然后慢慢选择自己适合的手机,随着i816的老化,通话都受到影响,还为此影响了一次重要的事情后,于是下定决心,换!
    \n选了好久,不求花哨,但求个性,不求昂贵,只求实惠,在Nokia,联想等几个手机直接徘徊了很久,最后竟然选择了黑莓,也就是传说中的BB。
    \n偶受不了太大的个,所以选了个最苗条的,又有个很帅的“轨迹球”的8100系列,刷了最新的4.5系统,可以很好的支持中文,显示效果非常的榜。
    \n昨天玩了一天,基本上都熟悉了,还在不断的熟悉,把那么多的快捷键都记住了,会相当方便滴,满意。show个网上的照片,呵呵。
    \n 
    \n
    \n
    \n关于使用体会啥的,有时间再说。
    \n偶也终于跨入PDA的时代,hoho。。。

    \n", "_id"=>255}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby正则表达式小技巧", "body"=>"

    关于Ruby的正则表达式的基本的东西大家都很熟悉了,偶然会遇到一些没见过的小技巧,本篇用来收集和记录这些小技巧,如果你有其他小技巧,欢迎分享.

    \n

    pre_match和post_match这两个方法以前没使用过,他们分别是用来获取当前匹配结果的前一个和后一个匹配结果,看个例子既可以明白了. \n

    \n
    Ruby代码
    \n
      \n
    1. # #这个是分析URI的    
    2. \n
    3.  def self.split_uri( uri_str )    
    4. \n
    5.      m = %r<http://([^/]+)>.match(uri_str) or raise ArgumentError, "cannot parse URI: \#{uri_str}"    
    6. \n
    7.      host = m[1].strip    
    8. \n
    9.      path = m.post_match    
    10. \n
    11.      path = '/' if path.empty?    
    12. \n
    13.      puts host, path    
    14. \n
    15. # end  
    16. \n
    17.   
    18. \n
    19. url = http://www.1sters.com:80/this_is_a_string/and_this_is_too    
    20. \n
    21. puts(split_uri(url))  
    22. \n
    23. #  
    24. \n
    25. #Outout:  
    26. \n
    27. #www.1sters.com:80,this_is_a_string/and_this_is_too    
    28. \n
    \n
    \n如上这段代码很好的说明了post_match的作用.

    ", "created_at"=>2008-04-15 13:24:14 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    关于Ruby的正则表达式的基本的东西大家都很熟悉了,偶然会遇到一些没见过的小技巧,本篇用来收集和记录这些小技巧,如果你有其他小技巧,欢迎分享.
    \npre_match和post_match这两个方法以前没使用过,他们分别是用来获取当前匹配结果的前一个和后一个匹配结果,看个例子既可以明白了. 
    \n
    \nRuby代码
    \n
    \n # #这个是分析URI的    
    \n  def self.split_uri( uri_str )    
    \n      m = %r<http://([^/]+)>.match(uri_str) or raise ArgumentError, "cannot parse URI: \#{uri_str}"    
    \n      host = m[1].strip    
    \n      path = m.post_match    
    \n      path = '/' if path.empty?    
    \n      puts host, path    
    \n # end  
    \n   
    \n url = http://www.1sters.com:80/this_is_a_string/and_this_is_too    
    \n puts(split_uri(url))  
    \n #  
    \n #Outout:  
    \n #www.1sters.com:80,this_is_a_string/and_this_is_too    
    \n
    \n
    \n如上这段代码很好的说明了post_match的作用.

    \n", "_id"=>256}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,前途无量,充满乐趣", "body"=>"

    早在几天前,就在Gseek上看到关于GoogleAppEngine的介绍,可惜当时去晚了,没有申请到试用帐号,只大略的看了下,发现其实好东西,今天在infoQ上再次看到这个东西的就介绍,再跑过去看看,下载了SDK并看了下他的guider,和演示代码,发现其真的很有前途,是个很有诱惑力的东西。

    \n

    尽管Google说会支持其他很多环境,但是现在还只支持python,毫无疑问,Google内部对python的喜爱已经毋庸置疑的。当然,我期待着哪天其可以支持ruby(rails框架或者其他);或者我该抽点时间去学学python了,呵呵。
    \n看看他自己的说明:
    \nRun your web applications on Google's infrastructure.
    \nGoogle App Engine enables you to build web applications on the same scalable systems that power Google applications.
    \nNo assembly required.
    \nGoogle App Engine provides a fully-integrated application environment.
    \nIt's easy to scale.
    \nGoogle App Engine makes it easy to build scalable applications that grow from one user to millions of users without infrastructure headaches.
    \nIt's free to get started.
    \nEvery Google App Engine application can use up to 500MB of persistent storage and enough bandwidth and CPU for 5 million monthly page views.

    \n

    毫无疑问,如果能大规模的推广开,将会带来很大的web开发热浪,同时Google将在这个里面得到更多的东西,不仅仅限于卖这个服务的费用,还会给google自己的其他份额应用更好的支撑。

    \n

    同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。

    ", "created_at"=>2008-04-16 02:09:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    早在几天前,就在Gseek上看到关于GoogleAppEngine的介绍,可惜当时去晚了,没有申请到试用帐号,只大略的看了下,发现其实好东西,今天在infoQ上再次看到这个东西的就介绍,再跑过去看看,下载了SDK并看了下他的guider,和演示代码,发现其真的很有前途,是个很有诱惑力的东西。
    \n尽管Google说会支持其他很多环境,但是现在还只支持python,毫无疑问,Google内部对python的喜爱已经毋庸置疑的。当然,我期待着哪天其可以支持ruby(rails框架或者其他);或者我该抽点时间去学学python了,呵呵。
    \n看看他自己的说明:
    \nRun your web applications on Google's infrastructure.
    \nGoogle App Engine enables you to build web applications on the same scalable systems that power Google applications.
    \nNo assembly required.
    \nGoogle App Engine provides a fully-integrated application environment.
    \nIt's easy to scale.
    \nGoogle App Engine makes it easy to build scalable applications that grow from one user to millions of users without infrastructure headaches.
    \nIt's free to get started.
    \nEvery Google App Engine application can use up to 500MB of persistent storage and enough bandwidth and CPU for 5 million monthly page views.
    \n毫无疑问,如果能大规模的推广开,将会带来很大的web开发热浪,同时Google将在这个里面得到更多的东西,不仅仅限于卖这个服务的费用,还会给google自己的其他份额应用更好的支撑。
    \n同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。

    \n", "_id"=>257}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Scout已经长大,正式上线,试用手记~", "body"=>"

    前段时间我曾写过一篇介绍Scout插件编写规则的文章《Scout是个挺有趣的tools》,当时Scout尚未正式商用,今天收到Scout的邮件说,已经正式上线了。

    \n

    过去注册了一个free的帐号,在我的一个应用里面使用了下,感觉效果相当不错,将来肯定有大量的用户和开发者。

    \n

    Scout的模式相当好,对于Saas应用来说,这个模式相当不错,首先开发一个应用框架,Scout本身就是一个监控框架,然后制定相应的插件开发规则,让更多的人贡献智慧,而Scout本身作为一个数据存储中心,接收每个客户机上采集到的数据,入库保存,生成报表,并做适当的告警处理等。

    \n

    这个做法相当棒,他在用户注册的时候,会生成一个Client Key,然后您在安装Scout的时候,输入验证,如果通过,就认为是自己的客户。(至于客户的类型等等都是在服务器上保存的,客户端只需要这个key就OK了)。

    \n

    看了一眼价格,还真不便宜,Basc版本的都是 \t\t\t$14.00/mo,最高的是$119.00/mo,这样的价格,会带来不小的收益哦。

    \n

    另外,如果能集合SMS告警等,就不用SS每天的724监控了,呵呵。

    \n

    但是有一点需要注意的是:

    \n

    你在客户机上安装了Scout的gem后,其他插件并不需要再SSH上去安装,主要在Scout的UI界面上,选择你要的插件,简单的配置,即可安装,这么看来,其实可以让客户端系统安装任何插件了,如果有人非法利用,后果还是挺严重的,比后门还要NB呀~

    \n


    \n看下我测试的一个界面:

    \n

    \"\"

    ", "created_at"=>2008-04-16 03:30:51 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前段时间我曾写过一篇介绍Scout插件编写规则的文章《Scout是个挺有趣的tools》,当时Scout尚未正式商用,今天收到Scout的邮件说,已经正式上线了。
    \n过去注册了一个free的帐号,在我的一个应用里面使用了下,感觉效果相当不错,将来肯定有大量的用户和开发者。
    \nScout的模式相当好,对于Saas应用来说,这个模式相当不错,首先开发一个应用框架,Scout本身就是一个监控框架,然后制定相应的插件开发规则,让更多的人贡献智慧,而Scout本身作为一个数据存储中心,接收每个客户机上采集到的数据,入库保存,生成报表,并做适当的告警处理等。
    \n这个做法相当棒,他在用户注册的时候,会生成一个Client Key,然后您在安装Scout的时候,输入验证,如果通过,就认为是自己的客户。(至于客户的类型等等都是在服务器上保存的,客户端只需要这个key就OK了)。
    \n看了一眼价格,还真不便宜,Basc版本的都是 $14.00/mo,最高的是$119.00/mo,这样的价格,会带来不小的收益哦。
    \n另外,如果能集合SMS告警等,就不用SS每天的724监控了,呵呵。
    \n但是有一点需要注意的是:
    \n你在客户机上安装了Scout的gem后,其他插件并不需要再SSH上去安装,主要在Scout的UI界面上,选择你要的插件,简单的配置,即可安装,这么看来,其实可以让客户端系统安装任何插件了,如果有人非法利用,后果还是挺严重的,比后门还要NB呀~
    \n
    \n看下我测试的一个界面:

    \n", "_id"=>258}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"EC2支持Persistent Storage,日渐完善", "body"=>"

    "Last night Amazon announced persistent storage on EC2. Now you can create disks in S3 and attach them to EC2 instances. You want a terabyte of storage for your machine, just create it in S3 and mount it."

    \n

    很多人应该记得,EC2才宣布支持静态IP没几天,今天就看到消息称EC2支持Persistent Storage了,大家应该还记得,EC2发布以来,虽然带给大家无数的方便和快捷,但是其中两个诟病一直被人提及,那就是“不支持固定IP地址”和“没有”Persistent Storage“,这两个诟病使得:

    \n

    1、一旦你重启了EC2,你的IP地址就会变化,这就意味着你花了几个小时才解析生效的DNS又无法解析。

    \n

    2、一旦你的EC2重启,你必须及时的备份数据库和数据文件到S3上,以防止重启或者down机丢失数据。

    \n

    而这两个问题,到现在为止,已经全部完善了,EC2基本上很成熟了,剩下一个让国内开发者认为不爽的是,在国内,访问的速度实在不咋地。希望亚马逊有改善的计划,到时,就不用自己买服务器,托管啥的啦,甚至VPS都得靠边站,呵呵,就像我以前说的《RubyOnRails + S3 + EC2 = ? 》,依然好戏。

    \n

    或许是受到Google发布的Google App Engine的刺激,亚马逊才会在最近做这么大的动作,因为Google App Engine号称是亚马逊的EC2,S3,SQS以及SimpleDB的整体方案。对亚马逊有直接的竞争关系。

    \n

    前面一篇文章《Google App Engine,前途无量,充满乐趣 》就说了,这样的竞争,会带来更多的好处,好戏还会有,下一个改进会是什么呢?

    \n

    PS:这次公告中还提及一个新功能:
    \nAnother feature rolled out last night is snapshots. Need backup or the ability to rollback? Snapshot the instance and it’s on S3, ready to use. You can create new volumes from any particular snapshot.
    \n
    \nThese two features make Amazon’s grid computing platform a very nice place for startups to experiment, develop, and build out. All with little or no capital cost.

    ", "created_at"=>2008-04-16 04:41:26 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    "Last night Amazon announced persistent storage on EC2. Now you can create disks in S3 and attach them to EC2 instances. You want a terabyte of storage for your machine, just create it in S3 and mount it."
    \n很多人应该记得,EC2才宣布支持静态IP没几天,今天就看到消息称EC2支持Persistent Storage了,大家应该还记得,EC2发布以来,虽然带给大家无数的方便和快捷,但是其中两个诟病一直被人提及,那就是“不支持固定IP地址”和“没有”Persistent Storage“,这两个诟病使得:
    \n1、一旦你重启了EC2,你的IP地址就会变化,这就意味着你花了几个小时才解析生效的DNS又无法解析。
    \n2、一旦你的EC2重启,你必须及时的备份数据库和数据文件到S3上,以防止重启或者down机丢失数据。
    \n而这两个问题,到现在为止,已经全部完善了,EC2基本上很成熟了,剩下一个让国内开发者认为不爽的是,在国内,访问的速度实在不咋地。希望亚马逊有改善的计划,到时,就不用自己买服务器,托管啥的啦,甚至VPS都得靠边站,呵呵,就像我以前说的《RubyOnRails + S3 + EC2 = ? 》,依然好戏。
    \n或许是受到Google发布的Google App Engine的刺激,亚马逊才会在最近做这么大的动作,因为Google App Engine号称是亚马逊的EC2,S3,SQS以及SimpleDB的整体方案。对亚马逊有直接的竞争关系。
    \n前面一篇文章《Google App Engine,前途无量,充满乐趣 》就说了,这样的竞争,会带来更多的好处,好戏还会有,下一个改进会是什么呢?
    \nPS:这次公告中还提及一个新功能:
    \nAnother feature rolled out last night is snapshots. Need backup or the ability to rollback? Snapshot the instance and it’s on S3, ready to use. You can create new volumes from any particular snapshot.
    \n
    \nThese two features make Amazon’s grid computing platform a very nice place for startups to experiment, develop, and build out. All with little or no capital cost.

    \n", "_id"=>259}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"服务器最近有些异常", "body"=>"

    也许大家发现了,我的Blog这几天有些异样,经常出现500错误,开始我并不晓得是咋回事,后来看了下内存才发现,是内存不够了.

    \n

    这个Blog是放在DH的PS上的,虽然号称PS,但是感觉还不如sharemode的时候稳定,无语,DH的一个经的催我增加内存.FT...

    \n

    我基本上天天在线,如果你发现本站不能访问了,请在GoogleTalk上告诉我,我重启下PS服务器..正在和DH的交涉,应该很快就有结果.

    \n

     

    ", "created_at"=>2008-04-20 16:30:27 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    也许大家发现了,我的Blog这几天有些异样,经常出现500错误,开始我并不晓得是咋回事,后来看了下内存才发现,是内存不够了.
    \n这个Blog是放在DH的PS上的,虽然号称PS,但是感觉还不如sharemode的时候稳定,无语,DH的一个经的催我增加内存.FT...
    \n我基本上天天在线,如果你发现本站不能访问了,请在GoogleTalk上告诉我,我重启下PS服务器..正在和DH的交涉,应该很快就有结果.
    \n 

    \n", "_id"=>260}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"1stlog归来,人员征集中。", "body"=>"

    花了一个周末,把1stlog的代码整理了下,由于当时开发的时候Rails还是1.2的版本,里面用了一些方法和措施,在Rails2版本上市不支持的。加上当时学习Rails不久,写的代码也有点XXX。
    \n
    \n本次修改的主要有:
    \n1、增加对Rails2版本的支持;
    \n2、增加配置文件的缓存,提高性能;
    \n3、增加多模板支持;
    \n4、使用一套全新的后台管理界面。
    \n
    \n以上四者是主要的工作,其他都是小细节的修复,基本工作已经完成,马上即可发布版本,敬请关注,谢谢。
    \n(PS:还没有修改完,目前搭建了一套空壳子,有兴趣的请在这里看 :http://1stlog.1sters.com
    \n
    \n需要如下人员参与:
    \n1、文档编写者 --负责编写(在原来的基础上修改和完善)插件开发手册;使用手册、安装部署文档以及模板设计手册;
    \n2、UI设计师 -- 负责按照模板设计手册设计有个性的模板并与大家分享;
    \n3、开发人员  --负责Bug修复和部分开发工作;
    \n4、QA人员  --负责收集和整理Bug和新需求;
    \n5、测试人员  -负责功能性测试、可用性测试等及其问题验证;
    \n
    \n1stlog是开源的项目,代码和设计思路等都贡献给每个人,所以以上工作都需要您有激情,有希望做些开源的事情,谢谢。
    \n
    \n如果您有兴趣,请跟贴或者给我发Email(iceskysl@gmail.com)报名并附带自己愿意担任的角色和自己擅长的地方,谢谢。

    ", "created_at"=>2008-04-21 02:25:57 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    花了一个周末,把1stlog的代码整理了下,由于当时开发的时候Rails还是1.2的版本,里面用了一些方法和措施,在Rails2版本上市不支持的。加上当时学习Rails不久,写的代码也有点XXX。
    \n
    \n本次修改的主要有:
    \n1、增加对Rails2版本的支持;
    \n2、增加配置文件的缓存,提高性能;
    \n3、增加多模板支持;
    \n4、使用一套全新的后台管理界面。
    \n
    \n以上四者是主要的工作,其他都是小细节的修复,基本工作已经完成,马上即可发布版本,敬请关注,谢谢。
    \n(PS:还没有修改完,目前搭建了一套空壳子,有兴趣的请在这里看 :http://1stlog.1sters.com
    \n
    \n需要如下人员参与:
    \n1、文档编写者 --负责编写(在原来的基础上修改和完善)插件开发手册;使用手册、安装部署文档以及模板设计手册;
    \n2、UI设计师 -- 负责按照模板设计手册设计有个性的模板并与大家分享;
    \n3、开发人员  --负责Bug修复和部分开发工作;
    \n4、QA人员  --负责收集和整理Bug和新需求;
    \n5、测试人员  -负责功能性测试、可用性测试等及其问题验证;
    \n
    \n1stlog是开源的项目,代码和设计思路等都贡献给每个人,所以以上工作都需要您有激情,有希望做些开源的事情,谢谢。
    \n
    \n如果您有兴趣,请跟贴或者给我发Email(iceskysl@gmail.com)报名并附带自己愿意担任的角色和自己擅长的地方,谢谢。

    \n", "_id"=>261}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails之Component探析,引出Cells。", "body"=>"

    由于打算将我的第一个开源项目1stlog重构和完善,看了下以前的实现方式,除了用到了很对rails2不支持的方法和插件外(正在着手修改),还用到了Rails中的component的。而这正是被很多railser们告诫要小心的地方,甚至有人说component是evil的,新版1stlog发布在即,我得好好了解下component为什么evil。

    \n

    一、为什么当时选择component

    \n

    选择component是根据当时的设计需求来的,1stlog设计的时候是作为一个只有基本blog功能的大框架,而其他的一些个性化功能,需要由其他开发人员或者爱好者来按照一定的规范开发和编写,当时认为,使用component时自简单有效的策略,您可以参考我当时编写”1stlog插件开发指南“。

    \n

    二、为什么说component是邪恶的

    \n

    有人说Rails中的component是邪恶的,千万不要使用,原因呢,还真不清楚,看到有人这么写:\n

    \n
    Using Components 
    \n
    \n \n
      \n
    1. Components don’t belong in Rails. Don’t use them. They weren’t an
      \n
    2. \n
    3. extraction. They weren’t well planned. When you want to use a
      \n
    4. \n
    5. component it is probably because you misunderstand them or
      \n
    6. \n
    7. really want a partial. Rethink what you’re doing.
      \n
    8. \n
    9. The rest of the Rails world has written off components for a
      \n
    10. \n
    11. reason and they’ll probably be deprecated by 2.0. Resist.  
    12. \n
    \n
    \n

    \n

    也有人拿typo中使用component导致响应很迟钝的数据说明,可以参考“Components may not be evil, but they sure can be slow”,再看看Rails的DHH咋说的呢?哦,他说”Why engines and components are not evil but distracting

    \n

    这么看来,component并不邪恶了,只是慢一点,有些小问题罢了。

    \n

    三、还用不用?

    \n

    竟然大家都持谨慎态度,那么我们还用不用呢?用!但是或许得换个方式用。此话怎么讲?因为有一个既可以实现component功能,又不evil的东西出现了,那就是Cells,何谓Cells?还是看他的自白好了:

    \n

    \"\"

    \n
    \n

    A rails plugin to push things towards component-oriented architecture. Controller logic and views are encapsulated in lightweight cells and can be rendered like render_component.

    \n
    \n

    哦,看来是个好东西,还想多了解点,看看这些文章吧,"Cells: Bringing Components Back Into Rails 3"或者中文简要版本”插件Cells:把模块化带入Rails 应用中,组件导向轻量级的开发“,还可以看看道喜的简介”Rails框架:组件理念是否重返Rails框架“,或者看看中文的一个简单那的例子”有人用过cell么?“,如果想更深入的了解,可以看看”Ruby Component Web Frameworks

    \n

    四、还有更好的?

    \n

    我是不知道了,您要是知道的话,还请告诉我。

    \n

    参考资料:

    \n

    1、http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails

    \n

    2、http://usurffx-gmail-com.javaeye.com/blog/176186

    \n

    3、https://groups.google.com/group/ruby-component-web-frameworks

    \n

    4、http://chinaonrails.com/topic/view/1318/1.html

    \n

    5、http://www.lycom.de/past/2008/2/14/component-2008-02-14/#comments

    \n

    6、http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow

    \n

    7、http://weblog.rubyonrails.org/2005/11/11/why-engines-and-components-are-not-evil-but-distracting/

    \n

    8、http://rubyforge.org/projects/cells/

    ", "created_at"=>2008-04-21 07:36:43 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    由于打算将我的第一个开源项目1stlog重构和完善,看了下以前的实现方式,除了用到了很对rails2不支持的方法和插件外(正在着手修改),还用到了Rails中的component的。而这正是被很多railser们告诫要小心的地方,甚至有人说component是evil的,新版1stlog发布在即,我得好好了解下component为什么evil。
    \n一、为什么当时选择component
    \n选择component是根据当时的设计需求来的,1stlog设计的时候是作为一个只有基本blog功能的大框架,而其他的一些个性化功能,需要由其他开发人员或者爱好者来按照一定的规范开发和编写,当时认为,使用component时自简单有效的策略,您可以参考我当时编写”1stlog插件开发指南“。
    \n二、为什么说component是邪恶的
    \n有人说Rails中的component是邪恶的,千万不要使用,原因呢,还真不清楚,看到有人这么写:
    \n
    \nUsing Components 
    \n
    \n
    \n
    \n Components don’t belong in Rails. Don’t use them. They weren’t an
    \n
    \n extraction. They weren’t well planned. When you want to use a
    \n
    \n component it is probably because you misunderstand them or
    \n
    \n really want a partial. Rethink what you’re doing.
    \n
    \n The rest of the Rails world has written off components for a
    \n
    \n reason and they’ll probably be deprecated by 2.0. Resist.  
    \n
    \n
    \n
    \n也有人拿typo中使用component导致响应很迟钝的数据说明,可以参考“Components may not be evil, but they sure can be slow”,再看看Rails的DHH咋说的呢?哦,他说”Why engines and components are not evil but distracting“
    \n这么看来,component并不邪恶了,只是慢一点,有些小问题罢了。
    \n三、还用不用?
    \n竟然大家都持谨慎态度,那么我们还用不用呢?用!但是或许得换个方式用。此话怎么讲?因为有一个既可以实现component功能,又不evil的东西出现了,那就是Cells,何谓Cells?还是看他的自白好了:
    \n
    \n
    \nA rails plugin to push things towards component-oriented architecture. Controller logic and views are encapsulated in lightweight cells and can be rendered like render_component.
    \n
    \n哦,看来是个好东西,还想多了解点,看看这些文章吧,"Cells: Bringing Components Back Into Rails 3"或者中文简要版本”插件Cells:把模块化带入Rails 应用中,组件导向轻量级的开发“,还可以看看道喜的简介”Rails框架:组件理念是否重返Rails框架“,或者看看中文的一个简单那的例子”有人用过cell么?“,如果想更深入的了解,可以看看”Ruby Component Web Frameworks“
    \n四、还有更好的?
    \n我是不知道了,您要是知道的话,还请告诉我。
    \n参考资料:
    \n1、http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails
    \n2、http://usurffx-gmail-com.javaeye.com/blog/176186
    \n3、https://groups.google.com/group/ruby-component-web-frameworks
    \n4、http://chinaonrails.com/topic/view/1318/1.html
    \n5、http://www.lycom.de/past/2008/2/14/component-2008-02-14/#comments
    \n6、http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow
    \n7、http://weblog.rubyonrails.org/2005/11/11/why-engines-and-components-are-not-evil-but-distracting/
    \n8、http://rubyforge.org/projects/cells/

    \n", "_id"=>262}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"TibetIsXiZang,Tell this to all over the world,Tibet就是西藏!", "body"=>"

    首先,我并不是一个专业的SEOer而只是个懂点安全对于互联网充满期待的程序员…并且在业务时间喜欢去Zac的“SEO每天一贴”和点石互动转转,喜欢观察观察网络风云的“互联网重度使用者”。

    \n

    我喜欢安静的写着代码,而不喜欢参与到关于政治方面的讨论和争辩,但我敢拍着胸脯说,我为我的祖国自豪。经历这一次浩浩荡荡的,仍然在继续的事情,我被很多人感动着。

    \n

    面对3.14发生下西藏的特殊事件,国外媒体的声音让我们首先是愤怒,接着是无奈,最后市打心底里看不起。就像一个朋友到CNN的时候,联系到前段时间CNN捏造了所谓中国政府资助一些”黑客“入侵了一些网站的’黑客门事件‘等,朋友说了这么一句话,“原来国外的媒体素质是这么低,这么多年,真是高看他们了”,无奈,瞧不起,我打心底里是这样的。

    \n

    西藏的事件和最近闹得沸沸扬扬的“圣火传递事件”,再加上CNN的那个素质低下的主持人和BBC的一些话语,巴黎的一些让人震惊的行为,一些政客们无耻的嘴脸,一些被人、媒体操纵了的民众无知的行为,言论;还有那披着宗教的外衣到处兴风作浪的可怜的小人,以及某些国家的领导人虚情假意的外交辞令,这都是丑陋的;

    \n

    相反,我被国外留学生,网络上的爱国人士,去游街宣传奥运的人,抵制家乐福,支持奥运,挂上”红心china“的上班族们,那些QQ群,社区,还有那些以比较极端的”技术手段“让其网站飘满五星红旗而最后被迫关闭的一小撮人,都是值得骄傲的。

    \n

    但是,这些是不够的,看到前些日子Zac说,最需要网络营销的是我们的国家,因为很多外国的民众是善良的,被其媒体愚弄的,zac说的一句话让我映像深刻:新加坡的一位朋友问‘北京有楼房么?’。这不是少数,而是现况,世界真的不了解我们。

    \n

    该怎么办?在互联网的今天,网络的力量是巨大的,当你在Google输入'Tibet'的时候,当你输入’xizang‘或者”西藏“的时候,你找到的都是什么网页,什么信息。你可以自己去试试看。

    \n

    做为国内知名的SEO聚集区的点石,SEOer们用自己的方式,来感动我们,第二届中文搜索引擎优化大赛“的关键字由”TibetIsXiZang“改为“tibet xizang”和’西藏‘做为最终的比赛关键字,用意十分清晰。

    \n

    我虽然不是SEOer,也不会刻意的去注册域名,做一个网站参与比赛,但我会使用现有的资源做些力所能及的事情,比如在Google开通了”TibetIsXiZang“的Group,还会有其他的动作。

    \n

    让不久后,还世界一个真实的西藏,让世界所有的人知道,Tibet IS XiZang...

    ", "created_at"=>2008-04-22 05:49:37 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    首先,我并不是一个专业的SEOer,而只是个懂点安全对于互联网充满期待的程序员…并且在业务时间喜欢去Zac的“SEO每天一贴”和点石互动转转,喜欢观察观察网络风云的“互联网重度使用者”。
    \n我喜欢安静的写着代码,而不喜欢参与到关于政治方面的讨论和争辩,但我敢拍着胸脯说,我为我的祖国自豪。经历这一次浩浩荡荡的,仍然在继续的事情,我被很多人感动着。
    \n面对3.14发生下西藏的特殊事件,国外媒体的声音让我们首先是愤怒,接着是无奈,最后市打心底里看不起。就像一个朋友到CNN的时候,联系到前段时间CNN捏造了所谓中国政府资助一些”黑客“入侵了一些网站的’黑客门事件‘等,朋友说了这么一句话,“原来国外的媒体素质是这么低,这么多年,真是高看他们了”,无奈,瞧不起,我打心底里是这样的。
    \n将西藏的事件和最近闹得沸沸扬扬的“圣火传递事件”,再加上CNN的那个素质低下的主持人和BBC的一些话语,巴黎的一些让人震惊的行为,一些政客们无耻的嘴脸,一些被人、媒体操纵了的民众无知的行为,言论;还有那披着宗教的外衣到处兴风作浪的可怜的小人,以及某些国家的领导人虚情假意的外交辞令,这都是丑陋的;
    \n相反,我被国外留学生,网络上的爱国人士,去游街宣传奥运的人,抵制家乐福,支持奥运,挂上”红心china“的上班族们,那些QQ群,社区,还有那些以比较极端的”技术手段“让其网站飘满五星红旗而最后被迫关闭的一小撮人,都是值得骄傲的。
    \n但是,这些是不够的,看到前些日子Zac说,最需要网络营销的是我们的国家,因为很多外国的民众是善良的,被其媒体愚弄的,zac说的一句话让我映像深刻:新加坡的一位朋友问‘北京有楼房么?’。这不是少数,而是现况,世界真的不了解我们。
    \n该怎么办?在互联网的今天,网络的力量是巨大的,当你在Google输入'Tibet'的时候,当你输入’xizang‘或者”西藏“的时候,你找到的都是什么网页,什么信息。你可以自己去试试看。
    \n做为国内知名的SEO聚集区的点石,SEOer们用自己的方式,来感动我们,”第二届中文搜索引擎优化大赛“的关键字由”TibetIsXiZang“改为“tibet xizang”和’西藏‘做为最终的比赛关键字,用意十分清晰。
    \n我虽然不是SEOer,也不会刻意的去注册域名,做一个网站参与比赛,但我会使用现有的资源做些力所能及的事情,比如在Google开通了”TibetIsXiZang“的Group,还会有其他的动作。
    \n让不久后,还世界一个真实的西藏,让世界所有的人知道,Tibet IS XiZang...

    \n", "_id"=>263}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Amazon SQS,分布式作业不再费心", "body"=>"

    开始写这个之前,我不得不佩服下Amazon,不用说别的,就其SimpleDB,S3,EC2这几个就足以让业界大为惊叹,这些都比较熟悉了,今天说的是另外一个类似的东西,Amazon Simple Queue Service(SQS)。

    \n

    看名字,大概就可以猜出大概的意思了,对,就是队列服务,SQS就是一个简单的队列服务,你可以创建一个队列,然后从不同的地方往里面东西,然后又可以在不同的地方不停的往外东西,想想看,这不就是分布式协作么。

    \n

    但是需要注意的是,往里面放的时候,消息必须是txet,也就是是说不能放Hash或者数组啥的,如果您有类似需求,请接着往后看,我将提供一个变通的方法。

    \n

    一、简介SQS

    \n

    Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available.

    \n

    二、如何使用

    \n

    Ruby的社区足够活跃,每个应用都能找到对应的Gem或者插件,这给了我们足够的方便,针对SQS,我推荐的两个gem,分别是:

    \n

    1、SQS Gem
    \n

    \n

    这个插件是Amazon SQS官方站点写的教程《Using Amazon S3, EC2, SQS, Lucene, and Ruby for Web Spidering》上使用的,足够的简单,但是其主页貌似访问不了了,只能通过Google Cach看看。

    \n

    使用非常方便,流程如下

    \n

    1)安装:gem install SQS

    \n

    2)测试:ruby test/all_tests.rb

    \n

    3)使用示例\n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'sqs'  
    4. \n
    5.   
    6. \n
    7. SQS.access_key_id = 'YOURACCESSKEYID'  
    8. \n
    9. SQS.secret_access_key = 'YOURSECRETACCESSKEY'  
    10. \n
    11.   
    12. \n
    13. q = SQS.create_queue 'myFantasticQ'  
    14. \n
    15. puts q.url  
    16. \n
    17.   
    18. \n
    19. SQS.each_queue do |q|  
    20. \n
    21.   puts q.name  
    22. \n
    23. end  
    24. \n
    25.   
    26. \n
    27. q = SQS.get_queue 'myFantasticQ'  
    28. \n
    29.   
    30. \n
    31. q.send_message 'This is a message!'  
    32. \n
    33.   
    34. \n
    35. m = q.receive_message  
    36. \n
    37. puts m.body  
    38. \n
    39. m.delete  
    40. \n
    41.   
    42. \n
    43. q.each_message do |m|  
    44. \n
    45.   # note that #each_message is an infinite loop!  
    46. \n
    47.   # you must either break out of it, or delete each message you receive  
    48. \n
    49.   m.delete  
    50. \n
    51. end  
    52. \n
    53.   
    54. \n
    55. q.approximate_number_of_messages  
    56. \n
    57. q.visibility_timeout  
    58. \n
    59. q.visibiltit_timeout = 3  
    60. \n
    61.   
    62. \n
    63. q.delete  
    64. \n
    \n
    \n其他文章,可以自己Google。

    \n

    2、RightScale gems

    \n

    RightScale gemsRightScale 从其产品里面提取出来的,这个现象很常见,就像Shopify 中提取的Active Merchant一样,从一个成熟的产品中提取出来一个gem,其可用性是相当高的。

    \n

    使用方法大同小异,不再赘述,如果感兴趣,请到上面的地址上自行查看。

    \n

    三、如何扩展

    \n

    前面我们说了,SQS中容纳的消息是text的,但是看其文档表述,是这样写的:

    \n
    \n

    New messages can be added to a queue at any time. The message body can contain up to 8 KB of text in any format.

    \n
    \n

    any time?啥意思?奇怪。

    \n

    我认为一种可行的办法是,把Hash转成ymal格式的(.to_yaml),然后放进去后;取出的时候,直接YAML.load(message.body),然后再还原即可了。

    \n

    看段代码,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'SQS'  
    2. \n
    3. class Tsqs  
    4. \n
    5. SQS.conf_file = 'sqs_conf.yml'  
    6. \n
    7. s = SQS.new  
    8. \n
    9. puts s.api_version  
    10. \n
    11. puts s.conf_file  
    12. \n
    13. puts s.url_for_query  
    14. \n
    15. iceskysl = s.get_queue('iceskysl_message')  
    16. \n
    17. books_to_update = { 'bookid'=>"1",'url'=>"url1",'queue'=>"queue1"}  
    18. \n
    19. iceskysl.send_message(books_to_update.to_yaml)  
    20. \n
    21.   
    22. \n
    23. iceskysl_messages = iceskysl.receive_messages  
    24. \n
    25. puts iceskysl_messages.size  
    26. \n
    27. iceskysl_messages.each do |message|  
    28. \n
    29.  params = YAML.load(message.body)  
    30. \n
    31.  puts "bookid=" + params[:bookid] + ",url=" + params[:url] +  ",queue=" + params[:queue]  
    32. \n
    33.   message.delete  
    34. \n
    35. end  
    36. \n
    37. end  
    38. \n
    \n
    \n看明白了么,没问题吧,呵呵。另外,这里还有一篇文章使用的是RightScale gems。

    \n

    OK,差不多介绍完了,有疑问或者有其他好的gem请告诉我,谢谢。

    \n

    参考文档:

    \n
      \n
    1. SQS API:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1148&categoryID=102
    2. \n
    3. SQS主页:http://www.amazon.com/Simple-Queue-Service-home-page/b/ref=sc_fe_l_2/102-6256901-8077705?ie=UTF8&node=13584001&no=3435361&me=A36L942TSJ2AJA
    4. \n
    \n

     

    ", "created_at"=>2008-04-23 02:03:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    开始写这个之前,我不得不佩服下Amazon,不用说别的,就其SimpleDB,S3,EC2这几个就足以让业界大为惊叹,这些都比较熟悉了,今天说的是另外一个类似的东西,Amazon Simple Queue Service(SQS)。
    \n看名字,大概就可以猜出大概的意思了,对,就是队列服务,SQS就是一个简单的队列服务,你可以创建一个队列,然后从不同的地方往里面放东西,然后又可以在不同的地方不停的往外取东西,想想看,这不就是分布式协作么。
    \n但是需要注意的是,往里面放的时候,消息必须是txet,也就是是说不能放Hash或者数组啥的,如果您有类似需求,请接着往后看,我将提供一个变通的方法。
    \n一、简介SQS
    \nAmazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available.
    \n二、如何使用
    \nRuby的社区足够活跃,每个应用都能找到对应的Gem或者插件,这给了我们足够的方便,针对SQS,我推荐的两个gem,分别是:
    \n1、SQS Gem
    \n
    \n这个插件是Amazon SQS官方站点写的教程《Using Amazon S3, EC2, SQS, Lucene, and Ruby for Web Spidering》上使用的,足够的简单,但是其主页貌似访问不了了,只能通过Google Cach看看。
    \n使用非常方便,流程如下
    \n1)安装:gem install SQS
    \n2)测试:ruby test/all_tests.rb
    \n3)使用示例
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'sqs'  
    \n   
    \n SQS.access_key_id = 'YOURACCESSKEYID'  
    \n SQS.secret_access_key = 'YOURSECRETACCESSKEY'  
    \n   
    \n q = SQS.create_queue 'myFantasticQ'  
    \n puts q.url  
    \n   
    \n SQS.each_queue do |q|  
    \n   puts q.name  
    \n end  
    \n   
    \n q = SQS.get_queue 'myFantasticQ'  
    \n   
    \n q.send_message 'This is a message!'  
    \n   
    \n m = q.receive_message  
    \n puts m.body  
    \n m.delete  
    \n   
    \n q.each_message do |m|  
    \n   # note that #each_message is an infinite loop!  
    \n   # you must either break out of it, or delete each message you receive  
    \n   m.delete  
    \n end  
    \n   
    \n q.approximate_number_of_messages  
    \n q.visibility_timeout  
    \n q.visibiltit_timeout = 3  
    \n   
    \n q.delete  
    \n
    \n
    \n其他文章,可以自己Google。
    \n2、RightScale gems
    \nRightScale gems是RightScale 从其产品里面提取出来的,这个现象很常见,就像Shopify 中提取的Active Merchant一样,从一个成熟的产品中提取出来一个gem,其可用性是相当高的。
    \n使用方法大同小异,不再赘述,如果感兴趣,请到上面的地址上自行查看。
    \n三、如何扩展
    \n前面我们说了,SQS中容纳的消息是text的,但是看其文档表述,是这样写的:
    \n
    \nNew messages can be added to a queue at any time. The message body can contain up to 8 KB of text in any format.
    \n
    \nany time?啥意思?奇怪。
    \n我认为一种可行的办法是,把Hash转成ymal格式的(.to_yaml),然后放进去后;取出的时候,直接YAML.load(message.body),然后再还原即可了。
    \n看段代码,如下:
    \n
    \n
    \nRuby代码
    \n
    \n require 'SQS'  
    \n class Tsqs  
    \n SQS.conf_file = 'sqs_conf.yml'  
    \n s = SQS.new  
    \n puts s.api_version  
    \n puts s.conf_file  
    \n puts s.url_for_query  
    \n iceskysl = s.get_queue('iceskysl_message')  
    \n books_to_update = { 'bookid'=>"1",'url'=>"url1",'queue'=>"queue1"}  
    \n iceskysl.send_message(books_to_update.to_yaml)  
    \n   
    \n iceskysl_messages = iceskysl.receive_messages  
    \n puts iceskysl_messages.size  
    \n iceskysl_messages.each do |message|  
    \n  params = YAML.load(message.body)  
    \n  puts "bookid=" + params[:bookid] + ",url=" + params[:url] +  ",queue=" + params[:queue]  
    \n   message.delete  
    \n end  
    \n end  
    \n
    \n
    \n看明白了么,没问题吧,呵呵。另外,这里还有一篇文章使用的是RightScale gems。
    \nOK,差不多介绍完了,有疑问或者有其他好的gem请告诉我,谢谢。
    \n参考文档:
    \n
    \n SQS API:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1148&categoryID=102;
    \n SQS主页:http://www.amazon.com/Simple-Queue-Service-home-page/b/ref=sc_fe_l_2/102-6256901-8077705?ie=UTF8&node=13584001&no=3435361&me=A36L942TSJ2AJA;
    \n
    \n 

    \n", "_id"=>264}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"终于等到Google Docs Offline了", "body"=>"

    早就在Gseek看到GoogleDocs可以离线的消息,但是我的帐户里面一直还没有发现,好歹我也算Dcos的重度使用者,咋一直没看到这个功能呢?

    \n

    今天猛然发现,OK了,我等到了,呵呵。

    \n

    Overview: What is Google Docs Offline?
    \n 
    \nGoogle Docs now allows you to view and edit your documents offline, without an internet connection. To do all of this, Google Docs uses Google Gears, an open source browser extension that adds offline functionality directly to the browser. Google Docs can be accessed offline by typing http://docs.google.com into your browser or by clicking on the desktop shortcut that is downloaded during the installation process.

    \n

    挺好的,可以彻底不用Word和OpenOffice咯。三者比较下,我还是喜欢GoogleDocs的这个简洁和方便,不过不得不说几句,上次的改变,把那结果H1 H2 H3几个放到下拉菜单,不是好的用户体验,每次都多点一下,囧~

    \n

    有了离线后,以后带着本本就不怕没网络咯,Good~

    ", "created_at"=>2008-04-23 06:40:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    早就在Gseek看到GoogleDocs可以离线的消息,但是我的帐户里面一直还没有发现,好歹我也算Dcos的重度使用者,咋一直没看到这个功能呢?
    \n今天猛然发现,OK了,我等到了,呵呵。
    \nOverview: What is Google Docs Offline?
    \n 
    \nGoogle Docs now allows you to view and edit your documents offline, without an internet connection. To do all of this, Google Docs uses Google Gears, an open source browser extension that adds offline functionality directly to the browser. Google Docs can be accessed offline by typing http://docs.google.com into your browser or by clicking on the desktop shortcut that is downloaded during the installation process.
    \n挺好的,可以彻底不用Word和OpenOffice咯。三者比较下,我还是喜欢GoogleDocs的这个简洁和方便,不过不得不说几句,上次的改变,把那结果H1 H2 H3几个放到下拉菜单,不是好的用户体验,每次都多点一下,囧~
    \n有了离线后,以后带着本本就不怕没网络咯,Good~

    \n", "_id"=>265}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lower Data Transfer Costs,AWS降价,欢喜吧.", "body"=>"

    晚上收到Amazon的AWS的邮件,说降价了,哈,真是好消息,前台在写<Google App Engine,前途无量,充满乐趣>的时候,还说到"同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。",不想到,这么快,Amazon就有动作了,真是好消息,直接看原文吧,总觉得用中文把E文再重复一遍挺浪费的,也比较别扭,总感觉有些外文不好使用中文表述出来,呵呵.

    \n

    =====================start===================
    \n

    \n

    Dear Amazon Web Services developers,\n

    We've often told you that one of our goals is to drive down costs continuously and to pass those savings on to you. We have been able to reduce our costs for data transfer, so we're pleased to announce that we're lowering our pricing for data transfer, effective May 1, 2008. You'll notice below that we've reduced price at every existing usage tier of transfer out, as well as added an additional tier for the heaviest users.

    \n

    Current data transfer price (through April 30, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.180 per GB - first 10 TB / month data transfer out
    \n$0.160 per GB - next 40 TB / month data transfer out
    \n$0.130 per GB - data transfer out / month over 50 TB

    \n

    Data transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.

    \n

    New data transfer price (effective May 1, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.170 per GB - first 10 TB / month data transfer out
    \n$0.130 per GB - next 40 TB / month data transfer out
    \n$0.110 per GB - next 100 TB / month data transfer out
    \n$0.100 per GB - data transfer out / month over 150 TB

    \n

    Data transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.

    \n

    The result of this pricing change is that all customers will see a reduction in the price of transfer out. For example, a customer transferring 50TB a month will save 16% and a customer transferring 500TB a month will save 26% on transfer with the new pricing. Please see http://aws.amazon.com for full pricing information for each service.

    \n

    Sincerely,
    \nThe Amazon Web Services Team

    \n

    ================end-==================

    \n

    当然了,你也可以到Amazon官方网站上看到这个消息,"Announcement: Lower Data Transfer Costs"

    \n

    AWS越来越成熟,在继支持静态IP和固定存储后,这又是一个大的变化,如果啥时能使得国内的访问速度提上去的话,对国内的WEB人员将是最大的幸福了.继续期待...

    \n

     

    \n

    ", "created_at"=>2008-04-23 15:30:30 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    晚上收到Amazon的AWS的邮件,说降价了,哈,真是好消息,前台在写<Google App Engine,前途无量,充满乐趣>的时候,还说到"同时,不可否认,会给亚马逊的S3,EC2,SQS等带来一些竞争,当然,这会使得这个领域更加合理和更多的选择。",不想到,这么快,Amazon就有动作了,真是好消息,直接看原文吧,总觉得用中文把E文再重复一遍挺浪费的,也比较别扭,总感觉有些外文不好使用中文表述出来,呵呵.
    \n=====================start===================
    \n
    \nDear Amazon Web Services developers,
    \nWe've often told you that one of our goals is to drive down costs continuously and to pass those savings on to you. We have been able to reduce our costs for data transfer, so we're pleased to announce that we're lowering our pricing for data transfer, effective May 1, 2008. You'll notice below that we've reduced price at every existing usage tier of transfer out, as well as added an additional tier for the heaviest users.
    \nCurrent data transfer price (through April 30, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.180 per GB - first 10 TB / month data transfer out
    \n$0.160 per GB - next 40 TB / month data transfer out
    \n$0.130 per GB - data transfer out / month over 50 TB
    \nData transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.
    \nNew data transfer price (effective May 1, 2008)
    \n$0.100 per GB - data transfer in
    \n$0.170 per GB - first 10 TB / month data transfer out
    \n$0.130 per GB - next 40 TB / month data transfer out
    \n$0.110 per GB - next 100 TB / month data transfer out
    \n$0.100 per GB - data transfer out / month over 150 TB
    \nData transfer "in" and "out" refers to transfer into and out of the Amazon service. Data transferred between Amazon EC2 and Amazon S3-US, Amazon SimpleDB and Amazon SQS is free of charge (i.e., $0.00 per GB). Data transferred between Amazon EC2 and Amazon S3-Europe will be charged at regular rates.
    \nThe result of this pricing change is that all customers will see a reduction in the price of transfer out. For example, a customer transferring 50TB a month will save 16% and a customer transferring 500TB a month will save 26% on transfer with the new pricing. Please see http://aws.amazon.com for full pricing information for each service.
    \nSincerely,
    \nThe Amazon Web Services Team
    \n================end-==================
    \n当然了,你也可以到Amazon官方网站上看到这个消息,"Announcement: Lower Data Transfer Costs"
    \nAWS越来越成熟,在继支持静态IP和固定存储后,这又是一个大的变化,如果啥时能使得国内的访问速度提上去的话,对国内的WEB人员将是最大的幸福了.继续期待...
    \n 

    \n", "_id"=>266}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用RMagick动态生成图片", "body"=>"

    很早前就有类似的需求了,但是当时恐惧RMagick的庞大身躯,加上其对中文的支持布什很完善,就没怎么去在意他,最近一个项目中需要生成一些动态的图片,本来使用了Google的那个chart功能,后来觉得有点牵强附会,于是乎,静下心来,仔细看看RMagick咋生成图片。

    \n

    我的需求很简单,就是动态生成一个指定大小的图片,然后再图片上写几个汉字或者数字,英文等,所以大概的步骤就是这样的,直接看代码吧:\n

    \n
    Ruby代码
    \n
      \n
    1. require 'RMagick'  
    2. \n
    3. class DrawPrice  
    4. \n
    5.   
    6. \n
    7.     def self.draw(name,nickname,email,blog='http://iceskysl.1sters.com/',columns=240,rows=80,bg_color='white')  
    8. \n
    9.          img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    10. \n
    11.          gc = Magick::Draw.new    
    12. \n
    13.          gc.stroke('transparent')    
    14. \n
    15.          gc.pointsize(16)    
    16. \n
    17.          gc.font("fonts/simhei.ttf")    
    18. \n
    19.          gc.text(10,30, "姓名:\#{nickname}")    
    20. \n
    21.          gc.text(10,50, "Email:\#{email}.")    
    22. \n
    23.          gc.pointsize(13)    
    24. \n
    25.          gc.text(10,70, blog)    
    26. \n
    27.          gc.draw(img)    
    28. \n
    29.          img.write("files/\#{name}.jpg")  
    30. \n
    31.      end  
    32. \n
    33.   
    34. \n
    35.  end  
    36. \n
    37.   
    38. \n
    39.  DrawPrice.draw("Ysl","IceskYsl","iceskysl@gmail.com")  
    40. \n
    \n
    \n再看个效果图:

    \n

    虽然很多函数,但是我们用到的就那么几个,Good~不是吗?

    \n

    参考文档:

    \n

    http://www.javaeye.com/post/262865

    \n

    http://www.javaeye.com/topic/174048

    \n

    http://www.javaeye.com/post/380907

    \n

    http://www.simplesystems.org/RMagick/doc/image1.html#new

    \n

    http://rmagick.rubyforge.org/portfolio3.html

    \n

     

    ", "created_at"=>2008-04-24 08:20:28 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很早前就有类似的需求了,但是当时恐惧RMagick的庞大身躯,加上其对中文的支持布什很完善,就没怎么去在意他,最近一个项目中需要生成一些动态的图片,本来使用了Google的那个chart功能,后来觉得有点牵强附会,于是乎,静下心来,仔细看看RMagick咋生成图片。
    \n我的需求很简单,就是动态生成一个指定大小的图片,然后再图片上写几个汉字或者数字,英文等,所以大概的步骤就是这样的,直接看代码吧:
    \n
    \nRuby代码
    \n
    \n require 'RMagick'  
    \n class DrawPrice  
    \n   
    \n     def self.draw(name,nickname,email,blog='http://iceskysl.1sters.com/',columns=240,rows=80,bg_color='white')  
    \n          img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    \n          gc = Magick::Draw.new    
    \n          gc.stroke('transparent')    
    \n          gc.pointsize(16)    
    \n          gc.font("fonts/simhei.ttf")    
    \n          gc.text(10,30, "姓名:\#{nickname}")    
    \n          gc.text(10,50, "Email:\#{email}.")    
    \n          gc.pointsize(13)    
    \n          gc.text(10,70, blog)    
    \n          gc.draw(img)    
    \n          img.write("files/\#{name}.jpg")  
    \n      end  
    \n   
    \n  end  
    \n   
    \n  DrawPrice.draw("Ysl","IceskYsl","iceskysl@gmail.com")  
    \n
    \n
    \n再看个效果图:
    \n虽然很多函数,但是我们用到的就那么几个,Good~不是吗?
    \n参考文档:
    \nhttp://www.javaeye.com/post/262865
    \nhttp://www.javaeye.com/topic/174048
    \nhttp://www.javaeye.com/post/380907
    \nhttp://www.simplesystems.org/RMagick/doc/image1.html#new
    \nhttp://rmagick.rubyforge.org/portfolio3.html
    \n 

    \n", "_id"=>267}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu 8.04 LTS (Hardy Heron)和Netbeans6.1发布啦~", "body"=>"

    最近好热闹,不说 Google App Engine Amazon降价,又有两个和我相关的重磅消息,那就是 Ubuntu 8.04 LTS (Hardy Heron) 按时发布了,另外就是NetBeans IDE 6.1发布了。

    \n

    我个人使用NetBeans IDE在Ubuntu下好长一段时间了,这两个新闻自然和我息息相关咯,找个时间,把7.10升级到8.04去,啥时在Down个NetBeans IDE 6.1下来。

    \n

    哦,对了,刚看到一个消息,貌似MySQL 5.1.24 rc版本中已取消集群功能,意味着什么,意味着MYSQL也会被肢解,一部分拿去赚钱了,这是个坏消息。

    \n

    wowo~真热闹~

    ", "created_at"=>2008-04-24 20:38:11 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近好热闹,不说 Google App Engine 和Amazon降价,又有两个和我相关的重磅消息,那就是 Ubuntu 8.04 LTS (Hardy Heron) 按时发布了,另外就是NetBeans IDE 6.1发布了。
    \n我个人使用NetBeans IDE在Ubuntu下好长一段时间了,这两个新闻自然和我息息相关咯,找个时间,把7.10升级到8.04去,啥时在Down个NetBeans IDE 6.1下来。
    \n哦,对了,刚看到一个消息,貌似MySQL 5.1.24 rc版本中已取消集群功能,意味着什么,意味着MYSQL也会被肢解,一部分拿去赚钱了,这是个坏消息。
    \nwowo~真热闹~

    \n", "_id"=>268}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"成功升级到Ubuntu8.08和Netbeans6.1", "body"=>"

    正如前面的这篇文章说的,Ubuntu8.04和NB6.1都发布了,我自然得抓紧升级了,正好今天调班在家休息,一觉睡到12点多,起来开始升级,先把重要的资料备份到另外一台电脑上,然后按照google出来的资料升级,我是用命令行升级的.

    \n

    1.修改源地址

    \n

    我以前的源很乱,正好这次一并清理下,把以前的 710的时候的源备份下,然后测了下google出来的那些源,选了个台湾的最快,(后来升级的时候发现这个源上有几个包当时下载不了,后来又加了一组上海电信的源)

    \n

    sudo gedit /etc/apt/sources.list

    \n

    \n

    \n
    这是我使用的源
    \n
      \n
    1. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse  
    2. \n
    3. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse  
    4. \n
    5. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse  
    6. \n
    7. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse  
    8. \n
    9. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse  
    10. \n
    11. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse  
    12. \n
    13. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse  
    14. \n
    15. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse  
    16. \n
    17. deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe  
    18. \n
    19. deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse   
    20. \n
    21.   
    22. \n
    23. deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse  
    24. \n
    25. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse  
    26. \n
    27. deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse  
    28. \n
    29. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse  
    30. \n
    31. deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse  
    32. \n
    33. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse  
    34. \n
    35. deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse  
    36. \n
    37. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse  
    38. \n
    39. deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe  
    40. \n
    41. deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse   
    42. \n
    43.   
    44. \n
    45. deb http://archive.ubuntu.org.cn/ubuntu-cn/ hardy main restricted universe multiverse  
    46. \n
    \n
    \n其他的请参考:http://hi.baidu.com/jmlover/blog/item/3b2e3bf3cd0e0b54352accd9.html

    \n

    2.执行升级命令

    \n

    sudo apt-get update

    \n

    sudo apt-get  upgrade

    \n

    3.修复相关问题

    \n

    由于我是使用Xfce的,所以最开始升级的时候忘记升级相应的xfce了,导致后来启动的时候,没有UI界面,并遇到了scree not found的问题;然后修复了小企鹅输入法的方块问题,并做了些美化.

    \n

    这些问题google都是可以找到答案的,我也没具体记是咋整的,呵呵,反正是可以解决的.

    \n

    4.安装了NB6.1版本

    \n

    差不多搞了一下午,,中途睡了一觉,遇到一些问题都解决了,呵呵,但没感觉到8.04的有啥不一样的地方,哈哈..

    \n

     

    ", "created_at"=>2008-04-25 15:04:23 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    正如前面的这篇文章说的,Ubuntu8.04和NB6.1都发布了,我自然得抓紧升级了,正好今天调班在家休息,一觉睡到12点多,起来开始升级,先把重要的资料备份到另外一台电脑上,然后按照google出来的资料升级,我是用命令行升级的.
    \n1.修改源地址
    \n我以前的源很乱,正好这次一并清理下,把以前的 710的时候的源备份下,然后测了下google出来的那些源,选了个台湾的最快,(后来升级的时候发现这个源上有几个包当时下载不了,后来又加了一组上海电信的源)
    \nsudo gedit /etc/apt/sources.list
    \n
    \n
    \n这是我使用的源
    \n
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe;  
    \n deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse;   
    \n   
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse;  
    \n deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe;  
    \n deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse;   
    \n   
    \n deb http://archive.ubuntu.org.cn/ubuntu-cn/ hardy main restricted universe multiverse;  
    \n
    \n
    \n其他的请参考:http://hi.baidu.com/jmlover/blog/item/3b2e3bf3cd0e0b54352accd9.html
    \n2.执行升级命令
    \nsudo apt-get update
    \nsudo apt-get  upgrade
    \n3.修复相关问题
    \n由于我是使用Xfce的,所以最开始升级的时候忘记升级相应的xfce了,导致后来启动的时候,没有UI界面,并遇到了scree not found的问题;然后修复了小企鹅输入法的方块问题,并做了些美化.
    \n这些问题google都是可以找到答案的,我也没具体记是咋整的,呵呵,反正是可以解决的.
    \n4.安装了NB6.1版本
    \n差不多搞了一下午,,中途睡了一觉,遇到一些问题都解决了,呵呵,但没感觉到8.04的有啥不一样的地方,哈哈..
    \n 

    \n", "_id"=>269}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu Hardy(8.04)源列表大全不断更新中)", "body"=>"

    升级的时候老是寻找最可靠的源,下面收集一些来自互联网的UBuntu8.04的源,供大家使用,会不断的更新和测试,谢谢.

    \n

    如下列举了部分电信,网通和双线的源,每个人具体的所在位置有些不同,所以速度相对来说是不一样,甚至差别很大的,所以各位在选的时候,先ping下看看那组最快,谢谢.

    \n

    Ubuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):
    \n
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \n
    \nArchive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):
    \n
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \nMirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
    \n
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):
    \n
    \ndeb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n厦门大学更新服务器(教育网服务器):
    \n
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \n
    \n成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==
    \n
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe

    \n

    北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):
    \n
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):
    \n
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nubuntu.cnsite.org更新服务器(福建省福州市 电信):
    \n
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nmirror.rootguide.org更新服务器(上海市 电信):
    \n
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse
    \n
    \n
    \n台湾的官方源速度也相当不错,有时甚至快于内地的:
    \n
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

    ", "created_at"=>2008-04-26 00:55:54 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    升级的时候老是寻找最可靠的源,下面收集一些来自互联网的UBuntu8.04的源,供大家使用,会不断的更新和测试,谢谢.
    \n如下列举了部分电信,网通和双线的源,每个人具体的所在位置有些不同,所以速度相对来说是不一样,甚至差别很大的,所以各位在选的时候,先ping下看看那组最快,谢谢.
    \nUbuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):
    \n
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \n
    \nArchive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):
    \n
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
    \n
    \nMirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
    \n
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):
    \n
    \ndeb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
    \n
    \n厦门大学更新服务器(教育网服务器):
    \n
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
    \n
    \n成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==
    \n
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
    \n北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):
    \n
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
    \ndeb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
    \n
    \n
    \n中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):
    \n
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nMirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):
    \n
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nubuntu.cnsite.org更新服务器(福建省福州市 电信):
    \n
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \n
    \n
    \nmirror.rootguide.org更新服务器(上海市 电信):
    \n
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
    \ndeb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
    \ndeb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse
    \n
    \n
    \n台湾的官方源速度也相当不错,有时甚至快于内地的:
    \n
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
    \ndeb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

    \n", "_id"=>270}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"利用Amazon Web Services(AWS)构建可扩展的WebApp应用", "body"=>"

    在上次(2008.01.10)简单了写了一篇《RubyOnRails + S3 + EC2 = ? 》至今已经有段时间了,经过一段时间的发展,Amazon Web Services到今天已经相当成熟了,一整套的解决方案可以给Web App带来很多的便利,再一系列的改进措施后,AWS基本上是成熟了。

    \n

    \"\"

    \n

    上面这个图片来源于slideshare上的一个PPT“Using Amazon SimpleDB with Ruby on Rails”,正如我上面截取的这个图片说的:

    \n
      \n
    • 静态文件存储在S3上;
    • \n
    • App server使用课余无限扩展的EC2;
    • \n
    • 结构化数据存储在SimpleDB上;
    • \n
    • 客户端/服务端的交互使用SQS;
    • \n
    \n

    看看AWS的几个应用,正好覆盖了WebApp的整个过程,以下逐一介绍下这几个服务:

    \n

    1、S3看上去就是一个大的硬盘,你可以把App中的所有数据都放上去,取回来,展示等等,是个比较安全的存储服务,省略了自己买磁盘阵列,维护等等费用,且号称是安全的。

    \n

    2、EC2的最大卖点就是其可以无限伸缩的,号称可以扩展到“云”上去,不用因为您的服务器压力过重而购买一批一批的机器,免得找机房,等等,可谓相当方便,在其推出固定IP固态存储之后,使得EC2相当成熟;

    \n

    3、SimpleDB推出的最早,但是一直没仔细看,以为其和S3差不多,今天仔细看了下,其实不然,看其名字是SimpleDB,是用来替代DB的,但是比普通的DB更加Simple,其实也就是一个结构化的存储,你可以把DB的东西(表,行)组合一下放进去,然后根据其有的API查询和存贮,省了维护数据库的人力物力,但是速度不晓得如何。

    \n

    4、SQS是前段时间了解的,不晓得这个服务当初推出的典型应用场景是什么样的,就我的理解,其就是一个队列,相当于一个缓冲队列,用在分布式处理或者作用同步上相当不错,有兴趣的可以看我以前的文章“Amazon SQS,分布式作业不再费心”。

    \n

    总的来说,AWS的几个服务都是将WebApp开发中涉及到的几个方面分拆出来做成服务,以来提供便捷,二来自己赚了一大笔,真是聪明,不过这些应用的维护不晓得Amazon 是怎么处理的,肯定不会是我们常见的人工维护,估计和Google存储差不多的自维护系统。

    \n

    如果您对AWS感兴趣,如果您和笔者一样使用的是RubyOnRails,你可以使用RightAws插件,其包含了以上4个应用的实现,相当不错。

    \n

    但是其不足之处依然存在,例如多国内用户,速度不敢恭维;也有人列举了“Top 10 Reasons to Avoid the SimpleDB Hype”,当然也有人针锋相对的回应了这10个问题“ Top 10 Reasons to Avoid Document Databases FUD  4 ”;另外还有其价格是否真的划算(现在支付美刀比较划算),以及其曾经出现过的问题,所以您在决定使用之前还请仔细考量,这几个应用我都有过尝试,虽然没有大规模的使用,但是基本上比较了解了,如果您有问题,或者其他的经验,欢迎和我交流。

    ", "created_at"=>2008-04-28 07:34:55 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在上次(2008.01.10)简单了写了一篇《RubyOnRails + S3 + EC2 = ? 》至今已经有段时间了,经过一段时间的发展,Amazon Web Services到今天已经相当成熟了,一整套的解决方案可以给Web App带来很多的便利,再一系列的改进措施后,AWS基本上是成熟了。
    \n
    \n上面这个图片来源于slideshare上的一个PPT“Using Amazon SimpleDB with Ruby on Rails”,正如我上面截取的这个图片说的:
    \n
    \n 静态文件存储在S3上;
    \n App server使用课余无限扩展的EC2;
    \n 结构化数据存储在SimpleDB上;
    \n 客户端/服务端的交互使用SQS;
    \n
    \n看看AWS的几个应用,正好覆盖了WebApp的整个过程,以下逐一介绍下这几个服务:
    \n1、S3看上去就是一个大的硬盘,你可以把App中的所有数据都放上去,取回来,展示等等,是个比较安全的存储服务,省略了自己买磁盘阵列,维护等等费用,且号称是安全的。
    \n2、EC2的最大卖点就是其可以无限伸缩的,号称可以扩展到“云”上去,不用因为您的服务器压力过重而购买一批一批的机器,免得找机房,等等,可谓相当方便,在其推出固定IP和固态存储之后,使得EC2相当成熟;
    \n3、SimpleDB推出的最早,但是一直没仔细看,以为其和S3差不多,今天仔细看了下,其实不然,看其名字是SimpleDB,是用来替代DB的,但是比普通的DB更加Simple,其实也就是一个结构化的存储,你可以把DB的东西(表,行)组合一下放进去,然后根据其有的API查询和存贮,省了维护数据库的人力物力,但是速度不晓得如何。
    \n4、SQS是前段时间了解的,不晓得这个服务当初推出的典型应用场景是什么样的,就我的理解,其就是一个队列,相当于一个缓冲队列,用在分布式处理或者作用同步上相当不错,有兴趣的可以看我以前的文章“Amazon SQS,分布式作业不再费心”。
    \n总的来说,AWS的几个服务都是将WebApp开发中涉及到的几个方面分拆出来做成服务,以来提供便捷,二来自己赚了一大笔,真是聪明,不过这些应用的维护不晓得Amazon 是怎么处理的,肯定不会是我们常见的人工维护,估计和Google存储差不多的自维护系统。
    \n如果您对AWS感兴趣,如果您和笔者一样使用的是RubyOnRails,你可以使用RightAws插件,其包含了以上4个应用的实现,相当不错。
    \n但是其不足之处依然存在,例如多国内用户,速度不敢恭维;也有人列举了“Top 10 Reasons to Avoid the SimpleDB Hype”,当然也有人针锋相对的回应了这10个问题“ Top 10 Reasons to Avoid Document Databases FUD  4 ”;另外还有其价格是否真的划算(现在支付美刀比较划算),以及其曾经出现过的问题,所以您在决定使用之前还请仔细考量,这几个应用我都有过尝试,虽然没有大规模的使用,但是基本上比较了解了,如果您有问题,或者其他的经验,欢迎和我交流。

    \n", "_id"=>271}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google更新PR~", "body"=>"

    Google正在更新PR,我放假回老家几天没上网,回来看到我的blog已经从以前的1更新到3,虽然不高,但是还是差不多体现了我blog的价值。

    \n

    基本上都是原创的内容,只是外链不多而已~

    ", "created_at"=>2008-05-05 02:24:36 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Google正在更新PR,我放假回老家几天没上网,回来看到我的blog已经从以前的1更新到3,虽然不高,但是还是差不多体现了我blog的价值。
    \n基本上都是原创的内容,只是外链不多而已~

    \n", "_id"=>272}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在RoR中取得最近记录的方法", "body"=>"

    时常有类似于“查看最近一天发布的文章”,“最近一个星期发布的文章”等,与是找到一段代码,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. class Topic < ActiveRecord::Base  
    2. \n
    3.   def self.find_latest(time = nil)  
    4. \n
    5.     r = %w( hour day week month year )  
    6. \n
    7.     if r.include?(time)  
    8. \n
    9.       self.find :all:conditions => ['created_at > ?', 1.send(time).ago]  
    10. \n
    11.     else  
    12. \n
    13.       self.find :all  
    14. \n
    15.     end  
    16. \n
    17.   end  
    18. \n
    19. end  
    20. \n
    21.   
    22. \n
    23. Topic.find_latest('day')  
    24. \n
    25. Topic.find_latest('week')  
    26. \n
    27. Topic.find_latest('year')  
    28. \n
    \n
    \n

    比较简单,就不罗嗦了,要是你有更好的方法,请分享下~

    ", "created_at"=>2008-05-05 02:37:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    时常有类似于“查看最近一天发布的文章”,“最近一个星期发布的文章”等,与是找到一段代码,如下:
    \n
    \nRuby代码
    \n
    \n class Topic < ActiveRecord::Base  
    \n   def self.find_latest(time = nil)  
    \n     r = %w( hour day week month year )  
    \n     if r.include?(time)  
    \n       self.find :all, :conditions => ['created_at > ?', 1.send(time).ago]  
    \n     else  
    \n       self.find :all  
    \n     end  
    \n   end  
    \n end  
    \n   
    \n Topic.find_latest('day')  
    \n Topic.find_latest('week')  
    \n Topic.find_latest('year')  
    \n
    \n
    \n比较简单,就不罗嗦了,要是你有更好的方法,请分享下~

    \n", "_id"=>273}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"F形网页浏览眼球轨迹的研究报告", "body"=>"

    这是个很古老的研究了,2006年4月,美国长期研究网站可用性的著名网站设计师杰柯柏·尼尔森(Jakob Nielsen)发表了一项《眼球轨迹的研究》报告(原文:F-Shaped Pattern For Reading Web Content)。
    \n报告称,大多数情况下浏览者都不由自主的以“F”形状的模式阅读网页,这种基本恒定的阅读习惯决定了网页呈现F形的关注热度。

    \n

     

    \n

    \"\"

    \n

    第一步:水平移动

    \n

    浏览者首先在网页最上部形成一个水平浏览轨迹。

    \n

    第二步:目光下移,短范围水平移动

    \n

    浏览者会将目光向下移,扫描比上一步短的区域。

    \n

    第三步:垂直浏览

    \n

    浏览者完成上两步后,会将目光沿网页左侧垂直扫描;这一步的浏览速度较慢,也较有系统性、条理性。

    \n

     

    \n

    附图:F形状网页浏览模式

    \n

    下面为杰柯柏·尼尔森报告中的3张热度图,用颜色来表示浏览者眼光聚集的热度,分为最热(红色)、较热(黄色)、不热(蓝色)和基本不关注(灰色)4种。其中图3搜索结果页因SERP中网站标题、网页摘要较宽,第二条线会随之加长,但仍然是F形状。

    \n

    \"Three

    \n

     

    \n

     

    \n

    详细的大家可以看:

    \n

    1、点石上一篇文章:尼尔森F形状网页浏览模式

    \n

    2、作者的原报告:F-Shaped Pattern For Reading Web Content

    ", "created_at"=>2008-05-07 03:33:50 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    这是个很古老的研究了,2006年4月,美国长期研究网站可用性的著名网站设计师杰柯柏·尼尔森(Jakob Nielsen)发表了一项《眼球轨迹的研究》报告(原文:F-Shaped Pattern For Reading Web Content)。
    \n报告称,大多数情况下浏览者都不由自主的以“F”形状的模式阅读网页,这种基本恒定的阅读习惯决定了网页呈现F形的关注热度。
    \n 
    \n
    \n第一步:水平移动
    \n浏览者首先在网页最上部形成一个水平浏览轨迹。
    \n第二步:目光下移,短范围水平移动
    \n浏览者会将目光向下移,扫描比上一步短的区域。
    \n第三步:垂直浏览
    \n浏览者完成上两步后,会将目光沿网页左侧垂直扫描;这一步的浏览速度较慢,也较有系统性、条理性。
    \n 
    \n附图:F形状网页浏览模式
    \n下面为杰柯柏·尼尔森报告中的3张热度图,用颜色来表示浏览者眼光聚集的热度,分为最热(红色)、较热(黄色)、不热(蓝色)和基本不关注(灰色)4种。其中图3搜索结果页因SERP中网站标题、网页摘要较宽,第二条线会随之加长,但仍然是F形状。
    \n
    \n 
    \n 
    \n详细的大家可以看:
    \n1、点石上一篇文章:尼尔森F形状网页浏览模式
    \n2、作者的原报告:F-Shaped Pattern For Reading Web Content

    \n", "_id"=>274}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Puppy Linux,放入U盘随身带的演示环境", "body"=>"

    在U盘价格卖到“白菜”一样的时候,你拿U盘来做什么,又可以做什么,你有想过把一个linux装到U盘里,打造一个随身携带的“生产环节”呢。

    \n

    设想下这么个场景,你是公司业务人员,受客户邀请和上司器重,去一个你并不熟悉的客户环境中讲解客户需要的产品,当你兴致勃勃的到达客户处时,却发现无法联上演示离不开的互联网来连到您的DEMO服务器,或者网路相当糟糕,让你不得不点一个按钮就停下里尴尬的等待,或者其他等等等情况。

    \n

    如果我告诉你,可以把Puppy Linux 4.00打造成这套演示环境(小生产环境)随手带在U盘里,随时随地的演示,你会不会心动?

    \n

    Ok,先看看“随身系统——Puppy Linux 4.00 初体验”,如何,挺不错吧,想自己做一个么,看“将 Puppy Linux 4.00 安装在U盘里 打造随身系统”,还想了解更多,看“E-PUP Linux 中文项目(Puppy Linux 中文版)您高效实用的小型Linux发行版”和"Puppy Linux Discussion Forum“。

    \n

    恩,差不多了,我想要的是一个带有Linux、Mysql,Ruby,Rails,gems,mogrels,nginx的小生产环境即可。至于开发环境下的JAVA,Netbeans等就无所谓了。有人能已经实践过了么,共享 :)

    ", "created_at"=>2008-05-07 09:48:04 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在U盘价格卖到“白菜”一样的时候,你拿U盘来做什么,又可以做什么,你有想过把一个linux装到U盘里,打造一个随身携带的“生产环节”呢。
    \n设想下这么个场景,你是公司业务人员,受客户邀请和上司器重,去一个你并不熟悉的客户环境中讲解客户需要的产品,当你兴致勃勃的到达客户处时,却发现无法联上演示离不开的互联网来连到您的DEMO服务器,或者网路相当糟糕,让你不得不点一个按钮就停下里尴尬的等待,或者其他等等等情况。
    \n如果我告诉你,可以把Puppy Linux 4.00打造成这套演示环境(小生产环境)随手带在U盘里,随时随地的演示,你会不会心动?
    \nOk,先看看“随身系统——Puppy Linux 4.00 初体验”,如何,挺不错吧,想自己做一个么,看“将 Puppy Linux 4.00 安装在U盘里 打造随身系统”,还想了解更多,看“E-PUP Linux 中文项目(Puppy Linux 中文版)您高效实用的小型Linux发行版”和"Puppy Linux Discussion Forum“。
    \n恩,差不多了,我想要的是一个带有Linux、Mysql,Ruby,Rails,gems,mogrels,nginx的小生产环境即可。至于开发环境下的JAVA,Netbeans等就无所谓了。有人能已经实践过了么,共享 :)

    \n", "_id"=>275}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"圣火登珠峰,卓望\"一键拍发\"助力新华网全球首发", "body"=>"

    \"\"

    \n

    北京时间2008年5月8日9时20分32秒,新华社向全球发布了扎西次仁从地球之巅拍摄的首张北京奥运圣火珠峰传递照片。
    \n此次照片的实时传递由卓望科技 提供技术支撑,使用卓望提供的“一键拍发”客户端软件,由新华社特约记者带着安装了卓望科技客户端软件的几台手机即拍即发,登顶后不到10分钟就有清晰的照片实时发布。新华社成为首家提供圣火珠峰传递照片的新闻单位。
    \nhttp://www.xinhuanet.com/
    \nhttp://news.xinhuanet.com/photo/2008-05/08/content_8126374.htm
    \nhttp://news.xinhuanet.com/sports/2008-05/08/content_8126456.htm

    ", "created_at"=>2008-05-08 02:32:29 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    北京时间2008年5月8日9时20分32秒,新华社向全球发布了扎西次仁从地球之巅拍摄的首张北京奥运圣火珠峰传递照片。
    \n此次照片的实时传递由卓望科技 提供技术支撑,使用卓望提供的“一键拍发”客户端软件,由新华社特约记者带着安装了卓望科技客户端软件的几台手机即拍即发,登顶后不到10分钟就有清晰的照片实时发布。新华社成为首家提供圣火珠峰传递照片的新闻单位。
    \nhttp://www.xinhuanet.com/
    \nhttp://news.xinhuanet.com/photo/2008-05/08/content_8126374.htm
    \nhttp://news.xinhuanet.com/sports/2008-05/08/content_8126456.htm

    \n", "_id"=>276}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Ruby测试AWS之S3国内数据存贮", "body"=>"

    一、S3概要介绍和其规范说明
    \n1、什么是S3
    \n    * Simple Storage Service Fron Amazon
    \n    * 一块无容量限制的网络硬盘
    \n    * 可以作为可靠、快速、可以无限扩展的网络存储服务
    \n
    \n2、S3的功能
    \n    * 支持最小1byte,最大5G的存储对象;
    \n    * 无存贮对象个数上的限制;
    \n    * 每个存储对象存储在bucket中,且由有个用户定义的唯一性key来标识;
    \n    * 可以对每个存贮对象设置访问权限;
    \n    * 提供了REST和SOAP接口对对象进行读写、删除等操作;
    \n    * 可靠时间为99.9%
    \n
    \n3、S3的价格
    \n4、S3中的概念
    \n5、S3中的操作
    \n6、S3的API和库
    \n7、S3客户端工具
    \n8、存在的问题
    \n
    \n二、实际测试
    \n1、测速代码:
    \n2、测速结果:
    \n
    \n参考资料

    \n

    详细文章,请阅读《 使用Amazon S3做资料存储》,我使用Google DOC写的,随时可能更新,不在另行通知,如果您有这方面的经验,欢迎探讨,分享。

    ", "created_at"=>2008-05-09 08:42:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一、S3概要介绍和其规范说明
    \n1、什么是S3
    \n    * Simple Storage Service Fron Amazon
    \n    * 一块无容量限制的网络硬盘
    \n    * 可以作为可靠、快速、可以无限扩展的网络存储服务
    \n
    \n2、S3的功能
    \n    * 支持最小1byte,最大5G的存储对象;
    \n    * 无存贮对象个数上的限制;
    \n    * 每个存储对象存储在bucket中,且由有个用户定义的唯一性key来标识;
    \n    * 可以对每个存贮对象设置访问权限;
    \n    * 提供了REST和SOAP接口对对象进行读写、删除等操作;
    \n    * 可靠时间为99.9%
    \n
    \n3、S3的价格
    \n4、S3中的概念
    \n5、S3中的操作
    \n6、S3的API和库
    \n7、S3客户端工具
    \n8、存在的问题
    \n
    \n二、实际测试
    \n1、测速代码:
    \n2、测速结果:
    \n
    \n参考资料
    \n详细文章,请阅读《 使用Amazon S3做资料存储》,我使用Google DOC写的,随时可能更新,不在另行通知,如果您有这方面的经验,欢迎探讨,分享。

    \n", "_id"=>277}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"LoadError: no such file to load -- RMagick", "body"=>"

    虽然在ubuntu上的rails里面使用过很多次的RMagick,但是却一直没有在单独的ruby

    \n

    script中使用过,这次需要单独使用来画一些图片,于是写了一段代码,但是却跑不起来,老是报"LoadError: no such file to load -- RMagick "错误,查了些资料,搞清楚原因,记录如下:

    \n

    1.注意大小写敏感度

    \n

    在windows或者mac上,不敏感大小写,可以:````require 'rmagick'```

    \n

    ````但是在linux上,却不行,需要写:``````` require 'RMagick'```

    \n

    ````否则您可能得到如下错误:```

    \n

    ```` MissingSourceFile: no such file to load -- rmagick```

    \n

    2.单独ruby中需要引用````rubygems```

    \n

    ````require 'rubygems'
    \nrequire 'RMagick'```

    \n

    ````如果不引用```````rubygems,可能会看到如下错误:```

    \n

    ```` `require': no such file to load -- rmagick (LoadError)```

    \n

    ````或者
    \n```

    \n

    ```` `require': no such file to load -- RMagick (LoadError)```

    \n

    参考文档:

    \n
      \n
    • 在Ubuntu上安装RMagic:http://www.hhtong.com/blog1/articles/2006/11/11/ubuntu20061111-install-rmagic
    • \n
    • Ruby on Rails RMagic:http://www.mysmallventures.com/ruby-on-rails-rmagick-linux-issues/
    • \n
    ", "created_at"=>2008-05-11 02:00:55 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    虽然在ubuntu上的rails里面使用过很多次的RMagick,但是却一直没有在单独的ruby
    \nscript中使用过,这次需要单独使用来画一些图片,于是写了一段代码,但是却跑不起来,老是报"LoadError: no such file to load -- RMagick "错误,查了些资料,搞清楚原因,记录如下:
    \n1.注意大小写敏感度
    \n在windows或者mac上,不敏感大小写,可以:require 'rmagick'```</p>
    \n<p>
    但是在linux上,却不行,需要写:require 'RMagick'```</p>
    \n<p>````否则您可能得到如下错误:```</p>
    \n<p>```` MissingSourceFile: no such file to load -- rmagick```</p>
    \n<p><strong>2.单独ruby中需要引用````rubygems```</strong></p>
    \n<p>````require 'rubygems'<br />
    \nrequire 'RMagick'```</p>
    \n<p>````如果不引用
    rubygems,可能会看到如下错误:</p>
    \n<p>
    require': no such file to load -- rmagick (LoadError)</p>
    \n<p>
    或者<br />
    \n
    </p>
    \n<p>
    `require': no such file to load -- RMagick (LoadError)`
    \n参考文档:
    \n
    \n 在Ubuntu上安装RMagic:http://www.hhtong.com/blog1/articles/2006/11/11/ubuntu20061111-install-rmagic
    \n Ruby on Rails RMagic:http://www.mysmallventures.com/ruby-on-rails-rmagick-linux-issues/

    \n", "_id"=>278}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇Magick::ImageMagickError", "body"=>"

    一段调用RMagic的Ruby脚本,在本地跑的好好的代码,放到服务器上出现这个错误:
    \n Non-conforming drawing primitive definition  (Magick::ImageMagickError)

    \n

    查了下服务器和本地,貌似只有Rmagic的版本不一样,如下:

    \n

    [iceskysl]$  gem list | grep rmagick
    \nrmagick (1.15.12, 1.15.10)
    \n[iceskysl]$ dpkg -l | grep magick
    \nii  imagemagick    6.2.4.5.dfsg1- Image manipulation programs
    \nii  libmagick6     6.0.6.2-2.9    Image manipulation library
    \nii  libmagick9     6.2.4.5.dfsg1- Image manipulation library
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.15.12-1      <insert up to 60 chars description>
    \nii  perlmagick     6.0.6.2-2.9    A perl interface to the libMagick graphics r
    \n
    \nand in my locolhost.it's:
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ gem list | grep rmagick
    \nrmagick (2.3.0, 1.15.10)

    \n

    iceskysl@IceskYsl:/opt/devroot/Taojer/lib$ dpkg -l | grep magick
    \nii  imagemagick                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation programs
    \nii  libmagick10                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library
    \nii  libmagick9                                 7:6.2.4.5.dfsg1-2ubuntu1            Image manipulation library
    \nii  libmagick9-dev                             7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library - development files
    \n不晓得是不是这个问题,查遍了Google也没找到合适的答案,记录在案,有遇到类似错误的还望指教,谢谢.

    \n

    \n

    \n
    附录:相关代码
    \n
      \n
    1. #!/usr/bin/ruby  
    2. \n
    3. require 'rubygems'  
    4. \n
    5. require 'RMagick'  
    6. \n
    7. #require 'RMagick'  
    8. \n
    9. class DrawPrice  
    10. \n
    11.     
    12. \n
    13.   #根据给出的文件名,路径等信息生成价图片  
    14. \n
    15.   def self.drawpic(dir,name,nickname,adrress,blog='http://iceskysl.1sters.com/',columns=200,rows=80,bg_color='white')  
    16. \n
    17.     img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    18. \n
    19.     puts "img=\#{img}"  
    20. \n
    21.     gc = Magick::Draw.new    
    22. \n
    23.     puts "gc=\#{gc}"  
    24. \n
    25.     gc.stroke('transparent')    
    26. \n
    27.     gc.pointsize(16)    
    28. \n
    29.     gc.font("fonts/simhei.ttf")    
    30. \n
    31.     gc.text(40,30, "姓名:\#{nickname}")    
    32. \n
    33.     gc.text(40,50, "地址:\#{adrress}.")    
    34. \n
    35.     gc.pointsize(13)    
    36. \n
    37.     gc.text(10,70, blog)    
    38. \n
    39.     gc.draw(img)    
    40. \n
    41.     img.write("\#{dir}/\#{name}.jpg")  
    42. \n
    43.   end  
    44. \n
    45.   
    46. \n
    47. end  
    48. \n
    49.   
    50. \n
    51. DrawPrice.drawpic("files","vip_price","IceskYsl","深圳")  
    52. \n
    \n
    \n

    \n

     

    ", "created_at"=>2008-05-11 02:12:48 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一段调用RMagic的Ruby脚本,在本地跑的好好的代码,放到服务器上出现这个错误:
    \n Non-conforming drawing primitive definition  (Magick::ImageMagickError)
    \n查了下服务器和本地,貌似只有Rmagic的版本不一样,如下:
    \n[iceskysl]$  gem list | grep rmagick
    \nrmagick (1.15.12, 1.15.10)
    \n[iceskysl]$ dpkg -l | grep magick
    \nii  imagemagick    6.2.4.5.dfsg1- Image manipulation programs
    \nii  libmagick6     6.0.6.2-2.9    Image manipulation library
    \nii  libmagick9     6.2.4.5.dfsg1- Image manipulation library
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.6.0-1        ImageMagick API for Ruby
    \nii  librmagick-rub 1.15.12-1      <insert up to 60 chars description>
    \nii  perlmagick     6.0.6.2-2.9    A perl interface to the libMagick graphics r
    \n
    \nand in my locolhost.it's:
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ gem list | grep rmagick
    \nrmagick (2.3.0, 1.15.10)
    \niceskysl@IceskYsl:/opt/devroot/Taojer/lib$ dpkg -l | grep magick
    \nii  imagemagick                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation programs
    \nii  libmagick10                                7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library
    \nii  libmagick9                                 7:6.2.4.5.dfsg1-2ubuntu1            Image manipulation library
    \nii  libmagick9-dev                             7:6.3.7.9.dfsg1-2ubuntu1            image manipulation library - development files
    \n不晓得是不是这个问题,查遍了Google也没找到合适的答案,记录在案,有遇到类似错误的还望指教,谢谢.
    \n
    \n
    \n附录:相关代码
    \n
    \n #!/usr/bin/ruby  
    \n require 'rubygems'  
    \n require 'RMagick'  
    \n #require 'RMagick'  
    \n class DrawPrice  
    \n     
    \n   #根据给出的文件名,路径等信息生成价图片  
    \n   def self.drawpic(dir,name,nickname,adrress,blog='http://iceskysl.1sters.com/',columns=200,rows=80,bg_color='white')  
    \n     img = Magick::Image.new(columns,rows,Magick::HatchFill.new(bg_color,'lightcyan2'))    
    \n     puts "img=\#{img}"  
    \n     gc = Magick::Draw.new    
    \n     puts "gc=\#{gc}"  
    \n     gc.stroke('transparent')    
    \n     gc.pointsize(16)    
    \n     gc.font("fonts/simhei.ttf")    
    \n     gc.text(40,30, "姓名:\#{nickname}")    
    \n     gc.text(40,50, "地址:\#{adrress}.")    
    \n     gc.pointsize(13)    
    \n     gc.text(10,70, blog)    
    \n     gc.draw(img)    
    \n     img.write("\#{dir}/\#{name}.jpg")  
    \n   end  
    \n   
    \n end  
    \n   
    \n DrawPrice.drawpic("files","vip_price","IceskYsl","深圳")  
    \n
    \n
    \n
    \n 

    \n", "_id"=>279}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Gmail妙用点滴聚合收集", "body"=>"

    是的,我是一个重度Google产品使用者,包括Gmail,GoogleDoc,picasa,Google Sync,GoogleReader等等,Google的很多产品的都很有创意,也符合未来“云计算”的趋势,同时给我带来诸多的便利。

    \n

    本篇文章主要是用来记录一些我自己使用的Gmail技巧和tips,或者是一些技巧的文章链接,以备不时之需,如果您有其他的小技巧,请与我分享,谢谢。

    \n

    1、Gmail与Google在线办公结合

    \n

    可以通过设置Gmail的过滤器为“有附件”且包含“DOC or XML”关键字的邮件转发到您的GoogleDoc的“Email-In Your Documents and Files"中,详细说明可以参考”Gmail过滤器妙用 之与Google在线办公结合“。

    \n

    2、Gmail Labels和过滤器结合在备份中的妙用

    \n

    Gmail的lable功能很强大,和上面说的过滤器结合可以做很好的备份用,例如我订阅了很多的邮件列表,想nginx,mogrel等等,这些邮件列表相当活跃,如果每次都如inbox,会严重干扰我其他的邮件,这时lable和过滤器就可以结合来做归档了,详细的操作方法请参考”Gmail Labels在备份中的妙用

    \n

     

    ", "created_at"=>2008-05-12 03:14:47 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    是的,我是一个重度Google产品使用者,包括Gmail,GoogleDoc,picasa,Google Sync,GoogleReader等等,Google的很多产品的都很有创意,也符合未来“云计算”的趋势,同时给我带来诸多的便利。
    \n本篇文章主要是用来记录一些我自己使用的Gmail技巧和tips,或者是一些技巧的文章链接,以备不时之需,如果您有其他的小技巧,请与我分享,谢谢。
    \n1、Gmail与Google在线办公结合
    \n可以通过设置Gmail的过滤器为“有附件”且包含“DOC or XML”关键字的邮件转发到您的GoogleDoc的“Email-In Your Documents and Files"中,详细说明可以参考”Gmail过滤器妙用 之与Google在线办公结合“。
    \n2、Gmail Labels和过滤器结合在备份中的妙用
    \nGmail的lable功能很强大,和上面说的过滤器结合可以做很好的备份用,例如我订阅了很多的邮件列表,想nginx,mogrel等等,这些邮件列表相当活跃,如果每次都如inbox,会严重干扰我其他的邮件,这时lable和过滤器就可以结合来做归档了,详细的操作方法请参考”Gmail Labels在备份中的妙用“
    \n 

    \n", "_id"=>280}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"中国,挺起自己的脊梁来", "body"=>"

    本来以为08是个大喜的年,我们期待这阳光和无限希望,我们盼了许久的奥运终于来临,我们无比兴奋,憧憬美好的未来。

    \n

    谁料,我们等到的是:

    \n

    2月肆虐的雪灾,冻裂了中国大地;3月的拉萨暴力事件,烧伤了美丽的圣地;4月的奥运火炬传递受阻,刺伤了中国人向世界张开的双臂;善变的5月,胶济铁路 火车相撞,撞碎了多少旅人的梦;突然传遍全国的儿童手足口病,令全国父母心头纠结;震动传及东南亚的四川大地震,撼及整个中国的灵魂……

    \n

    面对困难,面对挫折,我们如此渺小,昨天是地震发生的日志,下班后,看着新闻直播,不断的刷新互联网上的的死亡人数报告,心里无比的痛楚。

    \n

    看到温总理的不断喊话和鼓励现场的人们,看着写完遗书去现场的突击队员们,看到记者冒着生命危险给大家带来最新的报道,看到朋友们一遍一遍的发送着祝福和祈愿,我们地处安全,却无能为力,我们只能不断的祷告和许愿,希望祖国人民,每个人都能平安,健康,上苍有好生之德,大家一起祈祷,祝愿那些朋友们尽快脱落危险。

    \n

    附录:转载:一个记者在地震抢救现场给我们上午做的直播?
    \n-----------------
    \n绮梦 10:07:29
    \n现场简直不能看了
    \n绮梦 10:08:33
    \n年过花甲的总理已经哭得不成样子了
    \n绮梦 10:10:16
    \n刚刚挖开的地方又塌方了
    \n绮梦 10:11:24
    \n这倒霉天气还在下雨,现在一线的军人已经被下达死命令,必须冒雨解救
    \n绮梦 10:11:30
    \n我就在现场
    \n绮梦 10:11:56
    \n我现在是在都江堰市
    \n绮梦 10:13:24
    \n交通已经瘫痪了,人员和物资很难运进去
    \n绮梦 10:13:47
    \n汶川现在还不让我们去
    \n绮梦 10:15:21
    \n汶川的交通完全封闭了,现场到底怎么样我不知道,不过早上总理指示军队不管有多大代价,必须进城
    \n绮梦 10:16:03
    \n倒霉天气在下雨,飞机几次都不能降落,伞兵马上就要起飞了
    \n绮梦 10:17:36
    \n飞机在汶川空投物资了
    \n绮梦 10:20:06
    \n被压在废墟下的300多学生现在很危险啊,刚才一次的营救又失败了,现在总理在现场组织再次营救。
    \n绮梦 10:20:47
    \n啊 总理摔到了,
    \n绮梦 10:21:35
    \n照片我正在传给北京,不经过审核的是不允许发布的
    \n绮梦 10:22:21
    \n我和几个同行现在开了9台电脑,同时在传消息
    \n绮梦 10:22:37
    \n这个QQ在关键时候传的真慢
    \n绮梦 10:23:39
    \n突击队又上了
    \n绮梦 10:25:04
    \n如果你现在看见老爷子的样子,你马上就会哭的
    \n绮梦 10:26:40
    \n老爷子的手臂受伤出血了,他把要给他包扎的医务人员推开了
    \n绮梦 10:27:09
    \n好消息,发现一名学生了
    \n绮梦 10:28:00
    \n总理跑到塌方点了,在帮忙呢
    \n绮梦 10:28:13
    \n向峨乡中学
    \n绮梦 10:28:33
    \n拖出来了,医生在抢救
    \n绮梦 10:28:56
    \n部队上来的人还不是很多
    \n绮梦 10:29:07
    \n交通太困难
    \n绮梦 10:29:42
    \n现在还不一定,这个看样子看活着,吊瓶氧气都挂上了
    \n绮梦 10:31:06
    \n啊,又塌了
    \n绮梦 10:31:28
    \n突击队一个人被埋进去了
    \n绮梦 10:31:40
    \n等等,我到前面看看
    \n绮梦 10:36:24
    \n我回来了,抢救出来了
    \n绮梦 10:37:16
    \n最新消息,彭州被困的10万群众危险!!!
    \n绮梦 10:38:49
    \n由于大雨的影响,工程兵几次架桥失败,附近已经出现泥石流迹象,电话直接是叫通总理的,情况很危险!!!
    \n绮梦 10:39:19
    \n由于桥梁倒塌,彭州市10万群众被堵在山中,救灾人员和物资无法运人。已经出现泥石流迹象
    \n绮梦 10:41:11
    \n总理电话里大喊,我不管你们怎么样,我只要这10万群众月兑险,这是命令。他把电话摔了
    \n绮梦 10:41:33
    \n头一次看见老爷子这么厉害
    \n绮梦 10:41:54
    \n汶川现在还没通知去,估计情况不是很好
    \n绮梦 10:42:16
    \n我现在在通讯帐篷里
    \n绮梦 10:43:54
    \n汶川最新消息,雨开始小了,空投物资已经扔下去了,空降兵已经在外围机场登机了
    \n绮梦 10:45:19
    \n现在所有的国外记者都在关注号称中国最精锐的特种部队首次公开亮相
    \n绮梦 10:46:50
    \n总理现在和登机部队领导说话
    \n绮梦 10:47:41
    \n总理说,我就一句话,是人民在养你们,你们自己看着办。
    \n绮梦 11:11:00
    \n大家好,我现在是在军用直升机上,头一次坐这种飞机,很紧张。
    \n绮梦 11:12:51
    \n我现在在直升机上,估计一个小时后就到什肪了
    \n绮梦 11:34:40
    \n最新消息,汶川的映秀、漩口、卧龙三镇通讯信号很弱,至今也无法联系。估计三镇有将近两万多人被困,余震不断,大雨连绵,情况非常严峻,由于能见度太差,无法判断准确情况。总参命令,当空降部队到达汶川上空时,如果条件不允许,就不惜代价强行伞降!
    \n绮梦 11:36:38
    \n没有,飞机要进人雷区了,我要关机了,等会再和你们聊。

    \n

    附录:
    \nhttp://review.feedsky.com/review/feedsky/iceskysl_1sters/~/txt/171/r.html

    \n

    \"\"

    ", "created_at"=>2008-05-13 08:51:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    本来以为08是个大喜的年,我们期待这阳光和无限希望,我们盼了许久的奥运终于来临,我们无比兴奋,憧憬美好的未来。
    \n谁料,我们等到的是:
    \n2月肆虐的雪灾,冻裂了中国大地;3月的拉萨暴力事件,烧伤了美丽的圣地;4月的奥运火炬传递受阻,刺伤了中国人向世界张开的双臂;善变的5月,胶济铁路 火车相撞,撞碎了多少旅人的梦;突然传遍全国的儿童手足口病,令全国父母心头纠结;震动传及东南亚的四川大地震,撼及整个中国的灵魂……
    \n面对困难,面对挫折,我们如此渺小,昨天是地震发生的日志,下班后,看着新闻直播,不断的刷新互联网上的的死亡人数报告,心里无比的痛楚。
    \n看到温总理的不断喊话和鼓励现场的人们,看着写完遗书去现场的突击队员们,看到记者冒着生命危险给大家带来最新的报道,看到朋友们一遍一遍的发送着祝福和祈愿,我们地处安全,却无能为力,我们只能不断的祷告和许愿,希望祖国人民,每个人都能平安,健康,上苍有好生之德,大家一起祈祷,祝愿那些朋友们尽快脱落危险。
    \n附录:转载:一个记者在地震抢救现场给我们上午做的直播?
    \n-----------------
    \n绮梦 10:07:29
    \n现场简直不能看了
    \n绮梦 10:08:33
    \n年过花甲的总理已经哭得不成样子了
    \n绮梦 10:10:16
    \n刚刚挖开的地方又塌方了
    \n绮梦 10:11:24
    \n这倒霉天气还在下雨,现在一线的军人已经被下达死命令,必须冒雨解救
    \n绮梦 10:11:30
    \n我就在现场
    \n绮梦 10:11:56
    \n我现在是在都江堰市
    \n绮梦 10:13:24
    \n交通已经瘫痪了,人员和物资很难运进去
    \n绮梦 10:13:47
    \n汶川现在还不让我们去
    \n绮梦 10:15:21
    \n汶川的交通完全封闭了,现场到底怎么样我不知道,不过早上总理指示军队不管有多大代价,必须进城
    \n绮梦 10:16:03
    \n倒霉天气在下雨,飞机几次都不能降落,伞兵马上就要起飞了
    \n绮梦 10:17:36
    \n飞机在汶川空投物资了
    \n绮梦 10:20:06
    \n被压在废墟下的300多学生现在很危险啊,刚才一次的营救又失败了,现在总理在现场组织再次营救。
    \n绮梦 10:20:47
    \n啊 总理摔到了,
    \n绮梦 10:21:35
    \n照片我正在传给北京,不经过审核的是不允许发布的
    \n绮梦 10:22:21
    \n我和几个同行现在开了9台电脑,同时在传消息
    \n绮梦 10:22:37
    \n这个QQ在关键时候传的真慢
    \n绮梦 10:23:39
    \n突击队又上了
    \n绮梦 10:25:04
    \n如果你现在看见老爷子的样子,你马上就会哭的
    \n绮梦 10:26:40
    \n老爷子的手臂受伤出血了,他把要给他包扎的医务人员推开了
    \n绮梦 10:27:09
    \n好消息,发现一名学生了
    \n绮梦 10:28:00
    \n总理跑到塌方点了,在帮忙呢
    \n绮梦 10:28:13
    \n向峨乡中学
    \n绮梦 10:28:33
    \n拖出来了,医生在抢救
    \n绮梦 10:28:56
    \n部队上来的人还不是很多
    \n绮梦 10:29:07
    \n交通太困难
    \n绮梦 10:29:42
    \n现在还不一定,这个看样子看活着,吊瓶氧气都挂上了
    \n绮梦 10:31:06
    \n啊,又塌了
    \n绮梦 10:31:28
    \n突击队一个人被埋进去了
    \n绮梦 10:31:40
    \n等等,我到前面看看
    \n绮梦 10:36:24
    \n我回来了,抢救出来了
    \n绮梦 10:37:16
    \n最新消息,彭州被困的10万群众危险!!!
    \n绮梦 10:38:49
    \n由于大雨的影响,工程兵几次架桥失败,附近已经出现泥石流迹象,电话直接是叫通总理的,情况很危险!!!
    \n绮梦 10:39:19
    \n由于桥梁倒塌,彭州市10万群众被堵在山中,救灾人员和物资无法运人。已经出现泥石流迹象
    \n绮梦 10:41:11
    \n总理电话里大喊,我不管你们怎么样,我只要这10万群众月兑险,这是命令。他把电话摔了
    \n绮梦 10:41:33
    \n头一次看见老爷子这么厉害
    \n绮梦 10:41:54
    \n汶川现在还没通知去,估计情况不是很好
    \n绮梦 10:42:16
    \n我现在在通讯帐篷里
    \n绮梦 10:43:54
    \n汶川最新消息,雨开始小了,空投物资已经扔下去了,空降兵已经在外围机场登机了
    \n绮梦 10:45:19
    \n现在所有的国外记者都在关注号称中国最精锐的特种部队首次公开亮相
    \n绮梦 10:46:50
    \n总理现在和登机部队领导说话
    \n绮梦 10:47:41
    \n总理说,我就一句话,是人民在养你们,你们自己看着办。
    \n绮梦 11:11:00
    \n大家好,我现在是在军用直升机上,头一次坐这种飞机,很紧张。
    \n绮梦 11:12:51
    \n我现在在直升机上,估计一个小时后就到什肪了
    \n绮梦 11:34:40
    \n最新消息,汶川的映秀、漩口、卧龙三镇通讯信号很弱,至今也无法联系。估计三镇有将近两万多人被困,余震不断,大雨连绵,情况非常严峻,由于能见度太差,无法判断准确情况。总参命令,当空降部队到达汶川上空时,如果条件不允许,就不惜代价强行伞降!
    \n绮梦 11:36:38
    \n没有,飞机要进人雷区了,我要关机了,等会再和你们聊。
    \n附录:
    \nhttp://review.feedsky.com/review/feedsky/iceskysl_1sters//txt/171/r.html~

    \n", "_id"=>281}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails多个应用中共享数据库", "body"=>"

    如果你现在是这样的:

    \n

     

    \n

    \"\"

    \n

    但是想做成这样的:

    \n

    \"\"

    \n

    估计没有类似需求的人是看不明白的,如果有类似需求或者遇到类似问题的,一看到这个标题就能明白我要说的是什么,对,就是在多个Rails应用之间共享一个数据库。

    \n

    用什么?自然是选择插件了,刚刚看到有人放出了这样的插件uses_connection Rails plugin,代码在Github上,有篇介绍的文章(Introducing the "uses_connection" Rails plugin)在railsfreaks上,bdl7x也发了一篇简单的介绍《不同程序同一个数据库连接-插件uses_connection》,在chinaonrails上。看这些,应该就可以明白这个插件是做啥的了。

    \n

    这里说下可能存在的应用场景,你有一套系统对外提供服务,比如说是个新闻发布系统,您需要及时的抓取内容或者发布新的内容,以保证这个新闻系统的及时性,但是在一台主机上操作会比较耗费资源,这个时候,你可以开发几个后端发布系统,分开部署,共享这套数据库,然后就可以使用后端系统轻松发布、增加新的内容到数据库,然后前端输出就可以源源不断了。

    \n

    这个例子可能不是很清晰,但是我相信有类似需求的人一看就明白这样做的好处,我就不多说了。

    ", "created_at"=>2008-05-14 03:24:44 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    如果你现在是这样的:
    \n 
    \n
    \n但是想做成这样的:
    \n
    \n估计没有类似需求的人是看不明白的,如果有类似需求或者遇到类似问题的,一看到这个标题就能明白我要说的是什么,对,就是在多个Rails应用之间共享一个数据库。
    \n用什么?自然是选择插件了,刚刚看到有人放出了这样的插件uses_connection Rails plugin,代码在Github上,有篇介绍的文章(Introducing the "uses_connection" Rails plugin)在railsfreaks上,bdl7x也发了一篇简单的介绍《不同程序同一个数据库连接-插件uses_connection》,在chinaonrails上。看这些,应该就可以明白这个插件是做啥的了。
    \n这里说下可能存在的应用场景,你有一套系统对外提供服务,比如说是个新闻发布系统,您需要及时的抓取内容或者发布新的内容,以保证这个新闻系统的及时性,但是在一台主机上操作会比较耗费资源,这个时候,你可以开发几个后端发布系统,分开部署,共享这套数据库,然后就可以使用后端系统轻松发布、增加新的内容到数据库,然后前端输出就可以源源不断了。
    \n这个例子可能不是很清晰,但是我相信有类似需求的人一看就明白这样做的好处,我就不多说了。

    \n", "_id"=>282}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Dreamhost的Share Rails确实已经采用了mod_rails(Passenger)", "body"=>"

    看到http://chinaonrails.com/topic/view/1620.html上说DH已经采用了mod_rails(Passenger ),但是没看到效果,按照其介绍文章"Introducing Passenger for Ruby on Rails",登录我的DH帐户后,果然发现已经支持了,见我抓的图片。

    \n

     

    \n

    \"\"

    \n

    难道mod_rails真的是share rails的好的选择,偶没研究过,不发表观点,不晓得性能如何,晚上切换过去压下试试。

    ", "created_at"=>2008-05-14 10:28:48 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    看到http://chinaonrails.com/topic/view/1620.htmlDH已经采用了mod_rails(Passenger上说 ),但是没看到效果,按照其介绍文章"Introducing Passenger for Ruby on Rails",登录我的DH帐户后,果然发现已经支持了,见我抓的图片。
    \n 
    \n
    \n难道mod_rails真的是share rails的好的选择,偶没研究过,不发表观点,不晓得性能如何,晚上切换过去压下试试。

    \n", "_id"=>283}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用 NetBeans 开发 Blackberry", "body"=>"

    虽然我的Blackberry入手还不是很久,但是非常喜欢的说,看了些软件和API,doc,发现最BB上的开发应该也挺好玩的,毕竟BB还算开放的。

    \n

    如下找到几个相关的文章,没事的时候爱捣鼓捣鼓,写几个自己的小程序用也不错,由于本人偏爱Netbeans,于是关注点就是Netbeans+Blackberry + Mobility了。

    \n

    使用 NetBeans Mobility 开发 Blackberry”说了如何在NB上搭建BB的开发环境,“Service Is Living”这个Blog上不少不错的资料和文章,“Blackberry JDE 4.30 黑莓Java开发环境软件”这里是JDE安装软件,“NetBeans Mobility 开发 Blackberry 的环境设置”这里记录了一些NB上的BB开发环境,其他的都忘记存了,呵呵。

    \n

    要不要增加一个blog分类呢?思考ing....

    ", "created_at"=>2008-05-20 06:59:02 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    虽然我的Blackberry入手还不是很久,但是非常喜欢的说,看了些软件和API,doc,发现最BB上的开发应该也挺好玩的,毕竟BB还算开放的。
    \n如下找到几个相关的文章,没事的时候爱捣鼓捣鼓,写几个自己的小程序用也不错,由于本人偏爱Netbeans,于是关注点就是Netbeans+Blackberry + Mobility了。
    \n“使用 NetBeans Mobility 开发 Blackberry”说了如何在NB上搭建BB的开发环境,“Service Is Living”这个Blog上不少不错的资料和文章,“Blackberry JDE 4.30 黑莓Java开发环境软件”这里是JDE安装软件,“NetBeans Mobility 开发 Blackberry 的环境设置”这里记录了一些NB上的BB开发环境,其他的都忘记存了,呵呵。
    \n要不要增加一个blog分类呢?思考ing....

    \n", "_id"=>284}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"汶川地震,让我震撼的这瞬间", "body"=>"

    毫无疑问,我们每个人或多或少的被汶川大地震中的一些话语,场景,图片,故事感动着,逝者已去,我们不禁回想起自己遇到的一些瞬间,莫名的被感动着,本系列文章是由我们自发组织和撰写的那些真实的,震撼着我们的瞬间。

    \n

    采用Ping(点击文章下方的Trackbacks图标即可看到Trackbacks地址)或者留言的方式告诉我们您撰写的震撼你的那一瞬间,我们将召集网友,翻译成多种语言版本,展示给全世界的人们。

    \n

     

    ", "created_at"=>2008-05-21 02:10:14 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    毫无疑问,我们每个人或多或少的被汶川大地震中的一些话语,场景,图片,故事感动着,逝者已去,我们不禁回想起自己遇到的一些瞬间,莫名的被感动着,本系列文章是由我们自发组织和撰写的那些真实的,震撼着我们的瞬间。
    \n采用Ping(点击文章下方的Trackbacks图标即可看到Trackbacks地址)或者留言的方式告诉我们您撰写的震撼你的那一瞬间,我们将召集网友,翻译成多种语言版本,展示给全世界的人们。
    \n 

    \n", "_id"=>285}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"红十字会紧急救援队,救援队员写下个人资料以备不测", "body"=>"

    \"\"

    \n

    第一次看到这个图片是2008.05.17早上到长沙,坐公交车的时候买的一份义卖报纸上的图片新闻,一群红十字会紧急救援队队员在出发前,队员让其战友在自己的衣服背后写上其个人资料,以备不测。

    \n

    看到上面写的姓名单位血型证号等个人信息,我瞬间被震撼了,他们已经在为遇到的可能危险做准备,如果不幸牺牲,不用等待亲人辨认身份(因为有证号和姓名);如果重伤,不用验血就可以直接输血抢救(因为有血型了),等等。

    \n

    无法猜测当时他们的心情如何,但毫无疑问,我被这样一群勇敢的战士深深的震撼和感动了。

    ", "created_at"=>2008-05-21 02:22:19 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    第一次看到这个图片是2008.05.17早上到长沙,坐公交车的时候买的一份义卖报纸上的图片新闻,一群红十字会紧急救援队队员在出发前,队员让其战友在自己的衣服背后写上其个人资料,以备不测。
    \n看到上面写的姓名,单位,血型,证号等个人信息,我瞬间被震撼了,他们已经在为遇到的可能危险做准备,如果不幸牺牲,不用等待亲人辨认身份(因为有证号和姓名);如果重伤,不用验血就可以直接输血抢救(因为有血型了),等等。
    \n无法猜测当时他们的心情如何,但毫无疑问,我被这样一群勇敢的战士深深的震撼和感动了。

    \n", "_id"=>286}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Lockdown: A authentication/authorization system for RubyOnRails", "body"=>"

    RubyOnRails让我们无限惊喜,插件,gem,部署方式,协助方式等等层出不穷,让我们足够的惊喜,今天介绍的是一款用户权限控制系统Lockdown。

    \n

    Lockdown的使用也是足够的简单(包括安装和使用),但是也有些不足和缺陷,后面会说到,但是有些东西还是可以借鉴的。

    \n

    安装方便:

    \n

    $ sudo gem install lockdown
    \n$ cd <your_project_directory>
    \n$ lockdown .

    \n

    使用前需要配置:

    \n

    需要人工在init.rb 中配置角色和权限,不能通过界面维护,这点不是方便。

    \n

    定制不算复杂:

    \n

    定制角色和权限,以及权限的分配不是很复杂,但是显得比较呆板。

    \n

    其他不足:

    \n

    由于其兼顾了merb,导致很多代码混在一起,比较不轻便。

    \n

    详细的使用方法和特点请参考其主页上的说明,不再赘述。

    \n

    其他实现方案:

    \n

    我还是认为我自己写的一款角色控制、分配系统比较好用,只是没有插件化,不方便移植,实现的方式是初始化的时候将资源(action)入库,可以随时建立角色和用户组,每个用户组可以拥有多个角色,每个角色可以拥有多个资源权限,做了一些缓存以提高性能,另外,每次action前作适当的鉴权。

    \n

    有时间可以改成插件或者gem。。

    ", "created_at"=>2008-05-21 03:20:37 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    RubyOnRails让我们无限惊喜,插件,gem,部署方式,协助方式等等层出不穷,让我们足够的惊喜,今天介绍的是一款用户权限控制系统Lockdown。
    \nLockdown的使用也是足够的简单(包括安装和使用),但是也有些不足和缺陷,后面会说到,但是有些东西还是可以借鉴的。
    \n安装方便:
    \n$ sudo gem install lockdown
    \n$ cd <your_project_directory>
    \n$ lockdown .
    \n使用前需要配置:
    \n需要人工在init.rb 中配置角色和权限,不能通过界面维护,这点不是方便。
    \n定制不算复杂:
    \n定制角色和权限,以及权限的分配不是很复杂,但是显得比较呆板。
    \n其他不足:
    \n由于其兼顾了merb,导致很多代码混在一起,比较不轻便。
    \n详细的使用方法和特点请参考其主页上的说明,不再赘述。
    \n其他实现方案:
    \n我还是认为我自己写的一款角色控制、分配系统比较好用,只是没有插件化,不方便移植,实现的方式是初始化的时候将资源(action)入库,可以随时建立角色和用户组,每个用户组可以拥有多个角色,每个角色可以拥有多个资源权限,做了一些缓存以提高性能,另外,每次action前作适当的鉴权。
    \n有时间可以改成插件或者gem。。

    \n", "_id"=>287}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"遭遇ActionController::InvalidAuthenticityToken", "body"=>"

    一直没有自己亲自试试客户端直接POST一些数据到rails应用上,今天正好遇到这个需求,原以为会很简单的,在应用中加个action响应,再组合一个hash数据Post到这个action上就好了,赶紧试试,却遭遇ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)错误,唉,貌似有点不对哦.

    \n

    Google下,找到

    ", "created_at"=>2008-05-21 14:55:17 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一直没有自己亲自试试客户端直接POST一些数据到rails应用上,今天正好遇到这个需求,原以为会很简单的,在应用中加个action响应,再组合一个hash数据Post到这个action上就好了,赶紧试试,却遭遇ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)错误,唉,貌似有点不对哦.
    \nGoogle下,找到

    \n", "_id"=>288}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"新增“安全相关 | Security”分类", "body"=>"

    网络安全绝对是个很有前途的领域,同样,新技术层出不穷,手法和花样就像病毒变种一样,非常丰富。我接触安全领域有段历史了,现在依然是一个网络安全杂志的“新漏洞”栏目编辑和策划,自身对安全漏洞比较关注,尽管我的Rails的漏洞关注的不多,但是凭着这么多年的功底,还是比较容易的啦。

    \n

    本分类将关注Rails或者其他的语言或者系统的Security问题,例如SQL,CFRS,XSS等等以往的或者最新的安全知识,主要是针对RubyOnRails的安全问题予以分析和说明,并发布我发现的一些bug或者其他讯息。

    \n

    另外,本分类会经常关注其他同类bloger撰写的外文文章,做一些测试和再组合,以使得更多的国内读者能了解最新的Security问题。

    \n

    如果您有类似心得,还望交流指教,谢谢。

    ", "created_at"=>2008-05-22 03:06:19 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    网络安全绝对是个很有前途的领域,同样,新技术层出不穷,手法和花样就像病毒变种一样,非常丰富。我接触安全领域有段历史了,现在依然是一个网络安全杂志的“新漏洞”栏目编辑和策划,自身对安全漏洞比较关注,尽管我的Rails的漏洞关注的不多,但是凭着这么多年的功底,还是比较容易的啦。
    \n本分类将关注Rails或者其他的语言或者系统的Security问题,例如SQL,CFRS,XSS等等以往的或者最新的安全知识,主要是针对RubyOnRails的安全问题予以分析和说明,并发布我发现的一些bug或者其他讯息。
    \n另外,本分类会经常关注其他同类bloger撰写的外文文章,做一些测试和再组合,以使得更多的国内读者能了解最新的Security问题。
    \n如果您有类似心得,还望交流指教,谢谢。

    \n", "_id"=>289}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CSRF: 不要低估了我的危害和攻击能力", "body"=>"
    \n
    \n
    CSRF这种攻击方式虽然提出来很久(在2006年的时候就有了)了,但是这个沉睡的攻击巨人直到前不久才逐渐走入我们的视线,到底CSRF是啥,危害到底有多大?常见的利用方式是如何的,今天作为“安全相关 | Security”分类的第一篇文章,我按照自己的理解告诉你,不要低估了CSRF危害性和攻击能力。
    \n
    \n一、什么是CSRF

    \n先看看CSRF的原文说明,如下:
    \n
    \n
    Cross Site Reference Forgery works by including malicious code or a link in a page that accesses a web application that the user is believed to have authenticated. If the session for that web application has not timed out, an attacker may execute unauthorized commands.
    \n
    二、CSRF案例说明和分析
    \n自然,这里拿Rails程序来举例子说明这些问题,大家知道Rails2之前是把session放在服务器端(文件或者DB或者缓存中),客户但在 cookie中保存sessionid;而到了Rails2后,还有一种方式是把session放在基于cookie的客户端中。当然这两样都各有道理, 各有优劣,不在我们这次说的范围之内。我们继续说,当我们向一个域名发送一个请求的时候,如果本店存在这个域名的cookie,浏览器会自动的把 cookie附带上。这样本来没有啥问题,也是我们为了解决http无状态记录的解决方案,但是有个问题出现了,如果出现一个到其他域名的请求,浏览区在 加载的时候,也把cookie给带上了,会有什么问题?我们举个简单的也很常见的例子来说明这个问题。
    \n-----------------------------案例------------------------------
    \n1、Bob在自己的电脑上刚刚查看完自己的银行A账户余额,然后比较无聊就跑到一个公开的BBS上灌水,当他看到一篇“银行A的内部照片”的帖子,很有兴趣的打开这个帖子想看看自己信任的银行A的内部图片是啥样子的,殊不知,这其实是一个attacker精心设计的骗局。
    \n2、在这个帖子中确实有几个图片,看上去真的像是银行A的照片,但是其中有个图片没显示出来,Bob以为是自己网速太慢,导致这个图片没有加载进来,也没在意。只是对这些并不是十分满意的照片摇摇头,就关了这个帖子。
    \n3、几天后,Bob猛然发现自己在银行A的账户上少了1000元,到底是怎么了?
    \n
    \n分析:

    \n为什么钱少了呢?我们得分析一下上面这个案例,好记得当时Bob说有个图片没显示么,是的,我们来看看这个图片的地址,惊奇的发现是:<img .src="http://www.banka.com/transfer?account=myself&amount=1000&destination=attacker">,这是一个什么地址?聪明的您一定很快就能明白,这个地址是邪恶的,看上去,他的意思是打开这个地址的人,给attacker转了1000元。
    \n这怎么可能?你肯定急了,我怎么能随便给一个人转1000元呢,而且我都不知道呀!但是,注意了,这其实是完全有可能的。还记得当时Bob刚刚查看完整及的帐号信息,基于银行A的cookie并不过期,当出现如上链接出现在src的时候(
    note that .src is meant to be src),浏览器尝试着按照本地的cookie去加载上面这个URL,而银行A验证了来源请求的cookie是可以的,所以就这样事情就悄悄的发生了。
    \n
    -------------------------------案例结束---------------------------
    \n
    \n
    ok,看明白了么,这就是CSRF,一句话给他下个定义就是:借你的cookie在你不知道的时候悄悄的做了一些你不愿意做 的事情。恶日期这里有个更要命的是,这个包含上述URL的图片或者链接,并不需要一定是放在银行A的服务器上,相反可以在任一地方,比如blog,公开的 BBS,或者一些群发的Mail中等等,如此多的场合下,这些都有可能存在陷阱。
    \n再看一副图片吧,其说明的正是CSRF的攻击原理。
    \n\"\"
    \n
    \n 三、CSRF的预防
    \n看上去很恐怖吧,是的,确实恐怖,意识到恐怖是个好事情,这样会促使你接着往下看如何改进和防止类似的漏洞出现。
    \n总体来说,预防CSRF主要从2个方面入手,分别是:
    \n1、正确使用GET,POST和Cookie;
    \n2、在non-GET请求中使用Security token;
    \n
    \n
    一般上,大家知道的浏览器发送请求的方式有GET或者POST,但是还有一种比较常用的是Cookie,至于其他的HTTP协议请求方式,你可以google,一般按照W3C的规范:
    \n1、GET常用在查看,列举,展示的时候;
    \n2、POST常用在下达订单,改变一个资源的属性或者做其他一些事情

    \n
    \nok,我们这里拿Rails按照前面列举的2种预防手段做说明,首先,我们可以在Rails的控制权中(controller)将一些方法(action)限定(verify)为只能使用POST或者GET,例如:\n
    \n
    Ruby代码
    \n
      \n
    1. verify :method => :post:only => [ :transfer ], :redirect_to => { :action => :list }   
    2. \n
    \n
    \n恩,很好,这样做下限制以后,前面案例中的方法就失效了,因为这里我们限定了transfer必须使用POST来提交请求,当GET请求来的时候并不会被响应。
    \n万事大吉了?NO!因为POST的请求也是可以被构造出来后自动发送的,如何实现,看下面吧,你肯定会吃惊的。
    \n
    \n
    XML/HTML代码
    \n
      \n
    1. <a .href="http://www.1sters.com/" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 'http://www.example.com/account/destroy'; f.submit();return false;">点我试试</a>  
    2. \n
    \n
    \n是的,这就是一个活生生的例子(.href is meant to be href),使用link的href或者img的src都可以的,再想想一个Attacher放了一个图片,然后写了一个
    onmouseover方法,执行上述的那段JS,如下,或者使用AJAX。\n
    \n
    XML/HTML代码
    \n
      \n
    1. <img .src="http://www.harmless.com/img" width="400" height="400" onmouseover="…" /> 
      \n
    2. \n
    \n
    \n所以,限定为POST后还不是非常的保险,怎么办?不急,我们还有第二步,给non-GET的请求设置 security token,如何实现,在Rails2以后非常简单(也是默认的),我们只需要在environment.rb中添加如下代码:
    \n
    \n
    Ruby代码
    \n
      \n
    1. config.action_controller.session = {  
    2. \n
    3.   :session_key => '_csrf_session',  
    4. \n
    5.   :secret      => 'ae4b43dda38ff78bb50898b2935da76d1e224061ab72a9399d34cea4c6178eee6dae815fff920a20642f27abda83b793da4e9b6cf20c4838805e80abf53e318a'  
    6. \n
    7. }  
    8. \n
    \n
    \n然后
    application controller中包含如下security token设置:
    \n
    \n
    Ruby代码
    \n
      \n
    1. protect_from_forgery  :secret => '053cef294a333f72c3584311799c69d2' 
    2. \n
    \n
    \nok,基本上安全了,如果这时POST请求过去,但是
    security token和session计算出来的secret和服务端的secret匹配不上的话,就会返回一个ActionController::InvalidAuthenticityToken错误,防止该类缺陷的出现。
    \n安全了,也许你要说,那我如果能破解出
    protect_from_forgery,不进OK了么,按照理论上是,但是实际是破解是基本上不可能的,因为有人曾计算过,暴力破解该串大概需要2的11次方时间,后续我将再写一篇文章详细的介绍,这里不再赘述。
    \n
    \n
    四、总结
    \n总的来说,CSRF的兴起刚刚开始,网络上肯定会有一股热潮,Railser们一定要注意自己的程序的安全性,CSRF比你我能想到的更有威胁,千万别小瞧了它。
    ", "created_at"=>2008-05-22 03:48:41 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    CSRF这种攻击方式虽然提出来很久(在2006年的时候就有了)了,但是这个沉睡的攻击巨人直到前不久才逐渐走入我们的视线,到底CSRF是啥,危害到底有多大?常见的利用方式是如何的,今天作为“安全相关 | Security”分类的第一篇文章,我按照自己的理解告诉你,不要低估了CSRF危害性和攻击能力。
    \n
    \n一、什么是CSRF
    \n先看看CSRF的原文说明,如下:
    \n
    \nCross Site Reference Forgery works by including malicious code or a link in a page that accesses a web application that the user is believed to have authenticated. If the session for that web application has not timed out, an attacker may execute unauthorized commands.
    \n二、CSRF案例说明和分析
    \n自然,这里拿Rails程序来举例子说明这些问题,大家知道Rails2之前是把session放在服务器端(文件或者DB或者缓存中),客户但在 cookie中保存sessionid;而到了Rails2后,还有一种方式是把session放在基于cookie的客户端中。当然这两样都各有道理, 各有优劣,不在我们这次说的范围之内。我们继续说,当我们向一个域名发送一个请求的时候,如果本店存在这个域名的cookie,浏览器会自动的把 cookie附带上。这样本来没有啥问题,也是我们为了解决http无状态记录的解决方案,但是有个问题出现了,如果出现一个到其他域名的请求,浏览区在 加载的时候,也把cookie给带上了,会有什么问题?我们举个简单的也很常见的例子来说明这个问题。
    \n-----------------------------案例------------------------------
    \n1、Bob在自己的电脑上刚刚查看完自己的银行A账户余额,然后比较无聊就跑到一个公开的BBS上灌水,当他看到一篇“银行A的内部照片”的帖子,很有兴趣的打开这个帖子想看看自己信任的银行A的内部图片是啥样子的,殊不知,这其实是一个attacker精心设计的骗局。
    \n2、在这个帖子中确实有几个图片,看上去真的像是银行A的照片,但是其中有个图片没显示出来,Bob以为是自己网速太慢,导致这个图片没有加载进来,也没在意。只是对这些并不是十分满意的照片摇摇头,就关了这个帖子。
    \n3、几天后,Bob猛然发现自己在银行A的账户上少了1000元,到底是怎么了?
    \n
    \n分析:
    \n为什么钱少了呢?我们得分析一下上面这个案例,好记得当时Bob说有个图片没显示么,是的,我们来看看这个图片的地址,惊奇的发现是:<img .src="http://www.banka.com/transfer?account=myself&amount=1000&destination=attacker;">,这是一个什么地址?聪明的您一定很快就能明白,这个地址是邪恶的,看上去,他的意思是打开这个地址的人,给attacker转了1000元。
    \n这怎么可能?你肯定急了,我怎么能随便给一个人转1000元呢,而且我都不知道呀!但是,注意了,这其实是完全有可能的。还记得当时Bob刚刚查看完整及的帐号信息,基于银行A的cookie并不过期,当出现如上链接出现在src的时候(note that .src is meant to be src),浏览器尝试着按照本地的cookie去加载上面这个URL,而银行A验证了来源请求的cookie是可以的,所以就这样事情就悄悄的发生了。
    \n-------------------------------案例结束---------------------------
    \n
    \nok,看明白了么,这就是CSRF,一句话给他下个定义就是:借你的cookie在你不知道的时候悄悄的做了一些你不愿意做 的事情。恶日期这里有个更要命的是,这个包含上述URL的图片或者链接,并不需要一定是放在银行A的服务器上,相反可以在任一地方,比如blog,公开的 BBS,或者一些群发的Mail中等等,如此多的场合下,这些都有可能存在陷阱。
    \n再看一副图片吧,其说明的正是CSRF的攻击原理。
    \n
    \n
    \n 三、CSRF的预防
    \n看上去很恐怖吧,是的,确实恐怖,意识到恐怖是个好事情,这样会促使你接着往下看如何改进和防止类似的漏洞出现。
    \n总体来说,预防CSRF主要从2个方面入手,分别是:
    \n1、正确使用GET,POST和Cookie;
    \n2、在non-GET请求中使用Security token;
    \n
    \n一般上,大家知道的浏览器发送请求的方式有GET或者POST,但是还有一种比较常用的是Cookie,至于其他的HTTP协议请求方式,你可以google,一般按照W3C的规范:
    \n1、GET常用在查看,列举,展示的时候;
    \n2、POST常用在下达订单,改变一个资源的属性或者做其他一些事情;
    \n
    \nok,我们这里拿Rails按照前面列举的2种预防手段做说明,首先,我们可以在Rails的控制权中(controller)将一些方法(action)限定(verify)为只能使用POST或者GET,例如:
    \n
    \nRuby代码
    \n
    \n verify :method => :post, :only => [ :transfer ], :redirect_to => { :action => :list }   
    \n
    \n
    \n恩,很好,这样做下限制以后,前面案例中的方法就失效了,因为这里我们限定了transfer必须使用POST来提交请求,当GET请求来的时候并不会被响应。
    \n万事大吉了?NO!因为POST的请求也是可以被构造出来后自动发送的,如何实现,看下面吧,你肯定会吃惊的。
    \n
    \nXML/HTML代码
    \n
    \n <a .href="http://www.1sters.com/" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 'http://www.example.com/account/destroy f.submit();return false';;">点我试试</a>  
    \n
    \n
    \n是的,这就是一个活生生的例子(.href is meant to be href),使用link的href或者img的src都可以的,再想想一个Attacher放了一个图片,然后写了一个onmouseover方法,执行上述的那段JS,如下,或者使用AJAX。
    \n
    \nXML/HTML代码
    \n
    \n <img .src="http://www.harmless.com/img" width="400" height="400" onmouseover="…" /> 
    \n
    \n
    \n
    \n所以,限定为POST后还不是非常的保险,怎么办?不急,我们还有第二步,给non-GET的请求设置 security token,如何实现,在Rails2以后非常简单(也是默认的),我们只需要在environment.rb中添加如下代码:
    \n
    \nRuby代码
    \n
    \n config.action_controller.session = {  
    \n   :session_key => '_csrf_session',  
    \n   :secret      => 'ae4b43dda38ff78bb50898b2935da76d1e224061ab72a9399d34cea4c6178eee6dae815fff920a20642f27abda83b793da4e9b6cf20c4838805e80abf53e318a'  
    \n }  
    \n
    \n
    \n然后在application controller中包含如下security token设置:
    \n
    \nRuby代码
    \n
    \n protect_from_forgery  :secret => '053cef294a333f72c3584311799c69d2' 
    \n
    \n
    \nok,基本上安全了,如果这时POST请求过去,但是security token和session计算出来的secret和服务端的secret匹配不上的话,就会返回一个ActionController::InvalidAuthenticityToken错误,防止该类缺陷的出现。
    \n安全了,也许你要说,那我如果能破解出protect_from_forgery,不进OK了么,按照理论上是,但是实际是破解是基本上不可能的,因为有人曾计算过,暴力破解该串大概需要2的11次方时间,后续我将再写一篇文章详细的介绍,这里不再赘述。
    \n
    \n四、总结
    \n总的来说,CSRF的兴起刚刚开始,网络上肯定会有一股热潮,Railser们一定要注意自己的程序的安全性,CSRF比你我能想到的更有威胁,千万别小瞧了它。

    \n", "_id"=>290}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google Sites开放,建立IceskYsl@Docs", "body"=>"

    很早前就用上了Google Docs来写一些技术文档,我个人觉得用GoogleDocs些技术文档相当好,可以随时修改和编辑,且可以保存版本信息,非常好。
    \n我已经使用GoogleDocs写了诸如“使用Amazon S3做资料存储”,“Twitter的Widget实现探析”,"Amazon SQS,分布式作业不再费心","CSRF: 不要低估了我的危害和攻击能力"等技术文档,也曾在blog上发布了一些,以前都是在Blog简要的写个介绍,然后贴上Docs的链接地址,但是一直有个问题困扰我。
    \n我理想的状态是可以在页面上直接展示发布的docs,这样看上去更加直观,而不用每次都再点一次链接,曾经尝试过GoogleBlogger,但是除了被GFW外,他的布局我也不是很喜欢。一直在寻找另外可行的方式。
    \n今天看到Gseeker上说到Google Sites正式开放,Google Sites我以前也试过,只是当时还不成熟,竟然这次正式开放了,那么肯定比较成熟了。
    \n\"\"
    \n赶紧试试,很不错,正好满足我的需要,于是赶快建立一个IceskYsl@Docs,把以前在Doc上写的文档都包含进去,效果挺好,除了可以插入Doc外,还可以插入表格,视频等等。
    \n
    \n以后我还使用Doc写更多的技术文档,并随时更新,修改,届时将第一时间放在IceskYsl@Docs上,同时将会在这个blog上的发布。
    \n
    \n有兴趣的赶紧去瞧瞧吧,有啥子问题记得给我留言。

    ", "created_at"=>2008-05-22 12:39:29 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很早前就用上了Google Docs来写一些技术文档,我个人觉得用GoogleDocs些技术文档相当好,可以随时修改和编辑,且可以保存版本信息,非常好。
    \n我已经使用GoogleDocs写了诸如“使用Amazon S3做资料存储”,“Twitter的Widget实现探析”,"Amazon SQS,分布式作业不再费心","CSRF: 不要低估了我的危害和攻击能力"等技术文档,也曾在blog上发布了一些,以前都是在Blog简要的写个介绍,然后贴上Docs的链接地址,但是一直有个问题困扰我。
    \n我理想的状态是可以在页面上直接展示发布的docs,这样看上去更加直观,而不用每次都再点一次链接,曾经尝试过GoogleBlogger,但是除了被GFW外,他的布局我也不是很喜欢。一直在寻找另外可行的方式。
    \n今天看到Gseeker上说到Google Sites正式开放,Google Sites我以前也试过,只是当时还不成熟,竟然这次正式开放了,那么肯定比较成熟了。
    \n
    \n赶紧试试,很不错,正好满足我的需要,于是赶快建立一个IceskYsl@Docs,把以前在Doc上写的文档都包含进去,效果挺好,除了可以插入Doc外,还可以插入表格,视频等等。
    \n
    \n以后我还使用Doc写更多的技术文档,并随时更新,修改,届时将第一时间放在IceskYsl@Docs上,同时将会在这个blog上的发布。
    \n
    \n有兴趣的赶紧去瞧瞧吧,有啥子问题记得给我留言。

    \n", "_id"=>291}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"CsrfKiller: 看CSRF还怎么乐的起来", "body"=>"

    前面一篇文章《CSRF: 不要低估了我的危害和攻击能力》说到了CSRF是相当恐怖的,前面也说了,在Rails2中可以设置安全码来进一步的防止,另外,今天给大家分享一个插件,是csrf_killer,详细的介绍请参考README

    \n``CsrfKiller
    ==========

    This plugin helps protect against possible CSRF attacks. If you don't know what a Cross Site Request Forgery attack is, check these links:

    * http://isc.sans.org/diary.html?storyid=1750
    * http://en.wikipedia.org/wiki/Cross-site_request_forgery

    This plugin works by extending all forms created with #form_tag (including #form_for, #form_remote_tag, and #remote_form_for) by adding
    a token unique to each session id. It also adds a filter that checks all non-GET requests for the existence of this token. This should
    ensure that all non-GET actions have been correctly submitted from a form on your site.```", "created_at"=>2008-05-22 13:28:39 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前面一篇文章《CSRF: 不要低估了我的危害和攻击能力》说到了CSRF是相当恐怖的,前面也说了,在Rails2中可以设置安全码来进一步的防止,另外,今天给大家分享一个插件,是csrf_killer,详细的介绍请参考README。
    \n<strong>CsrfKiller</strong><br />==========<br /><br />This plugin helps protect against possible CSRF attacks. If you don't know what a Cross Site Request Forgery attack is, check these links:<br /><br />* http://isc.sans.org/diary.html?storyid=1750<br />* http://en.wikipedia.org/wiki/Cross-site_request_forgery<br /><br />This plugin works by extending all forms created with #form_tag (including #form_for, #form_remote_tag, and #remote_form_for) by adding<br />a token unique to each session id. It also adds a filter that checks all non-GET requests for the existence of this token. This should<br />ensure that all non-GET actions have been correctly submitted from a form on your site.`

    \n", "_id"=>292}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"与时俱进,使用Git", "body"=>"

    与时俱进总是好的,由Rails带动起来的东西真的不少,虽然Git早已大名鼎鼎,但是一直没有走入一般开发人员的视线,而Rails的到来,把Git带入了大家的视野,普遍认为Git比SVN更懂得协作的概念,呵呵,N多人推荐呀,眼看着merb,rails,vlad以及许多的gems都转移到Git,偶也安奈不住了。

    \n

    其实关注GIt挺早了,草草的看了几篇介绍,囫囵吞枣,没有看到其哦精髓,以为没啥了不起的,于是乎就没有继续深入进去,今天周末晚上,终于又想来了,把他从头到尾的看了一遍,看了不少文章(外文居多 ),总算得到一些启示,Git很好,很强大,不多说,下次有机会再说吧,反正偶已经悄悄的用上了Git。

    \n

    推荐几个参考文档,都读完就会了:

    \n

    http://git.or.cz/course/svn.html

    \n

    http://www.bitsun.com/documents/gittutorcn.htm

    \n

    http://eagain.net/articles/git-for-computer-scientists/

    ", "created_at"=>2008-05-23 16:19:22 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    与时俱进总是好的,由Rails带动起来的东西真的不少,虽然Git早已大名鼎鼎,但是一直没有走入一般开发人员的视线,而Rails的到来,把Git带入了大家的视野,普遍认为Git比SVN更懂得协作的概念,呵呵,N多人推荐呀,眼看着merb,rails,vlad以及许多的gems都转移到Git,偶也安奈不住了。
    \n其实关注GIt挺早了,草草的看了几篇介绍,囫囵吞枣,没有看到其哦精髓,以为没啥了不起的,于是乎就没有继续深入进去,今天周末晚上,终于又想来了,把他从头到尾的看了一遍,看了不少文章(外文居多 ),总算得到一些启示,Git很好,很强大,不多说,下次有机会再说吧,反正偶已经悄悄的用上了Git。
    \n推荐几个参考文档,都读完就会了:
    \nhttp://git.or.cz/course/svn.html
    \nhttp://www.bitsun.com/documents/gittutorcn.htm
    \nhttp://eagain.net/articles/git-for-computer-scientists/

    \n", "_id"=>293}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"将1stlog迁移到GitHub上.", "body"=>"

    经过昨天的试用,发现GIT真的很不错,于是将1stlog迁移了过去,原来GoogleCode上的SVN将保持同步更新,另外主要活动将在Git上,望周知。
    \n
    \nPublic Clone URL:git://github.com/IceskYsl/1stlog.git
    \nGit地址:http://github.com/IceskYsl/1stlog/tree
    \n
    \n稍微赶紧了下,发现GitHub还真是快,相当的快,难怪昨天Raecoo说“速度是相当的棒!”,虽然还是有点不熟悉,但是还是觉得Git还是挺好的。
    \n继续学习中,继续开发中...

    ", "created_at"=>2008-05-24 02:30:17 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    经过昨天的试用,发现GIT真的很不错,于是将1stlog迁移了过去,原来GoogleCode上的SVN将保持同步更新,另外主要活动将在Git上,望周知。
    \n
    \nPublic Clone URL:git://github.com/IceskYsl/1stlog.git
    \nGit地址:http://github.com/IceskYsl/1stlog/tree
    \n
    \n稍微赶紧了下,发现GitHub还真是快,相当的快,难怪昨天Raecoo说“速度是相当的棒!”,虽然还是有点不熟悉,但是还是觉得Git还是挺好的。
    \n继续学习中,继续开发中...

    \n", "_id"=>294}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"用Vlad通过Git在 Nginx+mogrels上部署RubyOnRails应用.", "body"=>"

    一个周末又快过完了,这个周末主要看了下如何自动部署RubyOnRails,目前用的比较多的是capistrano和Vlad,两者各有优缺点,但是考虑到自身的情况和未来的趋势,我主要看的是Vlad,这里就说说如何试用Vlad来把RoR应用自动部署到Nginx,Mogrels,当然,我们这里就不堪SVN了,我们看看Git的实现。

    \n

    Vlad的最新版本中已经支持了Git,但是尚不支持Nginx,于是我们需要自己代码,我在GitHub上fork了一份Vlad的代码,然后添加了对nginx的支持,然后就按照自己的使用方便,修改了他的core文件,添加了自动生成配置文件的方法。

    \n

    1、增加对Nginx的支持,可以通过Vlad来start,stop,restart Nginx服务器;

    \n

    2、可以自动生成匹配web服务器,app服务器和scm的deploy.rb配置文件;

    \n

    3、可以根据deploy.rb自动生成合适的nginx的配置文件,并上传到服务器;(需要rsync支持.)

    \n

    4、可以通过Git自动clone需要的代码,自动发布。(需要服务器上有git支持)

    \n

    详细的信息,感兴趣的可以查看我的vlad的git,使用帮助信息,请查看“/how_to_generate_configs.txt”,有啥子意见,请告诉我,:)

    ", "created_at"=>2008-05-25 15:33:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一个周末又快过完了,这个周末主要看了下如何自动部署RubyOnRails,目前用的比较多的是capistrano和Vlad,两者各有优缺点,但是考虑到自身的情况和未来的趋势,我主要看的是Vlad,这里就说说如何试用Vlad来把RoR应用自动部署到Nginx,Mogrels,当然,我们这里就不堪SVN了,我们看看Git的实现。
    \nVlad的最新版本中已经支持了Git,但是尚不支持Nginx,于是我们需要自己代码,我在GitHub上fork了一份Vlad的代码,然后添加了对nginx的支持,然后就按照自己的使用方便,修改了他的core文件,添加了自动生成配置文件的方法。
    \n1、增加对Nginx的支持,可以通过Vlad来start,stop,restart Nginx服务器;
    \n2、可以自动生成匹配web服务器,app服务器和scm的deploy.rb配置文件;
    \n3、可以根据deploy.rb自动生成合适的nginx的配置文件,并上传到服务器;(需要rsync支持.)
    \n4、可以通过Git自动clone需要的代码,自动发布。(需要服务器上有git支持)
    \n详细的信息,感兴趣的可以查看我的vlad的git,使用帮助信息,请查看“/how_to_generate_configs.txt”,有啥子意见,请告诉我,:)

    \n", "_id"=>295}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"git-svn: 整合使用git和svn", "body"=>"

    前面已经说了“与时俱进,使用Git”,用了几天git后,越来越觉得不错,如下说说SVNGit的主要区别:

    \n
    \n

    Git是分布式SCM,而SVN是基于服务器的,也就是说每个开发者本地都有一套git库,每个人维护自己的版本(或者合并其他人的版本),而SVN是每个人写完代码后都及时的checkin到服务器上,进行合并。

    \n
    \n

    如果上面这段话还不能让你真正了解Git的好处,而不想使用git来替代你的svn的话,那么我再列举几个我认为不错的比较直观的场景:

    \n

    1、可以在本地(离线)就做好版本控制,而不用时刻连网,特别是Soho一族或者喜欢经常到处跑,又喜欢在路上、车上或者马路旁边的小凳子上coding的人;这个时候你可以在自己的Git库上进行版本控制,而不用到处找网络把代码搞到svn上去。

    \n

    2、分布式的SCM更加安全和健壮,有没有想过,如果你的SVN版本服务器挂掉了(硬盘坏了或者网络不可用等等),你会咋样,能修复的好么,一旦修复不好,资料都完蛋了,而Git的分布式SCM,其中的几个节点挂掉影响并不大。

    \n

    3、速度,你如果使用GoogleCode或者其他的SVN服务的话,不知道你是否有呆呆的等待chenkin完成的情况(我是经常有的),而Git,毫无疑问,速度快的多,(就算是使用GitHub也快),究其原因,应该是Git是打包好了上传,而不像SVN单个文件上传。

    \n

    4、版本、分支管理

    \n

    还有啥?想不来了,差不多就这样了,视个人情况而定,但是我认为Git会让你更加满意。

    \n

    但是有人可能会有这样的想法,我本地使用git,然后定时的checkin到SVN上,这样岂不是更好,啊哈,好吧,你还不习惯或者还有其他的特殊情况(比如其他开发者不喜欢git,或者原来的代码在svn上等等),这里看看如何把git和svn结合起来一起使用。

    \n

    1、比较笨的方法

    \n

    同时使用Git和SVN,然后再各自的“忽略”列表里面加加上对方的版本库,比如在svn的忽略列表中加上.git,而同时在git的.gitignore中加上.svn;然后执行各自的命令。

    \n

    2、比较靠谱的方法

    \n

    使用git-svn应该算更加科学和靠谱的方法,安装好git-svn(这个是需要单独安装的)后,就可以使用啦,基本上是这样的:

    \n

    mkdir 1stlog
    \ncd 1stlog && git-svn init http://1stlog.googlecode.com/svn/trunk/

    \n

    其他的就不多说了,可以参考“git and subversion”和“Howto use Git and svn together”以及“git-svn 常用功能示例”。

    ", "created_at"=>2008-05-27 05:14:42 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前面已经说了“与时俱进,使用Git”,用了几天git后,越来越觉得不错,如下说说SVN和Git的主要区别:
    \n
    \nGit是分布式SCM,而SVN是基于服务器的,也就是说每个开发者本地都有一套git库,每个人维护自己的版本(或者合并其他人的版本),而SVN是每个人写完代码后都及时的checkin到服务器上,进行合并。
    \n
    \n如果上面这段话还不能让你真正了解Git的好处,而不想使用git来替代你的svn的话,那么我再列举几个我认为不错的比较直观的场景:
    \n1、可以在本地(离线)就做好版本控制,而不用时刻连网,特别是Soho一族或者喜欢经常到处跑,又喜欢在路上、车上或者马路旁边的小凳子上coding的人;这个时候你可以在自己的Git库上进行版本控制,而不用到处找网络把代码搞到svn上去。
    \n2、分布式的SCM更加安全和健壮,有没有想过,如果你的SVN版本服务器挂掉了(硬盘坏了或者网络不可用等等),你会咋样,能修复的好么,一旦修复不好,资料都完蛋了,而Git的分布式SCM,其中的几个节点挂掉影响并不大。
    \n3、速度,你如果使用GoogleCode或者其他的SVN服务的话,不知道你是否有呆呆的等待chenkin完成的情况(我是经常有的),而Git,毫无疑问,速度快的多,(就算是使用GitHub也快),究其原因,应该是Git是打包好了上传,而不像SVN单个文件上传。
    \n4、版本、分支管理
    \n还有啥?想不来了,差不多就这样了,视个人情况而定,但是我认为Git会让你更加满意。
    \n但是有人可能会有这样的想法,我本地使用git,然后定时的checkin到SVN上,这样岂不是更好,啊哈,好吧,你还不习惯或者还有其他的特殊情况(比如其他开发者不喜欢git,或者原来的代码在svn上等等),这里看看如何把git和svn结合起来一起使用。
    \n1、比较笨的方法
    \n同时使用Git和SVN,然后再各自的“忽略”列表里面加加上对方的版本库,比如在svn的忽略列表中加上.git,而同时在git的.gitignore中加上.svn;然后执行各自的命令。
    \n2、比较靠谱的方法
    \n使用git-svn应该算更加科学和靠谱的方法,安装好git-svn(这个是需要单独安装的)后,就可以使用啦,基本上是这样的:
    \nmkdir 1stlog
    \ncd 1stlog && git-svn init http://1stlog.googlecode.com/svn/trunk/
    \n其他的就不多说了,可以参考“git and subversion”和“Howto use Git and svn together”以及“git-svn 常用功能示例”。

    \n", "_id"=>296}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Google App Engine,正式向所有用户开放并推出收费计划", "body"=>"

    \"\"
    \n经常来我blog的人应该还记得,前段时间介绍了“Google App Engine,前途无量,充满乐趣”,当时还是内测版本,我也去晚了没有申请到,只是下了SDK看了下,觉得很有前途,并说了多Amazon的EC2等服务有竞争关系(后来不久Amazon就降价了)。

    \n

    刚刚看到Gseeker上放出消息说“Google App Engine向所有用户开放 推出收费计划”,貌似不错,赶紧去试试,发现我的mail还在waitlist里面,囧~~

    \n

    但是,消息应该是真的,因为其实Google在“Google I/O大会”上宣布的,只是貌似还是只针对Py的支持,对Rails等还不支持,继续等待,也等待Amazon有没有其他的动作。

    ", "created_at"=>2008-05-28 05:46:59 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    经常来我blog的人应该还记得,前段时间介绍了“Google App Engine,前途无量,充满乐趣”,当时还是内测版本,我也去晚了没有申请到,只是下了SDK看了下,觉得很有前途,并说了多Amazon的EC2等服务有竞争关系(后来不久Amazon就降价了)。
    \n刚刚看到Gseeker上放出消息说“Google App Engine向所有用户开放 推出收费计划”,貌似不错,赶紧去试试,发现我的mail还在waitlist里面,囧~~
    \n但是,消息应该是真的,因为其实Google在“Google I/O大会”上宣布的,只是貌似还是只针对Py的支持,对Rails等还不支持,继续等待,也等待Amazon有没有其他的动作。

    \n", "_id"=>297}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"我为什么那么喜欢GoogleDoc呢?", "body"=>"

    很早前就说过,我非常喜欢使用GoogleDoc来写技术文章,其好处有很多:

    \n

    \"\"

    \n

    1、编辑、组织、协作、维护方便

    \n

    GoogleDoc编辑器我非常喜欢,去掉Word中那些我基本上用不上的功能,而只提供需要的功能,这是比较难得可贵的,“不要让用户思考”是一种好的用户体验,而我深信,google在这个方面比盖茨大叔做的更符合我的需求。

    \n

    我可以按照不同的文件夹或者Tag来组织我的文章,可以快速方便的索引和搜索到需要找到的文档。

    \n

    GoogleDoc的协助功能也非常的榜,我经常和其他人一起完成一份文档的编写,这比在本地写一份文档传来传去要方便,合理的多。我们经常一起编写,在意见不一致的地方批注,等待其他人的确认等等。

    \n

    另外,每次修改都有历史版本信息,可以很轻松的找到以前的版本,这点相当的好呀。

    \n

    2、在线存储,更加方便

    \n

    GoogleDoc是在线存储的,按照google和amazon的“云计算”的概念,这应该算云计算的一种了,其强大的云存储能力,我相信比存在我本地或者我自己的服务器上更加安全和可靠,且我可以随时随地的联网更新和查看,而不需要随身拿个U盘带来带去,还要提防丢失U盘的噩梦。

    \n

    另外,这样比直接发布在自己的Blog要可靠的多,谁知道您的blog服务商或者自己的blog服务器会不会那天罢工,或者哪天你的域名失效,或者那天您的数据库崩溃了,还有。。。

    \n

    3、离线功能,锦上添花

    \n

    以前有人说“要是我上不了网,那我岂不是死翘翘了!”,呵呵,现在有了离线功能,可以在本地编辑,然后在有网络的时候再传上去就OK了。

    \n

    4、不一安装,且自动更新,不断完善

    \n

    GoogleDoc还有个好处是,其不用每次修复一个漏洞或者增加一个新功能都要down下来重新安装,他在服务端更新了,我就可以即刻体验,免去一切不必要的麻烦。另外,他的功能还在不断的增加,比如我就很期待一个可以自动给代码着色的功能,那样我写文章里面的代码就可以更加直观了。只是我不知道谁还有和我类似的需求,也没有找到反馈的地方,有人有类似需求的么?帮我一起反馈上去吧 :)

    \n

    相信随着网速的越来越快,所谓的云计算都能得到很好的应用。我现在只有工作的时候写相关文档才被迫使用Word,虽然在家的本本上的Ubuntu下有Openoffice,但是写自己的一些技术文章的时候,我还都是使用GoogleDoc。且可以利用其它的技术(比如GoogleSite)来整合、组织和展示文档。大家可以在IceskYsl@Docs上看到我分享出来的一些技术文档。

    \n

     

    ", "created_at"=>2008-05-30 03:39:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很早前就说过,我非常喜欢使用GoogleDoc来写技术文章,其好处有很多:
    \n
    \n1、编辑、组织、协作、维护方便
    \nGoogleDoc的编辑器我非常喜欢,去掉Word中那些我基本上用不上的功能,而只提供需要的功能,这是比较难得可贵的,“不要让用户思考”是一种好的用户体验,而我深信,google在这个方面比盖茨大叔做的更符合我的需求。
    \n我可以按照不同的文件夹或者Tag来组织我的文章,可以快速方便的索引和搜索到需要找到的文档。
    \nGoogleDoc的协助功能也非常的榜,我经常和其他人一起完成一份文档的编写,这比在本地写一份文档传来传去要方便,合理的多。我们经常一起编写,在意见不一致的地方批注,等待其他人的确认等等。
    \n另外,每次修改都有历史版本信息,可以很轻松的找到以前的版本,这点相当的好呀。
    \n2、在线存储,更加方便
    \nGoogleDoc是在线存储的,按照google和amazon的“云计算”的概念,这应该算云计算的一种了,其强大的云存储能力,我相信比存在我本地或者我自己的服务器上更加安全和可靠,且我可以随时随地的联网更新和查看,而不需要随身拿个U盘带来带去,还要提防丢失U盘的噩梦。
    \n另外,这样比直接发布在自己的Blog要可靠的多,谁知道您的blog服务商或者自己的blog服务器会不会那天罢工,或者哪天你的域名失效,或者那天您的数据库崩溃了,还有。。。
    \n3、离线功能,锦上添花
    \n以前有人说“要是我上不了网,那我岂不是死翘翘了!”,呵呵,现在有了离线功能,可以在本地编辑,然后在有网络的时候再传上去就OK了。
    \n4、不一安装,且自动更新,不断完善
    \nGoogleDoc还有个好处是,其不用每次修复一个漏洞或者增加一个新功能都要down下来重新安装,他在服务端更新了,我就可以即刻体验,免去一切不必要的麻烦。另外,他的功能还在不断的增加,比如我就很期待一个可以自动给代码着色的功能,那样我写文章里面的代码就可以更加直观了。只是我不知道谁还有和我类似的需求,也没有找到反馈的地方,有人有类似需求的么?帮我一起反馈上去吧 :)
    \n相信随着网速的越来越快,所谓的云计算都能得到很好的应用。我现在只有工作的时候写相关文档才被迫使用Word,虽然在家的本本上的Ubuntu下有Openoffice,但是写自己的一些技术文章的时候,我还都是使用GoogleDoc。且可以利用其它的技术(比如GoogleSite)来整合、组织和展示文档。大家可以在IceskYsl@Docs上看到我分享出来的一些技术文档。
    \n 

    \n", "_id"=>298}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"发布Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术系列文章", "body"=>"

    前面已经说了,我非常喜欢使用GoogleDoc来写一些文章,一来是编写、协助、维护方便,二来是可以更加安全、长远的保存;而可以和其他的产品,比如GoogleSite整合展示,这里发布我最近翻译、实践、整理、撰写的“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列文章,该类文章旨在全面,详细的告诉你如何在UbuntuHardy下使用Nginx+Mongrel(后续可能会加上Thin或者Memcached等)搭建一套很棒的Rails生产环境。

    \n

    考虑编写,协助和维护的方便,已经可能存在的blog服务器出现问题的风险,该类及其以后类似系列文章都将使用GoogleDoc来编写和保持。然后在IceskYsl@Docs上整合组织展示,并在这个blog上发布更新信息等。

    \n

    本次“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列,已经编写如下几个文章:

    \n\n

    如果你有类似的经验需要分享或者想参与进来,一些协助完成一些专题、系列文章的整理,实践和撰写,欢迎加入一起编写和维护,请发送Mail到(iceskysl_At_Gmail.com)或者留言告诉我(需要你有Google帐号,否则协作不了)。

    ", "created_at"=>2008-05-30 03:58:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前面已经说了,我非常喜欢使用GoogleDoc来写一些文章,一来是编写、协助、维护方便,二来是可以更加安全、长远的保存;而可以和其他的产品,比如GoogleSite整合展示,这里发布我最近翻译、实践、整理、撰写的“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列文章,该类文章旨在全面,详细的告诉你如何在UbuntuHardy下使用Nginx+Mongrel(后续可能会加上Thin或者Memcached等)搭建一套很棒的Rails生产环境。
    \n考虑编写,协助和维护的方便,已经可能存在的blog服务器出现问题的风险,该类及其以后类似系列文章都将使用GoogleDoc来编写和保持。然后在IceskYsl@Docs上整合组织展示,并在这个blog上发布更新信息等。
    \n本次“Ubuntu Hardy下使用Nginx+Mongrel跑Rails应用的相关技术”系列,已经编写如下几个文章:
    \n
    \n RubyOnRails , Ubuntu Hardy , Nginx and Mongrel
    \n 使用aptitude安装Nginx
    \n 从源码编译安装Nginx
    \n 添加启动脚本
    \n 配置Nginx
    \n 定制Nginx目录结构
    \n Nginx虚拟主机配置详解
    \n 让Nginx支持虚拟主机
    \n
    \n如果你有类似的经验需要分享或者想参与进来,一些协助完成一些专题、系列文章的整理,实践和撰写,欢迎加入一起编写和维护,请发送Mail到(iceskysl_At_Gmail.com)或者留言告诉我(需要你有Google帐号,否则协作不了)。

    \n", "_id"=>299}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Windows command shell (cmd.exe)下设置Proxy", "body"=>"

    For use appcfg.py to upload you app datas behind an HTTP proxy in Google App Engine
    \n,or use with gems, cpan,etc. Inside cmd.exe, typed:
    \n
    \nset HTTP_proxy=http://my.proxy.server:8000

    ", "created_at"=>2008-05-30 05:51:59 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    For use appcfg.py to upload you app datas behind an HTTP proxy in Google App Engine
    \n,or use with gems, cpan,etc. Inside cmd.exe, typed:
    \n
    \nset HTTP_proxy=http://my.proxy.server:8000

    \n", "_id"=>300}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails的find中使用DISTINCT功能(MYSQL)", "body"=>"

    有的时候需要在SQL里面加上distinck来过滤一些重复的记录,使用SQL比较好写,但是在Rails的API里面并没有找到DISTINCK的参数,于是google了一把,看到不少人有类似的需求,最后找到方案,整理如下:
    \n1、使用:select

    \n
    Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ),这里就可以使用DISTINCT参数但是你可能很郁闷的发现,这
    样select出来的结果并不完全符合您的要求或者预想,呵呵。

    2、加上:group参数
    前面说的,如果只有:select参数,这样出来的结果可能会让你郁闷的发现,并不是您的预期,原因是前面的:select会对
    “fieldname1,filename2,filename3”做DISTINCT,所有不满足您的预期;
    我们可以再加上group参数即可,类似语句如下:
    Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ,:group => 'fieldname1')

    最后还要说下这个:select参数,他可以很好的提高性能,因为在Rails中的find会把所有字段都select出来,如果遇到大字
    段会很影像性能的,所有在必要的时候,最好是用:select限制下要取出的列。

    参考:
    1、Using :select in Rails for Better Performance (这篇文章详细的说了使用select来提高性能)
    2、说Mysql的distinct语句和group by,order by (这篇文章说了distinct、group by和order by的关系)```", "created_at"=>2008-06-01 00:44:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有的时候需要在SQL里面加上distinck来过滤一些重复的记录,使用SQL比较好写,但是在Rails的API里面并没有找到DISTINCK的参数,于是google了一把,看到不少人有类似的需求,最后找到方案,整理如下:
    \n1、使用:select
    \nItem.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ),这里就可以使用DISTINCT参数但是你可能很郁闷的发现,这样select出来的结果并不完全符合您的要求或者预想,呵呵。2、加上:group参数前面说的,如果只有:select参数,这样出来的结果可能会让你郁闷的发现,并不是您的预期,原因是前面的:select会对“fieldname1,filename2,filename3”做DISTINCT,所有不满足您的预期;我们可以再加上group参数即可,类似语句如下:Item.find( :all, :select => 'DISTINCT fieldname1,filename2,filename3' ,:group => 'fieldname1')最后还要说下这个:select参数,他可以很好的提高性能,因为在Rails中的find会把所有字段都select出来,如果遇到大字段会很影像性能的,所有在必要的时候,最好是用:select限制下要取出的列。参考:1、Using :select in Rails for Better Performance (这篇文章详细的说了使用select来提高性能)2、说Mysql的distinct语句和group by,order by (这篇文章说了distinct、group by和order by的关系)```

    \n", "_id"=>301}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1 释出,众多特性值的尝试", "body"=>"

    在距离Rails2.0发布六个月后,Rails2.1于6.1号(儿童节)又释出了,按照DHH的说法,在过去的6个月中,有差不多1400名贡献者提交了1600多个patch,也可以在GitHub上看到Rails的最活跃的,这次发布包含的新功能有:

    \n\n

    Railscasts上游很多视频教程,在ryandaigle哪里有很多的特性介绍文章,另外,按照“新教程:跟着2.1转 Rolling with Rails 2.1”上的介绍:功能上增强,以及性能上的优化,促使必定要upgrade 到2.1。

    \n

    Update:
    \n刚刚仔细的看了下新特性,发现有几个还是挺不错的,也是我一直以来认为Rails比较别扭的地方,现在改进了很多,例如gem的install和unpack;只update修改的字段,改进migrate的命名规范,dbconsole等等;另外,关于性能的测试还没有进行,测试后将分享给大家。

    ", "created_at"=>2008-06-02 03:15:59 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在距离Rails2.0发布六个月后,Rails2.1于6.1号(儿童节)又释出了,按照DHH的说法,在过去的6个月中,有差不多1400名贡献者提交了1600多个patch,也可以在GitHub上看到Rails的最活跃的,这次发布包含的新功能有:
    \n
    \n Time zones (by Geoff Buesing): Tutorial | Introdction | Railscast
    \n Dirty tracking: Introduction (partial updates) | Railscast
    \n Gem Dependencies: Introduction | Railscast
    \n Named scope (by Nick Kallen): Introduction | Railscast
    \n UTC-based migrations: Introduction | Railscast
    \n Better caching: Introduction
    \n
    \n在Railscasts上游很多视频教程,在ryandaigle哪里有很多的特性介绍文章,另外,按照“新教程:跟着2.1转 Rolling with Rails 2.1”上的介绍:功能上增强,以及性能上的优化,促使必定要upgrade 到2.1。
    \nUpdate:
    \n刚刚仔细的看了下新特性,发现有几个还是挺不错的,也是我一直以来认为Rails比较别扭的地方,现在改进了很多,例如gem的install和unpack;只update修改的字段,改进migrate的命名规范,dbconsole等等;另外,关于性能的测试还没有进行,测试后将分享给大家。

    \n", "_id"=>302}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fork了backup_fu 插件,将添加FTP传输支持等新特性.", "body"=>"

    因为项目需要定时将资料打包备份到远程主机或者AmazonS3上存储以备不测,我自己写了自动打包,备份的代码,用的也挺好的,但是一直想着可以做成插件之类的分享给更多的人。

    \n

    今天重新看了下backup_fu这个插件,其实知道这个插件很早了,但是一直没仔细看它到底是做啥的,今天仔细看了下,原来是专门用来打包、上传到Amazon的S3的上一个插件,其使用的是aws-s3类。简单了看了下起代码,发现挺简单的,于是fork了一份回来。

    \n

    然后我将在其基础上做一些现在可以想到的修改和完善:

    \n

    1、增加FTP远程备份功能 --这个是我fork过来的主要用途,因为不是每个人都用S3的,很多人会选择通过FTP远程备份到另为的主机上;

    \n

    2、增加对RightScale gems的支持  --尽管aws-s3的口碑不错,但是RightScale 的AWS的gems更加完备和健壮,且有产品级的支持,我自己环境用的也是这个gems,于是打算加入这个的支持。

    \n

    3、其他的一些比较的修改   --按照我的习惯来修改,如果作者愿意,可以pull过去,呵呵。

    \n

    如果您有类似的需求,请关注我fork的github:IceskYsl / backup_fu
    \n

    \n

     

    ", "created_at"=>2008-06-02 04:50:27 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    因为项目需要定时将资料打包备份到远程主机或者Amazon的S3上存储以备不测,我自己写了自动打包,备份的代码,用的也挺好的,但是一直想着可以做成插件之类的分享给更多的人。
    \n今天重新看了下backup_fu这个插件,其实知道这个插件很早了,但是一直没仔细看它到底是做啥的,今天仔细看了下,原来是专门用来打包、上传到Amazon的S3的上一个插件,其使用的是aws-s3类。简单了看了下起代码,发现挺简单的,于是fork了一份回来。
    \n然后我将在其基础上做一些现在可以想到的修改和完善:
    \n1、增加FTP远程备份功能 --这个是我fork过来的主要用途,因为不是每个人都用S3的,很多人会选择通过FTP远程备份到另为的主机上;
    \n2、增加对RightScale gems的支持  --尽管aws-s3的口碑不错,但是RightScale 的AWS的gems更加完备和健壮,且有产品级的支持,我自己环境用的也是这个gems,于是打算加入这个的支持。
    \n3、其他的一些比较的修改   --按照我的习惯来修改,如果作者愿意,可以pull过去,呵呵。
    \n如果您有类似的需求,请关注我fork的github:IceskYsl / backup_fu
    \n
    \n 

    \n", "_id"=>303}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails+Memcached,跑起来嗖嗖的", "body"=>"

    很早前接触Rails的时候就知道memcached了,只是在自己的服务器上尚未看到这个需求,但是真的不久将来可能出现的情况,还是提前做下功课比较靠谱。

    \n

    今天在看一篇比较不错的文章“ 从LiveJournal后台发展看大规模网站性能优化方法”,该文章说了其LiveJournal发展过程中的几个阶段,逐渐的扩展和完善架构,从一个真实的环境中看出其架构的基本趋势。文中提到了memcached,原来memcached就诞生于此,很有兴趣的再多了解一些,memcached属于Danga,旗下还有其他几个很著名的东西,比如MogileFS等。
    \nMemcached 是高效、快速的分布式内存对象缓存系统,主要用于加速 WEB 动态应用程序。关于Memcached的安装等,可以参考“PHP & memcached”这篇文章的说明,基本上和其他unix下的程序安装差不多,下载源码、编译等等,不再赘述。

    \n

    其使用非常简单,直接就一个命令,连配置文件都省了,如下:

    \n

    /usr/bin/memcached -d -m 128 -l 192.168.10.1 -p 11211 -u httpd

    \n

    参数分别代表:

    \n

     

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. -d 以守护程序(daemon)方式运行 memcached;  
    2. \n
    3. -m 设置 memcached 可以使用的内存大小,单位为 M;  
    4. \n
    5. -l 设置监听的 IP 地址,如果是本机的话,通常可以不设置此参数;  
    6. \n
    7. -p 设置监听的端口,默认为 11211,所以也可以不设置此参数;  
    8. \n
    9. -u 指定用户,如果当前为 root 的话,需要使用此参数指定用户。  
    10. \n
    \n
    \n

    如果你想了解在Rails中如何使用,请参cai同学翻译的”Ruby on Rails + Memcached“,或者直接去看原文;另外,如果你和我一样比较喜欢Nginx做webserver,你可以看看我写的Nginx在Ubuntu上的一系列文章,马上会加上Memcached的相关内容。

    \n

     

    \n
     ```", "created_at"=>2008-06-04 04:55:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很早前接触Rails的时候就知道memcached了,只是在自己的服务器上尚未看到这个需求,但是真的不久将来可能出现的情况,还是提前做下功课比较靠谱。
    \n今天在看一篇比较不错的文章“ 从LiveJournal后台发展看大规模网站性能优化方法”,该文章说了其LiveJournal发展过程中的几个阶段,逐渐的扩展和完善架构,从一个真实的环境中看出其架构的基本趋势。文中提到了memcached,原来memcached就诞生于此,很有兴趣的再多了解一些,memcached属于Danga,旗下还有其他几个很著名的东西,比如MogileFS等。
    \nMemcached 是高效、快速的分布式内存对象缓存系统,主要用于加速 WEB 动态应用程序。关于Memcached的安装等,可以参考“PHP & memcached”这篇文章的说明,基本上和其他unix下的程序安装差不多,下载源码、编译等等,不再赘述。
    \n其使用非常简单,直接就一个命令,连配置文件都省了,如下:
    \n/usr/bin/memcached -d -m 128 -l 192.168.10.1 -p 11211 -u httpd
    \n其参数分别代表:
    \n 
    \n
    \nXML/HTML代码
    \n
    \n -d 以守护程序(daemon)方式运行 memcached;  
    \n -m 设置 memcached 可以使用的内存大小,单位为 M;  
    \n -l 设置监听的 IP 地址,如果是本机的话,通常可以不设置此参数;  
    \n -p 设置监听的端口,默认为 11211,所以也可以不设置此参数;  
    \n -u 指定用户,如果当前为 root 的话,需要使用此参数指定用户。  
    \n
    \n
    \n如果你想了解在Rails中如何使用,请参cai同学翻译的”Ruby on Rails + Memcached“,或者直接去看原文;另外,如果你和我一样比较喜欢Nginx做webserver,你可以看看我写的Nginx在Ubuntu上的一系列文章,马上会加上Memcached的相关内容。
    \n 
    \n ```

    \n", "_id"=>304}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Ruby中使用WWW::Mechanize来开发爬虫程序.", "body"=>"

    有的时候需要去一个URL上取一些文字或者简介啥的下来,或者取一些自己需要的内容下来,这个时候虽然可以直接使用http-net连到URL上,取回内容,然后自己解析等,但是这在一定程度上算是网络爬虫的范畴。

    \n

    WWW::Mechanize:The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. 

    \n

    啊哈,貌似不错,在这个上面构建自己的爬虫应该简单的多了,可以使用它模拟浏览器的行为,但是需要注意的一点是,他模拟浏览器的时候会按照浏览器一样记住“历史”,如果你不设定历史条数,wowo,请留意你的内存吧,详细的请查看“ashchan”的文章”Mechanize的内存问题“。

    \n

    再看段例子吧,真的很简单,他里面使用的是hpricot,大家都比较熟悉了,呵呵,看段代码,如下:

    \n

    \n

    \n
    Google
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'mechanize'  
    4. \n
    5.   
    6. \n
    7. agent = WWW::Mechanize.new  
    8. \n
    9. agent.user_agent_alias = 'Mac Safari'  
    10. \n
    11. page = agent.get("http://www.google.com/")  
    12. \n
    13. search_form = page.forms.with.name("f").first  
    14. \n
    15. search_form.q = "Hello"  
    16. \n
    17. search_results = agent.submit(search_form)  
    18. \n
    19. puts search_results.body  
    20. \n
    \n
    \n简单吧,其他的请参考他的“EXAMPLES.txt”,其他信息请到其“Documentation”页面上查看吧。

    ", "created_at"=>2008-06-06 02:49:50 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有的时候需要去一个URL上取一些文字或者简介啥的下来,或者取一些自己需要的内容下来,这个时候虽然可以直接使用http-net连到URL上,取回内容,然后自己解析等,但是这在一定程度上算是网络爬虫的范畴。
    \nWWW::Mechanize:The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. 
    \n啊哈,貌似不错,在这个上面构建自己的爬虫应该简单的多了,可以使用它模拟浏览器的行为,但是需要注意的一点是,他模拟浏览器的时候会按照浏览器一样记住“历史”,如果你不设定历史条数,wowo,请留意你的内存吧,详细的请查看“ashchan”的文章”Mechanize的内存问题“。
    \n再看段例子吧,真的很简单,他里面使用的是hpricot,大家都比较熟悉了,呵呵,看段代码,如下:
    \n
    \n
    \nGoogle
    \n
    \n require 'rubygems'  
    \n require 'mechanize'  
    \n   
    \n agent = WWW::Mechanize.new  
    \n agent.user_agent_alias = 'Mac Safari'  
    \n page = agent.get("http://www.google.com/")  
    \n search_form = page.forms.with.name("f").first  
    \n search_form.q = "Hello"  
    \n search_results = agent.submit(search_form)  
    \n puts search_results.body  
    \n
    \n
    \n简单吧,其他的请参考他的“EXAMPLES.txt”,其他信息请到其“Documentation”页面上查看吧。

    \n", "_id"=>305}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"提升MYSQL性能可用思路和方案的技术分析", "body"=>"

    MYSQL成为越来越多的web2站点的选择的DB的时候,当站点越来越大,流量越来越多,用户越来越多的时候,数据库往往第一个成为系统的瓶颈,如何提升DB的性能成为系统成败的关键点,本文只是从自己的认识上说说可以从几个方面提升MYSQL的性能,以及可以采取的扩展方式。但是不会详细的阐述,详细的说明和操作,分析方法以后有时间再仔细分享。

    \n

    一、选择合适的数据库存贮引擎

    \n

    MYSQL支持的引擎很多,例如MyISAMMEMORYInnoDB等等类型,每个类型试用的场景是不一样的,恰当的选择存储引擎可以节省你不少时间,详细的介绍你可以参考”第15章:存储引擎和表类型“。

    \n

    二、优化SQL语句

    \n

    不要以为SQL语句关系不大,按照以往的经验,往往几个畸形的SQL就可以拖垮一个DB,决定不是危言耸听,在从系统优化和DB优化及其扩展之前,请仔细检查系统中用到的SQL,先解决SQL可能带来的问题,而经验是,做好这步,就可以解决很多初期的性能问题。

    \n

    三、建立索引

    \n

    这和前面的SQL优化有一定的联系,仔细查看你的SQL语言,尽可能的优化他,然后建立必须的索引,千万不要忽视了索引的威力,我们曾经有过测试,2W条的基本数据,生成页面,没有索引前,推算其全部生成需要的时间是81个小时,而加上索引后,只需要12分钟,多大的性能提升,各位可以自己那计算器粗略的算算。

    \n

    四、建立分区&表空间

    \n

    很多人以为只有Oracle才有表空间,分区这些东西,不想到MYSQL中也有类似的东西吧,尽管这个东西是mysql5才引入的,尽管其还不是很成熟,但是毫无疑问,这是一个好的信号,在我们使用MYSQL的时候就有了更多的方案来提升性能了。

    \n

    分区一般分为水平分区和垂直分区,MYSQL目前只支持水平分区,有RANGE,LIST,HASH,KEY等等分区方式,详细说明以后再说,你可以参考”第18章:分区“,"通过分区(Partition)提升MySQL性能"等文章。

    \n

    表空间的相关话题,可以参考”第17章:MySQL簇“,不在赘述。

    \n

    五、调整MYSQL和系统参数

    \n

    这个方案是伴随着整个性能提升过程的,你的不时的调整参数以得到更好的性能,这个比较复杂,没有啥成文的规定,都是靠经验或者实践得到的。

    \n

    六、集群或者proxy

    \n

    到这里为止,单机的MYSQL基本上可以优化调整的都涉及到了,如果这个时候还是顶不住压力,该考虑水平扩展或者垂直扩展了,垂直扩展比较容易,只要针对单机的性能得到瓶颈的所在,增加CPU或者内存或者换比较强劲的设备就可以很快得到立竿见影的效果。

    \n

    但是垂直扩展能力有限,不可能得到无限级的扩展,风险也比较大,除了垂直扩展,大家选择较多的是水平扩展,也就是通过增加服务器,无限的得到性能的扩展,当然这个里面内容是很多的,如何做到数据库的备份同步等都是需要考虑和解决的问题,而且还要考虑这么多机器间的数据重复成都等问题;除此之外,还有可能将数据库缓存到memcached或者使用mysql proxy等实现连接池之类的方案,都是需要考虑和抉择的。

    \n

    以上每个分类都是个大的话题,这么一篇文章只是说明了优化的思路基本流程,其中涉及到很多东西,例如诊断分析等都是很有技术含量的,我们下次会一个专题一个专题的仔细分析,力求将MYSQL的性能达到尽可能的榜。

    \n

    本人也只是站在自己使用的角度以及一些前人的经验上分析和分享,如果你有类似经验,还望分享,如果文章中有错误的或者不到位的地方,还望指出,谢谢。

    ", "created_at"=>2008-06-06 03:41:52 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    当MYSQL成为越来越多的web2站点的选择的DB的时候,当站点越来越大,流量越来越多,用户越来越多的时候,数据库往往第一个成为系统的瓶颈,如何提升DB的性能成为系统成败的关键点,本文只是从自己的认识上说说可以从几个方面提升MYSQL的性能,以及可以采取的扩展方式。但是不会详细的阐述,详细的说明和操作,分析方法以后有时间再仔细分享。
    \n一、选择合适的数据库存贮引擎
    \nMYSQL支持的引擎很多,例如MyISAM,MEMORY,InnoDB等等类型,每个类型试用的场景是不一样的,恰当的选择存储引擎可以节省你不少时间,详细的介绍你可以参考”第15章:存储引擎和表类型“。
    \n二、优化SQL语句
    \n不要以为SQL语句关系不大,按照以往的经验,往往几个畸形的SQL就可以拖垮一个DB,决定不是危言耸听,在从系统优化和DB优化及其扩展之前,请仔细检查系统中用到的SQL,先解决SQL可能带来的问题,而经验是,做好这步,就可以解决很多初期的性能问题。
    \n三、建立索引
    \n这和前面的SQL优化有一定的联系,仔细查看你的SQL语言,尽可能的优化他,然后建立必须的索引,千万不要忽视了索引的威力,我们曾经有过测试,2W条的基本数据,生成页面,没有索引前,推算其全部生成需要的时间是81个小时,而加上索引后,只需要12分钟,多大的性能提升,各位可以自己那计算器粗略的算算。
    \n四、建立分区&表空间
    \n很多人以为只有Oracle才有表空间,分区这些东西,不想到MYSQL中也有类似的东西吧,尽管这个东西是mysql5才引入的,尽管其还不是很成熟,但是毫无疑问,这是一个好的信号,在我们使用MYSQL的时候就有了更多的方案来提升性能了。
    \n分区一般分为水平分区和垂直分区,MYSQL目前只支持水平分区,有RANGE,LIST,HASH,KEY等等分区方式,详细说明以后再说,你可以参考”第18章:分区“,"通过分区(Partition)提升MySQL性能"等文章。
    \n表空间的相关话题,可以参考”第17章:MySQL簇“,不在赘述。
    \n五、调整MYSQL和系统参数
    \n这个方案是伴随着整个性能提升过程的,你的不时的调整参数以得到更好的性能,这个比较复杂,没有啥成文的规定,都是靠经验或者实践得到的。
    \n六、集群或者proxy
    \n到这里为止,单机的MYSQL基本上可以优化调整的都涉及到了,如果这个时候还是顶不住压力,该考虑水平扩展或者垂直扩展了,垂直扩展比较容易,只要针对单机的性能得到瓶颈的所在,增加CPU或者内存或者换比较强劲的设备就可以很快得到立竿见影的效果。
    \n但是垂直扩展能力有限,不可能得到无限级的扩展,风险也比较大,除了垂直扩展,大家选择较多的是水平扩展,也就是通过增加服务器,无限的得到性能的扩展,当然这个里面内容是很多的,如何做到数据库的备份,同步等都是需要考虑和解决的问题,而且还要考虑这么多机器间的数据重复成都等问题;除此之外,还有可能将数据库缓存到memcached或者使用mysql proxy等实现连接池之类的方案,都是需要考虑和抉择的。
    \n以上每个分类都是个大的话题,这么一篇文章只是说明了优化的思路和基本流程,其中涉及到很多东西,例如诊断和分析等都是很有技术含量的,我们下次会一个专题一个专题的仔细分析,力求将MYSQL的性能达到尽可能的榜。
    \n本人也只是站在自己使用的角度以及一些前人的经验上分析和分享,如果你有类似经验,还望分享,如果文章中有错误的或者不到位的地方,还望指出,谢谢。

    \n", "_id"=>306}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"WWDC 2008中让人兴奋的那么些消息", "body"=>"

    昨天夜里熬夜看欧洲杯,看WWDC2008的直播,一边写代码,实在是够爽,欧洲杯的法国和尼日利亚最终打成0:0,场面比较沉闷,而WWDC却让人非常兴奋。

    \n

    \"\"

    \n

    在Twitter上有WWDC的直播,但是Twitter提前就发布消息说其WWDC大会会给twitter增加了10倍的流量,造成twitter非常慢,期间还出现了“超过”负荷导致twitter崩溃的小片断。

    \n

    WWDC上最令人激动的消息应该是iphone 3G的推出了,其最最让人激动的应该是其价格大降,8G的iPhone 3G卖199美元,16G的卖299美元(有白色版本可以选)。之前的iphone价格,不晓得之前 入手的是否会骂jobs呢。。。

    \n

    另外还有其他的的消息,大家可以去apple4us上去看,消息比较全面,这次也非常的及时。看来是时候可以入手了哦。

    \n

    另外,怎么没看到mac book的消息呢,不是说mac book马上也有新版本的推出么?偶可一直在等呢。。。

    ", "created_at"=>2008-06-10 00:14:51 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    昨天夜里熬夜看欧洲杯,看WWDC2008的直播,一边写代码,实在是够爽,欧洲杯的法国和尼日利亚最终打成0:0,场面比较沉闷,而WWDC却让人非常兴奋。
    \n
    \n在Twitter上有WWDC的直播,但是Twitter提前就发布消息说其WWDC大会会给twitter增加了10倍的流量,造成twitter非常慢,期间还出现了“超过”负荷导致twitter崩溃的小片断。
    \nWWDC上最令人激动的消息应该是iphone 3G的推出了,其最最让人激动的应该是其价格大降,8G的iPhone 3G卖199美元,16G的卖299美元(有白色版本可以选)。之前的iphone价格,不晓得之前 入手的是否会骂jobs呢。。。
    \n另外还有其他的的消息,大家可以去apple4us上去看,消息比较全面,这次也非常的及时。看来是时候可以入手了哦。
    \n另外,怎么没看到mac book的消息呢,不是说mac book马上也有新版本的推出么?偶可一直在等呢。。。

    \n", "_id"=>307}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"PayPal携手Skype网络电话,让无线运营商见鬼去吧!", "body"=>"

    早上收到Paypal的mail,说和skype携手,提供更便宜的资费,又是一个好消息,难道不是么?

    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    可选套餐一国通套餐亚洲通套餐世界通套餐
    拨打范围可选择拨打全球34个国家地区之一可拨任意打亚洲4个国家地区可任意拨打全球34个国家地区
    超低资费44元/10000分钟50元/200分钟99元/10000分钟
    标准IP电话资费\n

    以中国大陆为例

    \n 0.3元/分钟
    \n

    以日本为例

    \n 3.6元/分钟
    \n

    以美国为例

    \n 2.4元/分钟
    打1小时可为您节省17.76元可为您节省201元可为您节省143.4元
    \n

    Good,详细信息可以看,“PayPal携手Skype网络电话——让您直通全球客户”,在IP电话逐渐盛行的今天,在iphone价格暴跌的现在,我想那些所谓的“运营商”们也该胆寒了吧,在自己围墙圈地,拿政策来发大财的时候,最后会发现,大家都绕着走,最后圈住的只是他们自己,这真是一个喜剧。

    ", "created_at"=>2008-06-10 01:54:37 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    早上收到Paypal的mail,说和skype携手,提供更便宜的资费,又是一个好消息,难道不是么?
    \n
    \n
    \n
    \n 可选套餐
    \n 一国通套餐
    \n 亚洲通套餐
    \n 世界通套餐
    \n
    \n
    \n 拨打范围
    \n 可选择拨打全球34个国家地区之一
    \n 可拨任意打亚洲4个国家地区
    \n 可任意拨打全球34个国家地区
    \n
    \n
    \n 超低资费
    \n 44元/10000分钟
    \n 50元/200分钟
    \n 99元/10000分钟
    \n
    \n
    \n 标准IP电话资费
    \n
    \n 以中国大陆为例
    \n 0.3元/分钟
    \n
    \n 以日本为例
    \n 3.6元/分钟
    \n
    \n 以美国为例
    \n 2.4元/分钟
    \n
    \n
    \n 打1小时
    \n 可为您节省17.76元
    \n 可为您节省201元
    \n 可为您节省143.4元
    \n
    \n
    \n
    \nGood,详细信息可以看,“PayPal携手Skype网络电话——让您直通全球客户”,在IP电话逐渐盛行的今天,在iphone价格暴跌的现在,我想那些所谓的“运营商”们也该胆寒了吧,在自己围墙圈地,拿政策来发大财的时候,最后会发现,大家都绕着走,最后圈住的只是他们自己,这真是一个喜剧。

    \n", "_id"=>308}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"HAProxy,智能分流的负载均衡方案。", "body"=>"

    以前说过,我最喜欢的一个跑Rails的方式是Nginx在前面,后端采用mongrel或者thin,采用nginx的原因不在多说,想详细了解 nginx的参考我以前的文章,按照道理来说,这样的方案已经很不错了,如果再加上memcached做cach,应该可以顶住不小的压力了。
    \n但是其当时也说到,Nginx的负载均衡到目前为止还是比较简单的轮训算法,他不会检测后端的mongrel是否压力过大,或者是否已经down下去了,这样就会初选,如果其中的一个mongrel挂掉了,nginx还是会把请求分过去的,这样就存在一个问题。
    \n
    \n于是就有这么一个需求,能不能监控到后端的mongrel的状况,做智能分发呢?啊哈,是的,可以,HAProxy就可以做到这点。先看个改进版的架构。
    \n\"\"
    \nok,比较清晰吧,Nginx接收到请求后,放到RequestQueue中,然后HAProxy从queue中取请求,智能的分发给后端的 App.Server。如此处理的好处就是HAProxy可以判断后端App.Server的负载情况以及是否down机情况,然后做智能分发。

    \n

    OK,比较清晰了,我们再把Memcached加上,再加上智能判断一台服务器Down掉的情况,我再画个图片,如下:

    \n

    \"\"

    \n

    参考文章:
    \n1、HAproxy做负载均衡
    \n2、nginx - Reading the fine print
    \n3、New Nginx.conf with optimizations
    \n4、Load Balancing & QoS with HAProxy
    \n5、Reviewing Application Health with HAProxy Stats

    ", "created_at"=>2008-06-10 09:38:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    以前说过,我最喜欢的一个跑Rails的方式是Nginx在前面,后端采用mongrel或者thin,采用nginx的原因不在多说,想详细了解 nginx的参考我以前的文章,按照道理来说,这样的方案已经很不错了,如果再加上memcached做cach,应该可以顶住不小的压力了。
    \n但是其当时也说到,Nginx的负载均衡到目前为止还是比较简单的轮训算法,他不会检测后端的mongrel是否压力过大,或者是否已经down下去了,这样就会初选,如果其中的一个mongrel挂掉了,nginx还是会把请求分过去的,这样就存在一个问题。
    \n
    \n于是就有这么一个需求,能不能监控到后端的mongrel的状况,做智能分发呢?啊哈,是的,可以,HAProxy就可以做到这点。先看个改进版的架构。
    \n
    \nok,比较清晰吧,Nginx接收到请求后,放到RequestQueue中,然后HAProxy从queue中取请求,智能的分发给后端的 App.Server。如此处理的好处就是HAProxy可以判断后端App.Server的负载情况以及是否down机情况,然后做智能分发。
    \nOK,比较清晰了,我们再把Memcached加上,再加上智能判断一台服务器Down掉的情况,我再画个图片,如下:
    \n
    \n参考文章:
    \n1、HAproxy做负载均衡
    \n2、nginx - Reading the fine print
    \n3、New Nginx.conf with optimizations
    \n4、Load Balancing & QoS with HAProxy
    \n5、Reviewing Application Health with HAProxy Stats

    \n", "_id"=>309}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中使用will_Paginate的分页技巧", "body"=>"

    WillPaginate这个插件很棒,以至于其取代了Rails中原有的Paginate方法,虽然看上其很简单,其实还是有不少技巧的,本篇用来记录我遇到的或者使用到的一些tips。
    \n
    \n1.直接使用paginate
    \n这个比较简单,也是使用的最多的,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.get_all_items_in_catelog( catelog_id,page,per_page="10")  
    2. \n
    3.   paginate :per_page => per_page, :page => page,  
    4. \n
    5.     :conditions =>["catelog_id = ? and caiji > 0",catelog_id],  
    6. \n
    7.     :order => 'created_at DESC ,updated_at  DESC'  
    8. \n
    9. end 
      \n
    10. \n
    \n
    \n

     2.使用Model.paginate_by_sql
    \n有的时候,你需要的SQL用Rails拼的时候有些不方便,这个时候可以考虑使用paginate_by_sql来实现,这个没啥好说的,你需要什么样的SQL直接写就可以了,例如:
    \n  #排行榜列表

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.get_all_items_in_rank(rank_id, page,per_page="10")  
    2. \n
    3.     Book.paginate_by_sql ["SELECT DISTINCT `books`.* FROM `books` LEFT OUTER JOIN `ranksorts`
      \n
    4. \n
    5. ON (`books`.`prodid` = `ranksorts`.`prodid`) LEFT OUTER JOIN `ranks` 
      \n
    6. \n
    7. ON (`ranks`.`id` = `ranksorts`.`rank_id`) WHERE (ranks.id = ?)
      \n
    8. \n
    9. ORDER BY books.updated_at DESC,books.created_at DESC", rank_id],  
    10. \n
    11.       :page => page, :per_page => per_page  
    12. \n
    13. end  
    14. \n
    \n
    \n

    还有其他的一些小技巧,慢慢添加,你如果有类似的技巧,期待您的分享。。
    \n
    \n参考文档:
    \n1、I'm Paginating Again

    ", "created_at"=>2008-06-10 17:34:21 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    WillPaginate这个插件很棒,以至于其取代了Rails中原有的Paginate方法,虽然看上其很简单,其实还是有不少技巧的,本篇用来记录我遇到的或者使用到的一些tips。
    \n
    \n1.直接使用paginate
    \n这个比较简单,也是使用的最多的,如下:
    \n
    \nRuby代码
    \n
    \n def self.get_all_items_in_catelog( catelog_id,page,per_page="10")  
    \n   paginate :per_page => per_page, :page => page,  
    \n     :conditions =>["catelog_id = ? and caiji > 0",catelog_id],  
    \n     :order => 'created_at DESC ,updated_at  DESC'  
    \n end 
    \n
    \n
    \n
    \n 2.使用Model.paginate_by_sql
    \n有的时候,你需要的SQL用Rails拼的时候有些不方便,这个时候可以考虑使用paginate_by_sql来实现,这个没啥好说的,你需要什么样的SQL直接写就可以了,例如:
    \n  #排行榜列表
    \n
    \nRuby代码
    \n
    \n def self.get_all_items_in_rank(rank_id, page,per_page="10")  
    \n     Book.paginate_by_sql ["SELECT DISTINCT books.* FROM books LEFT OUTER JOIN ranksorts
    \n
    \n ON (books.prodid = ranksorts.prodid) LEFT OUTER JOIN ranks 
    \n
    \n ON (ranks.id = ranksorts.rank_id) WHERE (ranks.id = ?)
    \n
    \n ORDER BY books.updated_at DESC,books.created_at DESC", rank_id],  
    \n       :page => page, :per_page => per_page  
    \n end  
    \n
    \n
    \n还有其他的一些小技巧,慢慢添加,你如果有类似的技巧,期待您的分享。。
    \n
    \n参考文档:
    \n1、I'm Paginating Again

    \n", "_id"=>310}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails在MySQL的大表中add_column很慢的问题!", "body"=>"

    项目使用Rails开发,DB采用的是MySQL,有一个不算复杂的表A,记录数差不多50W条数据,现在想增加一个列属性,于是很自然的想到Rails中的add_column,然后rake迁移数据,但是等了很久未见执行完毕,诡异。
    \n初步判断是由于表里的记录太多了,查下add_column是怎杨的,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. # File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 121  
    2. \n
    3. 121:       def add_column(table_name, column_name, type, options = {})  
    4. \n
    5. 122:         add_column_sql = "ALTER TABLE \#{table_name} ADD \#{quote_column_name(column_name)} \#{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"  
    6. \n
    7. 123:         add_column_options!(add_column_sql, options)  
    8. \n
    9. 124:         execute(add_column_sql)  
    10. \n
    11. 125:       end  
    12. \n
    \n
    \n

    恩,挺直接的,就是:
    \nALTER TABLE table_name ADD column_name ,貌似没啥问题,看来是MySQL的问题,和Rails无关,Google下资料,发现“change index or add column in a very big table”和我遇到的问题基本一致,但是其回复中并没有说道如何解决或者如何提升性能。
    \n继续Google,找到“Why MySQL could be slow with large tables ?”这篇文章,谈到了为什么说MySQL在大表的时候会很慢,其观点是和表的结构设计有关。其有人回复说“I have a table with 35 mil records. When I wanted to add a column (alter table) I would take about 2 days.”,和我的问题一致,这个文章很好,建议各位有时间的仔细看看。
    \n但是我的这个数据表结构并不复杂,如何能提升其速度呢,还在研究中,有了思路会再更新上来。
    \n

    ", "created_at"=>2008-06-12 09:05:21 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    项目使用Rails开发,DB采用的是MySQL,有一个不算复杂的表A,记录数差不多50W条数据,现在想增加一个列属性,于是很自然的想到Rails中的add_column,然后rake迁移数据,但是等了很久未见执行完毕,诡异。
    \n初步判断是由于表里的记录太多了,查下add_column是怎杨的,如下:
    \n
    \nRuby代码
    \n
    \n # File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 121  
    \n 121:       def add_column(table_name, column_name, type, options = {})  
    \n 122:         add_column_sql = "ALTER TABLE \#{table_name} ADD \#{quote_column_name(column_name)} \#{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"  
    \n 123:         add_column_options!(add_column_sql, options)  
    \n 124:         execute(add_column_sql)  
    \n 125:       end  
    \n
    \n
    \n恩,挺直接的,就是:
    \nALTER TABLE table_name ADD column_name ,貌似没啥问题,看来是MySQL的问题,和Rails无关,Google下资料,发现“change index or add column in a very big table”和我遇到的问题基本一致,但是其回复中并没有说道如何解决或者如何提升性能。
    \n继续Google,找到“Why MySQL could be slow with large tables ?”这篇文章,谈到了为什么说MySQL在大表的时候会很慢,其观点是和表的结构设计有关。其有人回复说“I have a table with 35 mil records. When I wanted to add a column (alter table) I would take about 2 days.”,和我的问题一致,这个文章很好,建议各位有时间的仔细看看。
    \n但是我的这个数据表结构并不复杂,如何能提升其速度呢,还在研究中,有了思路会再更新上来。

    \n", "_id"=>311}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"ubuntu8.04安装gem install mysql 出错", "body"=>"

    问题:在ubuntu8.04中,使用

    \n
    \n
      \n
    1. sudo gem install mysql  
    2. \n
    \n
    \n
    sudo gem install mysql```\n

    出现:

    \n
    \n
      \n
    1. ERROR:  While executing gem ... (RuntimeError)  
    2. \n
    3.     ERROR: Failed to build gem native extension.  
    4. \n
    5. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys  
    6. \n
    \n
    \n
    ERROR:  While executing gem ... (RuntimeError)     ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys```\n

    解决方案
    \n1.先运行

    \n
    \n
      \n
    1. $ sudo apt-get install libmysqlclient15-dev  
    2. \n
    \n
    \n
    $ sudo apt-get install libmysqlclient15-dev```\n

    注意上面安装的库名为libmysqlclient15-dev而非libmysqlclient5-dev
    \n
    \n2.再运行
    \nsudo gem install mysql

    ", "created_at"=>2008-06-12 12:48:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    问题:在ubuntu8.04中,使用
    \n
    \n
    \n sudo gem install mysql  
    \n
    \n
    \nsudo gem install mysql
    \n<p>出现:</p>
    \n<div class="dp-highlighter">
    \n<ol start="1" class="dp-j">
    \n <li><span><span>ERROR:&nbsp;&nbsp;While&nbsp;executing&nbsp;gem&nbsp;...&nbsp;(RuntimeError)&nbsp;&nbsp;</span></span></li>
    \n <li><span>&nbsp;&nbsp;&nbsp;&nbsp;ERROR:&nbsp;Failed&nbsp;to&nbsp;build&nbsp;gem&nbsp;<span class="keyword">native</span><span>&nbsp;extension.&nbsp;&nbsp;</span></span></li>
    \n <li><span>Gem&nbsp;files&nbsp;will&nbsp;remain&nbsp;installed&nbsp;in&nbsp;/usr/lib/ruby/gems/<span class="number">1.8</span><span>/gems/mys&nbsp;&nbsp;</span></span></li>
    \n</ol>
    \n</div>
    \n<pre class="java" name="code" style="display: none;">ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mys

    \n解决方案
    \n1.先运行
    \n
    \n
    \n $ sudo apt-get install libmysqlclient15-dev  
    \n
    \n
    \n$ sudo apt-get install libmysqlclient15-dev```
    \n注意上面安装的库名为libmysqlclient15-dev而非libmysqlclient5-dev
    \n
    \n2.再运行
    \nsudo gem install mysql

    \n", "_id"=>312}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ubuntu:gzip: stdout: No space left on device", "body"=>"

    问题:
    \niceskysl@IceskYsl:/boot$ sudo dpkg --configure -a
    \n正在设置 initramfs-tools (0.85eubuntu39.1) ...
    \nupdate-initramfs: deferring update (trigger activated)
    \n
    \n正在设置 linux-ubuntu-modules-2.6.24-18-generic (2.6.24-18.26) ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \n正在设置 linux-image-generic (2.6.24.18.20) ...
    \n正在设置 linux-generic (2.6.24.18.20) ...
    \nProcessing triggers for initramfs-tools ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \ngzip: stdout: No space left on device
    \nupdate-initramfs: failed for /boot/initrd.img-2.6.24-18-generic
    \ndpkg: 子进程 post-installation script 返回了错误号 1
    \n
    \n解决:
    \nuname -a 看自己用的什么
    \ndpkg --get-selections|grep linux 看机器里都装了什么
    \nsudo apt-get remove linux-image-2.6.XX 直接删 XX替代为不用的
    \n或者用新立得搜索到不用的卸载

    \n
    \n实践:
    \niceskysl@IceskYsl:~$ uname -a
    \nLinux IceskYsl 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
    \niceskysl@IceskYsl:~$ dpkg --get-selections|grep linux
    \nlibselinux1                    install
    \nlinux-generic                    install
    \nlinux-headers-2.6.20-15                install
    \nlinux-headers-2.6.20-15-generic            install
    \nlinux-headers-2.6.20-16                install
    \nlinux-headers-2.6.20-16-generic            install
    \nlinux-headers-2.6.24-16                install
    \nlinux-headers-2.6.24-16-generic            install
    \nlinux-headers-2.6.24-17                install
    \nlinux-headers-2.6.24-17-generic            install
    \nlinux-headers-2.6.24-18                install
    \nlinux-headers-2.6.24-18-generic            install
    \nlinux-headers-generic                install
    \nlinux-image-2.6.20-15-generic            deinstall
    \nlinux-image-2.6.20-16-generic            install
    \nlinux-image-2.6.22-14-generic            install
    \nlinux-image-2.6.24-16-generic            install
    \nlinux-image-2.6.24-17-generic            install
    \nlinux-image-2.6.24-18-generic            install
    \nlinux-image-generic                install
    \nlinux-libc-dev                    install
    \nlinux-restricted-modules-2.6.20-15-generic    deinstall
    \nlinux-restricted-modules-2.6.20-16-generic    install
    \nlinux-restricted-modules-2.6.22-14-generic    install
    \nlinux-restricted-modules-2.6.24-16-generic    install
    \nlinux-restricted-modules-2.6.24-17-generic    install
    \nlinux-restricted-modules-2.6.24-18-generic    install
    \nlinux-restricted-modules-common            install
    \nlinux-restricted-modules-generic        install
    \nlinux-sound-base                install
    \nlinux-ubuntu-modules-2.6.22-14-generic        install
    \nlinux-ubuntu-modules-2.6.24-16-generic        install
    \nlinux-ubuntu-modules-2.6.24-17-generic        install
    \nlinux-ubuntu-modules-2.6.24-18-generic        install
    \nutil-linux                    install
    \nutil-linux-locales                install
    \niceskysl@IceskYsl:~$ sudo apt-get remove linux-image-2.6.20-16-generic
    \n正在读取软件包列表... 完成
    \n正在分析软件包的依赖关系树      
    \n读取状态信息... 完成            
    \n下列软件包将被【卸载】:
    \n  linux-image-2.6.20-16-generic linux-restricted-modules-2.6.20-16-generic
    \n共升级了 0 个软件包,新安装了 0 个软件包,要卸载 2 个软件包,有 34 个软件未被升级。
    \n操作完成后,会释放 114MB 的磁盘空间。
    \n您希望继续执行吗?[Y/n]y
    \n(正在读取数据库 ... 系统当前总共安装有 218707 个文件和目录。)
    \n正在删除 linux-restricted-modules-2.6.20-16-generic ...
    \nFATAL: Could not open '/boot/System.map-2.6.20-16-generic': No such file or directory
    \n正在删除 linux-image-2.6.20-16-generic ...
    \nRunning postrm hook script /sbin/update-grub.
    \nSearching for GRUB installation directory ... found: /boot/grub
    \nSearching for default file ... found: /boot/grub/default
    \nTesting for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    \nSearching for splash image ... none found, skipping ...
    \nFound kernel: /vmlinuz-2.6.24-18-generic
    \nFound kernel: /memtest86+.bin
    \nUpdating /boot/grub/menu.lst ... done

    ", "created_at"=>2008-06-12 12:59:54 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    问题:
    \niceskysl@IceskYsl:/boot$ sudo dpkg --configure -a
    \n正在设置 initramfs-tools (0.85eubuntu39.1) ...
    \nupdate-initramfs: deferring update (trigger activated)
    \n
    \n正在设置 linux-ubuntu-modules-2.6.24-18-generic (2.6.24-18.26) ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \n正在设置 linux-image-generic (2.6.24.18.20) ...
    \n正在设置 linux-generic (2.6.24.18.20) ...
    \nProcessing triggers for initramfs-tools ...
    \nupdate-initramfs: Generating /boot/initrd.img-2.6.24-18-generic
    \n
    \ngzip: stdout: No space left on device
    \nupdate-initramfs: failed for /boot/initrd.img-2.6.24-18-generic
    \ndpkg: 子进程 post-installation script 返回了错误号 1
    \n
    \n解决:
    \nuname -a 看自己用的什么
    \ndpkg --get-selections|grep linux 看机器里都装了什么
    \nsudo apt-get remove linux-image-2.6.XX 直接删 XX替代为不用的
    \n或者用新立得搜索到不用的卸载
    \n
    \n实践:
    \niceskysl@IceskYsl:~$ uname -a
    \nLinux IceskYsl 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
    \niceskysl@IceskYsl:~$ dpkg --get-selections|grep linux
    \nlibselinux1                    install
    \nlinux-generic                    install
    \nlinux-headers-2.6.20-15                install
    \nlinux-headers-2.6.20-15-generic            install
    \nlinux-headers-2.6.20-16                install
    \nlinux-headers-2.6.20-16-generic            install
    \nlinux-headers-2.6.24-16                install
    \nlinux-headers-2.6.24-16-generic            install
    \nlinux-headers-2.6.24-17                install
    \nlinux-headers-2.6.24-17-generic            install
    \nlinux-headers-2.6.24-18                install
    \nlinux-headers-2.6.24-18-generic            install
    \nlinux-headers-generic                install
    \nlinux-image-2.6.20-15-generic            deinstall
    \nlinux-image-2.6.20-16-generic            install
    \nlinux-image-2.6.22-14-generic            install
    \nlinux-image-2.6.24-16-generic            install
    \nlinux-image-2.6.24-17-generic            install
    \nlinux-image-2.6.24-18-generic            install
    \nlinux-image-generic                install
    \nlinux-libc-dev                    install
    \nlinux-restricted-modules-2.6.20-15-generic    deinstall
    \nlinux-restricted-modules-2.6.20-16-generic    install
    \nlinux-restricted-modules-2.6.22-14-generic    install
    \nlinux-restricted-modules-2.6.24-16-generic    install
    \nlinux-restricted-modules-2.6.24-17-generic    install
    \nlinux-restricted-modules-2.6.24-18-generic    install
    \nlinux-restricted-modules-common            install
    \nlinux-restricted-modules-generic        install
    \nlinux-sound-base                install
    \nlinux-ubuntu-modules-2.6.22-14-generic        install
    \nlinux-ubuntu-modules-2.6.24-16-generic        install
    \nlinux-ubuntu-modules-2.6.24-17-generic        install
    \nlinux-ubuntu-modules-2.6.24-18-generic        install
    \nutil-linux                    install
    \nutil-linux-locales                install
    \niceskysl@IceskYsl:~$ sudo apt-get remove linux-image-2.6.20-16-generic
    \n正在读取软件包列表... 完成
    \n正在分析软件包的依赖关系树      
    \n读取状态信息... 完成            
    \n下列软件包将被【卸载】:
    \n  linux-image-2.6.20-16-generic linux-restricted-modules-2.6.20-16-generic
    \n共升级了 0 个软件包,新安装了 0 个软件包,要卸载 2 个软件包,有 34 个软件未被升级。
    \n操作完成后,会释放 114MB 的磁盘空间。
    \n您希望继续执行吗?[Y/n]y
    \n(正在读取数据库 ... 系统当前总共安装有 218707 个文件和目录。)
    \n正在删除 linux-restricted-modules-2.6.20-16-generic ...
    \nFATAL: Could not open '/boot/System.map-2.6.20-16-generic': No such file or directory
    \n正在删除 linux-image-2.6.20-16-generic ...
    \nRunning postrm hook script /sbin/update-grub.
    \nSearching for GRUB installation directory ... found: /boot/grub
    \nSearching for default file ... found: /boot/grub/default
    \nTesting for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    \nSearching for splash image ... none found, skipping ...
    \nFound kernel: /vmlinuz-2.6.24-18-generic
    \nFound kernel: /memtest86+.bin
    \nUpdating /boot/grub/menu.lst ... done

    \n", "_id"=>313}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"留意你的layout和filter的摆放顺序", "body"=>"

    前几天发现Rails的log里面老是出现一些按照ID找不到记录的错误,如下:

    \n

    ActiveRecord::RecordNotFound (Couldn't find User without an ID):
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1248:in `find_from_ids'
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in `find'
    \n    /app/models/right.rb:7:in `chech_right'
    \n    /app/controllers/home_controller.rb:30:in `check_right'

    \n

    奇怪了,这个是我用来做权限控制的,按照道理来说,这个如果未登录的话,应该会被before_filter定向到其他的地方去的,咋会还显示这个页面呢,原来以为Rails会丢失session中的东西,不过仔细想想可能性不大,于是仔细检查了下代码,发现问题的根源是before_filter和layout的摆放顺序有问题,竟然是这样摆放的:

    \n
      layout "back"
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n
    \n

    看到其上面的layout竟然放在  before_filter之前了,哦,原来如此,修改下顺序,现在为:

    \n
      before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n  layout "back" 
    \n

    重启服务,OK,搞定。

    \n

     

    \n

     

    ", "created_at"=>2008-06-15 13:48:52 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前几天发现Rails的log里面老是出现一些按照ID找不到记录的错误,如下:
    \nActiveRecord::RecordNotFound (Couldn't find User without an ID):
    \n    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1248:in find_from_ids'<br />
    \n&nbsp;&nbsp;&nbsp; /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in
    find'
    \n    /app/models/right.rb:7:in chech_right'<br />
    \n&nbsp;&nbsp;&nbsp; /app/controllers/home_controller.rb:30:in
    check_right'
    \n奇怪了,这个是我用来做权限控制的,按照道理来说,这个如果未登录的话,应该会被before_filter定向到其他的地方去的,咋会还显示这个页面呢,原来以为Rails会丢失session中的东西,不过仔细想想可能性不大,于是仔细检查了下代码,发现问题的根源是before_filter和layout的摆放顺序有问题,竟然是这样摆放的:
    \n  layout "back"
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n
    \n看到其上面的layout竟然放在  before_filter之前了,哦,原来如此,修改下顺序,现在为:
    \n  before_filter :get_current_user
    \n  before_filter :authorize
    \n  before_filter :init_user
    \n  before_filter :check_right
    \n  layout "back" 
    \n重启服务,OK,搞定。
    \n 
    \n 

    \n", "_id"=>314}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"推荐两款支持Rails的服务提供商(SliceHost&DreamHost)", "body"=>"

    上次写了一篇文章《谈谈我使用过的几个国外服务器提供商》,不少朋友来信要我再推荐好的Rails空间和优惠码,如果你正在找寻支持Rails的空间,不妨试试我使用过的这两款,看您的需求,选择合适的。
    \n1.SliceHost生产系统性价比最高)
    \nSliceHost是一家很棒的VPS服务商提供诸如Ubuntu(提供好几个版本)、CentOS、Debian 4.0、Fedora 9、Gentoo好几种系统发行版选择,可以选择256M、512M、1G等好几种方案,拥有root权限,完全自主,非常稳定且价格在VPS中是最便宜 的,适合做生产环境,极力推荐。
    \n如果你感兴趣,按照如下两个方式得到最大优惠:
    \n1.点击优惠的SliceHost过去注册;
    \n2.注册时“Referral email address”输入"iceskysl@gmail.com"即可。
    \n另外,值得一提的是,其可以重新rebuild发行版(会丢失数据,切记备份),使用Slicehost的感觉就是自己除了物理接触外,完全拥有。且其相关的教材、文章非常详细,我在其上部署的Nginx+Mongrel+Vlad+MySQL非常棒。
    \n体验站点IceskYsl@1sters! | Focus on Ruby on Rails ,Security, Web2.0, Idea, Business and Beyond.

    \n

    2.DreamHostDemo演示类性价比最高)

    \n

    DreamHost在Rails和PHP的支持上还是不错的,部署和定制都很方便,其支持无限域名绑定,500G硬盘和无限流量,虽然有赚取眼球的嫌疑,但是用来给客户做Demo演示、个人Blog等等非常适合,你可以按照如下两个中的任意方式得到其允许的最大优惠额度:
    \n1.直接按照优惠的DreamHost过去注册;
    \n2.注册时输入优惠码"1STERS";
    \n体验站点: 1sters! - Ruby on Rails web development(敏捷满足您个性化的需求...)!

    \n

    有任何问题,请联系我,很乐意帮忙:)

    \n

    其他的信息(例如优缺点,局限性等),请参考前面写的那篇《谈谈我使用过的几个国外服务器提供商》,不在赘述,本文只是就自己使用感受给大家推荐的,如果你试用过其他服务商,还请分享。

    ", "created_at"=>2008-06-16 03:01:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    上次写了一篇文章《谈谈我使用过的几个国外服务器提供商》,不少朋友来信要我再推荐好的Rails空间和优惠码,如果你正在找寻支持Rails的空间,不妨试试我使用过的这两款,看您的需求,选择合适的。
    \n1.SliceHost(生产系统性价比最高)
    \nSliceHost是一家很棒的VPS服务商提供诸如Ubuntu(提供好几个版本)、CentOS、Debian 4.0、Fedora 9、Gentoo好几种系统发行版选择,可以选择256M、512M、1G等好几种方案,拥有root权限,完全自主,非常稳定且价格在VPS中是最便宜 的,适合做生产环境,极力推荐。
    \n如果你感兴趣,按照如下两个方式得到最大优惠:
    \n1.点击优惠的SliceHost过去注册;
    \n2.注册时“Referral email address”输入"iceskysl@gmail.com"即可。
    \n另外,值得一提的是,其可以重新rebuild发行版(会丢失数据,切记备份),使用Slicehost的感觉就是自己除了物理接触外,完全拥有。且其相关的教材、文章非常详细,我在其上部署的Nginx+Mongrel+Vlad+MySQL非常棒。
    \n体验站点:IceskYsl@1sters! | Focus on Ruby on Rails ,Security, Web2.0, Idea, Business and Beyond.
    \n2.DreamHost(Demo演示类性价比最高)
    \nDreamHost在Rails和PHP的支持上还是不错的,部署和定制都很方便,其支持无限域名绑定,500G硬盘和无限流量,虽然有赚取眼球的嫌疑,但是用来给客户做Demo演示、个人Blog等等非常适合,你可以按照如下两个中的任意方式得到其允许的最大优惠额度:
    \n1.直接按照优惠的DreamHost过去注册;
    \n2.注册时输入优惠码"1STERS";
    \n体验站点: 1sters! - Ruby on Rails web development(敏捷满足您个性化的需求...)!
    \n有任何问题,请联系我,很乐意帮忙:)
    \n其他的信息(例如优缺点,局限性等),请参考前面写的那篇《谈谈我使用过的几个国外服务器提供商》,不在赘述,本文只是就自己使用感受给大家推荐的,如果你试用过其他服务商,还请分享。

    \n", "_id"=>315}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"协作翻译: Ruby On Raisl 2.1新特性(第二版)", "body"=>"

    昨天看到caiwangqin在CoR上发了一篇帖子说“RubyOnRails 2.1 what's new”这本书原文是葡萄牙的,由Brazilian社区翻译为英文,希望能有人组织翻译成中文版。

    \n

    我向来希望把自己了解的东西写下里,记录成Doc文档分享给其他的人,如果你经常关注我的blog,应该了解;于是花了中午午休的时候,按照以往的经验做了一份协作约定文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,然后翻译了索引篇《Ruby On Raisl 2.1新特性介绍》和第一章《第1章: 概述(Introduction)》,发布给其他成员。

    \n

    紧接着我有挑选了几篇感兴趣的翻译,其他成员积极性相当高,仅仅一下午,所有14章全部领取完毕,晚上看GoogleDoc发现大家都在辛苦工作,实在感动,谢谢各位。

    \n

    再次感受到社区的力量,很多朋友一般是不怎么联系的,但是这事情一发动就得到大家的积极响应,人多力量果然很大。

    \n

    相信,这本书很快就可以和大家见面了,:)

    \n

    这是个不错的模式,希望以后还能有机会找到好资料,大家协作完成。

    ", "created_at"=>2008-06-16 14:50:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    昨天看到caiwangqin在CoR上发了一篇帖子说“RubyOnRails 2.1 what's new”这本书原文是葡萄牙的,由Brazilian社区翻译为英文,希望能有人组织翻译成中文版。
    \n我向来希望把自己了解的东西写下里,记录成Doc文档分享给其他的人,如果你经常关注我的blog,应该了解;于是花了中午午休的时候,按照以往的经验做了一份协作约定文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,然后翻译了索引篇《Ruby On Raisl 2.1新特性介绍》和第一章《第1章: 概述(Introduction)》,发布给其他成员。
    \n紧接着我有挑选了几篇感兴趣的翻译,其他成员积极性相当高,仅仅一下午,所有14章全部领取完毕,晚上看GoogleDoc发现大家都在辛苦工作,实在感动,谢谢各位。
    \n再次感受到社区的力量,很多朋友一般是不怎么联系的,但是这事情一发动就得到大家的积极响应,人多力量果然很大。
    \n相信,这本书很快就可以和大家见面了,:)
    \n这是个不错的模式,希望以后还能有机会找到好资料,大家协作完成。

    \n", "_id"=>316}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"install and configuration vsftpd ftp service on Ubuntu Linux", "body"=>"

    Q. How do I install Ubuntu ftp service or server?

    \n

    A. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
    \n=> proftpd - Versatile, virtual-hosting FTP daemon

    \n

    => vsftpd - The Very Secure FTP Daemon

    \n

    => ftpd - FTP server

    \n

    => wu-ftpd - powerful and widely used FTP server

    \n

    => wzdftpd - A portable, modular, small and efficient ftp server

    \n

    => pure-ftpd - Pure-FTPd FTP server

    \n

    其中vsftpd相当优秀,其配置简单方便,且非常安全,如下是其主页上的说明:

    \n

    vsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.

    \n

    => Default ftp port : 21
    \n=> Default configuration file : /etc/vsftpd.conf

    \n

    Q:如何安装vsftpd

    \n

    很简单,即可搞,如下:
    \n

    \n### Step # 1: Install vsftpd\n

    Type apt-get command to install vsftpd
    \n````$ sudo apt-get install vsftpd```
    \nOutput:

    \n
    \n``Password:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
    vsftpd
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 121kB of archives.
    After unpacking 438kB of additional disk space will be used.
    Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
    Fetched 121kB in 0s (246kB/s)
    Selecting previously deselected package vsftpd.
    (Reading database ... 31396 files and directories currently installed.)
    Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
    Setting up vsftpd (2.0.4-0ubuntu5) ...
    Adding system user `ftp' with uid 106...
    Adding new user `ftp' (106) with group `nogroup'.
    Not creating home directory `/home/ftp'.
    * Starting FTP server: vsftpd```\n
    \n### Step # 2: Configure /etc/vsftpd.conf\n

    The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
    \n````$ sudo vi /etc/vsftpd.conf```

    \n

    Add the following line (uncomment line) to the vsftpd configuration file:
    \n````local_enable=YES```
    \nAbove config directive will allow local users to log in via ftp

    \n

    If you would like to allow users to upload file, add the following to the file:
    \n````write_enable=YES```

    \n

    For security you may restrict local users to their home directories. Add the following to the file:
    \n````chroot_local_user=YES```

    \n

    Save and close the file.

    \n### Step # 3: Restart vsftpd\n

    To restart vsftpd type the command :
    \n````$ sudo /etc/init.d/vsftpd restart```
    \nOutput:

    \n``* Stopping FTP server: vsftpd [ ok ]
    * Starting FTP server: vsftpd [ ok ]

    add following rules to your iptables script. Assuming that default
    incoming policy is drop. If protocol is TCP and destination port is 21
    (ftp):

    ````iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT```

    See - How do I open open ftp port 21 using iptables for more information.```\n

    There are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
    \n````$ man vsftpd.conf```

    \n``参考文档:
    1、http://www.cyberciti.biz/faq/ubuntu-vsftpd-ftp-service-server/
    2、http://school.cfan.com.cn/system/unix/2008-06-16/1213603744d188509.shtml```", "created_at"=>2008-06-17 12:33:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Q. How do I install Ubuntu ftp service or server?
    \nA. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
    \n=> proftpd - Versatile, virtual-hosting FTP daemon
    \n=> vsftpd - The Very Secure FTP Daemon
    \n=> ftpd - FTP server
    \n=> wu-ftpd - powerful and widely used FTP server
    \n=> wzdftpd - A portable, modular, small and efficient ftp server
    \n=> pure-ftpd - Pure-FTPd FTP server
    \n其中vsftpd相当优秀,其配置简单方便,且非常安全,如下是其主页上的说明:
    \nvsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.
    \n=> Default ftp port : 21
    \n=> Default configuration file : /etc/vsftpd.conf
    \nQ:如何安装vsftpd
    \n很简单,即可搞,如下:

    \n\n

    Step # 1: Install vsftpd

    \n\n

    Type apt-get command to install vsftpd
    \n`$ sudo apt-get install vsftpd
    \nOutput:
    \n
    \nPassword:<br />Reading package lists... Done<br />Building dependency tree<br />Reading state information... Done<br />The following NEW packages will be installed:<br /> vsftpd<br />0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.<br />Need to get 121kB of archives.<br />After unpacking 438kB of additional disk space will be used.<br />Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]<br />Fetched 121kB in 0s (246kB/s)<br />Selecting previously deselected package vsftpd.<br />(Reading database ... 31396 files and directories currently installed.)<br />Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...<br />Setting up vsftpd (2.0.4-0ubuntu5) ...<br />Adding system user `ftp' with uid 106...<br />Adding new user `ftp' (106) with group `nogroup'.<br />Not creating home directory `/home/ftp'.<br /> * Starting FTP server: vsftpd`

    \n\n

    Step # 2: Configure /etc/vsftpd.conf

    \n\n

    The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
    \n$ sudo vi /etc/vsftpd.conf```</strong></p>
    \n<p>Add the following line (uncomment line) to the vsftpd configuration file:<br />
    \n<strong>
    local_enable=YES</strong><br />
    \nAbove config directive will allow local users to log in via ftp</p>
    \n<p>If you would like to allow users to upload file, add the following to the file:<br />
    \n<strong>
    write_enable=YES</strong></p>
    \n<p>For security you may restrict local users to their home directories. Add the following to the file:<br />
    \n<strong>
    chroot_local_user=YES`
    \nSave and close the file.

    \n\n

    Step # 3: Restart vsftpd

    \n\n

    To restart vsftpd type the command :
    \n$ sudo /etc/init.d/vsftpd restart```</strong><br />
    \nOutput:</p>
    \n``* Stopping FTP server: vsftpd [ ok ]<br /> * Starting FTP server: vsftpd [ ok ]<br /><br />add following rules to your iptables script. Assuming that default<br />incoming policy is drop. If protocol is TCP and destination port is 21<br />(ftp):<br /><br /><em>
    iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT</em><br /><br />See - <a href="http://www.cyberciti.biz/faq/iptables-open-ftp-port-21/">How do I open open ftp port 21 using iptables</a> for more information.
    \nThere are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
    \n`$ man vsftpd.conf
    \n参考文档:<br />1、http://www.cyberciti.biz/faq/ubuntu-vsftpd-ftp-service-server/<br />2、http://school.cfan.com.cn/system/unix/2008-06-16/1213603744d188509.shtml`

    \n", "_id"=>317}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"关于这两天blog挂掉的说明", "body"=>"

    关注我Blog的朋友,这两天由于服务器问题,down了两天,深表歉意!

    \n

    挂掉这两天,和DH的客服反复较量了好多次,mail一封接一封,完全是我说啥,他查啥,够晕的,幸好最后我还是定位到问题了,他们就解决了,够晕的。

    \n

    比较庆幸的是我的E文他们看的明白,他们的mail我也懂,就这样一来一去的,拉锯了好多次,最后定位到时他们新加了一块硬盘,导致对我的帐户写在那个硬盘上的文件数被限制了。

    \n

    还在交涉赔偿事件,我倒要看看DH到底有uo难缠,多专业。

    ", "created_at"=>2008-06-20 18:59:54 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    关注我Blog的朋友,这两天由于服务器问题,down了两天,深表歉意!
    \n挂掉这两天,和DH的客服反复较量了好多次,mail一封接一封,完全是我说啥,他查啥,够晕的,幸好最后我还是定位到问题了,他们就解决了,够晕的。
    \n比较庆幸的是我的E文他们看的明白,他们的mail我也懂,就这样一来一去的,拉锯了好多次,最后定位到时他们新加了一块硬盘,导致对我的帐户写在那个硬盘上的文件数被限制了。
    \n还在交涉赔偿事件,我倒要看看DH到底有uo难缠,多专业。

    \n", "_id"=>318}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.1中文文档翻译完成[已发布]", "body"=>"

    前几天发布了一篇文章说我们正在翻译Rails 2.1文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,经过3天不到的时间,我们就完稿了,参与翻译的都是COR中的做Rails的朋友,大家都很积极,从那天下午我做出“协作约定”开始领取翻译任务后,半天时间就认领完毕了,不得不赞下大家的热情和速度,特别是snow同学,上来就挑了个最大块头的第二章,呵呵。

    \n

    最后是我整理生成PDF文档的,现在已经发布出去,需要的朋友可以在这里看到“Ruby on Rails 2.1更新了什么?”,另外,infoQ也发布了新闻“Rails 2.1中文文档翻译计划完成”。

    \n

    另外,你可以通过如下几个方式查看:

    \n

    1、在slideshare上观看PPT版本

    \n

    2、通过Google Site上可以查看最新版本的google Doc,地址在我的GoogleSite上。

    \n

    3、Google Doc上的索引页面"Ruby On Rails 2.1新特性介绍".

    \n

    如果你发现错误的地方,或者有其他意见,请联系我修正,谢谢。

    ", "created_at"=>2008-06-20 19:13:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前几天发布了一篇文章说我们正在翻译Rails 2.1文档《协作翻译: Ruby On Raisl 2.1新特性(第二版)》,经过3天不到的时间,我们就完稿了,参与翻译的都是COR中的做Rails的朋友,大家都很积极,从那天下午我做出“协作约定”开始领取翻译任务后,半天时间就认领完毕了,不得不赞下大家的热情和速度,特别是snow同学,上来就挑了个最大块头的第二章,呵呵。
    \n最后是我整理生成PDF文档的,现在已经发布出去,需要的朋友可以在这里看到“Ruby on Rails 2.1更新了什么?”,另外,infoQ也发布了新闻“Rails 2.1中文文档翻译计划完成”。
    \n另外,你可以通过如下几个方式查看:
    \n1、在slideshare上观看PPT版本
    \n2、通过Google Site上可以查看最新版本的google Doc,地址在我的GoogleSite上。
    \n3、Google Doc上的索引页面"Ruby On Rails 2.1新特性介绍".
    \n如果你发现错误的地方,或者有其他意见,请联系我修正,谢谢。

    \n", "_id"=>319}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"如何在Rails的controller中取得URL中的anchor值", "body"=>"

    有人问,如何在Rails的控制器中取得URL中的锚点的值,这个需求比较奇特,以前没搞过,于是google了一把,在“Getting the # value”这个帖子看到有人有类似的问题,他说出了在controller中直接取不到的原因是“For normal links/urls the #anchor is a client side feature and is often not even sent to the server as part of a request.”,恩,确实直接取不到,只能使用类似JS的方法来取了,因为其没有将URL全部提交到服务端,所以是无法取值的。

    \n

    另外,看了下Rails中生成anchor的方法比较简单,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. <%= url_for(:action => 'play':anchor => 'player') %>  
    2. \n
    3. # => /messages/play/#player  
    4. \n
    5.   
    6. \n
    7. <%= url_for(:action => 'checkout':anchor => 'tax&ship') %>  
    8. \n
    9. # => /testing/jump/#tax&ship  
    10. \n
    11.   
    12. \n
    13. <%= url_for(:action => 'checkout':anchor => 'tax&ship':escape => false) %>  
    14. \n
    15. # => /testing/jump/#tax&ship  
    16. \n
    \n
    \n详细的请参考API:ActionView::Helpers::UrlHelper

    ", "created_at"=>2008-06-23 09:12:45 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有人问,如何在Rails的控制器中取得URL中的锚点的值,这个需求比较奇特,以前没搞过,于是google了一把,在“Getting the # value”这个帖子看到有人有类似的问题,他说出了在controller中直接取不到的原因是“For normal links/urls the #anchor is a client side feature and is often not even sent to the server as part of a request.”,恩,确实直接取不到,只能使用类似JS的方法来取了,因为其没有将URL全部提交到服务端,所以是无法取值的。
    \n另外,看了下Rails中生成anchor的方法比较简单,如下:
    \n
    \n
    \nRuby代码
    \n
    \n <%= url_for(:action => 'play', :anchor => 'player') %>  
    \n # => /messages/play/#player  
    \n   
    \n <%= url_for(:action => 'checkout', :anchor => 'tax&ship') %>  
    \n # => /testing/jump/#tax&ship  
    \n   
    \n <%= url_for(:action => 'checkout', :anchor => 'tax&ship', :escape => false) %>  
    \n # => /testing/jump/#tax&ship  
    \n
    \n
    \n详细的请参考API:ActionView::Helpers::UrlHelper

    \n", "_id"=>320}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下相关信息查看", "body"=>"有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:\r\n\r\n1、Java版本(JDK)\r\n\r\n$ java -version\r\njava version \"1.4.2_11\"\r\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)\r\nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)\r\n\r\n2、weblogic版本\r\n\r\n查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:\r\n\r\n$ cat log.txt\r\n2004-10-20 15:00:58 -- install \"WebLogic Platform\" 8.1.3.0 at /opt/bea/weblogic81\r\nrelease 8.1.3.0 [Added]\r\n\r\n3、Oracle版本\r\n\r\n(1)用客户端连接到数据库,执行select * from v$instance查看version项\r\n(2)select * from product_component_version\r\n(3)或查询V$VERSION查看组件级信息\r\n\r\n4、内核\r\n
    $ uname -a\r\nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \r\n
    [iceskysl@oj-web03 logs]$ cat /proc/version\r\nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo\r\n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息\r\n$df\r\n\r\n
    ", "created_at"=>2008-06-24 09:12:23 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有的时候需要对服务器信息做比较详细的了解,需要查看一些信息,整理如下:

    \n\n

    1、Java版本(JDK)

    \n\n

    $ java -version
    \njava version "1.4.2_11"
    \nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    \nJava HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)

    \n\n

    2、weblogic版本

    \n\n

    查看weblogic的版本信息,可以在bea\\logs目录下的log.txt中查到版本信息,如下:

    \n\n

    $ cat log.txt
    \n2004-10-20 15:00:58 -- install "WebLogic Platform" 8.1.3.0 at /opt/bea/weblogic81
    \nrelease 8.1.3.0 [Added]

    \n\n

    3、Oracle版本

    \n\n

    (1)用客户端连接到数据库,执行select * from v$instance查看version项
    \n(2)select * from product_component_version
    \n(3)或查询V$VERSION查看组件级信息

    \n\n

    4、内核
    \n$ uname -a
    \nLinux oj-web03 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux
    \n[iceskysl@oj-web03 logs]$ cat /proc/version
    \nLinux version 2.4.21-27.ELsmp (bhcompile@bugs.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1 21:59:02 EST 20045、内存信息$ cat /proc/meminfo
    \n$ free -M6、CPU信息$cat /proc/cpuinfo7、硬盘信息
    \n$df

    \n\n", "_id"=>321}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "安全", "漏洞"], "comments_count"=>0, "category_id"=>8, "title"=>"Ruby暴出大量严重漏洞!", "body"=>"Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.\n\nAccording to the official Ruby security advisory, the vulnerable Rubies are:\n\n* 1.8.4 and earlier\n* 1.8.5-p230 and earlier\n* 1.8.6-p229 and earlier\n* 1.8.7-p21 and earlier\n\nThose of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.\n\n(Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)\n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。", "created_at"=>2008-06-25 06:05:42 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code—holy crap! Better upgrade sooner than later.

    \n\n

    According to the official Ruby security advisory, the vulnerable Rubies are:

    \n\n
      \n
    • 1.8.4 and earlier
    • \n
    • 1.8.5-p230 and earlier
    • \n
    • 1.8.6-p229 and earlier
    • \n
    • 1.8.7-p21 and earlier
    • \n
    \n\n

    Those of us running Ruby 1.8.4 or earlier must upgrade to 1.8.5 or later for a fix. Those on 1.8.5-7 can grab the latest patchlevel release for a fix.

    \n\n

    (Please note: Ruby 1.8.7 breaks backward compatibility and is only compatible with Rails 2.1 and later, so don’t go overboard!)
    \n虽然暂时还没看到具体的细节公布出来,也没看到0day放出来,但是从其描述上不难看出,这些bug是ruby一致以来都有的,或许还有更多的bug,ruby走向成熟,离不开这样的检验。

    \n", "_id"=>322}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["libmmseg", "rails", "Sphinx", "Ultrasphinx"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails全文检索最佳方案:Sphinx+libmmseg+Ultrasphinx", "body"=>"大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。\r\n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。\r\n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。\r\n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。\r\n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。\r\n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:\r\n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。\r\n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。\r\n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。\r\n\r\n以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。\r\n\r\n参考文档:\r\n1、acts_as_sphinx plugin\r\n2、JavaEye3.0开发手记之三 - 狮身人面\r\n3、使用libmmseg实现Ruby的中文分词功能\r\n4、Plugins - Ultrasphinx\r\n5、Rails程序员Sphinx中文全文检索安装指南\r\n6、Sphinx", "created_at"=>2008-06-25 07:25:41 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    大家知道,全文检索(特别是中文全文检索)中有两个比较重要的指标,性能和中文分词技术,由于性能要求,使得其必须采用C/C++的检索引擎才有生存的空间,其二是中文分词等,这也是个难题。
    \n在Java中lucene是绝对的权威和首选,虽然其对中文分词支持也不是很好,但是有很多第三方的程序可以集成起来实现相关功能,而在Rails中,至今尚无权威的解决方案,最开始的时候是Ferret一枝独秀,现在另外一个很优秀的Sphinx。
    \n刚接触Rails全文检索的时候就知道Sphinx了,当时还不是很完善,而且那个时候Ferret非常流行,所以也就没有多加关注,只记得这两个全文检索都不提供中文分词技术,而全文检索中的中文分词恰恰是无法绕过去的。
    \n前段时间,看到有人介绍了libmmseg, 这个是李沫南用C++编写的开源的中文分词软件,libmmseg的分词算法采用的是“基于词库的最大匹配算法”,分词速度为每秒300KB左右,使用 libmmseg,可以和Ferret结合起来做全文检索了,这个JavaEye的Robbin有介绍过,详细情况请参看《使用libmmseg实现Ruby的中文分词功能》,其详细介绍了如何在Ruby中调用libmmseg做中文分词,进而使用Ferret做全文检索。
    \n但是值得说的是,libmmseg本来是被作者用来实现Sphinx全文检索软件的中文分词功能,因此作者给Sphinx提供了一个补丁文件,可以让Sphinx集成libmmseg,从而支持对于中文文章的全文检索功能,关于这一点可以看《Rails程序员Sphinx中文全文检索安装指南》的介绍。
    \n所以,如果你要在Rails中做全文检索的话,我推荐您使用的是Sphinx + libmmseg + Ultrasphinx来实现,其简单高效,且支持并发,再仔细说一下:
    \n1、Sphinx,是俄罗斯的Andrew Aksyonoff 开发的,被人叫做“狮身人面”,关于其高效的介绍,你可以参考《JavaEye3.0开发手记之三 - 狮身人面》,其性能出色,和架构清晰,学习成本很低,且其和数据库结合的很棒。其他相关介绍可以参考“coreseek对Sphinx的就介绍”,也可以参考其发布的《Coreseek 全文检索服务器 2.0 (Sphinx 0.9.8)参考手册》,其Coreseek就是基于Sphinx的一个全文搜索服务器。
    \n2、libmmseg,就是前面说的中文分词程序,当前最新版本是0.73,采用C++开发,同时支持Linux平台和Windows平 台,切分速度大约在300K/s(PM-1.2G),libmmseg从0.7.2版本开始,作者提供了ruby调用的接口,所以我们可以直接在ruby 程序里面调用libmmseg进行分词,相当方便。
    \n3、Ultrasphinx,是一个Rails插件,Rails开发人员可以使用它来很方便地调用Sphinx的功能。其他类似的插件有acts_as_sphinx,使用其可以很方便的在Rails中整合Sphinx。

    \n\n

    以上三个的安全不是很复杂,推荐是在Unix上,请参考《Rails程序员Sphinx中文全文检索安装指南》,这个文章就是基于以上三个组件的安装和使用说明。我会在近期发布出一些笔记和文档,以帮助需要的朋友更好的实现自己的全文检索。
    \n
    \n参考文档:
    \n1、acts_as_sphinx plugin
    \n2、JavaEye3.0开发手记之三 - 狮身人面
    \n3、使用libmmseg实现Ruby的中文分词功能
    \n4、Plugins - Ultrasphinx
    \n5、Rails程序员Sphinx中文全文检索安装指南
    \n6、Sphinx

    \n", "_id"=>323}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rsync"], "comments_count"=>0, "category_id"=>9, "title"=>"同步利器rsync", "body"=>"rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.\r\n\r\n参考资料:\r\n\r\n1.rsync的安装和使用\r\n\r\n2. rsync", "created_at"=>2008-06-25 19:58:32 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    rsync is a program that copies file from one location to another, with it you can make backups of your files, synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys.

    \n\n

    参考资料:

    \n\n

    1.rsync的安装和使用

    \n\n
      \n
    1. rsync
    2. \n
    \n", "_id"=>324}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ADSL"], "comments_count"=>0, "category_id"=>6, "title"=>"深圳ADSL真垃圾的说,我很失望", "body"=>"一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。\r\n\r\n而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。\r\n\r\n另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。\r\n\r\n用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。", "created_at"=>2008-06-26 14:07:07 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一直以来,我都是忍耐力很好的,无奈的是深圳电信的ADSL真的越来越垃圾,让人失望的很呀,虽然看到月光说我的E家现在 M的提速到3M了,我下了avltool测了下,巨寒,第一次0.76M,第二次0.82M,下载速度只有4k的样子。

    \n\n

    而我的是380包季的2M带宽,不想这个速度实在让人不爽呀,每天都不能享受ADSL快速的感觉,每天都是蜗牛一样,一个网页打开都半天,还不如当时我在学校的30元包月一个账号,买个集线器4个电脑用的速度。

    \n\n

    另外,上面说的380包季还不包含每月20固定电话费,Y的我不用电话,也没装话机。凭什么要我交座机费,这是哪门子规定,以前没发现,上次发现了,打电话强行取消,说到,说可以去掉,办成停机留号,每月5元,当时感觉取得一定成果,就没斤斤计较了,现在想想,也不合理呀,寒。另外,当时改成5元后,说以前扣的20的也返还,真是流氓。。

    \n\n

    用了差不多2年的ADSL,一直以来都在忍耐,最近网速越来越慢,严重影响我工作,SSH都要等,这还能叫2M么?垄断真是中国的悲哀,我非常失望。

    \n", "_id"=>325}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["YOBO"], "comments_count"=>0, "category_id"=>6, "title"=>"movtown,Yobo要换域名了?", "body"=>"晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。\r\n\r\n有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。\r\n\r\n顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。\r\n\r\n从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?\r\n\r\n先占座,以后慢慢补充。", "created_at"=>2008-06-26 18:07:16 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    晚上等着看欧洲杯,就在Yobo上听歌,顺便打探下其用户量和流行程度,无意发现其域名变了,由原来的yobo.com变成movtown.com了。

    \n\n

    有人对YOBO这个域名有意见是早有耳闻,或许movtown这个域名会替代?完全是个人感觉,hoho。。

    \n\n

    顺手查询了下movtown的历史,以前应该是一个免费电影下载的站点,流量不是很大,从其Alex排名(1487849)上可以看到,估计是被Yobo买了的吧。

    \n\n

    从这个域名上可以看出yobo下一步发展的趋势和动态,把这个域名扯开可以看到,以后应该会往mov方面靠拢,不应该呀,mov应该是偏向于电影才对的呀,yobo应该是做电子音乐不会做视频方面的,不晓得mov如何解释,或许有谁可以把这个域名往音乐上靠呢?

    \n\n

    先占座,以后慢慢补充。

    \n", "_id"=>326}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gravatars"], "comments_count"=>0, "category_id"=>6, "title"=>"Gravatars,图片标识服务-多小的Idea都可以做成.", "body"=>"这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:\r\n
    A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \r\n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。\r\n\r\n这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。\r\n\r\n使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):\r\n\r\n\r\n\r\n1、首先在````application_helper.rb中增加一个helper方法```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'digest/md5'    
    2. \r\n\t
    3. #增加一个Helper方法    
    4. \r\n\t
    5. def gravatar_url_for(email, options = {})        
    6. \r\n\t
    7.    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    8. \r\n\t
    9.             :protocol => 'http://':only_path => false:controller => 'avatar.php'        
    10. \r\n\t
    11.        }.merge(options))      
    12. \r\n\t
    13. end    
    14. \r\n
    \r\n
    \r\n \r\n\r\n2、然后就可以在view里面直接使用了\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # plain old gravatar url      
    2. \r\n\t
    3. <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    4. \r\n\t
    5.     
    6. \r\n\t
    7. # gravatar url with a rating threshold       
    8. \r\n\t
    9. <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    10. \r\n\t
    11.     
    12. \r\n\t
    13. # show the avatar       
    14. \r\n\t
    15. <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    16. \r\n\t
    17.     
    18. \r\n\t
    19. # show the avatar with size specified, in case it's served slowly      
    20. \r\n\t
    21. <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    22. \r\n\t
    23.   
    24. \r\n\t
    25. # link the avatar to some/url    
    26. \r\n\t
    27. <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    28. \r\n
    \r\n
    \r\nPS:果然不出所料,还有Gem可以使用\" Ruby Avatar Gem\"\r\n\r\n ", "created_at"=>2008-06-27 01:46:13 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    这个世界有意思,多大的idea都可以做成网站,以前看过缩址的网站,现在有看到一个省份标识的网站, Gravatars,看他的介绍:
    \nA gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?
    \n看明白了么,就是一个你输入自己的Email,然后上传自己的图片标识,然后在其他支持 Gravatars的网站(blog居多)中发表评论的时候输入自己的Email地址,就可以在Gravatars上找到其对应的图片来显示了。

    \n\n

    这确实是个不错的Idea,相当简单,但是也做得有声有色的,有点意思。

    \n\n

    使用也很方便,其在“How the URL is constructed”上介绍了其URL的组成,中可以这么使用(来源Gravatars on Rails):

    \n\n

    <!--more-->

    \n\n

    1、首先在`application_helper.rb中增加一个helper方法
    \n
    \nRuby代码
    \n
    \n require 'digest/md5'    
    \n #增加一个Helper方法    
    \n def gravatar_url_for(email, options = {})        
    \n    url_for({ :gravatar_id => Digest::MD5.hexdigest(email), :host => 'www.gravatar.com',          
    \n             :protocol => 'http://', :only_path => false, :controller => 'avatar.php'        
    \n        }.merge(options))      
    \n end    
    \n
    \n
    \n 

    \n\n

    2、然后就可以在view里面直接使用了
    \n
    \nRuby代码
    \n
    \n # plain old gravatar url      
    \n <%= gravatar_url_for 'iceskysl@gmail.com' %>        
    \n     
    \n # gravatar url with a rating threshold       
    \n <%= gravatar_url_for 'iceskysl@gmail.com', { :rating => 'R' } %>        
    \n     
    \n # show the avatar       
    \n <%= image_tag(gravatar_url_for 'iceskysl@gmail.com')%>       
    \n     
    \n # show the avatar with size specified, in case it's served slowly      
    \n <%= image_tag(gravatar_url_for('iceskysl@gmail.com'), { :width => 80, :height => 80 }) %>      
    \n   
    \n # link the avatar to some/url    
    \n <%= link_to(image_tag(gravatar_url_for 'iceskysl@gmail.com'), 'some/url')%>    
    \n
    \n
    \nPS:果然不出所料,还有Gem可以使用" Ruby Avatar Gem"

    \n\n

     

    \n", "_id"=>327}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞:limit,offset过滤不严.", "body"=>"现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。\r\n\r\n大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # vulnerable controller code  
    2. \r\n\t
    3. User.find(:all:limit => params[:limit])  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. User.find(:all:limit => 10, :offset => params[:offset])  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    12. \r\n\t
    13. # you got a big problem ...  
    14. \r\n
    \r\n
    \r\n如上我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。\r\n\r\n幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。\r\n\r\n现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。\r\n\r\n参考文档: Why you should upgrade to Rails 2.1  0  ", "created_at"=>2008-06-28 12:43:58 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    现在很多人应该都开始使用Rails2.1了吧,如果你还没有升级到Rails2.1版,那么看看前段时间,我和其他几个RoRer翻译的《Rails 2.1中文文档翻译完成[已发布]》中其所增加的新功能。如果这些新功能还不能说服你升级到Rails2.1的话,那么请接着看,在Rails2.1之前,Rails1.X和Rails2.0中都存在如下漏洞。

    \n\n

    大家可以看看Rails2.1之前的 ActiveRecord 中,其允许在:offset中任意构造SQL语句,也就是说,如果可能的话,我们可以利用:offset来构造SQL注射。

    \n\n

     
    \n
    \nRuby代码
    \n
    \n # vulnerable controller code  
    \n User.find(:all, :limit => params[:limit])  
    \n   
    \n User.find(:all, :limit => 10, :offset => params[:offset])  
    \n   
    \n # with params[:offset] or params[:limit] set to '; DROP TABLE users;'  
    \n # you got a big problem ...  
    \n
    \n
    \n如上,我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。

    \n\n

    幸好,Mysql默认的是不许一次API调用执行多条SQL,但是这个问题还是存在的,但是PostgreSQL和 SQLite就没那么幸运了,按照上面说的,你可以自己测试下。

    \n\n

    现在的Rails2.1版本中已经修复了PostgreSQL 和SQLite中存在的问题,但是并没有其在Mysql中存在的问题(虽然现在尚且无法利用),后面的Rails2.1.1版本中已经修复了。

    \n\n

    参考文档: Why you should upgrade to Rails 2.1  0 

    \n", "_id"=>328}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["linux"], "comments_count"=>0, "category_id"=>7, "title"=>"分析解决linux下的空间满的问题", "body"=>"家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:\r\niceskysl@IceskYsl:/opt/devroot$ df\r\n文件系统           1K-块        已用     可用 已用% 挂载点\r\n/dev/sda8             10309796   9547180    238900  98% /\r\nvarrun                  772952       228    772724   1% /var/run\r\nvarlock                 772952         0    772952   0% /var/lock\r\nudev                    772952        72    772880   1% /dev\r\ndevshm                  772952         0    772952   0% /dev/shm\r\nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile\r\n/dev/sda7                93307     92784         0 100% /boot\r\n/dev/sda9              9614116   5557504   3568240  61% /home\r\n/dev/sda1             14195576  12552736   1642840  89% /media/sda1\r\n/dev/sda5             15366140  13757584   1608556  90% /media/sda5\r\n(PS:这个是我清掉一部分日志后的,原来的/是100%的)\r\n\r\n可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml\r\nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml", "created_at"=>2008-06-29 03:08:46 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    家里用的本本上装ubuntu的时候是在win上格了一块硬盘装的,原来硬盘60G,分了20G给linux,这几天发现系统有些不正常,直接告诉我是空间不足了,赶紧看看:
    \niceskysl@IceskYsl:/opt/devroot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   9547180    238900  98% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     38176    734776   5% /lib/modules/2.6.24-18-generic/volatile
    \n/dev/sda7                93307     92784         0 100% /boot
    \n/dev/sda9              9614116   5557504   3568240  61% /home
    \n/dev/sda1             14195576  12552736   1642840  89% /media/sda1
    \n/dev/sda5             15366140  13757584   1608556  90% /media/sda5
    \n(PS:这个是我清掉一部分日志后的,原来的/是100%的)

    \n\n

    可以看到,空间实在是紧张,没办法,又不想格了重新装,只能看看有没有啥“软”办法来清理下空间了,找到两篇不错的文章,《解决Linux磁盘空间满的“软”办法》列举了10个软办法,相当不错;《空间满问题,请各位高手帮忙啊!》这个帖子讨论了一般的思路和方法。另外还可以参考如下两个文档:
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/ext2/index.shtml
    \nhttp://www-900.ibm.com/developerWorks/cn/linux/filesystem/l-fs9/index.shtml

    \n", "_id"=>329}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "WAP"], "comments_count"=>0, "category_id"=>2, "title"=>"使用Rails开发支持WAP/WML的应用", "body"=>"Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。\r\n\r\n总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。\r\n\r\n一、按照一般方式支持\r\n\r\n这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:\r\n\r\n1、在app/controllers/application.rb中增加对WAP格式输出的支持\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. before_filter :set_wap_content_type:only => :wap  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. def set_wap_content_type  
    6. \r\n\t
    7.   @headers[\"Content-Type\"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <?xml version=”1.0″?>  
    2. \r\n\t
    3. <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    4. \r\n\t
    5. <wml>  
    6. \r\n\t
    7. <card title=”<%= @title %>>  
    8. \r\n\t
    9. <p align=”center”>  
    10. \r\n\t
    11. <%= @content_for_layout %>  
    12. \r\n\t
    13. </p>  
    14. \r\n\t
    15. </card>  
    16. \r\n\t
    17. </wml>  
    18. \r\n
    \r\n
    \r\n3、在我的controller中(index)中增加一个action用来响应WAP请求。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def wap  
    2. \r\n\t
    3.   @title = \"San Francisco Sailing Weather\"  
    4. \r\n\t
    5.   render(:layout => \"wml\")  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n4、添加相应的view模板app/views/index/wap.rhtml\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    2. \r\n\t
    3. <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    4. \r\n\t
    5. <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    6. \r\n
    \r\n
    \r\n \r\n\r\n二、使用Rails2支持的多模板类型支持\r\n\r\n在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。\r\n\r\n1、添加MIME格式支持\r\n\r\n在config/environment.rb中增加MIME的格式支持,方式如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. Mime::Type.register \"text/vnd.wap.wml\":wml  
    2. \r\n
    \r\n
    \r\n
    \r\n2、判断请求类型```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # application.rb  
    2. \r\n\t
    3. before_filter :adjust_format_for_beta  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. ...  
    8. \r\n\t
    9.   
    10. \r\n\t
    11. def adjust_format_for_beta  
    12. \r\n\t
    13.   request.format = :beta if beta_request?   
    14. \r\n\t
    15. end  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. def beta_request?  
    20. \r\n\t
    21.   return (request.subdomains.first == \"beta\" || params[:format] == \"beta\")  
    22. \r\n\t
    23. end  
    24. \r\n
    \r\n
    \r\n
    \r\n3、添加相应的view代码比较简单,就是写XML或者WML模板show.wml.erb```\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. xml.instruct! :xml, :version => \"1.0\"  
    2. \r\n\t
    3. xml.wml \"xml:lang\" => \"en-gb\" do  
    4. \r\n\t
    5.   xml.card :title => \"My title here\" do  
    6. \r\n\t
    7.     xml.p \"Something interesting here\"  
    8. \r\n\t
    9.     xml.p \"Something else interesting here.\"  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13. end  
    14. \r\n
    \r\n
    \r\n
    \r\n4、添加输出类型支持```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def index  
    2. \r\n\t
    3.   respond_to do |format|  
    4. \r\n\t
    5.     format.html  
    6. \r\n\t
    7.     format.wml  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n
    \r\n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。实用工具:wmlbrowser add-on for Firefox :可以在FF下直接查看WML网页Opera:支持WML格式显示```\r\n参考资文章:\r\n\r\n1、Making your Rails app mobile with WAP and WML\r\n2、Ruby on Rails (and some WAP)\r\n3、Redesign your site in place using Rails custom mime types\r\n\r\n参考资料:\r\n\r\nW3schools WAP tutorial\r\nW3schools WML reference\r\nWeb based WAP Emulator\r\n\r\n ", "created_at"=>2008-07-01 06:51:55 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Rails在WEB开发中独树一帜,取得相当大的成功,但是其内核中尚未支持WML,于是查找了一些资料,如果你使用Rails开发的系统向添加WAP支持,这或许对你有用。

    \n\n

    总的来看,有两个方式来实现对WML的支持,单独支持和整合支持,下面详细的说。

    \n\n

    一、按照一般方式支持

    \n\n

    这个方式和做PC WEB方式是一样的,有个单独的controller或者action,指定特有的layout和页面模板,而这些模板中采用WML语言编写,在请求到来的时候,按照URL中特有的特征字符(比如二级域名)或者Http Head中的标识转向Wap的action,进而显示。详细的步骤基本上是这样的:

    \n\n

    1、在app/controllers/application.rb中增加对WAP格式输出的支持
    \n
    \nRuby代码
    \n
    \n before_filter :set_wap_content_type, :only => :wap  
    \n   
    \n def set_wap_content_type  
    \n   @headers["Content-Type"] = “text/vnd.wap.wml; charset=iso-8859-1″  
    \n end  
    \n
    \n
    \n2、添加一个WAP的全局布局模板app/views/layouts/wap.rhtm
    \n
    \nXML/HTML代码
    \n
    \n <?xml version=”1.0″?>  
    \n <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN” “http://www.wapforum.org/DTD/wml_1.1.xml”>  
    \n <wml>  
    \n <card title=”<%= @title %>”>  
    \n <p align=”center”>  
    \n <%= @content_for_layout %>  
    \n </p>  
    \n </card>  
    \n </wml>  
    \n
    \n
    \n3、在我的controller中(index)中增加一个action用来响应WAP请求。
    \n
    \nRuby代码
    \n
    \n def wap  
    \n   @title = "San Francisco Sailing Weather"  
    \n   render(:layout => "wml")  
    \n end  
    \n
    \n
    \n4、添加相应的view模板app/views/index/wap.rhtml
    \n
    \nXML/HTML代码
    \n
    \n <%= link_to 'NOAA Marine Forecast', { :controller => '/marine/forecast', :action => 'wap' } %><br/>  
    \n <%= link_to 'Wind Readings', { :controller => '/marine/wind', :action => 'wap' } %><br/>  
    \n <%= link_to 'Current Predictions', { :controller => '/marine/tide', :action => 'wap' } %>  
    \n
    \n
    \n 

    \n\n

    二、使用Rails2支持的多模板类型支持

    \n\n

    在Rails2以后,Rails支持多种格式的输出,比如Html,RSS,JS等,当然你还可以定制自己的格式,比如我们这里说的WML,Iphone等,使用起来更简单、自然。

    \n\n

    1、添加MIME格式支持

    \n\n

    在config/environment.rb中增加MIME的格式支持,方式如下:
    \n
    \nRuby代码
    \n
    \n Mime::Type.register "text/vnd.wap.wml", :wml  
    \n
    \n
    \n
    \n2、判断请求类型
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># application.rb</span><span>  </span></span></li>
    \n <li><span>before_filter <span class="symbol">:adjust_format_for_beta</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>...  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> adjust_format_for_beta  </span></span></li>
    \n <li class="alt"><span>  request.format = <span class="symbol">:beta</span><span> </span><span class="keyword">if</span><span> beta_request?   </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="keyword">def</span><span> beta_request?  </span></span></li>
    \n <li class="alt"><span>  <span class="keyword">return</span><span> (request.subdomains.first == </span><span class="string">"beta"</span><span> || params[</span><span class="symbol">:format</span><span>] == </span><span class="string">"beta"</span><span>)  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n<strong>3、添加相应的view代码</strong>比较简单,就是写XML或者WML模板<strong>show.wml.erb</strong>

    \n
    \nXML/HTML代码
    \n
    \n xml.instruct! :xml, :version => "1.0"  
    \n xml.wml "xml:lang" => "en-gb" do  
    \n   xml.card :title => "My title here" do  
    \n     xml.p "Something interesting here"  
    \n     xml.p "Something else interesting here."  
    \n   end  
    \n end  
    \n
    \n
    \n
    \n4、添加输出类型支持
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="keyword">def</span><span> index  </span></span></li>
    \n <li><span>  respond_to <span class="keyword">do</span><span> |format|  </span></span></li>
    \n <li class="alt"><span>    format.html  </span></li>
    \n <li><span>    format.wml  </span></li>
    \n <li class="alt"><span>  <span class="keyword">end</span><span>  </span></span></li>
    \n <li><span><span class="keyword">end</span><span>  </span></span></li>
    \n</ol>
    \n</div>
    \n<pre style="font-size: 90%;">
    \n以上两中方式,我个人更加喜欢Rails2的多模板支持模式,更加自然和清晰。<strong>实用工具:</strong><a href="http://addons.mozilla.org/firefox/addon/62">wmlbrowser add-on for Firefox</a> :可以在FF下直接查看WML网页<a href="http://cn.opera.com/">Opera</a>:支持WML格式显示

    \n参考资文章:

    \n\n

    1、Making your Rails app mobile with WAP and WML
    \n2、Ruby on Rails (and some WAP)
    \n3、Redesign your site in place using Rails custom mime types

    \n\n

    参考资料:

    \n\n

    W3schools WAP tutorial
    \nW3schools WML reference
    \nWeb based WAP Emulator

    \n\n

     

    \n", "_id"=>330}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["北京"], "comments_count"=>0, "category_id"=>5, "title"=>"下午启程去北京,有请饭的没?", "body"=>"工作需要,出差北京,晚上7点飞机,深圳到北京。\r\n\r\n第一次去北京,充满期待,有请我吃饭的没?", "created_at"=>2008-07-02 06:16:36 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    工作需要,出差北京,晚上7点飞机,深圳到北京。

    \n\n

    第一次去北京,充满期待,有请我吃饭的没?

    \n", "_id"=>331}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"RatProxy:Google提供的开源web应用安全工具", "body"=>"网络安全永远都是一个值得深究的领域,随着技术的不断发展,越来越多的技术手段被利用在网络安全中;而这其中,web安全越来越被人重视,攻击方式不断革新,技术手法层数不穷,但是目前的状况是,攻击和利用越来越自动化,但是防护和检查都还是偏向人工审核的方式,效率实在一般,但是基于web攻击手段的多样性和复杂性,一直没有一款比较不错的安全检查工具诞生。\r\nRatProxy是Google信息安全技术团队所研发的程序安全侦测工具,一向为Google 内部所使用。用于评估基于Web的应用程序的安全性Web Application Security Consortium在2006年的调查发现,31,373个被调查网站中有85.57%容易遭受跨站点脚本攻击,26.38%面临SQL注入攻击,15.70%有一些其它问题,可能导致数据丢失。\r\nGoogle信息安全工程师Michal Zalewski表示,Google决定将该工具免费开放是因为他们认为这将对信息安全社群有价值,强化社群理解与Web技术有关的安全问题。RatProxy能够分析诸如跨站威胁、防御伪装的跨站请求,以及侦测到快取问题或是潜在的信息泄露问题等。\r\n\"\"\r\nGoogle在文件中表示,RatProxy为一半自动、多数是被动的网络应用程序安全侦测工具,它同时补足了传统主动爬寻及手动侦测的缺点,而且特别针对潜在的问题及安全相关设计的精确侦测与自动批注进行优化。\r\n\r\n至于比起传统安全侦测工具,Google亦列出几项 RatProxy 的优势,包括在默认的操作模式中不会引起仿真攻击所带来的庞大流量,可避免正在使用的系统的瓦解,而且它提供直觉式的操作,并降低时间及带宽的使用,并能找出产品的问题与潜在的漏洞等。\r\n\r\nRatproxy采用Apache 2.0软件许可证,可以查找Web应用程序中的多种代码问题,支持Linux、FreeBSD、Mac OS X、Windows(Cygwin)等操作系统,特别适用于用户为先的Web 2.0环境。\r\n如果你感兴趣,请参考“RatproxyDoc ”", "created_at"=>2008-07-07 02:02:55 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    网络安全永远都是一个值得深究的领域,随着技术的不断发展,越来越多的技术手段被利用在网络安全中;而这其中,web安全越来越被人重视,攻击方式不断革新,技术手法层数不穷,但是目前的状况是,攻击和利用越来越自动化,但是防护和检查都还是偏向人工审核的方式,效率实在一般,但是基于web攻击手段的多样性和复杂性,一直没有一款比较不错的安全检查工具诞生。
    \nRatProxy是Google信息安全技术团队所研发的程序安全侦测工具,一向为Google 内部所使用。用于评估基于Web的应用程序的安全性。Web Application Security Consortium在2006年的调查发现,31,373个被调查网站中有85.57%容易遭受跨站点脚本攻击,26.38%面临SQL注入攻击,15.70%有一些其它问题,可能导致数据丢失。
    \nGoogle信息安全工程师Michal Zalewski表示,Google决定将该工具免费开放是因为他们认为这将对信息安全社群有价值,强化社群理解与Web技术有关的安全问题。RatProxy能够分析诸如跨站威胁、防御伪装的跨站请求,以及侦测到快取问题或是潜在的信息泄露问题等。
    \n
    \nGoogle在文件中表示,RatProxy为一半自动、多数是被动的网络应用程序安全侦测工具,它同时补足了传统主动爬寻及手动侦测的缺点,而且特别针对潜在的问题及安全相关设计的精确侦测与自动批注进行优化。

    \n\n

    至于比起传统安全侦测工具,Google亦列出几项 RatProxy 的优势,包括在默认的操作模式中不会引起仿真攻击所带来的庞大流量,可避免正在使用的系统的瓦解,而且它提供直觉式的操作,并降低时间及带宽的使用,并能找出产品的问题与潜在的漏洞等。

    \n\n

    Ratproxy采用Apache 2.0软件许可证,可以查找Web应用程序中的多种代码问题,支持Linux、FreeBSD、Mac OS X、Windows(Cygwin)等操作系统,特别适用于用户为先的Web 2.0环境。
    \n如果你感兴趣,请参考“RatproxyDoc ”

    \n", "_id"=>332}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"Amoeba:分布式数据库Proxy解决方案", "body"=>"Amoeba 座落与Client、Database Server(s)之间。 具有负载均衡、高可用性、sql过滤、可承受高并发、读写分离、Query Route(解析sql query语句,并且根据条件与预先设定的规则,请求到指定的目标数据库。可并发请求多台数据库合并结果)、对客户端透明。\r\n主要降低 数据切分带来的复杂多数据库结构、数据切分规则 给应用带来的影响,能够轻易实现:\r\n
      \r\n\t
    • 读写分离
    • \r\n\t
    • Failover
    • \r\n\t
    • 负载均衡
    • \r\n\t
    • 数据切分
    • \r\n
    \r\n这个和mysql proxy是有一些差别的,按照其作者的说法为:“在 mysql proxy 上面如果想要读写分离并且 读集群、写集群 机器比较多情况下,用mysql proxy 需要相当大的工作量,目前mysql proxy没有现成的 lua脚本。mysql proxy根本没有配置文件,lua脚本就是它的全部,当然可以是相当方便的。那么同样这种东西需要编写大量的lua脚本才能完成一个复杂的配置“\r\n\r\n按照其说明文档中的”Amoeba:分布式数据库Proxy解决“说法,其主要也就扮演proxy的角色,目前已经发布了对mysql的proxy功能,其主要是为了支持分布式的DB系统,从读写、数据切分几个方面,来做到负载均衡并伴有故障转移等功能。\r\n\r\n想法好似很好的,但是其文件http://www.sourceforge.net/projects/amoeba我现在无法下载,没时间尝试,有时间可以再试试。\r\n\r\n参考文档:\r\n\r\n1、http://www.javaeye.com/topic/188598\r\n\r\n\r\n ", "created_at"=>2008-07-08 07:02:08 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Amoeba 座落与Client、Database Server(s)之间。 具有负载均衡、高可用性、sql过滤、可承受高并发、读写分离、Query Route(解析sql query语句,并且根据条件与预先设定的规则,请求到指定的目标数据库。可并发请求多台数据库合并结果)、对客户端透明。
    \n主要降低 数据切分带来的复杂多数据库结构、数据切分规则 给应用带来的影响,能够轻易实现:
    \n
    \n 读写分离
    \n Failover
    \n 负载均衡
    \n 数据切分
    \n
    \n这个和mysql proxy是有一些差别的,按照其作者的说法为:“在 mysql proxy 上面如果想要读写分离并且 读集群、写集群 机器比较多情况下,用mysql proxy 需要相当大的工作量,目前mysql proxy没有现成的 lua脚本。mysql proxy根本没有配置文件,lua脚本就是它的全部,当然可以是相当方便的。那么同样这种东西需要编写大量的lua脚本才能完成一个复杂的配置“

    \n\n

    按照其说明文档中的”Amoeba:分布式数据库Proxy解决“说法,其主要也就扮演proxy的角色,目前已经发布了对mysql的proxy功能,其主要是为了支持分布式的DB系统,从读写、数据切分几个方面,来做到负载均衡并伴有故障转移等功能。

    \n\n

    想法好似很好的,但是其文件http://www.sourceforge.net/projects/amoeba我现在无法下载,没时间尝试,有时间可以再试试。

    \n\n

    参考文档:

    \n\n

    1、http://www.javaeye.com/topic/188598

    \n\n

     

    \n", "_id"=>333}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails: How to use helper inside a controller & model", "body"=>"前几天一个朋友问我如何在Controller中使用helper,我当时说helper是view层的东西,C层没法使用,当时有点忙,虽然知道这个说法也过得去,但是一棍子打死的说法肯定不对。\r\n\r\n今天另外一个朋友问我如何在Model里面使用helper,我开始也说没法使用,并说以前我都是直接在model里面在copy一遍helper的东西。然后还是觉得应该是可以使用的,于是google到一篇tips,但是其访问不了了,还好使用google caceh还是看到了其内容,现在记录如下:\r\n\r\nThis is an easy to use any helpers that rails provides in any other place besides views and view helpers\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # create a new file inside lib/ and call it helpers.rb  
    2. \r\n\t
    3. # paste the following:  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. def help  
    8. \r\n\t
    9.     Helper.instance  
    10. \r\n\t
    11. end  
    12. \r\n\t
    13.    
    14. \r\n\t
    15. class Helper  
    16. \r\n\t
    17.     include Singleton  
    18. \r\n\t
    19.     # look inside ActionView::Helpers to include any other helpers that you might need  
    20. \r\n\t
    21.     include ActionView::Helpers::DateHelper  
    22. \r\n\t
    23.     include ActionView::Helpers::TextHelper  
    24. \r\n\t
    25. end  
    26. \r\n\t
    27.    
    28. \r\n\t
    29. # then in any model or controller:  
    30. \r\n\t
    31. require 'lib/helpers'  
    32. \r\n\t
    33.    
    34. \r\n\t
    35. # to use:  
    36. \r\n\t
    37. # help.name_of_helper  
    38. \r\n\t
    39. # EX: help.pluralize 10, \"person\"  
    40. \r\n
    \r\n
    \r\n然后又找到一篇类似的文档:http://snippets.dzone.com/posts/show/1799,摘个方法如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. def check_for_max_donkeys  
    2. \r\n\t
    3.   if Donkey.find_fit_donkeys.size == APP_SETTINGS['max_fit_donkeys']  
    4. \r\n\t
    5.     flash_error \"The maximum of \#{help.pluralize(APP_SETTINGS['max_fit_donkeys'], 'donkey')} has been reached.\"  
    6. \r\n\t
    7.     redirect_to_index  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\nPS:Don't use the method name \"helper\" because Rails already uses that. Just \"help\" works fine.", "created_at"=>2008-07-10 08:33:29 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    前几天一个朋友问我如何在Controller中使用helper,我当时说helper是view层的东西,C层没法使用,当时有点忙,虽然知道这个说法也过得去,但是一棍子打死的说法肯定不对。

    \n\n

    今天另外一个朋友问我如何在Model里面使用helper,我开始也说没法使用,并说以前我都是直接在model里面在copy一遍helper的东西。然后还是觉得应该是可以使用的,于是google到一篇tips,但是其访问不了了,还好使用google caceh还是看到了其内容,现在记录如下:

    \n\n

    This is an easy to use any helpers that rails provides in any other place besides views and view helpers
    \n
    \nRuby代码
    \n
    \n # create a new file inside lib/ and call it helpers.rb  
    \n # paste the following:  
    \n   
    \n def help  
    \n     Helper.instance  
    \n end  
    \n    
    \n class Helper  
    \n     include Singleton  
    \n     # look inside ActionView::Helpers to include any other helpers that you might need  
    \n     include ActionView::Helpers::DateHelper  
    \n     include ActionView::Helpers::TextHelper  
    \n end  
    \n    
    \n # then in any model or controller:  
    \n require 'lib/helpers'  
    \n    
    \n # to use:  
    \n # help.name_of_helper  
    \n # EX: help.pluralize 10, "person"  
    \n
    \n
    \n然后又找到一篇类似的文档:http://snippets.dzone.com/posts/show/1799,摘个方法如下:
    \n
    \nRuby代码
    \n
    \n def check_for_max_donkeys  
    \n   if Donkey.find_fit_donkeys.size == APP_SETTINGS['max_fit_donkeys']  
    \n     flash_error "The maximum of \#{help.pluralize(APP_SETTINGS['max_fit_donkeys'], 'donkey')} has been reached."  
    \n     redirect_to_index  
    \n   end  
    \n end  
    \n
    \n
    \nPS:Don't use the method name "helper" because Rails already uses that. Just "help" works fine.

    \n", "_id"=>334}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby中的Mixin特性", "body"=>"在Ruby中,我们可以把一个模块混入(Mixin)到对象中,从而达到类似多重继承的效果。看几个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. module Mixin1  
    2. \r\n\t
    3.   def fun1  
    4. \r\n\t
    5.     puts \"I am fun1 from Mixin1\"  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9.   
    10. \r\n\t
    11.   def fun2  
    12. \r\n\t
    13.     puts \"I am fun2 from Mixin1. I’ll call a member function of the class which includes me\"  
    14. \r\n\t
    15.     mem_fun  
    16. \r\n\t
    17.   end  
    18. \r\n\t
    19.   
    20. \r\n\t
    21.   def fun3  
    22. \r\n\t
    23.     puts \"I am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me\"  
    24. \r\n\t
    25.     puts @mem_var  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29. end  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. class A  
    34. \r\n\t
    35.   include Mixin1  
    36. \r\n\t
    37.   def mem_fun  
    38. \r\n\t
    39.     puts \"I am a member fun of class A\"  
    40. \r\n\t
    41.   end  
    42. \r\n\t
    43.   
    44. \r\n\t
    45.   def initialize  
    46. \r\n\t
    47.     @mem_var =\"I am a member varaible of class A\"  
    48. \r\n\t
    49.   end  
    50. \r\n\t
    51. end  
    52. \r\n
    \r\n
    \r\n调用一下试试看:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. a = A.new  
    2. \r\n\t
    3. a.fun1  
    4. \r\n\t
    5. a.fun2  
    6. \r\n\t
    7. a.fun3  
    8. \r\n
    \r\n
    \r\n结果如下:\r\nI am fun1 from Mixin1\r\nI am fun2 from Mixin1. I’ll call a member function of the class which includes me\r\nI am a member fun of class A\r\nI am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me\r\nI am a member varaible of class A\r\n\r\n很明显了,不赘述。\r\n\r\n参考文档:\r\nhttp://thinkinginruby.javaeye.com/blog/148967\r\nhttp://my.donews.com/idlecat/2006/10/21/UDDxaYBkNCABNXNVgmIMuMwuKJMHiRXduBBu/\r\nhttp://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/", "created_at"=>2008-07-10 10:01:42 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在Ruby中,我们可以把一个模块混入(Mixin)到对象中,从而达到类似多重继承的效果。看几个例子:
    \n
    \nRuby代码
    \n
    \n module Mixin1  
    \n   def fun1  
    \n     puts "I am fun1 from Mixin1"  
    \n   end  
    \n   
    \n   def fun2  
    \n     puts "I am fun2 from Mixin1. I’ll call a member function of the class which includes me"  
    \n     mem_fun  
    \n   end  
    \n   
    \n   def fun3  
    \n     puts "I am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me"  
    \n     puts @mem_var  
    \n   end  
    \n end  
    \n   
    \n class A  
    \n   include Mixin1  
    \n   def mem_fun  
    \n     puts "I am a member fun of class A"  
    \n   end  
    \n   
    \n   def initialize  
    \n     @mem_var ="I am a member varaible of class A"  
    \n   end  
    \n end  
    \n
    \n
    \n调用一下试试看:
    \n
    \nRuby代码
    \n
    \n a = A.new  
    \n a.fun1  
    \n a.fun2  
    \n a.fun3  
    \n
    \n
    \n结果如下:
    \nI am fun1 from Mixin1
    \nI am fun2 from Mixin1. I’ll call a member function of the class which includes me
    \nI am a member fun of class A
    \nI am fun3 from Mixin1. I’ll puts out a member variable of the class which includes me
    \nI am a member varaible of class A

    \n\n

    很明显了,不赘述。

    \n\n

    参考文档:
    \nhttp://thinkinginruby.javaeye.com/blog/148967
    \nhttp://my.donews.com/idlecat/2006/10/21/UDDxaYBkNCABNXNVgmIMuMwuKJMHiRXduBBu/
    \nhttp://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/

    \n", "_id"=>335}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机摔坏了,一个星期没开机", "body"=>"上次去北京出差的时候,下的士的时候没注意把手机摔下,结果屏幕黑了,啥也看不见了,于是回来这个星期一直在找手机。\r\n\r\n由于用了一段时间的BB,习惯了BB的键盘和强大的功能,其他手机我都不喜欢了,所以选了这么久也没选到合适的。\r\n\r\n本来打算再买一个BB的,心理有阴影了,因为看过一次拆机,发现其可靠的屏保其实很简单就可以贴上去,里面的配件,显示屏啥的都很简单就换了,实在是不咋放心。。\r\n\r\n需要联系我的朋友请发mail或者通过Gtalk,我基本上都在网上的。\r\n\r\n估计选中合适的手机,还得有段时日~", "created_at"=>2008-07-14 07:09:49 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    上次去北京出差的时候,下的士的时候没注意把手机摔下,结果屏幕黑了,啥也看不见了,于是回来这个星期一直在找手机。

    \n\n

    由于用了一段时间的BB,习惯了BB的键盘和强大的功能,其他手机我都不喜欢了,所以选了这么久也没选到合适的。

    \n\n

    本来打算再买一个BB的,心理有阴影了,因为看过一次拆机,发现其可靠的屏保其实很简单就可以贴上去,里面的配件,显示屏啥的都很简单就换了,实在是不咋放心。。

    \n\n

    需要联系我的朋友请发mail或者通过Gtalk,我基本上都在网上的。

    \n\n

    估计选中合适的手机,还得有段时日~

    \n", "_id"=>336}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Protocol Buffers:更简洁有效的数据交换格式!", "body"=>"“Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.”\r\n\r\nGoogle公司与本月初宣布其内部数据交换格式Protocol Buffers正式开源,基于Apache软件证书2.0发布,相关文档、实例和代码已经可以从Google Code上 访问到。\r\n\r\nProtocol Buffers被定义为一种数据描述语言(Data Description Language,DDL),广泛的应用于Google内部,用于结构化数据的描述、传输和存储。尽管其功能和用途与XML基本相似,但是 Protocol Buffers更为轻便。Google宣称其效率对于XML有很大提升,文本比XML要小3-10倍,而解析效率却提升至20-100倍。\r\n\r\n这真是和好消息,XML慢的诟病相比大家都非常清楚,JSON格式的又无法取代XML的强大地位,虽然Ruby中有Hpricot这样的XML解析利器,但是在大批量的解析中还是会有瓶颈出现,而Google此次放出的Protocol Buffers比XML小,且解析速度很快,足够引起广泛的关注了。\r\n\r\nInfoQ上有篇报道“Google开源数据交换格式Protocol Buffers”比较详细,你也可以在\"Protocol Buffers\"上查看。\r\n\r\n目前已经看到C++,Java,Python格式的API,但是没看到基于Ruby的API,何时会出现 ,应该很快就有了。", "created_at"=>2008-07-15 03:20:15 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    “Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.”

    \n\n

    Google公司与本月初宣布其内部数据交换格式Protocol Buffers正式开源,基于Apache软件证书2.0发布,相关文档、实例和代码已经可以从Google Code上 访问到。

    \n\n

    Protocol Buffers被定义为一种数据描述语言(Data Description Language,DDL),广泛的应用于Google内部,用于结构化数据的描述、传输和存储。尽管其功能和用途与XML基本相似,但是 Protocol Buffers更为轻便。Google宣称其效率对于XML有很大提升,文本比XML要小3-10倍,而解析效率却提升至20-100倍。

    \n\n

    这真是和好消息,XML慢的诟病相比大家都非常清楚,JSON格式的又无法取代XML的强大地位,虽然Ruby中有Hpricot这样的XML解析利器,但是在大批量的解析中还是会有瓶颈出现,而Google此次放出的Protocol Buffers比XML小,且解析速度很快,足够引起广泛的关注了。

    \n\n

    InfoQ上有篇报道“Google开源数据交换格式Protocol Buffers”比较详细,你也可以在"Protocol Buffers"上查看。

    \n\n

    目前已经看到C++,Java,Python格式的API,但是没看到基于Ruby的API,何时会出现 ,应该很快就有了。

    \n", "_id"=>337}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["生日"], "comments_count"=>0, "category_id"=>5, "title"=>"生日呢喃,我的一年又过完了!", "body"=>"忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。\r\n\r\n一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。\r\n\r\n同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。\r\n\r\n我在等什么....\r\n\r\n或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。", "created_at"=>2008-07-15 17:50:53 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    忙完手上的事情,想想明天还要做的事情,再看看时间,wo,凌晨1点40了,再看看日历,哦,我的生日到了,我的一年又过去了。

    \n\n

    一年来,又是一个工作的一年,这是我的本命年,都说本命年事多不顺,我曾经很不屑,但是回头看看过去的半年,似乎真的不是很顺利,经过过程很顺利,很美好,但是结果真的不竟如我意。

    \n\n

    同伴早都熟睡了,我才刚刚忙完手上的事情,这是充实还是忙瞎,呵呵。。追求过程的美好,又怎能预测结果的美好呢?有种声音在说:改变吧,丢掉过去才能创早更美好的未来。

    \n\n

    我在等什么....

    \n\n

    或许是忙晕了,脑袋晕晕的,还没洗澡,粘粘的,呢呢喃喃迎来我自己的节日,洗洗睡吧,明天会有大惊喜。

    \n", "_id"=>338}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"03. 技术归总 | Technic"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"03. 技术归总 | Technic", "updated_at"=>2012-06-24 15:53:13 UTC, "created_at"=>2012-06-24 15:53:13 UTC, "_id"=>11}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["getRemoteAddr", "ip"], "comments_count"=>0, "category_id"=>11, "title"=>"Java获取IP地址:request.getRemoteAddr()警惕", "body"=>"项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。\r\n\r\n我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。\r\n\r\n最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。\r\n\r\n如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。\r\n\r\n经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。\r\n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。\r\n\r\n给出一份还算靠谱的代码,如下:\r\n
    \r\n
    Java代码
    \r\n
      \r\n\t
    1. public String getIpAddr(HttpServletRequest request) {
    2. \r\n\t
    3. String ip = request.getHeader(\"x-forwarded-for\");
    4. \r\n\t
    5. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    6. \r\n\t
    7. ip = request.getHeader(\"Proxy-Client-IP\");
    8. \r\n\t
    9. }
    10. \r\n\t
    11. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    12. \r\n\t
    13. ip = request.getHeader(\"WL-Proxy-Client-IP\");
    14. \r\n\t
    15. }
    16. \r\n\t
    17. if(ip == null || ip.length() == 0 || \"unknown\".equalsIgnoreCase(ip)) {
    18. \r\n\t
    19. ip = request.getRemoteAddr();
    20. \r\n\t
    21. }
    22. \r\n\t
    23. return ip;
    24. \r\n\t
    25. }
    26. \r\n
    \r\n
    \r\n如果有人遇到类似问题,请多加留意,呵呵。\r\n\r\nPS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?\r\n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110\r\n\r\n参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html", "created_at"=>2008-07-16 04:01:01 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    项目中需要和第三方平台接口,加了来源IP鉴权功能,测试时发现没有问题,但是部署以后发现存在问题,一直鉴权不通过,一群人抓瞎。

    \n\n

    我找到那块的代码,跟了一遍流程发现逻辑没有啥问题,但是最终的结果却还是鉴权不通过,实在有些诡异。其基本逻辑为先取得配置的IP列表,然后通过request.getRemoteAddr()取得客户端的IP地址,做鉴权和校验,逻辑没问题,那么肯定是request.getRemoteAddr()出了问题,google下,发现有人遇到类似的问题。

    \n\n

    最终定位为request.getRemoteAddr()这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。

    \n\n

    如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方法获取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客户端的真实IP。

    \n\n

    经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。
    \n原来如此,我们的项目中正好是有前置apache,将一些请求转发给后端的weblogic,看来就是这样导致的咯。

    \n\n

    给出一份还算靠谱的代码,如下:
    \n
    \nJava代码
    \n
    \n public String getIpAddr(HttpServletRequest request) {
    \n String ip = request.getHeader("x-forwarded-for");
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getHeader("WL-Proxy-Client-IP");
    \n }
    \n if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
    \n ip = request.getRemoteAddr();
    \n }
    \n return ip;
    \n }
    \n
    \n
    \n如果有人遇到类似问题,请多加留意,呵呵。

    \n\n

    PS:可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?
    \n答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用户真实IP为: 192.168.1.110

    \n\n

    参考文章:http://blog.sina.com.cn/s/blog_407a68fc01000ai7.html

    \n", "_id"=>339}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"http_load:压力测试小工具", "body"=>"命令行工具http_load看上去和apache的ab很相似,用来做网站的压力测试。其主要用法为:\r\n\r\n1.http_load -parallel 5 -fetches 1000 urls.txt\r\n2.http_load -rate 2 -seconds 300 urls.txt\r\n例子只是个参考,参数其实可以自由组合,参数之间的选择并没有什么限制。比如你写成http_load -parallel 5 -seconds 300 urls.txt也是可以的。我们把参数给大家简单说明一下。\r\n-parallel 简写-p :含义是并发的用户进程数。\r\n-fetches 简写-f :含义是总计的访问次数\r\n-rate    简写-p :含义是每秒的访问频率\r\n-seconds简写-s :含义是总计的访问时间\r\n\r\nurl 是你要访问的网址名,参数可以是单个的网址也可以使包含网址的文件。文件格式如下\r\n
    http://iceskysl.1sters.com/?action=show&id=336\r\nhttp://iceskysl.1sters.com/?action=show&id=335\r\nhttp://iceskysl.1sters.com/?action=show&id=332\r\nhttp://iceskysl.1sters.com/?action=show&id=32
    \r\n参数了解了,我们来看运行一条命令来看看它的返回结果\r\n\r\n命令:% ./http_load -rate 5 -seconds 10 urls\r\n说明执行了一个持续时间10秒的测试,每秒的频率为5。\r\n
    49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds\r\n5916 mean bytes/connection\r\n4.89274 fetches/sec, 28945.5 bytes/sec\r\nmsecs/connect: 28.8932 mean, 44.243 max, 24.488 min\r\nmsecs/first-response: 63.5362 mean, 81.624 max, 57.803 min\r\nHTTP response codes:\r\ncode 200 -- 49
    \r\n结果分析:\r\n1.49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds\r\n说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148秒\r\n2.5916 mean bytes/connection\r\n说明每一连接平均传输的数据量289884/49=5916\r\n3.4.89274 fetches/sec, 28945.5 bytes/sec\r\n说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec\r\n4.msecs/connect: 28.8932 mean, 44.243 max, 24.488 min\r\n说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs\r\n5.msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min\r\n6、HTTP response codes: code 200 -- 49\r\n\r\n说明打开响应页面的类型,如果403的类型过多,那可能要注意是否系统遇到了瓶颈。\r\n特殊说明:这里,我们一般会关注到的指标是fetches/sec、msecs/connect\r\n他们分别对应的常用性能指标参数\r\nQpt-每秒响应用户数和response time,每连接响应用户时间。\r\n测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的cpu、men进行分析,才能得出结论\r\n\r\n参考文档:\r\n\r\nhttp://www.ooso.net/index.php/archives/219\r\n\r\nhttp://www.acme.com/software/http_load/", "created_at"=>2008-07-17 08:30:26 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    命令行工具http_load看上去和apache的ab很相似,用来做网站的压力测试。其主要用法为:

    \n\n

    1.http_load -parallel 5 -fetches 1000 urls.txt
    \n2.http_load -rate 2 -seconds 300 urls.txt
    \n例子只是个参考,参数其实可以自由组合,参数之间的选择并没有什么限制。比如你写成http_load -parallel 5 -seconds 300 urls.txt也是可以的。我们把参数给大家简单说明一下。
    \n-parallel 简写-p :含义是并发的用户进程数。
    \n-fetches 简写-f :含义是总计的访问次数
    \n-rate    简写-p :含义是每秒的访问频率
    \n-seconds简写-s :含义是总计的访问时间

    \n\n

    url 是你要访问的网址名,参数可以是单个的网址也可以使包含网址的文件。文件格式如下
    \nhttp://iceskysl.1sters.com/?action=show&id=336;
    \nhttp://iceskysl.1sters.com/?action=show&id=335;
    \nhttp://iceskysl.1sters.com/?action=show&id=332;
    \nhttp://iceskysl.1sters.com/?action=show&id=32;
    \n参数了解了,我们来看运行一条命令来看看它的返回结果

    \n\n

    命令:% ./http_load -rate 5 -seconds 10 urls
    \n说明执行了一个持续时间10秒的测试,每秒的频率为5。
    \n49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
    \n5916 mean bytes/connection
    \n4.89274 fetches/sec, 28945.5 bytes/sec
    \nmsecs/connect: 28.8932 mean, 44.243 max, 24.488 min
    \nmsecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
    \nHTTP response codes:
    \ncode 200 -- 49
    \n结果分析:
    \n1.49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
    \n说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148秒
    \n2.5916 mean bytes/connection
    \n说明每一连接平均传输的数据量289884/49=5916
    \n3.4.89274 fetches/sec, 28945.5 bytes/sec
    \n说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec
    \n4.msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
    \n说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs
    \n5.msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
    \n6、HTTP response codes: code 200 -- 49

    \n\n

    说明打开响应页面的类型,如果403的类型过多,那可能要注意是否系统遇到了瓶颈。
    \n特殊说明:这里,我们一般会关注到的指标是fetches/sec、msecs/connect
    \n他们分别对应的常用性能指标参数
    \nQpt-每秒响应用户数和response time,每连接响应用户时间。
    \n测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的cpu、men进行分析,才能得出结论

    \n\n

    参考文档:

    \n\n

    http://www.ooso.net/index.php/archives/219

    \n\n

    http://www.acme.com/software/http_load/

    \n", "_id"=>340}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"潘多拉(Pandora)受限,谁来顶起这片天", "body"=>"很多人都说Pandora是目前最好的歌曲智能推荐的应用,其历时8年之久汇总的音乐DNA分类可以比较准确的推荐一些你喜欢的歌曲给你;其iphone版本也相当成功,详细的可以看“iPhone 软件介绍之潘多拉(Pandora)”,非常不错。\r\n\r\n当我一次次的打开其网站准备体验一把的时候,遇到的却是一篇致歉信,大概瞄了一遍,其说不对US之外的用户提供服务(自然是许可证原因),正好看到yeeyan上有篇翻译“Pandora Internet Radio的道歉信”,懒得看E文的可以去瞧瞧。\r\n\r\n很明显,Pandora受限后,其他做音乐的会有一个比较好的机会来迅速填补这个空缺,强占一定的用户,但问题是,谁有能力顶起这片天呢?让我们看看在中国的情况。\r\n\r\n中国的在线音乐网站非常多,但是形式都普遍的很单一,主要有三种形式:\r\n\r\n1、大部分都是首页上横七竖八的堆一堆排行榜,点了直接就听歌,其代表者有一听,九天等。\r\n\r\n2、另外一个代表者是Baidu MP3下载,虽然人气不错,但是其损害的是唱片公司或者是艺人的利益,一直以来都是官司缠身。\r\n\r\n3、还有一种是新兴的web2模式的音乐网站,有yobo.com8box等等网站,其加入社区和互动,yobo甚至还有点Pandora的味道,主推音乐DNA。就目前我用到的,我最看好的还是YOBO,虽然最近他们也遇到一些问题。\r\n\r\nYOBO成立于2006年12月,从1.0到2.0到3.0,和现在正在开发的4.0版本中,在一步步的完善,用户口碑也越来越好。其上的电台和频道功能相当不错,很多定制化的东西可以很容易的找到需要的歌曲,如果你习惯Pandora的智能推荐模式,那么你可以设置让其自动推荐,虽然有的时候结果可能并不能让你满意,但是,请注意,YOBO还不到2岁,他还在不断的完善。\r\n\r\n另外就是最近老是遇到服务器不能及时响应的事情,就我感觉,不排除有人使坏,还是流量真的大的顶不住。\r\n\r\n对了,还有一个last.fm,其现在推出的中版主打中国市场,但是其和其他舶来品差不多,有点水土不服,加上速度一直被人诟病,中文歌曲质量不高等,暂时还不是很看好。", "created_at"=>2008-07-22 01:39:35 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    很多人都说Pandora是目前最好的歌曲智能推荐的应用,其历时8年之久汇总的音乐DNA分类可以比较准确的推荐一些你喜欢的歌曲给你;其iphone版本也相当成功,详细的可以看“iPhone 软件介绍之潘多拉(Pandora)”,非常不错。

    \n\n

    当我一次次的打开其网站准备体验一把的时候,遇到的却是一篇致歉信,大概瞄了一遍,其说不对US之外的用户提供服务(自然是许可证原因),正好看到yeeyan上有篇翻译“Pandora Internet Radio的道歉信”,懒得看E文的可以去瞧瞧。

    \n\n

    很明显,Pandora受限后,其他做音乐的会有一个比较好的机会来迅速填补这个空缺,强占一定的用户,但问题是,谁有能力顶起这片天呢?让我们看看在中国的情况。

    \n\n

    中国的在线音乐网站非常多,但是形式都普遍的很单一,主要有三种形式:

    \n\n

    1、大部分都是首页上横七竖八的堆一堆排行榜,点了直接就听歌,其代表者有一听,九天等。

    \n\n

    2、另外一个代表者是Baidu MP3下载,虽然人气不错,但是其损害的是唱片公司或者是艺人的利益,一直以来都是官司缠身。

    \n\n

    3、还有一种是新兴的web2模式的音乐网站,有yobo.com,8box等等网站,其加入社区和互动,yobo甚至还有点Pandora的味道,主推音乐DNA。就目前我用到的,我最看好的还是YOBO,虽然最近他们也遇到一些问题。

    \n\n

    YOBO成立于2006年12月,从1.0到2.0到3.0,和现在正在开发的4.0版本中,在一步步的完善,用户口碑也越来越好。其上的电台和频道功能相当不错,很多定制化的东西可以很容易的找到需要的歌曲,如果你习惯Pandora的智能推荐模式,那么你可以设置让其自动推荐,虽然有的时候结果可能并不能让你满意,但是,请注意,YOBO还不到2岁,他还在不断的完善。

    \n\n

    另外就是最近老是遇到服务器不能及时响应的事情,就我感觉,不排除有人使坏,还是流量真的大的顶不住。

    \n\n

    对了,还有一个last.fm,其现在推出的中版主打中国市场,但是其和其他舶来品差不多,有点水土不服,加上速度一直被人诟病,中文歌曲质量不高等,暂时还不是很看好。

    \n", "_id"=>341}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Starling: 消息队列服务器", "body"=>"Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter's backend, and is in production across Twitter's cluster.\r\n\r\n参考文章:\r\n1、http://rubyforge.org/projects/starling/\r\n2、The complete guide to setting up Starling:http://rubypond.com/articles/2008/07/17/the-complete-guide-to-setting-up-starling/\r\n3、http://github.com/IceskYsl/starling/tree/master\r\n4、http://myspacesurfer.hee-ro.net/index.php?q=uggc%3A%2F%2Fjjj.eholvafvqr.pbz%2Ffgneyvat-naq-ehqrd-crefvfgrag-ehol-dhrhrf-958.ugzy", "created_at"=>2008-07-22 02:24:50 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter's backend, and is in production across Twitter's cluster.

    \n\n

    参考文章:
    \n1、http://rubyforge.org/projects/starling/
    \n2、The complete guide to setting up Starling:http://rubypond.com/articles/2008/07/17/the-complete-guide-to-setting-up-starling/
    \n3、http://github.com/IceskYsl/starling/tree/master
    \n4、http://myspacesurfer.hee-ro.net/index.php?q=uggc%3A%2F%2Fjjj.eholvafvqr.pbz%2Ffgneyvat-naq-ehqrd-crefvfgrag-ehol-dhrhrf-958.ugzy

    \n", "_id"=>342}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"原来我还不够果断", "body"=>"一直以为自己是个想做就做,行动第一的人,但是有些时候还是有些犹豫和不果断,非要把一切都把握在自己手里,才敢做,犹犹豫豫的,一拖再拖,这不是我希望的。\r\n\r\n立此文章为标,果断点,做回自己!", "created_at"=>2008-07-28 07:29:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    一直以为自己是个想做就做,行动第一的人,但是有些时候还是有些犹豫和不果断,非要把一切都把握在自己手里,才敢做,犹犹豫豫的,一拖再拖,这不是我希望的。

    \n\n

    立此文章为标,果断点,做回自己!

    \n", "_id"=>343}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Fleximage:Rails图片处理新选择", "body"=>"Fleximage is a Rails plugin that tries to make image uploading and rendering super easy.\r\nThere are 2 pieces involved in making Rails image handling easy.\r\n1. Image Uploads\r\n2. Image Rendering\r\n其使用的是Magick\r\n\r\n参考文档:\r\n1.让rails处理图片再简单一点\r\n2.fleximage", "created_at"=>2008-07-29 02:54:14 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    Fleximage is a Rails plugin that tries to make image uploading and rendering super easy.
    \nThere are 2 pieces involved in making Rails image handling easy.
    \n1. Image Uploads
    \n2. Image Rendering
    \n其使用的是Magick

    \n\n

    参考文档:
    \n1.让rails处理图片再简单一点
    \n2.fleximage

    \n", "_id"=>344}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"收到《开源技术选型手册》,谢谢diuera", "body"=>"收到博文的diuera送的《开源技术选型手册》,还有段小故事,呵呵。大概翻了一下,内容虽然不是很深,但是涉及到的内容还是不错的,有预算的朋友可以买本放那,有时间翻阅下。\r\n\r\n\"\"\r\n\r\n另外,有我参与的一本书正在撰写中,希望早早完稿,出版;另外还在策划一本书,希望早早策划好,开始撰写。", "created_at"=>2008-07-29 09:26:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    收到博文的diuera送的《开源技术选型手册》,还有段小故事,呵呵。大概翻了一下,内容虽然不是很深,但是涉及到的内容还是不错的,有预算的朋友可以买本放那,有时间翻阅下。

    \n\n\n

    另外,有我参与的一本书正在撰写中,希望早早完稿,出版;另外还在策划一本书,希望早早策划好,开始撰写。

    \n", "_id"=>345}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"vi/vim命令大全壁纸", "body"=>"我一直苦恼记不住VI的那么多的命令,每次都要翻宝典,实在是效率低下,看到有人做了一份壁纸,挺好的,分享给大家。\r\n\"\"", "created_at"=>2008-08-02 01:30:57 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    我一直苦恼记不住VI的那么多的命令,每次都要翻宝典,实在是效率低下,看到有人做了一份壁纸,挺好的,分享给大家。

    \n", "_id"=>346}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"安装QQ的linux版本", "body"=>"以前是ubuntu下的使用gaim和eva都不是很好用QQ,7.31号QQ发布了linux版本,一直没来得及试试,今天搞好宽带后终于可以试试了,还行,还讲的过去。\r\n\r\n======安装过程===\r\n\r\niceskysl@IceskYsl:/home/software$ wget http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb\r\n--11:07:14--  http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb\r\n=> `linuxqq_1.0-Preview1_i386.deb'\r\n正在解析主机 dl_dir.qq.com... 121.11.68.3, 202.104.241.135, 202.104.241.136, ...\r\n正在连接 dl_dir.qq.com|121.11.68.3|:80... 已连接。\r\n已发出 HTTP 请求,正在等待回应... 200 OK\r\n长度: 4,870,522 (4.6M) [application/octet-stream]\r\n\r\n100%[====================================>] 4,870,522    122.24K/s    ETA 00:00\r\n\r\n11:08:05 (94.06 KB/s) - `linuxqq_1.0-Preview1_i386.deb' 已经保存 [4870522/4870522]\r\n\r\niceskysl@IceskYsl:/home/software$ dpkg -i linuxqq_1.0-Preview1_i386.deb\r\ndpkg: 该操作需要超级用户权限\r\niceskysl@IceskYsl:/home/software$ sudo dpkg -i linuxqq_1.0-Preview1_i386.deb\r\n选中了曾被取消选择的软件包 linuxqq。\r\n(正在读取数据库 ... 系统当前总共安装有 225548 个文件和目录。)\r\n正在解压缩 linuxqq (从 linuxqq_1.0-Preview1_i386.deb) ...\r\n正在设置 linuxqq (1.0-Preview1) ...\r\niceskysl@IceskYsl:/home/software$\r\n\r\n就不截图了,需要了解详细的去他官方了解吧:http://im.qq.com/qq/linux/", "created_at"=>2008-08-02 03:21:11 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    以前是ubuntu下的使用gaim和eva都不是很好用QQ,7.31号QQ发布了linux版本,一直没来得及试试,今天搞好宽带后终于可以试试了,还行,还讲的过去。

    \n\n

    ======安装过程===

    \n\n

    iceskysl@IceskYsl:/home/software$ wget http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb
    \n--11:07:14--  http://dl_dir.qq.com/linuxqq/linuxqq_1.0-Preview1_i386.deb
    \n=> `linuxqq_1.0-Preview1_i386.deb'
    \n正在解析主机 dl_dir.qq.com... 121.11.68.3, 202.104.241.135, 202.104.241.136, ...
    \n正在连接 dl_dir.qq.com|121.11.68.3|:80... 已连接。
    \n已发出 HTTP 请求,正在等待回应... 200 OK
    \n长度: 4,870,522 (4.6M) [application/octet-stream]

    \n\n

    100%[====================================>] 4,870,522    122.24K/s    ETA 00:00

    \n\n

    11:08:05 (94.06 KB/s) - `linuxqq_1.0-Preview1_i386.deb' 已经保存 [4870522/4870522]

    \n\n

    iceskysl@IceskYsl:/home/software$ dpkg -i linuxqq_1.0-Preview1_i386.deb
    \ndpkg: 该操作需要超级用户权限
    \niceskysl@IceskYsl:/home/software$ sudo dpkg -i linuxqq_1.0-Preview1_i386.deb
    \n选中了曾被取消选择的软件包 linuxqq。
    \n(正在读取数据库 ... 系统当前总共安装有 225548 个文件和目录。)
    \n正在解压缩 linuxqq (从 linuxqq_1.0-Preview1_i386.deb) ...
    \n正在设置 linuxqq (1.0-Preview1) ...
    \niceskysl@IceskYsl:/home/software$

    \n\n

    就不截图了,需要了解详细的去他官方了解吧:http://im.qq.com/qq/linux/

    \n", "_id"=>347}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) + String not valid UTF-8 +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"把Ajax文件寄放在Google,Yahoo!", "body"=>"在中国,电信,网通,联通等南北分化问题相当突出,电线的线路网通的访问可能会慢的无法忍受,解决这个问题的办法中,CDN比较靠谱,但是价格不是一般的贵,一般人玩不起,呵呵。一般会搞双线或者在每个网络中部署一套以提高用户体验。\r\n而在页面上,一般来说,AJAX用的JS库表会比较大,这个时候就可以考虑直接使用Google或者Yahoo的JS库,Google的“AJAX Libraries API  ”库包含了常见的jQuery, prototype, script.aculo.us, MooTools, and dojo.等等。\r\n这样一来可以省去不少的网络流量,也提高了各地的速度。而且是免费的,何乐而不为呢?\r\n还有类似YUI的UI库,也可以这样考虑。可以提高不少性能。", "created_at"=>2008-08-07 04:53:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在中国,电信,网通,联通等南北分化问题相当突出,电线的线路网通的访问可能会慢的无法忍受,解决这个问题的办法中,CDN比较靠谱,但是价格不是一般的贵,一般人玩不起,呵呵。一般会搞双线或者在每个网络中部署一套以提高用户体验。
    \n而在页面上,一般来说,AJAX用的JS库表会比较大,这个时候就可以考虑直接使用Google或者Yahoo的JS库,Google的“AJAX Libraries API  ”库包含了常见的jQuery, prototype, script.aculo.us, MooTools, and dojo.等等。
    \n这样一来可以省去不少的网络流量,也提高了各地的速度。而且是免费的,何乐而不为呢?
    \n还有类似YUI的UI库,也可以这样考虑。可以提高不少性能。

    \n", "_id"=>349}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Apache Tomcat Directory Traversal Vulnerability", "body"=>"``Title: Apache Tomcat Directory Traversal VulnerabilityAuthor: Simon Ryeo(bar4mi (at) gmail.com, barami (at) ahnlab.com)Severity: HighImpact: Remote File DisclosureVulnerable Version: prior to 6.0.18Solution: - Best Choice: Upgrade to 6.0.18 (http://tomcat.apache.org) - Hot fix: Disable allowLinking or do not set URIencoding to utf8 in order to avoid this vulnerability. - Tomcat 5.5.x and 4.1.x Users: The fix will be included in the next releases. Please apply the hot fix until next release.References: - http://tomcat.apache.org/security.html - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2938History: - 07.17.2008: Initiate notify (To Apache Security Team) - 08.02.2008: Responsed this problem fixed and released new version - 08.05.2008: Notify disclosure (To Apache Tomcat Security Team) - 08.10.2008: Responsed with some suggestions.\r\n\r\nDescriptionAs Apache Security Team, this problem occurs because of JAVA side.If your context.xml or server.xml allows 'allowLinking'and 'URIencoding' as'UTF-8', an attacker can obtain your important system files.(e.g. /etc/passwd)\r\n\r\nExploitIf your webroot directory has three depth(e.g /usr/local/wwwroot), Anattacker can access arbitrary files as below. (Proof-of-concept)\r\n\r\nhttp://www.target.com/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/foo/bar\r\n\r\n# milw0rm.com [2008-08-11]```", "created_at"=>2008-08-11 09:51:56 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    ``Title: Apache Tomcat Directory Traversal VulnerabilityAuthor: Simon Ryeo(bar4mi (at) gmail.com, barami (at) ahnlab.com)Severity: HighImpact: Remote File DisclosureVulnerable Version: prior to 6.0.18Solution: - Best Choice: Upgrade to 6.0.18 (http://tomcat.apache.org) - Hot fix: Disable allowLinking or do not set URIencoding to utf8 in order to avoid this vulnerability. - Tomcat 5.5.x and 4.1.x Users: The fix will be included in the next releases. Please apply the hot fix until next release.References: - http://tomcat.apache.org/security.html - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2938History: - 07.17.2008: Initiate notify (To Apache Security Team) - 08.02.2008: Responsed this problem fixed and released new version - 08.05.2008: Notify disclosure (To Apache Tomcat Security Team) - 08.10.2008: Responsed with some suggestions.

    \n\n

    DescriptionAs Apache Security Team, this problem occurs because of JAVA side.If your context.xml or server.xml allows 'allowLinking'and 'URIencoding' as'UTF-8', an attacker can obtain your important system files.(e.g. /etc/passwd)

    \n\n

    ExploitIf your webroot directory has three depth(e.g /usr/local/wwwroot), Anattacker can access arbitrary files as below. (Proof-of-concept)

    \n\n

    http://www.target.com/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/foo/bar

    \n\n

    milw0rm.com [2008-08-11]```

    \n", "_id"=>350}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"中国网民都在做什么?", "body"=>"\"\"\r\n\r\n有时间的看看其他人对中国网民的调查、分析、报告还是有好处的,至少可以让自己在一个宏观和趋势是了解中国网民在做什么和喜欢做什么,在08年1月的时候,在一篇《What Do Chinese Internet Users Do Online?》文章中看到《中国互联网络发展状况统计报告》,比较详细的说明了中国网民的构成,分布等等,非常不错。\r\n\r\n时隔半年,《TrendsSpotting Handbook Of Online China》这篇文章中又看到一个《Handbook of Online China》的PPT,该PPT分析了中国互联网用户的行为特征,从应用、搜索、web2等方面分析、比较了中国当下比较大的应用。\r\n\r\n在该报告中,我们可以看到,互联网应用中网络音乐,IM和在线视频,在线游戏都是热门,详细的可以进一步的查看该PPT。\r\n\r\n\"\"", "created_at"=>2008-08-13 03:24:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    有时间的看看其他人对中国网民的调查、分析、报告还是有好处的,至少可以让自己在一个宏观和趋势是了解中国网民在做什么和喜欢做什么,在08年1月的时候,在一篇《What Do Chinese Internet Users Do Online?》文章中看到《中国互联网络发展状况统计报告》,比较详细的说明了中国网民的构成,分布等等,非常不错。

    \n\n

    时隔半年,《TrendsSpotting Handbook Of Online China》这篇文章中又看到一个《Handbook of Online China》的PPT,该PPT分析了中国互联网用户的行为特征,从应用、搜索、web2等方面分析、比较了中国当下比较大的应用。

    \n\n

    在该报告中,我们可以看到,互联网应用中网络音乐,IM和在线视频,在线游戏都是热门,详细的可以进一步的查看该PPT。
    \nHandbook of Online China
    \nView SlideShare presentation (tags: web trend trends powerpoint olympics)
    \n

    \n", "_id"=>351}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID做ActiveRecord主键", "body"=>"大家都知道,在Rails中比较常见的做法是使用“auto increment”的id做为主键,虽然很便捷,但是也存在以下问题:\r\n\r\n1)敏感信息泄漏 --比如注册用户数,发表文章数等,内行一眼就看出你系统的规模;\r\n\r\n2)分布式DB存在冲突 --一个DB不够了,需要多个DB的时候,可能会存在ID冲突的情况;\r\n\r\n3)旧数据库影响  --导入、导出的时候可能存在一些问题(rake db:schema:dump)\r\n\r\n由于这些问题都是很关键的,所以很有必要做一些改变,思路很简单,使用UUID做主键,可以保证主键的唯一性(类似12f186e6-687e-11ad-843e-001b632783f1,全世界唯一),又能隐藏敏感信息,且实现很简单,如下:\r\n\r\n1、创建表,去掉ID属性,增加UUID属性\r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. create_table :posts:id => false do |t|  
    2. \r\n\t
    3.   t.string :uuid:limit => 36, :primary => true  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n2、在Model中设置主键为UUID\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Post < ActiveRecord::Base  
    2. \r\n\t
    3.   set_primary_key \"uuid\"  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n3、安装UUID的gem\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. sudo gem install uuidtools  
    2. \r\n
    \r\n
    \r\n4、创建lib/uuid_helper.rb \r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'rubygems'  
    2. \r\n\t
    3. require 'uuidtools'  
    4. \r\n\t
    5.    
    6. \r\n\t
    7. module UUIDHelper  
    8. \r\n\t
    9.   def before_create()  
    10. \r\n\t
    11.     self.uuid = UUID.timestamp_create().to_s  
    12. \r\n\t
    13.   end  
    14. \r\n\t
    15. end  
    16. \r\n
    \r\n
    \r\n5、使用UUIDHelper\r\n\r\n \r\n\r\n \r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Post < ActiveRecord::Base  
    2. \r\n\t
    3.   set_primary_key \"uuid\"  
    4. \r\n\t
    5.   include UUIDHelper  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\nOK,新建一个post,就可以看到,该字段被自动填入了。\r\n\r\n \r\n\r\nPS:需要注意的是,需要留意before_create是否有冲突。\r\n\r\n参考文章:\r\n\r\nhttp://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key/", "created_at"=>2008-08-14 02:43:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    大家都知道,在Rails中比较常见的做法是使用“auto increment”的id做为主键,虽然很便捷,但是也存在以下问题:

    \n\n

    1)敏感信息泄漏 --比如注册用户数,发表文章数等,内行一眼就看出你系统的规模;

    \n\n

    2)分布式DB存在冲突 --一个DB不够了,需要多个DB的时候,可能会存在ID冲突的情况;

    \n\n

    3)旧数据库影响  --导入、导出的时候可能存在一些问题(rake db:schema:dump)

    \n\n

    由于这些问题都是很关键的,所以很有必要做一些改变,思路很简单,使用UUID做主键,可以保证主键的唯一性(类似12f186e6-687e-11ad-843e-001b632783f1,全世界唯一),又能隐藏敏感信息,且实现很简单,如下:

    \n\n

    1、创建表,去掉ID属性,增加UUID属性

    \n\n

     
    \n
    \nRuby代码
    \n
    \n create_table :posts, :id => false do |t|  
    \n   t.string :uuid, :limit => 36, :primary => true  
    \n end  
    \n
    \n
    \n2、在Model中设置主键为UUID

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n class Post < ActiveRecord::Base  
    \n   set_primary_key "uuid"  
    \n end  
    \n
    \n
    \n3、安装UUID的gem

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n sudo gem install uuidtools  
    \n
    \n
    \n4、创建lib/uuid_helper.rb

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'uuidtools'  
    \n    
    \n module UUIDHelper  
    \n   def before_create()  
    \n     self.uuid = UUID.timestamp_create().to_s  
    \n   end  
    \n end  
    \n
    \n
    \n5、使用UUIDHelper

    \n\n

     

    \n\n

     
    \n
    \nRuby代码
    \n
    \n class Post < ActiveRecord::Base  
    \n   set_primary_key "uuid"  
    \n   include UUIDHelper  
    \n end  
    \n
    \n
    \nOK,新建一个post,就可以看到,该字段被自动填入了。

    \n\n

     

    \n\n

    PS:需要注意的是,需要留意before_create是否有冲突。

    \n\n

    参考文章:

    \n\n

    http://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key/

    \n", "_id"=>352}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用UUID隐藏系统敏感信息", "body"=>"在前面一篇文章中已经说了如何使用“使用UUID做ActiveRecord主键”,其说到使用Rails默认的id做为自增变量的几个缺点,其中一条就是“敏感信息泄漏 ”,这个是很致命的,可以让您的竞争对手很清楚的了解到你的系统的数据量,比如多少注册用户,发布了多少个帖子等等,还可以根据这个计算出你系统的增长率,做趋势预测,总之,把这些敏感信息暴露出来非常危险(搞社工的都明白)。\r\n\r\n更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。\r\n\r\n而采用UUID来做逐渐,因为其每次生成的都是唯一的、类似12f186e6-687e-11ad-843e-001b632783f1这样的串,所以可以很大程度上避免敏感信息的泄露。也可以防止自动采集的发生。\r\n具体使用方法,请参考前面一篇文章“使用UUID做ActiveRecord主键”。安全意识还是要有的,切记。", "created_at"=>2008-08-14 02:53:05 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在前面一篇文章中已经说了如何使用“使用UUID做ActiveRecord主键”,其说到使用Rails默认的id做为自增变量的几个缺点,其中一条就是“敏感信息泄漏 ”,这个是很致命的,可以让您的竞争对手很清楚的了解到你的系统的数据量,比如多少注册用户,发布了多少个帖子等等,还可以根据这个计算出你系统的增长率,做趋势预测,总之,把这些敏感信息暴露出来非常危险(搞社工的都明白)。

    \n\n

    更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。

    \n\n

    而采用UUID来做逐渐,因为其每次生成的都是唯一的、类似12f186e6-687e-11ad-843e-001b632783f1这样的串,所以可以很大程度上避免敏感信息的泄露。也可以防止自动采集的发生。
    \n具体使用方法,请参考前面一篇文章“使用UUID做ActiveRecord主键”。安全意识还是要有的,切记。

    \n", "_id"=>353}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Yahoo! Music 放出API,音乐平台开放趋势凸显", "body"=>"在Last.fm宣布其开放API后,Yahoo! Music也宣布其开放API。直接看一段英文描述,不废话了,大家都看得懂,如下:\r\n
    The music API gives developers access to Yahoo!’s “catalog of artists, albums, tracks, videos, ratings and more,” according to the company. It allows developers to interface with Yahoo! Music’s database via “charts, search, similarities, genres, artists, and user recommendations and ratings.”\r\n\r\nThe REST-based API returns data in XML, JSON, and RSS and uses BBAuth to allow user authentication for Yahoo! Music users to access their personal data via external apps. Use of the API is currently limited to 5k queries per day.
    \r\n采用REST格式的API,使用Ruby来调用非常简单,看一段代码:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'yahoo-music'  
    2. \r\n\t
    3. include Yahoo::Music  
    4. \r\n\t
    5. Yahoo::Music.app_id = \"...\" # Put Your App ID Here  
    6. \r\n\t
    7. artist = Artist.new(\"Beirut\"# Searches by name and uses first result  
    8. \r\n\t
    9. album = artist.releases.detect{|r| r.title == \"Flying Club Cup\"}  
    10. \r\n\t
    11. puts album.title  
    12. \r\n\t
    13. puts album.artist  
    14. \r\n\t
    15. puts \"Release Date:\" + album.released_on.strftime(\"%m/%d/%Y\")  
    16. \r\n\t
    17. puts  
    18. \r\n\t
    19. puts \"Tracks\"  
    20. \r\n\t
    21. artist.tracks.each_with_index do |track, i|  
    22. \r\n\t
    23. puts \"\\t%d %s \\t%2d:%2d\" % [i, track.title, track.duration / 60, track.duration % 60]  
    24. \r\n\t
    25. end  
    26. \r\n
    \r\n
    \r\n详细资料,请参考:\r\n\r\nhttp://developer.yahoo.net/blog/archives/2008/08/y_music_battle_of_the_apis.html\r\n\r\nhttp://developer.yahoo.com/music/\r\n\r\nhttp://www.sitepoint.com/blogs/2008/08/05/yahoo-releases-music-api/\r\n\r\n ", "created_at"=>2008-08-15 06:32:02 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在Last.fm宣布其开放API后,Yahoo! Music也宣布其开放API。直接看一段英文描述,不废话了,大家都看得懂,如下:
    \nThe music API gives developers access to Yahoo!’s “catalog of artists, albums, tracks, videos, ratings and more,” according to the company. It allows developers to interface with Yahoo! Music’s database via “charts, search, similarities, genres, artists, and user recommendations and ratings.”

    \n\n

    The REST-based API returns data in XML, JSON, and RSS and uses BBAuth to allow user authentication for Yahoo! Music users to access their personal data via external apps. Use of the API is currently limited to 5k queries per day.
    \n采用REST格式的API,使用Ruby来调用非常简单,看一段代码:
    \n
    \nRuby代码
    \n
    \n require 'yahoo-music'  
    \n include Yahoo::Music  
    \n Yahoo::Music.app_id = "..." # Put Your App ID Here  
    \n artist = Artist.new("Beirut") # Searches by name and uses first result  
    \n album = artist.releases.detect{|r| r.title == "Flying Club Cup"}  
    \n puts album.title  
    \n puts album.artist  
    \n puts "Release Date:" + album.released_on.strftime("%m/%d/%Y")  
    \n puts  
    \n puts "Tracks"  
    \n artist.tracks.each_with_index do |track, i|  
    \n puts "\\t%d %s \\t%2d:%2d" % [i, track.title, track.duration / 60, track.duration % 60]  
    \n end  
    \n
    \n
    \n详细资料,请参考:

    \n\n

    http://developer.yahoo.net/blog/archives/2008/08/y_music_battle_of_the_apis.html

    \n\n

    http://developer.yahoo.com/music/

    \n\n

    http://www.sitepoint.com/blogs/2008/08/05/yahoo-releases-music-api/

    \n\n

     

    \n", "_id"=>354}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails Plugins]dnsbl_check过滤来源IP", "body"=>"dnsbl_check是个很有意思的插件,它其实就是一个前置过滤器,在请求第一次到来的时候,会根据DNS Blackhole Lists来判断来源IP是否合法,如果合法,放行,并在其session中标识已经被checked,而后再来源就不会再去校验(省了不少资源);如果来源IP在DBL内,就会显示“Access denied”页面,同时阻止其进一步访问。\r\n\r\n安装和使用:\r\n
      \r\n\t
    1. 在Rails项目的根目录下执行\"script/plugin install http://www.spacebabies.nl/svn/dnsbl_check\" ;
    2. \r\n\t
    3. 在需要早检查的controllers 中添加\"before_filter :dnsbl_check\" ;
    4. \r\n\t
    5. 重启应用程序.
    6. \r\n
    \r\n在 vendor/plugins 目录下需要包含如下结构文件:\r\n\r\n<site name>/vendor/plugins/dnsbl_check/\r\n|-- 403.html\r\n|-- README\r\n|-- init.rb\r\n|-- install.rb\r\n`-- lib\r\n`-- dnsbl_check.rb\r\n\r\n代码示例:\r\n```````\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class CommentsController < ApplicationController  
    2. \r\n\t
    3.   before_filter :dnsbl_check  
    4. \r\n\t
    5.   
    6. \r\n\t
    7.   # Let users submit comments.  
    8. \r\n\t
    9.   def submit  
    10. \r\n\t
    11.     ...  
    12. \r\n\t
    13.   end  
    14. \r\n\t
    15. end  
    16. \r\n
    \r\n
    \r\n参考:\r\nhttp://agilewebdevelopment.com/plugins/rbl_check\r\nhttp://spacebabies.nl/dnsbl_check/\r\nhttp://spacebabies.nl/svn/dnsbl_check/\r\n\r\nPS:其主页貌似无法访问了,不晓得哪里有代码下载。", "created_at"=>2008-08-15 09:02:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    dnsbl_check是个很有意思的插件,它其实就是一个前置过滤器,在请求第一次到来的时候,会根据DNS Blackhole Lists来判断来源IP是否合法,如果合法,放行,并在其session中标识已经被checked,而后再来源就不会再去校验(省了不少资源);如果来源IP在DBL内,就会显示“Access denied”页面,同时阻止其进一步访问。

    \n\n

    安装和使用:
    \n
    \n 在Rails项目的根目录下执行"script/plugin install http://www.spacebabies.nl/svn/dnsbl_check" ;
    \n 在需要早检查的controllers 中添加"before_filter :dnsbl_check" ;
    \n 重启应用程序.
    \n
    \n在 vendor/plugins 目录下需要包含如下结构文件:

    \n\n

    <site name>/vendor/plugins/dnsbl_check/
    \n|-- 403.html
    \n|-- README
    \n|-- init.rb
    \n|-- install.rb
    \n-- lib
    \n
    -- dnsbl_check.rb

    \n\n

    代码示例:
    \n```````
    \n
    \nRuby代码
    \n
    \n class CommentsController < ApplicationController  
    \n   before_filter :dnsbl_check  
    \n   
    \n   # Let users submit comments.  
    \n   def submit  
    \n     ...  
    \n   end  
    \n end  
    \n
    \n
    \n参考:
    \nhttp://agilewebdevelopment.com/plugins/rbl_check
    \nhttp://spacebabies.nl/dnsbl_check/
    \nhttp://spacebabies.nl/svn/dnsbl_check/

    \n\n

    PS:其主页貌似无法访问了,不晓得哪里有代码下载。

    \n", "_id"=>355}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"ulimit:修改和检查文件句柄数限制", "body"=>"在Linux下面部署应用的时候,有时候会遇上Socket/File: Can’t open so many files的问题,其实Linux是有文件句柄限制的,而且默认不是很高,一般都是1024,作为一台生产服务器,其实很容易就达到这个数量,因此我们需 要把这个值改大一些。\r\n\r\n我们可以用ulimit -a来查看所有限制值,我只关心文件句柄数量的问题\r\nopen files (-n) 1024\r\n这个就是限制数量 ,其指的是当前用户准备要运行的程序的限制。比较推荐的修改方法是:\r\n\r\n正确的做法,应该是修改/etc/security/limits.conf\r\n里面有很详细的注释,比如\r\n* soft nofile 2048\r\n* hard nofile 32768\r\n\r\n检查:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. #check file descriptor  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. echo  
    6. \r\n\t
    7. echo \"-----------------------------------------------\"  
    8. \r\n\t
    9. echo \"Begin to check the file descriptor limit\"  
    10. \r\n\t
    11. fd=`ulimit -n`  
    12. \r\n\t
    13. if [ $fd -lt 8192 ];  
    14. \r\n\t
    15.    then  
    16. \r\n\t
    17.    echo \"Fatal Error!\"  
    18. \r\n\t
    19.    echo \"The file descriptor limit is only '\"$fd\"'!\"  
    20. \r\n\t
    21.    echo \"Please make it more than 8192!\"  
    22. \r\n\t
    23.    exit  
    24. \r\n\t
    25. fi  
    26. \r\n\t
    27. echo \"OK, the file descriptor limit is\" $fd  
    28. \r\n\t
    29. echo \"-----------------------------------------------\"  
    30. \r\n\t
    31. echo  
    32. \r\n\t
    33. echo\r\n
    34. \r\n
    \r\n
    \r\n参考文章:\r\nhttp://blog.chinaunix.net/u2/64804/showart_1019246.html\r\nhttp://hi.baidu.com/leshy/blog/item/f57f4a903fb0898ea877a452.html", "created_at"=>2008-08-19 08:37:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在Linux下面部署应用的时候,有时候会遇上Socket/File: Can’t open so many files的问题,其实Linux是有文件句柄限制的,而且默认不是很高,一般都是1024,作为一台生产服务器,其实很容易就达到这个数量,因此我们需 要把这个值改大一些。

    \n\n

    我们可以用ulimit -a来查看所有限制值,我只关心文件句柄数量的问题
    \nopen files (-n) 1024
    \n这个就是限制数量 ,其指的是当前用户准备要运行的程序的限制。比较推荐的修改方法是:

    \n\n

    正确的做法,应该是修改/etc/security/limits.conf
    \n里面有很详细的注释,比如
    \n* soft nofile 2048
    \n* hard nofile 32768

    \n\n

    检查:
    \n
    \nRuby代码
    \n
    \n #check file descriptor  
    \n   
    \n echo  
    \n echo "-----------------------------------------------"  
    \n echo "Begin to check the file descriptor limit"  
    \n fd=ulimit -n  
    \n if [ $fd -lt 8192 ];  
    \n    then  
    \n    echo "Fatal Error!"  
    \n    echo "The file descriptor limit is only '"$fd"'!"  
    \n    echo "Please make it more than 8192!"  
    \n    exit  
    \n fi  
    \n echo "OK, the file descriptor limit is" $fd  
    \n echo "-----------------------------------------------"  
    \n echo  
    \n echo
    \n
    \n
    \n
    \n参考文章:
    \nhttp://blog.chinaunix.net/u2/64804/showart_1019246.html
    \nhttp://hi.baidu.com/leshy/blog/item/f57f4a903fb0898ea877a452.html

    \n", "_id"=>356}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"查看MYSQL表占用空间状态", "body"=>"比如需要查询库占用的空间和索引占用的空间:\r\n\r\n查整个库的状态:\r\nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,\r\nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,\r\nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,\r\nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size\r\nfrom information_schema.tables where TABLE_SCHEMA = 'databasename';\r\n\r\n查单表:\r\nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,\r\nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,\r\nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,\r\nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size\r\nfrom information_schema.tables where TABLE_NAME = 'tablename';", "created_at"=>2008-08-19 09:08:34 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    比如需要查询库占用的空间和索引占用的空间:

    \n\n

    查整个库的状态:
    \nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
    \nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
    \nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
    \nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
    \nfrom information_schema.tables where TABLE_SCHEMA = 'databasename';

    \n\n

    查单表:
    \nselect concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
    \nconcat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
    \nconcat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
    \nconcat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
    \nfrom information_schema.tables where TABLE_NAME = 'tablename';

    \n", "_id"=>357}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Prawn:Ruby生成PDF更简捷的选择", "body"=>"在InfoQ上看到《Prawn:使用Ruby生成PDF更简捷》,其说到的Prawn可以更加快捷的在Ruby中生成PDF文件。因为之前使用过很多版本的PDF生成类库都不尽如人意,有的太复杂,有的太慢,于是对这个做了测试。\r\n\r\n1、安装\r\n\r\n安装很简单,直接使用gem install prawn即可安装完成;\r\n\r\n2、使用\r\n\r\n比较简单,详细的参考其文档,我直接贴一段我测试用的代码,如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # coding: utf-8  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. $LOAD_PATH << File.join(File.dirname(__FILE__), '..''lib')  
    6. \r\n\t
    7. require \"prawn\"  
    8. \r\n\t
    9. start = Time.now  
    10. \r\n\t
    11. Prawn::Document.generate(\"utf8_text_flow.pdf\"do  
    12. \r\n\t
    13.   font \"\#{Prawn::BASEDIR}/data/fonts/simfang.ttf\"  
    14. \r\n\t
    15.   text \"我是中文,还有数字+yingwen+898\"* 2  
    16. \r\n\t
    17.   text \"This is a english text, and i will be here ...\"  
    18. \r\n\t
    19.   text \"This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,\"  
    20. \r\n\t
    21.     
    22. \r\n\t
    23.   font_size!(16)  
    24. \r\n\t
    25.   text \"At size 16\"  
    26. \r\n\t
    27.     
    28. \r\n\t
    29.   font_size!(16)  
    30. \r\n\t
    31.   text \"\\nIceskYsl@1sters!\"  
    32. \r\n\t
    33.   font_size!(10)  
    34. \r\n\t
    35.   text \"不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…\"  
    36. \r\n\t
    37.   font_size!(12)  
    38. \r\n\t
    39.   text \"更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。\"  
    40. \r\n\t
    41. \r\n
    42. \r\n\t
    43. end  
    44. \r\n\t
    45. puts \"Spend \#{Time.now-start}s\"  
    46. \r\n\t
    47.                                   
    48. \r\n\t
    49.         
    50. \r\n\t
    51.         
    52. \r\n
    \r\n
    \r\n生成的PDF效果还是比较让人满意的,如下是效果图:\r\n\r\n \r\n\r\n\"\"\r\n\r\n3、优缺点\r\n
      \r\n\t
    • 使用比较方便,API都比较简单;
    • \r\n\t
    • 相对来水比较快,从上面代码可以看到,生成如上这份PDF需要的时候是”Spend 4.36s“;
    • \r\n\t
    • 其本身支持14种内在字体,另外可以使用TTF字体文件来添加自己需要的字体;
    • \r\n\t
    • 支持UTF8字体,对中文等字体支持比较好
    • \r\n\t
    • 英文可以自动换行,但是我测试中文就不能自动换行了,如上图的红圈地方就是溢出的;--已经修复
    • \r\n\t
    • 定位方便;
    • \r\n\t
    • 支持图片插入;
    • \r\n\t
    • 支持表格,cell等等。
    • \r\n
    \r\n4、其他\r\n\r\n上面说的那个Bug我已经提交给作者,详细的参考这里”chinese text can not flow well “,应该很快就可以修复和完善了;\r\n\r\n让我惊奇的是其主页 上竟然有 中文版页面,难道有国人参与?\r\n\r\n其代码库在:http://github.com/sandal/prawn/tree/master\r\n\r\n5、更新\r\n\r\n上面说到的一个对中文自动换行的BUG,提交给作者后,他就修复了,现在我测试的效果非常棒,是我见过的最棒的一个PDF生成类库了,如下是效果图,可以和上面的那个比较下。\r\n\r\n\"\"", "created_at"=>2008-08-20 03:39:42 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在InfoQ上看到《Prawn:使用Ruby生成PDF更简捷》,其说到的Prawn可以更加快捷的在Ruby中生成PDF文件。因为之前使用过很多版本的PDF生成类库都不尽如人意,有的太复杂,有的太慢,于是对这个做了测试。

    \n\n

    1、安装

    \n\n

    安装很简单,直接使用gem install prawn即可安装完成;

    \n\n

    2、使用

    \n\n

    比较简单,详细的参考其文档,我直接贴一段我测试用的代码,如下:
    \n
    \nRuby代码
    \n
    \n # coding: utf-8  
    \n   
    \n $LOADPATH << File.join(File.dirname(FILE_), '..', 'lib')  
    \n require "prawn"  
    \n start = Time.now  
    \n Prawn::Document.generate("utf8_text_flow.pdf") do  
    \n   font "\#{Prawn::BASEDIR}/data/fonts/simfang.ttf"  
    \n   text "我是中文,还有数字+yingwen+898"* 2  
    \n   text "This is a english text, and i will be here ..."  
    \n   text "This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,This is a long text ,"  
    \n     
    \n   font_size!(16)  
    \n   text "At size 16"  
    \n     
    \n   font_size!(16)  
    \n   text "\\nIceskYsl@1sters!"  
    \n   font_size!(10)  
    \n   text "不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…"  
    \n   font_size!(12)  
    \n   text "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。"  
    \n
    \n
    \n end  
    \n puts "Spend \#{Time.now-start}s"  
    \n                                   
    \n         
    \n         
    \n
    \n
    \n生成的PDF效果还是比较让人满意的,如下是效果图:

    \n\n

     

    \n\n\n

    3、优缺点
    \n
    \n 使用比较方便,API都比较简单;
    \n 相对来水比较快,从上面代码可以看到,生成如上这份PDF需要的时候是”Spend 4.36s“;
    \n 其本身支持14种内在字体,另外可以使用TTF字体文件来添加自己需要的字体;
    \n 支持UTF8字体,对中文等字体支持比较好
    \n 英文可以自动换行,但是我测试中文就不能自动换行了,如上图的红圈地方就是溢出的;--已经修复
    \n 定位方便;
    \n 支持图片插入;
    \n 支持表格,cell等等。
    \n
    \n4、其他

    \n\n

    上面说的那个Bug我已经提交给作者,详细的参考这里”chinese text can not flow well “,应该很快就可以修复和完善了;

    \n\n

    让我惊奇的是其主页 上竟然有 中文版页面,难道有国人参与?

    \n\n

    其代码库在:http://github.com/sandal/prawn/tree/master

    \n\n

    5、更新

    \n\n

    上面说到的一个对中文自动换行的BUG,提交给作者后,他就修复了,现在我测试的效果非常棒,是我见过的最棒的一个PDF生成类库了,如下是效果图,可以和上面的那个比较下。

    \n\n", "_id"=>358}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"BOSSMan: 用Ruby利用yahoo!Boss打造自己的搜索引擎", "body"=>"yahoo的BOSS web服务比之前Yahoo! Search API更加方便灵活,取消了诸多限制,比如检索的次数等等,其介绍如下:\r\n
    BOSS (Build your Own Search Service) is Yahoo!'s open search web services platform. The goal of BOSS is simple: to foster innovation in the search industry. Developers, start-ups, and large Internet companies can use BOSS to build and launch web-scale search products that utilize the entire Yahoo! Search index. BOSS gives you access to Yahoo!'s investments in crawling and indexing, ranking and relevancy algorithms, and powerful infrastructure. By combining your unique assets and ideas with our search technology assets, BOSS is a platform for the next generation of search innovation, serving hundreds of millions of users across the Web.
    \r\n\"\"\r\nJay Pignata已经用Ruby写了一个类库BOSSMan,使用非常方便,步骤如下:\r\n1、安装gem\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. gem sources -a http://gems.github.com  
    2. \r\n\t
    3. gem install jpignata-bossman\r\n
    4. \r\n
    \r\n
    \r\n2、编写代码\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'rubygems'  
    2. \r\n\t
    3. require 'bossman'  
    4. \r\n\t
    5. include BOSSMan  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. BOSSMan.application_id = \"Your Application ID here\"  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. news = BOSSMan::Search.news(\"IceskYsl\", 0, 3)  
    14. \r\n\t
    15. news.results.each do |result|  
    16. \r\n\t
    17.   puts \"\#{result.title} [from \#{result.source}]\"  
    18. \r\n\t
    19. end   
    20. \r\n
    \r\n
    \r\n参考文档:\r\nBOSSMan: Build Your Own Search Engine With Yahoo And Ruby: http://www.rubyinside.com/ruby-and-yahoo-boss-with-bossman-1047.html\r\n插件BOSSman:http://github.com/jpignata/bossman-gem/tree/master\r\n看视频介绍:http://developer.yahoo.com/search/boss/", "created_at"=>2008-08-20 06:50:33 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    yahoo的BOSS web服务比之前Yahoo! Search API更加方便灵活,取消了诸多限制,比如检索的次数等等,其介绍如下:
    \nBOSS (Build your Own Search Service) is Yahoo!'s open search web services platform. The goal of BOSS is simple: to foster innovation in the search industry. Developers, start-ups, and large Internet companies can use BOSS to build and launch web-scale search products that utilize the entire Yahoo! Search index. BOSS gives you access to Yahoo!'s investments in crawling and indexing, ranking and relevancy algorithms, and powerful infrastructure. By combining your unique assets and ideas with our search technology assets, BOSS is a platform for the next generation of search innovation, serving hundreds of millions of users across the Web.
    \n
    \nJay Pignata已经用Ruby写了一个类库BOSSMan,使用非常方便,步骤如下:
    \n1、安装gem
    \n
    \nRuby代码
    \n
    \n gem sources -a http://gems.github.com  
    \n gem install jpignata-bossman
    \n
    \n
    \n
    \n2、编写代码
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'bossman'  
    \n include BOSSMan  
    \n   
    \n BOSSMan.application_id = "Your Application ID here"  
    \n   
    \n news = BOSSMan::Search.news("IceskYsl", 0, 3)  
    \n news.results.each do |result|  
    \n   puts "\#{result.title} [from \#{result.source}]"  
    \n end   
    \n
    \n
    \n参考文档:
    \nBOSSMan: Build Your Own Search Engine With Yahoo And Ruby: http://www.rubyinside.com/ruby-and-yahoo-boss-with-bossman-1047.html
    \n插件BOSSman:http://github.com/jpignata/bossman-gem/tree/master
    \n看视频介绍:http://developer.yahoo.com/search/boss/

    \n", "_id"=>359}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Connection refused: SliceHost上SSH登录问题", "body"=>"N久前买的slicehost上一个VPN,上面跑了一个mysql,和mongrel,好久没SSH上去了,今天SSH的时候老是被拒绝“port 22: Connection refused”,真是怪异,开始以为是我把sshd的端口改了,赶紧使用web console连上去看看,先````nano /etc/ssh/sshd_config看到的端口还是22,并没有修改。```\r\n\r\n````接着看是不是限制了登录,发现也没有,再检查iptables发现也没有阻拦22端口,怪异哦。最后使用netstat -antp看下端口,发现没有22,寒,难道sshd没启动,赶紧启动下:```/etc/init.d/ssh start\r\n\r\n然后再查下端口,有了:\r\n
    root@iceskysl:/var/log# /etc/init.d/ssh start                                                                              * Starting OpenBSD Secure Shell server sshd                             [ OK ]                                         root@iceskysl:/var/log# netstat -antp                                                                                     Active Internet connections (servers and established)                                                                   Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name                        tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6427/ruby1.8                            tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      6430/ruby1.8                            tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      8985/mysqld                             tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      8561/nginx                              tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      9191/ruby1.8                            tcp        0      0 127.0.0.1:7001          0.0.0.0:*               LISTEN      9194/ruby1.8                            tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3266/master                             tcp6       0      0 :::22                   :::*                    LISTEN      15682/sshd                              root@iceskysl:/var/log#    再试试,可以SSH连上去了,真够折腾的。幸好slicehost还有个web console,要不然咋整? 紧接着做下iptables,限制下登录。                                                          ```", "created_at"=>2008-08-20 13:29:56 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    N久前买的slicehost上一个VPN,上面跑了一个mysql,和mongrel,好久没SSH上去了,今天SSH的时候老是被拒绝“port 22: Connection refused”,真是怪异,开始以为是我把sshd的端口改了,赶紧使用web console连上去看看,先`nano /etc/ssh/sshd_config看到的端口还是22,并没有修改。

    \n\n

    `接着看是不是限制了登录,发现也没有,再检查iptables发现也没有阻拦22端口,怪异哦。最后使用netstat -antp看下端口,发现没有22,寒,难道sshd没启动,赶紧启动下:/etc/init.d/ssh start

    \n\n

    然后再查下端口,有了:
    \nroot@iceskysl:/var/log# /etc/init.d/ssh start                                                                              * Starting OpenBSD Secure Shell server sshd                             [ OK ]                                         root@iceskysl:/var/log# netstat -antp                                                                                     Active Internet connections (servers and established)                                                                   Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name                        tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6427/ruby1.8                            tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      6430/ruby1.8                            tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      8985/mysqld                             tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      8561/nginx                              tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      9191/ruby1.8                            tcp        0      0 127.0.0.1:7001          0.0.0.0:*               LISTEN      9194/ruby1.8                            tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3266/master                             tcp6       0      0 :::22                   :::*                    LISTEN      15682/sshd                              root@iceskysl:/var/log#    再试试,可以SSH连上去了,真够折腾的。幸好slicehost还有个web console,要不然咋整? 紧接着做下iptables,限制下登录。                                                          ```

    \n", "_id"=>360}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["git"], "comments_count"=>0, "category_id"=>7, "title"=>"在win下使用Git", "body"=>"以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。\r\n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:\r\n-----------------使用---------------\r\n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.\r\n\r\n1.创建git的数据库\r\nC:\\Git\\bin>git init-db\r\n\r\n2.生成一个文件xxx并加入到git中\r\nC:\\Git\\bin>echo hello > xxx\r\nC:\\Git\\bin>git add xxx\r\n\r\n3.提交[以上两步与标准教程还是一样的,关键是这一步]\r\nC:\\Git\\bin>set home=c:\\\r\nC:\\Git\\bin>git config --global user.name \"clq\"\r\nC:\\Git\\bin>git commit -m \"test\"\r\n\r\n一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 \"test\" 就是我加的注释了.\r\n\r\n4.改一下xxx文件\r\necho world >> xxx\r\n\r\n5.查看一下它和我们原来对比的有什么不同\r\nC:\\Git\\bin>git diff\r\n\r\n结果如下\r\ndiff --git a/xxx b/xxx\r\nindex 907cd4b..360c7f4 100644\r\n--- a/xxx\r\n+++ b/xxx\r\n@@ -1 +1,2 @@\r\nhello\r\n+world\r\n(END)\r\n\r\n用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样\r\n提交可以用一个命令来完成\r\ngit commit -m \"\" -a xxx\r\n\r\n省去git add\r\n\r\nC:\\Git\\bin>git show xxx\r\n查看最近一次提交的信息.\r\n\r\nC:\\Git\\bin>git commit -a -m\"aa\"\r\n\r\n提交全部更改过的文件.", "created_at"=>2008-08-21 02:23:09 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    以前说过“与时俱进,使用Git”,在自己的本本上,已经Ubuntu好久了,Git也是有的非常好,但是有的时候在其他机器上,是个weindows,需要使用Git的时候,就只能找找有没有wein版本的git客户端了。
    \n找到一个msysgit ,按照里面的说明下载安装就OK了,下面看看如何使用:
    \n-----------------使用---------------
    \n好,下面来个简单教程.标准的 git 教程是行不通的(要加些东西),因为这是windows.主要是没有用户信息.好我的git安装在 c:\\git 以下为命令行.
    \n
    \n1.创建git的数据库
    \nC:\\Git\\bin>git init-db

    \n\n

    2.生成一个文件xxx并加入到git中
    \nC:\\Git\\bin>echo hello > xxx
    \nC:\\Git\\bin>git add xxx

    \n\n

    3.提交[以上两步与标准教程还是一样的,关键是这一步]
    \nC:\\Git\\bin>set home=c:\\
    \nC:\\Git\\bin>git config --global user.name "clq"
    \nC:\\Git\\bin>git commit -m "test"

    \n\n

    一共三个命令,其中第1个是设置用户路径,第2个是设置用户名.而且是每次打开dos命令行后都要有这两个命令,当然你可以写成 bat 文件.第3个才是提交,不能直接写 git commit 因为这个版本好象一定要有注释,那个 "test" 就是我加的注释了.

    \n\n

    4.改一下xxx文件
    \necho world >> xxx

    \n\n

    5.查看一下它和我们原来对比的有什么不同
    \nC:\\Git\\bin>git diff

    \n\n

    结果如下
    \ndiff --git a/xxx b/xxx
    \nindex 907cd4b..360c7f4 100644
    \n--- a/xxx
    \n+++ b/xxx
    \n@@ -1 +1,2 @@
    \nhello
    \n+world
    \n(END)

    \n\n

    用过cvs的都明白了吧.另外这个显示的还得退出,退出命令和vi一样
    \n提交可以用一个命令来完成
    \ngit commit -m "" -a xxx

    \n\n

    省去git add

    \n\n

    C:\\Git\\bin>git show xxx
    \n查看最近一次提交的信息.

    \n\n

    C:\\Git\\bin>git commit -a -m"aa"

    \n\n

    提交全部更改过的文件.

    \n", "_id"=>361}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"《The Rails Way》召集railser协作翻译", "body"=>"\"\"\r\n\r\n引用YiTan帖子:\r\n
    The Rails Way是一本数一数二的Rails书籍,系统并全面地介绍Rails的使用和开发。也是那位写了 Mongrel,后来又暴走的Zed大牛唯一推荐的一本Rails书。
    \r\nLibin说:\r\n
    Obie 是我非常敬重的 Rubyist , The Rails Way 也是我最爱的 Ruby 书之一。
    \r\n最近将由人邮出版社引进。书比较厚,900+页 共22章。我们想找几个有兴趣参与的朋友,每人领取几章,共同翻译。\r\n\r\n目前已经有5个人(我,YiTan、陈恺、Libin、xue.yudi等)参与了,有时间,有兴趣的Railser,赶快确认。我这里有PDF版本,想了解内容的可以在Gtalk上找我要。报名后,YiTan会把相关说明和规范发给大家。\r\n\r\nPS:\r\n有稿费,但是偶个人比较看重的是翻译使我更仔细的去阅读和体会原文的意思,会收获更多。", "created_at"=>2008-08-21 03:05:20 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    引用YiTan帖子:
    \nThe Rails Way是一本数一数二的Rails书籍,系统并全面地介绍Rails的使用和开发。也是那位写了 Mongrel,后来又暴走的Zed大牛唯一推荐的一本Rails书。
    \nLibin说:
    \nObie 是我非常敬重的 Rubyist , The Rails Way 也是我最爱的 Ruby 书之一。
    \n最近将由人邮出版社引进。书比较厚,900+页 共22章。我们想找几个有兴趣参与的朋友,每人领取几章,共同翻译。

    \n\n

    目前已经有5个人(我,YiTan、陈恺、Libin、xue.yudi等)参与了,有时间,有兴趣的Railser,赶快确认。我这里有PDF版本,想了解内容的可以在Gtalk上找我要。报名后,YiTan会把相关说明和规范发给大家。

    \n\n

    PS:
    \n有稿费,但是偶个人比较看重的是翻译使我更仔细的去阅读和体会原文的意思,会收获更多。

    \n", "_id"=>362}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"cssh/DSH:ssh之cluster 管理工具", "body"=>"由于系统用到了很多的服务器,大致分成下面几组:\r\n
      \r\n\t
    • A组是做web服务器;
    • \r\n\t
    • B组是App服务器;
    • \r\n\t
    • C组是DB服务器;
    • \r\n
    \r\n每组服务器都有多台,APP服务器最多,有10多台,DB有5台,每次升级或者查询系统状况都是逐个的SSH登录,比较麻烦,一直在找一个可以按组管理多台服务器脚本或者客户端。\r\n在linuxtoy上看到对dshcssh的介绍,正好满足我的需求,记录一下。\r\n1、cssh:cluster 管理工具 (ssh)\r\n2、dsh:分布式 shell\r\n需要了解的,按照上面的链接了解。", "created_at"=>2008-08-21 06:24:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    由于系统用到了很多的服务器,大致分成下面几组:
    \n
    \n A组是做web服务器;
    \n B组是App服务器;
    \n C组是DB服务器;
    \n
    \n每组服务器都有多台,APP服务器最多,有10多台,DB有5台,每次升级或者查询系统状况都是逐个的SSH登录,比较麻烦,一直在找一个可以按组管理多台服务器脚本或者客户端。
    \n在linuxtoy上看到对dsh和cssh的介绍,正好满足我的需求,记录一下。
    \n1、cssh:cluster 管理工具 (ssh)
    \n2、dsh:分布式 shell
    \n需要了解的,按照上面的链接了解。

    \n", "_id"=>363}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用named_scope在Model中添加finder方法", "body"=>"在rubyfleebie上看到这篇文章,里面有个不错的技巧,在Rails 2.1中添加了named_scope特性,看下面这个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class Story < ActiveRecord::Base  
    2. \r\n\t
    3.   named_scope :hilarious:conditions => [\"type = ?\",\"comedy\"]  
    4. \r\n\t
    5.   named_scope :popular:conditions => [\"popularity_level > ?\", 3]  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n使用方法如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. funny_stories = @all_stories.hilarious  
    2. \r\n\t
    3. funny_and_popular = @all_stories.hilarious.popular  
    4. \r\n
    \r\n
    \r\n很好很强大。", "created_at"=>2008-08-21 16:33:42 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    在rubyfleebie上看到这篇文章,里面有个不错的技巧,在Rails 2.1中添加了named_scope特性,看下面这个例子:
    \n
    \nRuby代码
    \n
    \n class Story < ActiveRecord::Base  
    \n   named_scope :hilarious, :conditions => ["type = ?","comedy"]  
    \n   named_scope :popular, :conditions => ["popularity_level > ?", 3]  
    \n end  
    \n
    \n
    \n使用方法如下:
    \n
    \nRuby代码
    \n
    \n funny_stories = @all_stories.hilarious  
    \n funny_and_popular = @all_stories.hilarious.popular  
    \n
    \n
    \n很好很强大。

    \n", "_id"=>364}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby再曝REXML库的DOS漏洞", "body"=>"大家应该都还记得,前不久《Ruby暴出大量严重漏洞!》,当时我说“ruby走向成熟,离不开这样的检验。”,时间过去不久,又发现其REXML库存在漏洞,被利用的话可以导致DOS攻击。\r\n\r\n详细介绍在“DoS vulnerability in REXML”,中文翻译在“Ruby的REXML库缺陷将导致DOS攻击”。\r\n\r\n值得注意的是,Ruby的所有版本都存在这个问题,需要修复的安全前面文章中的方法啊修复;凡是在Rails中解析到XML用到REXML的都存在这个问题,但是个人认为使用REXML来解析XML的并不算很多,其速度不够快。很多人用的是hpricot。\r\n\r\n漏洞并不可怕,可怕的是被藏着掖着,期待Ruby的日趋成熟和完善。", "created_at"=>2008-08-25 01:24:50 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    大家应该都还记得,前不久《Ruby暴出大量严重漏洞!》,当时我说“ruby走向成熟,离不开这样的检验。”,时间过去不久,又发现其REXML库存在漏洞,被利用的话可以导致DOS攻击。

    \n\n

    详细介绍在“DoS vulnerability in REXML”,中文翻译在“Ruby的REXML库缺陷将导致DOS攻击”。

    \n\n

    值得注意的是,Ruby的所有版本都存在这个问题,需要修复的安全前面文章中的方法啊修复;凡是在Rails中解析到XML用到REXML的都存在这个问题,但是个人认为使用REXML来解析XML的并不算很多,其速度不够快。很多人用的是hpricot。

    \n\n

    漏洞并不可怕,可怕的是被藏着掖着,期待Ruby的日趋成熟和完善。

    \n", "_id"=>365}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决/var空间不足导致的无法登录问题", "body"=>"现象描述
    \r\n项目中有台服务器,其操作系统为RHEL 3 ,主要用途是实验室环境以及和第三方系统的FTP服务器,最近出现经常出现“假死”的情况,具体表现是Ping的通,但是ssh、ftp、telnet等都无法登陆,从lan console上看服务器运行正常。每次都是远程重启暂时解决问题。
    \r\n
    \r\n深入分析

    \r\n今天,另外一个负责主机维护的同事发现其/var/log/messages.x中有如下信息:
    \r\n
    \r\n
    Jul 30 17:36:15 www login(pam_unix)[11819]: session opened for user siteview by (uid=0)
    \r\nJul 30 17:36:15 www  -- siteview[11819]: LOGIN ON pts/0 BY siteview FROM 192.168.168.42
    \r\nJul 30 17:36:15 www login(pam_unix)[11819]: session closed for user siteview
    \r\nJul 30 17:47:17 www syslogd: /var/log/secure: No space left on device
    \r\nJul 30 19:11:58 www PAM-securetty[1611]: Couldn't open /etc/securetty
    \r\n 经过查找发现其原因是内核中开启的审核子系统LauS (Linux Auditing System)写的日志太多,把/var空间占了,再次登陆的时候,由于无法写日志导致挂在那里,出现假死现象。
    \r\n
    \r\n解决方法:
    \r\n定位到问题以后,就可以想办法解决了,目前可行的办法由四种,分别如下:
    \r\n1、定期手工删除/var/log/audit.d下的日志文件\r\n
    #删除7天前的
    \r\nfind ./ -mtime +7 -type f -exec rm {} \\;
    \r\n2、配置crob自动删除或者备份\r\n
    SEVEN_DAYS_OLD=`/usr/locale/ebin/date '+%d' --date '7 days ago'`
    \r\nif [ -f /var/log/audit/bin/bin.${SEVEN_DAYS_OLD} ]
    \r\nthen
    \r\nrm /var/log/audit/bin.${SEVEN_DAYS_OLD}
    \r\nfi
    \r\n
    \r\n3、修改/etc/audit/audit.conf配置文件
    \r\n可以通过修改audit.conf来配置,让其自动处理
    \r\n1)修改为自动删除的
    \r\n
    notify = \"/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'rm -f %f'\";
    \r\n[The notify line as above should (according to the docs) remove old 'save' files when the filesystem comes within 20% of full (change the figure after -T to specify how close to full you want to start deleting old files).]
    \r\n
    \r\n
    2)修改为自动备份的:(/backup 是另外您想保存数据的分区)\r\n
    notify = \"/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'mv %f /backup'\";
    \r\n
    \r\n4、
    禁用audtid服务
    \r\n如 果您不需要审核信息,禁用audtid服务 (\"chkconfig --del auditd\"),系统性能会有所提高. 如果想要彻底禁用内核中的audit,可以删除 /dev/audit文件,重新启动。以后可以通过在grub.conf 里kernel行最后加入audit=1来启用。
    \r\n
    \r\n
    \r\n
    \r\n参考文档 :\r\n
      \r\n\t
    • lAus相关: http://blog.chinaunix.net/u/6303/showart_275806.html
    • \r\n\t
    • console login hangs RHEL 3:http://www.linuxquestions.org/questions/linux-general-1/console-login-hangs-rhel-3-348072/
    • \r\n\t
    • Linux Console Hangs:http://www.usenet-forums.com/linux-networking/68241-linux-console-hangs-2.html
    • \r\n\t
    • /目录空间不足,清理/var/log/audit.d:http://blog.zhangjianfeng.com/article/386
    • \r\n
    ", "created_at"=>2008-08-26 03:37:04 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    现象描述
    \n项目中有台服务器,其操作系统为RHEL 3 ,主要用途是实验室环境以及和第三方系统的FTP服务器,最近出现经常出现“假死”的情况,具体表现是Ping的通,但是ssh、ftp、telnet等都无法登陆,从lan console上看服务器运行正常。每次都是远程重启暂时解决问题。
    \n
    \n深入分析
    \n今天,另外一个负责主机维护的同事发现其/var/log/messages.x中有如下信息:
    \n
    \nJul 30 17:36:15 www login(pam_unix)[11819]: session opened for user siteview by (uid=0)
    \nJul 30 17:36:15 www  -- siteview[11819]: LOGIN ON pts/0 BY siteview FROM 192.168.168.42
    \nJul 30 17:36:15 www login(pam_unix)[11819]: session closed for user siteview
    \nJul 30 17:47:17 www syslogd: /var/log/secure: No space left on device
    \nJul 30 19:11:58 www PAM-securetty[1611]: Couldn't open /etc/securetty
    \n 经过查找发现其原因是内核中开启的审核子系统LauS (Linux Auditing System)写的日志太多,把/var空间占了,再次登陆的时候,由于无法写日志导致挂在那里,出现假死现象。
    \n
    \n解决方法:
    \n定位到问题以后,就可以想办法解决了,目前可行的办法由四种,分别如下:
    \n1、定期手工删除/var/log/audit.d下的日志文件
    \n#删除7天前的
    \nfind ./ -mtime +7 -type f -exec rm {} \\;
    \n2、配置crob自动删除或者备份
    \nSEVEN_DAYS_OLD=/usr/locale/ebin/date '+%d' --date '7 days ago'
    \nif [ -f /var/log/audit/bin/bin.${SEVEN_DAYS_OLD} ]
    \nthen
    \nrm /var/log/audit/bin.${SEVEN_DAYS_OLD}
    \nfi
    \n
    \n3、修改/etc/audit/audit.conf配置文件
    \n可以通过修改audit.conf来配置,让其自动处理
    \n1)修改为自动删除的:
    \nnotify = "/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'rm -f %f'";
    \n[The notify line as above should (according to the docs) remove old 'save' files when the filesystem comes within 20% of full (change the figure after -T to specify how close to full you want to start deleting old files).]
    \n
    \n2)修改为自动备份的:(/backup 是另外您想保存数据的分区)
    \nnotify = "/usr/sbin/audbin -S /var/log/audit.d/save.%u -C -T 20% -N 'mv %f /backup'";
    \n
    \n4、禁用audtid服务
    \n如 果您不需要审核信息,禁用audtid服务 ("chkconfig --del auditd"),系统性能会有所提高. 如果想要彻底禁用内核中的audit,可以删除 /dev/audit文件,重新启动。以后可以通过在grub.conf 里kernel行最后加入audit=1来启用。
    \n
    \n
    \n
    \n参考文档 :
    \n
    \n lAus相关: http://blog.chinaunix.net/u/6303/showart_275806.html
    \n console login hangs RHEL 3:http://www.linuxquestions.org/questions/linux-general-1/console-login-hangs-rhel-3-348072/
    \n Linux Console Hangs:http://www.usenet-forums.com/linux-networking/68241-linux-console-hangs-2.html
    \n /目录空间不足,清理/var/log/audit.d:http://blog.zhangjianfeng.com/article/386

    \n", "_id"=>366}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"God: 比Monit更好用的monitoring", "body"=>"God是一个使用Ruby写成的用于监视任务运行状态的可扩展框架,它的配置脚本采用Ruby来编写。因此,比起它的前辈Monit,God更为简单,灵活且易于扩展(尤其对于Ruby使用者),你可以很轻易的添加一些自定义规则。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. MINIONS = [  
    2. \r\n\t
    3.   { :rails_root => \"/home/mycoolapp/staging/current\",  
    4. \r\n\t
    5.     :mongrel_ports => [4001,4002,4003,4004,4005],  
    6. \r\n\t
    7.     :uid => 'mycoolapp',  
    8. \r\n\t
    9.     :gid => 'mycoolapp',  
    10. \r\n\t
    11.     :pid_path => '/home/mycoolapp/staging/shared/tmp/pids' }  
    12. \r\n\t
    13. ]  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. MINIONS.each do |minion|  
    18. \r\n\t
    19.   minion[:mongrel_ports].each do |port|  
    20. \r\n\t
    21.     God.watch do |w|  
    22. \r\n\t
    23.       w.name = \"mongrel-\#{port}\"  
    24. \r\n\t
    25.       w.uid = minion[:uid]  
    26. \r\n\t
    27.       w.gid = minion[:gid]  
    28. \r\n\t
    29.       w.interval = 30.seconds # default        
    30. \r\n\t
    31.       w.start = \"mongrel_rails start -c \#{minion[:rails_root]} -p \#{port} \\ 
    32. \r\n\t
    33.         -P \#{minion[:pid_path]}/mongrel.\#{port}.pid -e production -d\"  
    34. \r\n\t
    35.       w.stop = \"mongrel_rails stop -P \#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    36. \r\n\t
    37.       w.restart = \"mongrel_rails restart -P \#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    38. \r\n\t
    39.       w.start_grace = 10.seconds  
    40. \r\n\t
    41.       w.restart_grace = 10.seconds  
    42. \r\n\t
    43.       w.pid_file = \"\#{minion[:pid_path]}/mongrel.\#{port}.pid\"  
    44. \r\n\t
    45.       
    46. \r\n\t
    47.       w.behavior(:clean_pid_file)  
    48. \r\n\t
    49.   
    50. \r\n\t
    51.       w.start_if do |start|  
    52. \r\n\t
    53.         start.condition(:process_runningdo |c|  
    54. \r\n\t
    55.           c.interval = 5.seconds  
    56. \r\n\t
    57.           c.running = false  
    58. \r\n\t
    59.         end  
    60. \r\n\t
    61.       end  
    62. \r\n\t
    63.       
    64. \r\n\t
    65.       w.restart_if do |restart|  
    66. \r\n\t
    67.         restart.condition(:memory_usagedo |c|  
    68. \r\n\t
    69.           c.above = 150.megabytes  
    70. \r\n\t
    71.           c.times = [3, 5] # 3 out of 5 intervals  
    72. \r\n\t
    73.         end  
    74. \r\n\t
    75.       
    76. \r\n\t
    77.         restart.condition(:cpu_usagedo |c|  
    78. \r\n\t
    79.           c.above = 50.percent  
    80. \r\n\t
    81.           c.times = 5  
    82. \r\n\t
    83.         end  
    84. \r\n\t
    85.       end  
    86. \r\n\t
    87.       
    88. \r\n\t
    89.       # lifecycle  
    90. \r\n\t
    91.       w.lifecycle do |on|  
    92. \r\n\t
    93.         on.condition(:flappingdo |c|  
    94. \r\n\t
    95.           c.to_state = [:start:restart]  
    96. \r\n\t
    97.           c.times = 5  
    98. \r\n\t
    99.           c.within = 5.minute  
    100. \r\n\t
    101.           c.transition = :unmonitored  
    102. \r\n\t
    103.           c.retry_in = 10.minutes  
    104. \r\n\t
    105.           c.retry_times = 5  
    106. \r\n\t
    107.           c.retry_within = 2.hours  
    108. \r\n\t
    109.         end  
    110. \r\n\t
    111.       end  
    112. \r\n\t
    113.     end  
    114. \r\n\t
    115.   end  
    116. \r\n\t
    117. end  
    118. \r\n
    \r\n
    \r\n要了解更多资料,请参考如下文档:\r\nhttp://god.rubyforge.org/\r\nhttp://ihower.idv.tw/blog/archives/1762\r\nhttp://ezinearticles.com/?Why-Rails-Developers-Need-God&id=845672\r\nhttp://www.letrails.cn/archives/46", "created_at"=>2008-08-26 07:50:47 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    God是一个使用Ruby写成的用于监视任务运行状态的可扩展框架,它的配置脚本采用Ruby来编写。因此,比起它的前辈Monit,God更为简单,灵活且易于扩展(尤其对于Ruby使用者),你可以很轻易的添加一些自定义规则。
    \n
    \nRuby代码
    \n
    \n MINIONS = [  
    \n   { :rails_root => "/home/mycoolapp/staging/current",  
    \n     :mongrel_ports => [4001,4002,4003,4004,4005],  
    \n     :uid => 'mycoolapp',  
    \n     :gid => 'mycoolapp',  
    \n     :pid_path => '/home/mycoolapp/staging/shared/tmp/pids' }  
    \n ]  
    \n   
    \n MINIONS.each do |minion|  
    \n   minion[:mongrel_ports].each do |port|  
    \n     God.watch do |w|  
    \n       w.name = "mongrel-\#{port}"  
    \n       w.uid = minion[:uid]  
    \n       w.gid = minion[:gid]  
    \n       w.interval = 30.seconds # default        
    \n       w.start = "mongrel_rails start -c \#{minion[:rails_root]} -p \#{port} </span> 
    \n         -P \#{minion[:pid_path]}/mongrel.\#{port}.pid -e production -d"  
    \n       w.stop = "mongrel_rails stop -P \#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       w.restart = "mongrel_rails restart -P \#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       w.start_grace = 10.seconds  
    \n       w.restart_grace = 10.seconds  
    \n       w.pid_file = "\#{minion[:pid_path]}/mongrel.\#{port}.pid"  
    \n       
    \n       w.behavior(:clean_pid_file)  
    \n   
    \n       w.start_if do |start|  
    \n         start.condition(:process_running) do |c|  
    \n           c.interval = 5.seconds  
    \n           c.running = false  
    \n         end  
    \n       end  
    \n       
    \n       w.restart_if do |restart|  
    \n         restart.condition(:memory_usage) do |c|  
    \n           c.above = 150.megabytes  
    \n           c.times = [3, 5] # 3 out of 5 intervals  
    \n         end  
    \n       
    \n         restart.condition(:cpu_usage) do |c|  
    \n           c.above = 50.percent  
    \n           c.times = 5  
    \n         end  
    \n       end  
    \n       
    \n       # lifecycle  
    \n       w.lifecycle do |on|  
    \n         on.condition(:flapping) do |c|  
    \n           c.to_state = [:start, :restart]  
    \n           c.times = 5  
    \n           c.within = 5.minute  
    \n           c.transition = :unmonitored  
    \n           c.retry_in = 10.minutes  
    \n           c.retry_times = 5  
    \n           c.retry_within = 2.hours  
    \n         end  
    \n       end  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n要了解更多资料,请参考如下文档:
    \nhttp://god.rubyforge.org/
    \nhttp://ihower.idv.tw/blog/archives/1762
    \nhttp://ezinearticles.com/?Why-Rails-Developers-Need-God&id=845672;
    \nhttp://www.letrails.cn/archives/46

    \n", "_id"=>367}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL存储引擎选择和比较", "body"=>"大家都知道MYSQL有很多的存储引擎机制,有人曾说过“多个引擎说明这是MYSQL的软肋,它不能像oracle那样搞出一个通用的”,这句话的具体意思自己揣摩,我就不瞎解读了。\r\n\r\n今天看到一篇文章,是关于其存储引擎的,虽然不长,但是写的很不错,里面有些tips值得学习,不再翻译,其原文地址为《MySQL Storage Engines》。\r\n\r\n\"\"\r\n\r\nTip: A well designed MySQL-powered application will use different storage engines for different tables. If you're still stuck with all MyISAM tables, now may be a good time to revisit.", "created_at"=>2008-08-27 06:36:06 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    大家都知道MYSQL有很多的存储引擎机制,有人曾说过“多个引擎说明这是MYSQL的软肋,它不能像oracle那样搞出一个通用的”,这句话的具体意思自己揣摩,我就不瞎解读了。

    \n\n

    今天看到一篇文章,是关于其存储引擎的,虽然不长,但是写的很不错,里面有些tips值得学习,不再翻译,其原文地址为《MySQL Storage Engines》。

    \n\n\n

    Tip: A well designed MySQL-powered application will use different storage engines for different tables. If you're still stuck with all MyISAM tables, now may be a good time to revisit.

    \n", "_id"=>368}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"基于CookieStore的session存储机制的安全话题", "body"=>"最近在看一本《The Rails way》的书,其中关于session存贮机制一章中,对基于CookieStore的session存储机制持否定态度,认为其存在被破解和Replay attack的可能。就我了解的信息来看,这个观点是不妥的。\r\n最详细的一篇文章是写的laigongli写的这篇“Rails 2.0, cookie session store and security”,文章比较长,说的很详细,感兴趣的可以过去看看。其中主要观点为:\r\n
      \r\n\t
    1. The problems with PStore are significant enough to warrant a replacement default implementation.
    2. \r\n\t
    3. It’s a bad idea anyway to store sensitive information (like passwords) in the session. It doesn’t matter whether the session data can be seen by the client or not, it’s something nobody should ever do.
    4. \r\n\t
    5. Forging session data is only possible if cracking the secret is feasible.
    6. \r\n
    \r\n文中,其针对Rails的采用CookieStore机制时,其针对“449fe2e7daee471bffae2fd8dc02313d”这样一个密码是,按照其机型:\r\n“My machine, an Intel Core 2 Duo T5300, can try 285840.1 passwords per second with 2 threads.”\r\n破解下来需要的时间是:\r\n``16^32/2 / 285840.1= 5.952*10^32 seconds= 1.886*10^25 years```\r\n这是个什么概念?\r\n\r\n但是其也提到了由于Rails采用的 Ruby’s CGI::Session的session Id生成器中存在一个缺陷,导致其算法是可以被破解的,不过“Update November 28: The key generation security problem has been fixed.”已经修复了。所以,我也认为基于CookieStore的session存储机制是安全可靠的。\r\n\r\n参考:\r\n", "created_at"=>2008-08-28 02:42:18 UTC, "updated_at"=>2012-06-24 15:53:13 UTC, "body_html"=>"

    最近在看一本《The Rails way》的书,其中关于session存贮机制一章中,对基于CookieStore的session存储机制持否定态度,认为其存在被破解和Replay attack的可能。就我了解的信息来看,这个观点是不妥的。
    \n最详细的一篇文章是写的laigongli写的这篇“Rails 2.0, cookie session store and security”,文章比较长,说的很详细,感兴趣的可以过去看看。其中主要观点为:
    \n
    \n The problems with PStore are significant enough to warrant a replacement default implementation.
    \n It’s a bad idea anyway to store sensitive information (like passwords) in the session. It doesn’t matter whether the session data can be seen by the client or not, it’s something nobody should ever do.
    \n Forging session data is only possible if cracking the secret is feasible.
    \n
    \n文中,其针对Rails的采用CookieStore机制时,其针对“449fe2e7daee471bffae2fd8dc02313d”这样一个密码是,按照其机型:
    \n“My machine, an Intel Core 2 Duo T5300, can try 285840.1 passwords per second with 2 threads.”
    \n破解下来需要的时间是:
    \n16^32/2 / 285840.1= 5.952*10^32 seconds= 1.886*10^25 years`
    \n这是个什么概念?

    \n\n

    但是其也提到了由于Rails采用的 Ruby’s CGI::Session的session Id生成器中存在一个缺陷,导致其算法是可以被破解的,不过“Update November 28: The key generation security problem has been fixed.”已经修复了。所以,我也认为基于CookieStore的session存储机制是安全可靠的。

    \n\n

    参考:
    \n
    \n Rails 2.0, cookie session store and security
    \n BustRailsCookie.rb

    \n", "_id"=>369}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Thin: A fast and very simple Ruby web server", "body"=>"知道Thin这个东西很久了,记忆中的还是下面这张和mongrel的性能比较图片,但是一直没深入进去了解其到底如何。\r\n\"\"\r\n从图上可以看到,除了总体性能好于mongrel以外,最大的区别在于其在100个并发的时候还能保证高性能,而100个并发的时候mongrel的性能非常差(且消耗很多的资源,经常由此导致请求无法处理,而出现503)。\r\n今天花了点时间,把Thin从头到尾的看了一遍,然后连到一个服务器上试验了下,总体感觉如下:\r\n
      \r\n\t
    • 安装方便,和mongrel差不多,一条命令就搞定;如果你需要还可以install到init下;
    • \r\n\t
    • 使用方便,嫌麻烦的直接thin start就OK了;
    • \r\n\t
    • 配置丰富,提供了很多可以配置的东西,比如max-conns,max-persistent-conns等;
    • \r\n\t
    • 可以集群,也非常方便,指定开始端口和实例的个数;
    • \r\n\t
    • 支持写配置文件,配置文件可以修改,重载。
    • \r\n\t
    • 支持做backend,前置nginx,配置和mongrel差不多。
    • \r\n\t
    • 可以走UNIX domain sockets;
    • \r\n\t
    • 节省资源,提供性能
    • \r\n
    \r\n使用过程大概如下,详细的参考资料:\r\n1、安装\r\nsudo gem install thin\r\n2、启动测试\r\ncd to/your/rails/app\r\nthin start\r\n3、配置集群\r\nthin config -C 1sters.yml -s2 -p 7000\r\n4、启动\r\nthin start -C 1sters.yml\r\n\r\n参考资料:\r\n
      \r\n\t
    • http://code.macournoyer.com/thin/
    • \r\n\t
    • http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin
    • \r\n\t
    • http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby
    • \r\n
    ", "created_at"=>2008-08-28 08:21:34 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    知道Thin这个东西很久了,记忆中的还是下面这张和mongrel的性能比较图片,但是一直没深入进去了解其到底如何。
    \n
    \n从图上可以看到,除了总体性能好于mongrel以外,最大的区别在于其在100个并发的时候还能保证高性能,而100个并发的时候mongrel的性能非常差(且消耗很多的资源,经常由此导致请求无法处理,而出现503)。
    \n今天花了点时间,把Thin从头到尾的看了一遍,然后连到一个服务器上试验了下,总体感觉如下:
    \n
    \n 安装方便,和mongrel差不多,一条命令就搞定;如果你需要还可以install到init下;
    \n 使用方便,嫌麻烦的直接thin start就OK了;
    \n 配置丰富,提供了很多可以配置的东西,比如max-conns,max-persistent-conns等;
    \n 可以集群,也非常方便,指定开始端口和实例的个数;
    \n 支持写配置文件,配置文件可以修改,重载。
    \n 支持做backend,前置nginx,配置和mongrel差不多。
    \n 可以走UNIX domain sockets;
    \n 节省资源,提供性能
    \n
    \n使用过程大概如下,详细的参考资料:
    \n1、安装
    \nsudo gem install thin
    \n2、启动测试
    \ncd to/your/rails/app
    \nthin start
    \n3、配置集群
    \nthin config -C 1sters.yml -s2 -p 7000
    \n4、启动
    \nthin start -C 1sters.yml

    \n\n

    参考资料:
    \n
    \n http://code.macournoyer.com/thin/
    \n http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin
    \n http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby

    \n", "_id"=>370}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Merb处理Rails中大文件上传难题", "body"=>"做Rails的应该知道,在Rails中处理大文件上传是很头疼的事情,比如你允许用户上传图片,那么其有的时候分辨率高的文件有1-2M的大小,这个时候rails的上传处理是很慢的,也不难理解,看段经典的上传代码:\r\n
    \r\n
    Rails代码
    \r\n
      \r\n\t
    1. def upload  
    2. \r\n\t
    3.   File.open(RAILS_ROOT+\"/uploads/\#{params[:file].original_filename}.\#{next_count}”, “w”) { |f| f.write(params[:file].read) }  
    4. \r\n\t
    5.   render :action => ‘index’  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n加上Rails是单线程的,这个时候处理大的IO非常慢,慢的后果是什么?拖死你的服务器,比如你使用mongrel,开了10个进程在跑,这个时候,用户上传一个文件要花2分钟,就会占着这个进程不放,导致其他的请求无法响应(好怀念weblogic的队列机制),所以你的系统抛给用户的可能就是503,504之类的错误。\r\n有人推荐,这个情况下可以使用merb,这东西也不会很陌生,从rails大红大紫后,其一直在后面追赶,其基本特性就是线程安全的,所以对一个请求可以多线程处理,会加快处理速度,看段类似处理上传的代码:\r\n
    \r\n
    Merb代码
    \r\n
      \r\n\t
    1. def upload  
    2. \r\n\t
    3.   FileUtils.mv params[:file][:tempfile].path, MERB_ROOT+”/uploads/\#{params[:file][:filename]}.\#{next_count}”  
    4. \r\n\t
    5.   render :action => ‘index’  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n详细的测试比较,请参考“File Uploads in Merb versus Rails”这里文章,其结论差不多是这样的“Merb’s average response time is 16 ms while Rails’s average is 205 ms (over 10x faster), yet the throughput is 3000 vs 2000 req/min (only 50% greater).”,针对其throughput提高不多的情况,merb的人给出的方案是add\":use_mutex: false\"in merb.yml,其原因说因为AR是非线程安全的才需要这个选项,设置成fasle后可以大大的提高性能。\r\n\r\n参考文章:\r\n", "created_at"=>2008-08-29 02:13:33 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    做Rails的应该知道,在Rails中处理大文件上传是很头疼的事情,比如你允许用户上传图片,那么其有的时候分辨率高的文件有1-2M的大小,这个时候rails的上传处理是很慢的,也不难理解,看段经典的上传代码:
    \n
    \nRails代码
    \n
    \n def upload  
    \n   File.open(RAILS_ROOT+"/uploads/\#{params[:file].original_filename}.\#{next_count}”, “w”) { |f| f.write(params[:file].read) }  
    \n   render :action => ‘index’  
    \n end  
    \n
    \n
    \n加上Rails是单线程的,这个时候处理大的IO非常慢,慢的后果是什么?拖死你的服务器,比如你使用mongrel,开了10个进程在跑,这个时候,用户上传一个文件要花2分钟,就会占着这个进程不放,导致其他的请求无法响应(好怀念weblogic的队列机制),所以你的系统抛给用户的可能就是503,504之类的错误。
    \n有人推荐,这个情况下可以使用merb,这东西也不会很陌生,从rails大红大紫后,其一直在后面追赶,其基本特性就是线程安全的,所以对一个请求可以多线程处理,会加快处理速度,看段类似处理上传的代码:
    \n
    \nMerb代码
    \n
    \n def upload  
    \n   FileUtils.mv params[:file][:tempfile].path, MERB_ROOT+”/uploads/\#{params[:file][:filename]}.\#{next_count}”  
    \n   render :action => ‘index’  
    \n end  
    \n
    \n
    \n详细的测试比较,请参考“File Uploads in Merb versus Rails”这里文章,其结论差不多是这样的“Merb’s average response time is 16 ms while Rails’s average is 205 ms (over 10x faster), yet the throughput is 3000 vs 2000 req/min (only 50% greater).”,针对其throughput提高不多的情况,merb的人给出的方案是add":use_mutex: false"in merb.yml,其原因说因为AR是非线程安全的才需要这个选项,设置成fasle后可以大大的提高性能。

    \n\n

    参考文章:
    \n
    \n File Uploads in Merb versus Rails
    \n [Mongrel] Uploading Large (100mb+) files
    \n Taking Merb for a Spin
    \n Uploading large files to Rails with Merb

    \n", "_id"=>371}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock: 非常值得期待的一组类库", "body"=>"\"\"\r\nNeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.\r\n\r\nRuby的伪线程,Rails的非线程安全性导致其性能始终上不去,前端时间发布的ruby1.9有多处修改,后面的Rails2.2也号称要做线程安全了,如果以上两个条件都满足,Rails的性能将得到大幅的提高。\r\n\r\n由于Rails的AR是非线程安全的,导致其IO性能不是很好,其Mysql驱动一直是单线,不能很好的提高性能,做个Oracle的应该很怀念Oracle,weblogic中的线程池,java5中的concurrent包用来写同步等处理非常方便和高效。\r\n\r\n很高兴看到Ruby世界也有类似的东西出现了,他就是NeverBlock,在其放出PostgreSQL的适配驱动后,近日有发布了针对MYSQL的版本,名字为mysqlplus,非常值得期待。\r\n\r\n另外,关于“同步、异步、阻塞和非阻塞的概念”,请参考其链接上的文章。\r\n\r\n参考文章:\r\n\r\nhttp://chinaonrails.com/topic/view/1974.html\r\n\r\nhttp://www.espace.com.eg/neverblock/blog/2008/08/28/neverblock-mysql-support/\r\n\r\nhttp://github.com/espace/mysqlplus/tree/master\r\n\r\nhttp://zhanjun.net/?q=node/7\r\n\r\n ", "created_at"=>2008-08-30 11:16:35 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    NeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.

    \n\n

    Ruby的伪线程,Rails的非线程安全性导致其性能始终上不去,前端时间发布的ruby1.9有多处修改,后面的Rails2.2也号称要做线程安全了,如果以上两个条件都满足,Rails的性能将得到大幅的提高。

    \n\n

    由于Rails的AR是非线程安全的,导致其IO性能不是很好,其Mysql驱动一直是单线,不能很好的提高性能,做个Oracle的应该很怀念Oracle,weblogic中的线程池,java5中的concurrent包用来写同步等处理非常方便和高效。

    \n\n

    很高兴看到Ruby世界也有类似的东西出现了,他就是NeverBlock,在其放出PostgreSQL的适配驱动后,近日有发布了针对MYSQL的版本,名字为mysqlplus,非常值得期待。

    \n\n

    另外,关于“同步、异步、阻塞和非阻塞的概念”,请参考其链接上的文章。

    \n\n

    参考文章:

    \n\n

    http://chinaonrails.com/topic/view/1974.html

    \n\n

    http://www.espace.com.eg/neverblock/blog/2008/08/28/neverblock-mysql-support/

    \n\n

    http://github.com/espace/mysqlplus/tree/master

    \n\n

    http://zhanjun.net/?q=node/7

    \n\n

     

    \n", "_id"=>372}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] 值得期待的internationalization", "body"=>"Rails2.2的脚步越来越近了,虽然Rails2.1才放出来没多久,不可否认的是Rails2.2的脚本也越来越近了,近期可以看到一些在Rails2.2中可能会包含的功能,值得期待和预先了解下。\r\n\r\n除了上次说到的Rails2.2中会实现线程安全外,今天在其weblog上看到,将包含另外一个很值得期待的功能:internationalization。\r\n\r\nRails2.2中将提供internationalization这个功能,有了这个功能,就可以更加方便的制作国际化的网站了,非常棒。以前我们都是使用插件的方式解决这个问题,可以选择的插件也挺多,各有优缺点,有的也有些bug,需要自己hack下,以后rails2.2中包含了i18n后,该有多方便呀。\r\n\r\nClemens Kofler’s已经做了个demo的演示,也提供了其代码,感兴趣的可以体检熟悉下。", "created_at"=>2008-08-30 17:10:00 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails2.2的脚步越来越近了,虽然Rails2.1才放出来没多久,不可否认的是Rails2.2的脚本也越来越近了,近期可以看到一些在Rails2.2中可能会包含的功能,值得期待和预先了解下。

    \n\n

    除了上次说到的Rails2.2中会实现线程安全外,今天在其weblog上看到,将包含另外一个很值得期待的功能:internationalization。

    \n\n

    Rails2.2中将提供internationalization这个功能,有了这个功能,就可以更加方便的制作国际化的网站了,非常棒。以前我们都是使用插件的方式解决这个问题,可以选择的插件也挺多,各有优缺点,有的也有些bug,需要自己hack下,以后rails2.2中包含了i18n后,该有多方便呀。

    \n\n

    Clemens Kofler’s已经做了个demo的演示,也提供了其代码,感兴趣的可以体检熟悉下。

    \n", "_id"=>373}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails2.2] Josh Peek,thread safety?", "body"=>"Rails上说有个叫做Josh Peek的家伙加入core,将带来thread safety,这无疑是个重磅炸弹,因为才Rails0.6到现在的Rails2.1都是非线程安全的,以至于其一些无法解决的问题,性能也一直被人诟病,其实也不能怪Rails,Ruby本身这个方面做的也不是很好。\r\n\r\n随着Ruby1.9的逐步推广,Rails2.2应该会对Ruby1.9广泛支持了吧,这个时候将会有很多新的东西加进来的吧,除了这里说的“线程安全”,还有前面说到的“国际化”,以及NeverBlock实现的一组同步组件包,其性能将会得到大幅的提高。\r\n\r\n另外,还有值得期待的就是Ruby的VM是否有改善?目前的GC还是问题大大的有,内存泄露也并不稀罕,希望有新的VM出来;另外,其Ruby的一些app服务器最近好像停止不前了,自从Zed A. Shaw闹脾气后,mongrel就很少有啥更新了,其maillist也冷冷清清的。thin还好,有些小的更新,这些server要针对Rails2.2和Ruby1.9做些大动作了。\r\n\r\nRuby的世界,前途无量。", "created_at"=>2008-08-30 17:29:28 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails上说有个叫做Josh Peek的家伙加入core,将带来thread safety,这无疑是个重磅炸弹,因为才Rails0.6到现在的Rails2.1都是非线程安全的,以至于其一些无法解决的问题,性能也一直被人诟病,其实也不能怪Rails,Ruby本身这个方面做的也不是很好。

    \n\n

    随着Ruby1.9的逐步推广,Rails2.2应该会对Ruby1.9广泛支持了吧,这个时候将会有很多新的东西加进来的吧,除了这里说的“线程安全”,还有前面说到的“国际化”,以及NeverBlock实现的一组同步组件包,其性能将会得到大幅的提高。

    \n\n

    另外,还有值得期待的就是Ruby的VM是否有改善?目前的GC还是问题大大的有,内存泄露也并不稀罕,希望有新的VM出来;另外,其Ruby的一些app服务器最近好像停止不前了,自从Zed A. Shaw闹脾气后,mongrel就很少有啥更新了,其maillist也冷冷清清的。thin还好,有些小的更新,这些server要针对Rails2.2和Ruby1.9做些大动作了。

    \n\n

    Ruby的世界,前途无量。

    \n", "_id"=>374}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Configatron&SimpleConfig: 在Rails中添加需要的配置", "body"=>"搞Java的人应该很习惯把一些配置(数据库连接、个性化配置等)写到配置文件中,一般会使用XML或者TXT文件中,在启动的时候读取配置,初始化等等。\r\nRails中也可以实现类似的功能,虽然Rails提倡“零配置”,但有的时候开发一个系统,比如Blog系统等还是需要一些个性化的配置,我们原来的实现方式是:增加一个配置文件,启动的时候读取,并保存为全局变量,用的时候直接使用。也很方便。\r\n其实还可以使用插件或者gem来做,Configatron就是这么一个gem,另外还有一个插件版的SimpleConfig,两者还是有些不同的,按照Configatron 作者的说法,其不同点在于:\r\n
    SimpleConfig looks nice, but it definitely has a few differences from Configatron. The first big difference is that SimpleConfig is limited to use with Rails. Configatron can be used with any framework, any application, and any script. Configatron also seems a bit easier to use. There are no mixins needed to use it. The configatron method lives in Kernel, which means it’s available everywhere, no ‘configuration’ needed. \":)\" Different strokes, eh? There are a few other configuration systems out there, I always encourage people to check out the options before they decide on a piece of software to use.
    \r\n其实我们自己也可以写,只是没有必要再搞一套,功能上来说,上述这两个足够了,下面简单的看看Configatron 的用法:\r\n1、安装\r\n$ sudo gem install configatron\r\n2、定义(支持namespace)\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron do |config|  
    2. \r\n\t
    3.   config.website_url = \"http://www.1sters.com\"  
    4. \r\n\t
    5.   config.namespace(:memsdo |mem|  
    6. \r\n\t
    7.     email.namespace(:iceskysldo |iceskysl|  
    8. \r\n\t
    9.       iceskysl.email = \"iceskysl@1sters.com\"  
    10. \r\n\t
    11.       pop.blog_url = \"http://iceskysl.1sters.com\"  
    12. \r\n\t
    13.       # etc ...  
    14. \r\n\t
    15.     end  
    16. \r\n\t
    17.     email.namespace(:shinedo |shine|  
    18. \r\n\t
    19.       smtp.email = \"shine@1sters.com\"  
    20. \r\n\t
    21.       smtp.blog_url = \"http://shine.1sters.com\"  
    22. \r\n\t
    23.       # etc ...  
    24. \r\n\t
    25.     end  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # etc...  
    30. \r\n\t
    31. end  
    32. \r\n
    \r\n
    \r\n3、使用\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron.mems.iceskysl.email # => \"iceskysl@1sters.com\"  
    2. \r\n\t
    3. configatron.mems.shine.blog_url # => \"http://shine.1sters.com\"  
    4. \r\n\t
    5. configatron.website_url # => \"http://www.1sters.com\"  
    6. \r\n
    \r\n
    \r\n4、重写\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. configatron do |config|  
    2. \r\n\t
    3.   config.website_url = \"http://www.1sters.com/index\"  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\nPS:\r\n如果你是在自己的Rails里使用,可能simpleconfig会更加适合你,请参考其链接上的Readme。\r\n\r\n参考文档:\r\nhttp://www.mackframework.com/2008/08/29/configatron-100-released/\r\nhttp://www.rubyinside.com/configatron-ruby-app-configuration-library-1130.html\r\nhttp://github.com/lukeredpath/simpleconfig/tree/master", "created_at"=>2008-08-31 03:45:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    搞Java的人应该很习惯把一些配置(数据库连接、个性化配置等)写到配置文件中,一般会使用XML或者TXT文件中,在启动的时候读取配置,初始化等等。
    \nRails中也可以实现类似的功能,虽然Rails提倡“零配置”,但有的时候开发一个系统,比如Blog系统等还是需要一些个性化的配置,我们原来的实现方式是:增加一个配置文件,启动的时候读取,并保存为全局变量,用的时候直接使用。也很方便。
    \n其实还可以使用插件或者gem来做,Configatron就是这么一个gem,另外还有一个插件版的SimpleConfig,两者还是有些不同的,按照Configatron 作者的说法,其不同点在于:
    \nSimpleConfig looks nice, but it definitely has a few differences from Configatron. The first big difference is that SimpleConfig is limited to use with Rails. Configatron can be used with any framework, any application, and any script. Configatron also seems a bit easier to use. There are no mixins needed to use it. The configatron method lives in Kernel, which means it’s available everywhere, no ‘configuration’ needed. Different strokes, eh? There are a few other configuration systems out there, I always encourage people to check out the options before they decide on a piece of software to use.
    \n其实我们自己也可以写,只是没有必要再搞一套,功能上来说,上述这两个足够了,下面简单的看看Configatron 的用法:
    \n1、安装
    \n$ sudo gem install configatron
    \n2、定义(支持namespace)
    \n
    \nRuby代码
    \n
    \n configatron do |config|  
    \n   config.website_url = "http://www.1sters.com"  
    \n   config.namespace(:mems) do |mem|  
    \n     email.namespace(:iceskysl) do |iceskysl|  
    \n       iceskysl.email = "iceskysl@1sters.com"  
    \n       pop.blog_url = "http://iceskysl.1sters.com"  
    \n       # etc ...  
    \n     end  
    \n     email.namespace(:shine) do |shine|  
    \n       smtp.email = "shine@1sters.com"  
    \n       smtp.blog_url = "http://shine.1sters.com"  
    \n       # etc ...  
    \n     end  
    \n   end  
    \n   # etc...  
    \n end  
    \n
    \n
    \n3、使用
    \n
    \nRuby代码
    \n
    \n configatron.mems.iceskysl.email # => "iceskysl@1sters.com"  
    \n configatron.mems.shine.blog_url # => "http://shine.1sters.com"  
    \n configatron.website_url # => "http://www.1sters.com"  
    \n
    \n
    \n4、重写
    \n
    \nRuby代码
    \n
    \n configatron do |config|  
    \n   config.website_url = "http://www.1sters.com/index"  
    \n end  
    \n
    \n
    \nPS:
    \n如果你是在自己的Rails里使用,可能simpleconfig会更加适合你,请参考其链接上的Readme。

    \n\n

    参考文档:
    \nhttp://www.mackframework.com/2008/08/29/configatron-100-released/
    \nhttp://www.rubyinside.com/configatron-ruby-app-configuration-library-1130.html
    \nhttp://github.com/lukeredpath/simpleconfig/tree/master

    \n", "_id"=>375}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]log4r&Logging: 替代Rails中logger的日志记录库", "body"=>"Rail本身自带的logger虽然好用,但是还是有点太简易了,针对一些特殊的业务需求(比如需要记录一些业务日志供后续的报表系统分析、解析等)就显得有点力不从心了。这个时候可以找找其他的替代品。\r\n1、log4r\r\n做java的应该对这样的名字相当熟悉,大名鼎鼎的log4j在java的世界里非常流行和实用,看这个log4r的名字就可以感受到其强大的功能。\r\n
    Log4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a hierarchical logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness, XML and YAML configuration, and more.
    \r\n但是截至到目前为止的其log4r-1.0.5版本中和Rails2的版本还存在一个冲突,详细的可以参考“Ticket #3512” (reopened defect)。\r\n
    ActionView::TemplateError (Expected kind of Outputter, got NilClass) c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in `each' c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in `add' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:30:in `benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:57:in `render_partial' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:230:in `render'
    \r\n但是其从March 2004开始到现在都没人有维护和更新,看来需要寻找新的解决方案了。\r\n2、Logging\r\nLogging is a flexible logging library for use in Ruby programs based on the design of Java‘s log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.\r\n关于Logging的详细API可以参考其doc文档,其详细的用法和注意事项,可以参考“HowtoConfigureLogging”,下面看个例子:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'logging'  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. logger = Logging::Logger['example_logger']  
    6. \r\n\t
    7. logger.add_appenders(  
    8. \r\n\t
    9.     Logging::Appender.stdout,  
    10. \r\n\t
    11.     Logging::Appenders::File.new('example.log')  
    12. \r\n\t
    13. )  
    14. \r\n\t
    15. logger.level = :info  
    16. \r\n\t
    17.   
    18. \r\n\t
    19. logger.debug \"this debug message will not be output by the logger\"  
    20. \r\n\t
    21. logger.info \"just some friendly advice\"  
    22. \r\n
    \r\n
    \r\n参考文章:\r\nhttp://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging\r\nhttp://logging.rubyforge.org/\r\nhttp://log4r.sourceforge.net/index.html\r\nhttp://007surfing.com/index.php?hl=f5&q=uggc%3A%2F%2Fapupenvyf.oybtfcbg.pbz%2F2007%2F04%2Fybt.ugzy", "created_at"=>2008-08-31 04:59:20 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rail本身自带的logger虽然好用,但是还是有点太简易了,针对一些特殊的业务需求(比如需要记录一些业务日志供后续的报表系统分析、解析等)就显得有点力不从心了。这个时候可以找找其他的替代品。
    \n1、log4r
    \n做java的应该对这样的名字相当熟悉,大名鼎鼎的log4j在java的世界里非常流行和实用,看这个log4r的名字就可以感受到其强大的功能。
    \nLog4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a hierarchical logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness, XML and YAML configuration, and more.
    \n但是截至到目前为止的其log4r-1.0.5版本中和Rails2的版本还存在一个冲突,详细的可以参考“Ticket #3512” (reopened defect)。
    \nActionView::TemplateError (Expected kind of Outputter, got NilClass) c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:in each' c:/ruby/lib/ruby/gems/1.8/gems/log4r-1.0.5/src/log4r/logger.rb:115:inadd' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:30:in benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:57:inrender_partial' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:230:in `render'
    \n但是其从March 2004开始到现在都没人有维护和更新,看来需要寻找新的解决方案了。
    \n2、Logging
    \nLogging is a flexible logging library for use in Ruby programs based on the design of Java‘s log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.
    \n关于Logging的详细API可以参考其doc文档,其详细的用法和注意事项,可以参考“HowtoConfigureLogging”,下面看个例子:
    \n
    \nRuby代码
    \n
    \n require 'logging'  
    \n   
    \n logger = Logging::Logger['example_logger']  
    \n logger.add_appenders(  
    \n     Logging::Appender.stdout,  
    \n     Logging::Appenders::File.new('example.log')  
    \n )  
    \n logger.level = :info  
    \n   
    \n logger.debug "this debug message will not be output by the logger"  
    \n logger.info "just some friendly advice"  
    \n
    \n
    \n参考文章:
    \nhttp://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging
    \nhttp://logging.rubyforge.org/
    \nhttp://log4r.sourceforge.net/index.html
    \nhttp://007surfing.com/index.php?hl=f5&q=uggc%3A%2F%2Fapupenvyf.oybtfcbg.pbz%2F2007%2F04%2Fybt.ugzy;

    \n", "_id"=>376}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Gem|plugin]Flash Message Conductor :在Rails中整合各类消息提示", "body"=>"Rails中特有的falsh消息提示机制非常好用,其三种消息(error,message,notice)针对不同的应用场景提示用户,非常方便。\r\n但是由于其三种消息提示的含义不一样,UI制作人员经常会使用不同的CSS来展示(比如error的就用红色,notice就用黄色等等),这样就存在一个问题,当在一个共用页面上需要展示几种可能的消息时,就不是很好处理,这个时候,对通用型的UI是个挑战。\r\n\r\n如果能把三种消息自动区分,使用各种的样式表,该多方便!确实,已经有人这么做了, Robby给出了一个plugin,“Flash Message Conductor”,看其介绍:\r\n``A simple pattern for managing flash messages in your Ruby on Rails application.\r\n\r\n1、安装script/plugin install git://github.com/planetargon/flash-message-conductor.git2、使用```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # Controller helpers  
    2. \r\n\t
    3. add_message( 'foo' )  
    4. \r\n\t
    5.   
    6. \r\n\t
    7. is the equivalent of  
    8. \r\n\t
    9. flash[:message] = 'foo'  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. Controller helpers included:  
    14. \r\n\t
    15. add_message( message )   
    16. \r\n\t
    17. add_notice( message )  
    18. \r\n\t
    19. add_error( message )  
    20. \r\n\t
    21.   
    22. \r\n\t
    23. # View helpers  
    24. \r\n\t
    25. <%= render_flash_messages %>  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. produces:  
    30. \r\n\t
    31. <div id=\"flash_messages\">  
    32. \r\n\t
    33.   <p class=\"message\">You have successfully done XYZ...</p>  
    34. \r\n\t
    35. </div>  
    36. \r\n\t
    37.   
    38. \r\n\t
    39. # or... if you set an error  
    40. \r\n\t
    41. <div id=\"flash_messages\">  
    42. \r\n\t
    43.   <p class=\"error\">Oops! Something went bonkers!</p>  
    44. \r\n\t
    45. </div>  
    46. \r\n
    \r\n
    \r\n``\r\n详细信息,参考上面给出的Github上的地址查看,谢谢!```", "created_at"=>2008-09-01 03:09:56 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails中特有的falsh消息提示机制非常好用,其三种消息(error,message,notice)针对不同的应用场景提示用户,非常方便。
    \n但是由于其三种消息提示的含义不一样,UI制作人员经常会使用不同的CSS来展示(比如error的就用红色,notice就用黄色等等),这样就存在一个问题,当在一个共用页面上需要展示几种可能的消息时,就不是很好处理,这个时候,对通用型的UI是个挑战。

    \n\n

    如果能把三种消息自动区分,使用各种的样式表,该多方便!确实,已经有人这么做了, Robby给出了一个plugin,“Flash Message Conductor”,看其介绍:
    \n``A simple pattern for managing flash messages in your Ruby on Rails application.

    \n\n

    1、安装script/plugin install git://github.com/planetargon/flash-message-conductor.git2、使用
    \n<div class="codeText">
    \n<div class="codeHead">Ruby代码</div>
    \n<ol class="dp-rb" start="1">
    \n <li class="alt"><span><span class="comment"># Controller helpers</span><span>  </span></span></li>
    \n <li><span>add_message( <span class="string">'foo'</span><span> )  </span></span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span>is the equivalent of  </span></li>
    \n <li class="alt"><span>flash[<span class="symbol">:message</span><span>] = </span><span class="string">'foo'</span><span>  </span></span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>Controller helpers included:  </span></li>
    \n <li><span>add_message( message )   </span></li>
    \n <li class="alt"><span>add_notice( message )  </span></li>
    \n <li><span>add_error( message )  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="comment"># View helpers</span><span>  </span></span></li>
    \n <li class="alt"><span>&lt;%= render_flash_messages %&gt;  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>produces:  </span></li>
    \n <li><span>&lt;div id=<span class="string">"flash_messages"</span><span>&gt;  </span></span></li>
    \n <li class="alt"><span>  &lt;p <span class="keyword">class</span><span>=</span><span class="string">"message"</span><span>&gt;You have successfully done XYZ...&lt;/p&gt;  </span></span></li>
    \n <li><span>&lt;/div&gt;  </span></li>
    \n <li class="alt"><span>  </span></li>
    \n <li><span><span class="comment"># or... if you set an error</span><span>  </span></span></li>
    \n <li class="alt"><span>&lt;div id=<span class="string">"flash_messages"</span><span>&gt;  </span></span></li>
    \n <li><span>  &lt;p <span class="keyword">class</span><span>=</span><span class="string">"error"</span><span>&gt;Oops! Something went bonkers!&lt;/p&gt;  </span></span></li>
    \n <li class="alt"><span>&lt;/div&gt;  </span></li>
    \n</ol>
    \n</div>
    \n``
    \n详细信息,参考上面给出的Github上的地址查看,谢谢!

    \n", "_id"=>377}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Google手机现身: 值得期待", "body"=>"今天在Donews上终于看到GooglePhone出现了,样式如下:\r\n\"\"\r\n\r\n在发售时间上,这款采用Android系统的HTC Dream手机将于9月17日面向T-Mobile用户进行预售,而手机型号则会被命名为G1,并提供白色、棕色和黑色等三种色彩款式选择,而正式面向其他地区的发售时间则在今年10月。\r\n\r\n说句实在话,我不是很喜欢iphone,虽然也试了下,但是我还是不是很喜欢,因为我生活中用到的Mac的东西太少了,与之相比,我认为在iphone和blackberry之间选择的话,我会选择BB,虽然我的第一款BB8100寿命不长,但是我非常喜欢,近期已经在联系入手一款升级版的BB8110。\r\n相比BB和iphone,我更加期待GooglePhone的上市,虽然Iphone在大陆上市一波三折,可能Gphone会吸取教训,更迅速的打开国内市场。\r\n为什么更加期待Google Phone,应该归于与生活中使用到Google的东西太多了,GoogleReader,GoogleDoc,Gmail,Google日历等等,都是必不可少的东西,若干Google手机上可以很好的把这些东西都整合进来,又能保证不会太笨重的话,我会买一部。\r\n期待赶快来吧,详细介绍请移步“iPhone也得低头 万众期待超炫Google手机现身”.", "created_at"=>2008-09-01 04:58:51 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    今天在Donews上终于看到GooglePhone出现了,样式如下:

    \n\n

    在发售时间上,这款采用Android系统的HTC Dream手机将于9月17日面向T-Mobile用户进行预售,而手机型号则会被命名为G1,并提供白色、棕色和黑色等三种色彩款式选择,而正式面向其他地区的发售时间则在今年10月。

    \n\n

    说句实在话,我不是很喜欢iphone,虽然也试了下,但是我还是不是很喜欢,因为我生活中用到的Mac的东西太少了,与之相比,我认为在iphone和blackberry之间选择的话,我会选择BB,虽然我的第一款BB8100寿命不长,但是我非常喜欢,近期已经在联系入手一款升级版的BB8110。
    \n相比BB和iphone,我更加期待GooglePhone的上市,虽然Iphone在大陆上市一波三折,可能Gphone会吸取教训,更迅速的打开国内市场。
    \n为什么更加期待Google Phone,应该归于与生活中使用到Google的东西太多了,GoogleReader,GoogleDoc,Gmail,Google日历等等,都是必不可少的东西,若干Google手机上可以很好的把这些东西都整合进来,又能保证不会太笨重的话,我会买一部。
    \n期待赶快来吧,详细介绍请移步“iPhone也得低头 万众期待超炫Google手机现身”.

    \n", "_id"=>378}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"开发Rails插件的方法和步骤", "body"=>"Rails丰富的插件真是强大,幻想着把各个功能都做出插件,以后开发系统就像搭积木一样堆积就好啦,呵呵。\r\n开发个Rails插件其实不难,或者说很简单,流程基本如下:\r\n1、生成骨架\r\n在Rails的script下有个generate,可以直接生成骨架,执行:\r\n# ruby script/generate plugin foo\r\n就会在$RAILS_ROOT/vendor/plugins下生成一个foo目录,如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. /1stlog$ruby script/generate plugin foo  
    2. \r\n\t
    3.       create  vendor/plugins/foo/lib  
    4. \r\n\t
    5.       create  vendor/plugins/foo/tasks  
    6. \r\n\t
    7.       create  vendor/plugins/foo/test  
    8. \r\n\t
    9.       create  vendor/plugins/foo/README  
    10. \r\n\t
    11.       create  vendor/plugins/foo/MIT-LICENSE  
    12. \r\n\t
    13.       create  vendor/plugins/foo/Rakefile  
    14. \r\n\t
    15.       create  vendor/plugins/foo/init.rb  
    16. \r\n\t
    17.       create  vendor/plugins/foo/install.rb  
    18. \r\n\t
    19.       create  vendor/plugins/foo/uninstall.rb  
    20. \r\n\t
    21.       create  vendor/plugins/foo/lib/foo.rb  
    22. \r\n\t
    23.       create  vendor/plugins/foo/tasks/foo_tasks.rake  
    24. \r\n\t
    25.       create  vendor/plugins/foo/test/foo_test.rb  
    26. \r\n
    \r\n
    \r\n2、编写相关代码\r\n在lib/foo.rb 下编写你的插件代码即可。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. module Foo  
    2. \r\n\t
    3.   def say_hello name  
    4. \r\n\t
    5.     \"hello \#{name}\"  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n3、混入到core中去\r\n在init.rb中编写混入代码即可。\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'foo'    
    2. \r\n\t
    3. ActionController::Base.send :include, Foo\r\n
    4. \r\n
    \r\n
    \r\n参考文档:\r\nhttp://blog.ericsk.org/archives/769\r\nhttp://blog.railschina.com/637/viewspace-236\r\nhttp://kyoleelqh.javaeye.com/blog/215090", "created_at"=>2008-09-01 08:56:56 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails丰富的插件真是强大,幻想着把各个功能都做出插件,以后开发系统就像搭积木一样堆积就好啦,呵呵。
    \n开发个Rails插件其实不难,或者说很简单,流程基本如下:
    \n1、生成骨架
    \n在Rails的script下有个generate,可以直接生成骨架,执行:

    \n\n

    ruby script/generate plugin foo

    \n\n

    就会在$RAILS_ROOT/vendor/plugins下生成一个foo目录,如下:
    \n
    \nRuby代码
    \n
    \n /1stlog$ruby script/generate plugin foo  
    \n       create  vendor/plugins/foo/lib  
    \n       create  vendor/plugins/foo/tasks  
    \n       create  vendor/plugins/foo/test  
    \n       create  vendor/plugins/foo/README  
    \n       create  vendor/plugins/foo/MIT-LICENSE  
    \n       create  vendor/plugins/foo/Rakefile  
    \n       create  vendor/plugins/foo/init.rb  
    \n       create  vendor/plugins/foo/install.rb  
    \n       create  vendor/plugins/foo/uninstall.rb  
    \n       create  vendor/plugins/foo/lib/foo.rb  
    \n       create  vendor/plugins/foo/tasks/foo_tasks.rake  
    \n       create  vendor/plugins/foo/test/foo_test.rb  
    \n
    \n
    \n2、编写相关代码
    \n在lib/foo.rb 下编写你的插件代码即可。
    \n
    \nRuby代码
    \n
    \n module Foo  
    \n   def say_hello name  
    \n     "hello \#{name}"  
    \n   end  
    \n end  
    \n
    \n
    \n3、混入到core中去
    \n在init.rb中编写混入代码即可。
    \n
    \nRuby代码
    \n
    \n require 'foo'    
    \n ActionController::Base.send :include, Foo
    \n
    \n
    \n
    \n参考文档:
    \nhttp://blog.ericsk.org/archives/769
    \nhttp://blog.railschina.com/637/viewspace-236
    \nhttp://kyoleelqh.javaeye.com/blog/215090

    \n", "_id"=>379}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Chrome: Google推浏览器正面迎战IE8", "body"=>"昨天说到“Google手机现身: 值得期待”,然而今天又看到另外一个更让你期待的东西——Chrome,Google推出的浏览器。\r\n\"\"\r\n相比GooglePhone,Chrome或许更让人们期待,因为它是免费的,也无需等待,只有发布就可以下载使用的,同样,是整合了大量google应用的。\r\nChrome的诞生肯定不是偶然,按照google的实力,别说搞个浏览器,搞个操作系统出来也不是不可能。相传N年前就流传Google要推出自己的浏览器,但是一直没有下文,按照现在的说法,Chrome已经开发了差不多两年时间,也就是说这么段时间内,Chrome都是在进行中的。\r\n为何选择现在放出来,偶自己认为IE8的发布刺疼了Google的神经,虽然说Google的商业价值并不是IE8中那些伎俩可以打倒的,但是IE8表达的是微软的一个态度,微软使出杀手锏,可见其无奈和无助。\r\n另外一个原因,近几年,firefox的成功让google有足够的信心推出自己的浏览器,firefox靠google的赞助和一些广告点击支付,占到了firefox每年85%的收入,如果google推出自己的浏览器,在性能和界面上可以匹敌firefox的话,在google强大的占用率上,推广肯定不是难事。近年来,马桶或者其他基于IE浏览器的成功都说明一个问题:浏览器只有做好浏览器的本职工作,又足够快速即可,如果google能加强对其浏览器安全性的推广,将其做为一个卖点的话,相信不少深受IE8安全问题的用户会转投其怀抱。\r\n另外一个就是firefox可能会受到影响,因为firefox的用户相对高端,讲求速度和简洁,google的风格肯定是这个方向,肯定会吸引众多firefox的用户前来试水,如果满意的话,也有不少人会转投google怀抱。\r\n至于消息是否准确,应该是差不多了,看其他地方的一些报道:\r\nhttp://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html\r\nhttp://it.sohu.com/20080902/n259325162.shtml\r\nhttp://webleon.org/2008/09/googlechrome.html", "created_at"=>2008-09-02 01:45:09 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    昨天说到“Google手机现身: 值得期待”,然而今天又看到另外一个更让你期待的东西——Chrome,Google推出的浏览器。
    \n
    \n相比GooglePhone,Chrome或许更让人们期待,因为它是免费的,也无需等待,只有发布就可以下载使用的,同样,是整合了大量google应用的。
    \nChrome的诞生肯定不是偶然,按照google的实力,别说搞个浏览器,搞个操作系统出来也不是不可能。相传N年前就流传Google要推出自己的浏览器,但是一直没有下文,按照现在的说法,Chrome已经开发了差不多两年时间,也就是说这么段时间内,Chrome都是在进行中的。
    \n为何选择现在放出来,偶自己认为IE8的发布刺疼了Google的神经,虽然说Google的商业价值并不是IE8中那些伎俩可以打倒的,但是IE8表达的是微软的一个态度,微软使出杀手锏,可见其无奈和无助。
    \n另外一个原因,近几年,firefox的成功让google有足够的信心推出自己的浏览器,firefox靠google的赞助和一些广告点击支付,占到了firefox每年85%的收入,如果google推出自己的浏览器,在性能和界面上可以匹敌firefox的话,在google强大的占用率上,推广肯定不是难事。近年来,马桶或者其他基于IE浏览器的成功都说明一个问题:浏览器只有做好浏览器的本职工作,又足够快速即可,如果google能加强对其浏览器安全性的推广,将其做为一个卖点的话,相信不少深受IE8安全问题的用户会转投其怀抱。
    \n另外一个就是firefox可能会受到影响,因为firefox的用户相对高端,讲求速度和简洁,google的风格肯定是这个方向,肯定会吸引众多firefox的用户前来试水,如果满意的话,也有不少人会转投google怀抱。
    \n至于消息是否准确,应该是差不多了,看其他地方的一些报道:
    \nhttp://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html
    \nhttp://it.sohu.com/20080902/n259325162.shtml
    \nhttp://webleon.org/2008/09/googlechrome.html

    \n", "_id"=>380}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"Download Chrome: 可以开始下载chrome", "body"=>"充满期待的chrome,希望不要让大家失望,仔细的看了他的那本连环画,觉得还不错,最主要功能看点将是其如何整合已有的Google应用。\r\n\r\n按照其发布说法,将在美国时间,周二开始提供下载,也就是中国的9.3号了,现在已经凌晨1点啦啦,貌似2点可以下载,偶是不等了,明天起来再试试。\r\n\r\n推测下载地址:http://gears.google.com/chrome/?hl=en  或者是 http://www.google.com/chrome\r\n\r\nps:网上很多钓鱼的网站已经出来了,冒充chrome的下载,有的是恶作剧,有的是木马,请大家耐心等下下,一定记得从上面这个主页上下,切记!", "created_at"=>2008-09-02 16:58:03 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    充满期待的chrome,希望不要让大家失望,仔细的看了他的那本连环画,觉得还不错,最主要功能看点将是其如何整合已有的Google应用。

    \n\n

    按照其发布说法,将在美国时间,周二开始提供下载,也就是中国的9.3号了,现在已经凌晨1点啦啦,貌似2点可以下载,偶是不等了,明天起来再试试。

    \n\n

    推测下载地址:http://gears.google.com/chrome/?hl=en  或者是 http://www.google.com/chrome

    \n\n

    ps:网上很多钓鱼的网站已经出来了,冒充chrome的下载,有的是恶作剧,有的是木马,请大家耐心等下下,一定记得从上面这个主页上下,切记!

    \n", "_id"=>381}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"喔唷,崩溃啦! Chrome启动异常解决方法", "body"=>"前面说到了,Google的浏览器Chrome在我工作环境下启动不成功,一启动就报告说XXX初始化失败,然后就显示“喔唷,崩溃啦!”,导致不可用。\r\n查了下原因,有如下几个可能:\r\n1、我是内网 ;\r\n2、我使用了一个安全软件SPA;\r\n3、我是windows xp sp3\r\n分析了下原因,很多人的XP SP3可以跑,说明3不是问题,有人是内网可以使用,说明1一哦不是问题,那么就剩下2这个原因了。\r\n经过多方查找,找到原因:\r\n由于采用了sandbox技术,被spa无情的干掉了,即使在SPA被干掉的情况下,chrome也无法正常启动。 \r\n\r\n解决方法:\r\n手工在command界面里面执行 chrome.exe -no-sandbox \r\n或者在你的快捷方式-右键-属性,在“目标”里面最后加上-no-sandbox 类似这样\r\n\"C:\\Documents and Settings\\iceskysl\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe\" -no-sandbox", "created_at"=>2008-09-04 01:32:20 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前面说到了,Google的浏览器Chrome在我工作环境下启动不成功,一启动就报告说XXX初始化失败,然后就显示“喔唷,崩溃啦!”,导致不可用。
    \n查了下原因,有如下几个可能:
    \n1、我是内网 ;
    \n2、我使用了一个安全软件SPA;
    \n3、我是windows xp sp3
    \n分析了下原因,很多人的XP SP3可以跑,说明3不是问题,有人是内网可以使用,说明1一哦不是问题,那么就剩下2这个原因了。
    \n经过多方查找,找到原因:
    \n由于采用了sandbox技术,被spa无情的干掉了,即使在SPA被干掉的情况下,chrome也无法正常启动。

    \n\n

    解决方法:
    \n手工在command界面里面执行 chrome.exe -no-sandbox
    \n或者在你的快捷方式-右键-属性,在“目标”里面最后加上-no-sandbox 类似这样
    \n"C:\\Documents and Settings\\iceskysl\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe" -no-sandbox

    \n", "_id"=>382}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NeverBlock到底有多快,对比测试说明问题", "body"=>"前面写过一篇《NeverBlock: 非常值得期待的一组类库》,其中说到了采用NeverBlock的non-blocking, concurrent机制,可以很大程度上提高mysql或者PostgreSQL的使用率,很多限度的提高性能。\r\n但是没有给出具体的对比测试数据,今天看到有个哥们已经使用Thin,Rails和PostgreSQL做了一次对比测试,相关环境如下:\r\n
    \r\n
    服务器配置
    \r\n
      \r\n\t
    1. 1 - 1 Thin server, normal postgreSQL Adapter  
    2. \r\n\t
    3. 2 - 2 Thin servers (behind nginx), normal postgreSQL Adapter  
    4. \r\n\t
    5. 3 - 4 Thin servers (behind nginx), normal postgreSQL Adapter  
    6. \r\n\t
    7. 4 - 1 Thin server, neverblock postgreSQL Adapter  
    8. \r\n
    \r\n
    \r\n
    \r\n
    压力配置
    \r\n
      \r\n\t
    1. 1 - Very light  work load,  every 200 requests, one \"select sleep(1)\" would be issued  
    2. \r\n\t
    3. 2 - Light work load,        every 100 requests, one \"select sleep(1)\" would be issued  
    4. \r\n\t
    5. 3 - Moderate work load,     every 50  requests, one \"select sleep(1)\" would be issued  
    6. \r\n\t
    7. 4 - Heavy work load,        every 20  requests, one \"select sleep(1)\" would be issued  
    8. \r\n\t
    9. 5 - Very heavy work load,   every 10  requests, one \"select sleep(1)\" would be issued  
    10. \r\n
    \r\n
    \r\n其结果对比如下:\r\n\"\"\r\n\r\n再来一张并发量的对比测试:\r\n\"\"\r\n\r\n接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。\r\n\r\n参考文档:\r\nhttp://oldmoe.blogspot.com/2008/09/building-never-blocking-rails-making.html\r\nhttp://chinaonrails.com/topic/view/1974.html", "created_at"=>2008-09-04 02:18:08 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前面写过一篇《NeverBlock: 非常值得期待的一组类库》,其中说到了采用NeverBlock的non-blocking, concurrent机制,可以很大程度上提高mysql或者PostgreSQL的使用率,很多限度的提高性能。
    \n但是没有给出具体的对比测试数据,今天看到有个哥们已经使用Thin,Rails和PostgreSQL做了一次对比测试,相关环境如下:
    \n
    \n服务器配置
    \n
    \n 1 - 1 Thin server, normal postgreSQL Adapter  
    \n 2 - 2 Thin servers (behind nginx), normal postgreSQL Adapter  
    \n 3 - 4 Thin servers (behind nginx), normal postgreSQL Adapter  
    \n 4 - 1 Thin server, neverblock postgreSQL Adapter  
    \n
    \n
    \n
    \n压力配置
    \n
    \n 1 - Very light  work load,  every 200 requests, one "select sleep(1)" would be issued  
    \n 2 - Light work load,        every 100 requests, one "select sleep(1)" would be issued  
    \n 3 - Moderate work load,     every 50  requests, one "select sleep(1)" would be issued  
    \n 4 - Heavy work load,        every 20  requests, one "select sleep(1)" would be issued  
    \n 5 - Very heavy work load,   every 10  requests, one "select sleep(1)" would be issued  
    \n
    \n
    \n其结果对比如下:

    \n\n

    再来一张并发量的对比测试:

    \n\n

    接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。

    \n\n

    参考文档:
    \nhttp://oldmoe.blogspot.com/2008/09/building-never-blocking-rails-making.html
    \nhttp://chinaonrails.com/topic/view/1974.html

    \n", "_id"=>383}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"Xsstc: 通过CSS跨站运行script", "body"=>"Xsstc: Cross-site scripting through CSS data,看名字就看出来了,通过CSS跨站运行script,使用方法:\r\n
      \r\n\t
    • 导入xsstcx.js(未压缩版xsstc.js)
    • \r\n\t
    • 添加一个id=”Xsstc”的空DIV。
    • \r\n\t
    • 在JS中调用Xsstc.exec(functionURL, callback),使用的内容作为callback的参数传入callback中
    • \r\n
    \r\n其中CSS的定义也有要求,下面是Hello World中CSS的定义\r\n
    \r\n
    CSS代码
    \r\n
    \r\n``````<pre lang=\"css\"> ```\r\nXsstc {\r\n background-image: url('about:blank#Hello%20World');\r\n}```\r\n``````</pre>``````\r\n
    \r\n
    \r\n
    \r\n
    JavaScript代码
    \r\n
      \r\n\t
    1. Xsstc.exec('http://lbs.tralfamadore.com/test.css', showResponse)  
    2. \r\n
    \r\n
    \r\n参考文档:\r\n\r\n原文说明: http://ajaxian.com/archives/xsstc-cross-site-scripting-through-css-data\r\n测试页面:http://www.tralfamadore.com/test-xsstc.html", "created_at"=>2008-09-04 02:50:53 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Xsstc: Cross-site scripting through CSS data,看名字就看出来了,通过CSS跨站运行script,使用方法:
    \n
    \n 导入xsstcx.js(未压缩版xsstc.js)
    \n 添加一个id=”Xsstc”的空DIV。
    \n 在JS中调用Xsstc.exec(functionURL, callback),使用的内容作为callback的参数传入callback中
    \n
    \n其中CSS的定义也有要求,下面是Hello World中CSS的定义
    \n
    \nCSS代码
    \n
    \n&lt;pre lang="css"&gt; ```
    \nXsstc {
    \n background-image: url('about:blank#Hello%20World');
    \n}```
    \n
    </pre>``````
    \n
    \n
    \n
    \nJavaScript代码
    \n
    \n Xsstc.exec('http://lbs.tralfamadore.com/test.css', showResponse)  
    \n
    \n
    \n参考文档:

    \n\n

    原文说明: http://ajaxian.com/archives/xsstc-cross-site-scripting-through-css-data
    \n测试页面:http://www.tralfamadore.com/test-xsstc.html

    \n", "_id"=>384}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]Rails 2.1.1发布,包括众多更新", "body"=>"Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本,按照DHH的说法:Next upcoming release will be Rails 2.2 beta which is quite close.\r\n\r\nRails2.2的一些特性,比如全球化支持,增加线程安全等几个是我们已经知道的,其他还会有哪些改进呢,非常值得期待。", "created_at"=>2008-09-05 17:50:56 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本,按照DHH的说法:Next upcoming release will be Rails 2.2 beta which is quite close.

    \n\n

    Rails2.2的一些特性,比如全球化支持,增加线程安全等几个是我们已经知道的,其他还会有哪些改进呢,非常值得期待。

    \n", "_id"=>385}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"NEVERBLOCK支持Ruby1.8,性能对比测试,提升非常显著", "body"=>"前面有篇文章介绍了NeverBlock,其一篇是关于NeverBlock 原理介绍的,另外一篇是在ruby1.9下做的对比测试,当时我们说:接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。现在有个好消息是,NeverBlock支持了Ruby1.8(通过一些手法),这次看到其更新的特性如下:\r\n
      \r\n\t
    •    NeverBlock now supports Ruby1.8.
    • \r\n\t
    •    NeverBlock support for Thin and Mongrel servers.
    • \r\n\t
    •    NeverBlock now supports Ruby on Rails.on
    • \r\n
    \r\n也就是说,现在NeverBlock支持Ruby1.8,支持Thin和mongrel服务器,另外支持Rails,测试方法很简单:\r\n1、安装需要的额外的系统类库\r\n
    \r\n
    Shell代码
    \r\n
      \r\n\t
    1. apt-get install libmysql++-dev\r\n
    2. \r\n
    \r\n
    \r\n2、安装需要的gems\r\n下载这几个包,NeverBlock (zip|tar.gz), Mysqlplus (zip|tar.gz), EventMachine (zip|tar.gz),\r\n然后解压各自包;tar -zxvf (respective file name).tar.gz\r\n然后CD到各自目录中build成gem;gem build (respective file name).gemspec\r\n最后gen install;gem install (generated file name).gem\r\n3、修改environment.rb\r\nrequire 'never_block/frameworks/rails'\r\nrequire 'never_block/servers/thin'(如果是mongrel,则require 'never_block/servers/mongrel')\r\n4、修改database.yml\r\nadapter: neverblock_mysql (如果是postgresql,则为 adapter: neverblock_postgresql )\r\nconnections: 12 # will spawn 12 connections instead of the defualt 4 #连接数\r\n5、重启thin(mongrel即可)\r\n\r\n以上步骤没有问题,我已经测试过了。\r\n\r\n下面附几个别人做的对比测试:\r\n
    \r\n
    测试环境如下:
    \r\n
      \r\n\t
    1. Rails 2.1  
    2. \r\n\t
    3. Thin 0.82  
    4. \r\n\t
    5. Ruby 1.8.6  
    6. \r\n\t
    7. MySQL 5.0  
    8. \r\n\t
    9. A special build of EventMachine 0.12  
    10. \r\n
    \r\n
    \r\n
    \r\n
    系统负载构造:
    \r\n
      \r\n\t
    1. 1 - Moderate work load,    one slow request for every 050 requests  
    2. \r\n\t
    3. 2 - Heavy work load,       one slow request for every 020 requests  
    4. \r\n\t
    5. 3 - Very heavy work load,  one slow request for every 010 requests\r\n
    6. \r\n
    \r\n
    \r\n结果如下:\r\n\r\nRails Performance (Thin Vs.NeverBlock::Thin)\r\n\r\n\"\"\r\n\r\nNeverBlock::Thin scaling\r\n\r\n\"\"\r\n\r\nMemory Consumption (Thin Vs. NeverBlock::Thin)\r\n\r\n\"\"\r\n\r\n \r\n\r\nPS:刚刚发布的时候存在一个find_by_sql的bug,现在已经修复了。\r\n\r\n参考文档:\r\n\r\nhttp://www.espace.com.eg/neverblock/blog/2008/09/04/neverblock-instant-scaling-for-your-rails-apps/\r\n\r\nhttp://chinaonrails.com/topic/view/2123.html", "created_at"=>2008-09-05 18:20:12 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前面有篇文章介绍了NeverBlock,其一篇是关于NeverBlock 原理介绍的,另外一篇是在ruby1.9下做的对比测试,当时我们说:接下来,,需要等待Ruby1.9和Rails2.2的到来,加上如上的测试对比,可以想象得到,Rails的性能会上很大一个台阶的。现在有个好消息是,NeverBlock支持了Ruby1.8(通过一些手法),这次看到其更新的特性如下:
    \n
    \n    NeverBlock now supports Ruby1.8.
    \n    NeverBlock support for Thin and Mongrel servers.
    \n    NeverBlock now supports Ruby on Rails.on
    \n
    \n也就是说,现在NeverBlock支持Ruby1.8,支持Thin和mongrel服务器,另外支持Rails,测试方法很简单:
    \n1、安装需要的额外的系统类库
    \n
    \nShell代码
    \n
    \n apt-get install libmysql++-dev
    \n
    \n
    \n
    \n2、安装需要的gems
    \n下载这几个包,NeverBlock (zip|tar.gz), Mysqlplus (zip|tar.gz), EventMachine (zip|tar.gz),
    \n然后解压各自包;tar -zxvf (respective file name).tar.gz
    \n然后CD到各自目录中build成gem;gem build (respective file name).gemspec
    \n最后gen install;gem install (generated file name).gem
    \n3、修改environment.rb
    \nrequire 'never_block/frameworks/rails'
    \nrequire 'never_block/servers/thin'(如果是mongrel,则require 'never_block/servers/mongrel')
    \n4、修改database.yml
    \nadapter: neverblock_mysql (如果是postgresql,则为 adapter: neverblock_postgresql )
    \nconnections: 12 # will spawn 12 connections instead of the defualt 4 #连接数
    \n5、重启thin(mongrel即可)

    \n\n

    以上步骤没有问题,我已经测试过了。

    \n\n

    下面附几个别人做的对比测试:
    \n
    \n测试环境如下:
    \n
    \n Rails 2.1  
    \n Thin 0.82  
    \n Ruby 1.8.6  
    \n MySQL 5.0  
    \n A special build of EventMachine 0.12  
    \n
    \n
    \n
    \n系统负载构造:
    \n
    \n 1 - Moderate work load,    one slow request for every 050 requests  
    \n 2 - Heavy work load,       one slow request for every 020 requests  
    \n 3 - Very heavy work load,  one slow request for every 010 requests
    \n
    \n
    \n
    \n结果如下:

    \n\n

    Rails Performance (Thin Vs.NeverBlock::Thin)

    \n\n\n

    NeverBlock::Thin scaling

    \n\n\n

    Memory Consumption (Thin Vs. NeverBlock::Thin)

    \n\n\n

     

    \n\n

    PS:刚刚发布的时候存在一个find_by_sql的bug,现在已经修复了。

    \n\n

    参考文档:

    \n\n

    http://www.espace.com.eg/neverblock/blog/2008/09/04/neverblock-instant-scaling-for-your-rails-apps/

    \n\n

    http://chinaonrails.com/topic/view/2123.html

    \n", "_id"=>386}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Rails]2.2版本即将来临,新功能提前看(一)", "body"=>"前面一篇文章“Rails 2.1.1发布,包括众多更新”说到“Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本”,今天看到Ryan已经陆续的介绍Rails2.2中的新特性。\r\n1、Shallow Routes\r\n以前在routing里写嵌套的资源为:\r\n
    \r\n
    routing写法
    \r\n
      \r\n\t
    1. map.resources :users do |user|  
    2. \r\n\t
    3.   user.resources :articles do |article|  
    4. \r\n\t
    5.     article.resourcs :comments  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n将使得对articles和comments的引用只能是如下格式 /users/1/articles、/users/1/articles/1/comments这样的URL,如果想直接引用资源,就有问题了,在Rails2.2中奖引入一个新的特性shallow route option,可以增加这个功能,routing写法为:\r\n
    \r\n
    routing写法
    \r\n
      \r\n\t
    1. map.resources :users:shallpow => true do |user|  
    2. \r\n\t
    3.   user.resources :articles do |article|  
    4. \r\n\t
    5.     article.resourcs :comments  
    6. \r\n\t
    7.   end  
    8. \r\n\t
    9. end  
    10. \r\n
    \r\n
    \r\n上面这个写法将保留以前的资源引用格式,同时增加如下的引用方法:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. articles_path #=> '/articles'    
    2. \r\n\t
    3. comments_path #=> '/comments'    
    4. \r\n\t
    5. article_comments_path(@article#=> '/articles/1/comments'    
    6. \r\n
    \r\n
    \r\n详细参考:What's New in Edge Rails: Shallow Routes\r\n\r\n2、Mailer Layouts\r\n在Rails2.2中将加入Mailer布局模板,就像view-template一样,每个mailer可以有一个模板,其默认的是mailer加上_mailer后缀,比如下面:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class UserMailer < ActionMailer::Base  
    2. \r\n\t
    3.   def registration(user)  
    4. \r\n\t
    5.     subject    \"You've registered\"  
    6. \r\n\t
    7.     from       \"system@example.com\"  
    8. \r\n\t
    9.   end  
    10. \r\n\t
    11. end  
    12. \r\n
    \r\n
    \r\n将会自动匹配layouts/user_mailer.html.erb这个布局模板 。当然,你也可以自己手工指定其对应的模板,如下:\r\n
    \r\n
    手工指定模板
    \r\n
      \r\n\t
    1. class UserMailer < ActionMailer::Base  
    2. \r\n\t
    3.   layout 'email'  
    4. \r\n\t
    5.   ...  
    6. \r\n\t
    7. end  
    8. \r\n
    \r\n
    \r\n参考:What's New in Edge Rails: Mailer Layouts\r\n\r\n3、Connection Pools\r\n前面说过,在Rails2.2中将会实现线程安全,如此以来,连接池的实现也就不在话下了,在Rails2.2中将增加连接池的特性,使用方法非常简单,直接在database.yml配置即可,如下:\r\n
    \r\n
    database.yml
    \r\n
      \r\n\t
    1. development:  
    2. \r\n\t
    3.   adapter: mysql  
    4. \r\n\t
    5.   username: root  
    6. \r\n\t
    7.   database: myapp_dev  
    8. \r\n\t
    9.   pool: 10  
    10. \r\n
    \r\n
    \r\n这个特性将极大的提高Rails的性能,非常值得期待。另外,还记得前面我们介绍过的“NeverBlock到底有多快,对比测试说明问题 ”么,同样值得期待。更多特性还有待慢慢介绍。\r\n参考: What's New in Edge Rails: Connection Pools", "created_at"=>2008-09-08 01:49:49 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前面一篇文章“Rails 2.1.1发布,包括众多更新”说到“Rails2.1.1版本发布,修复了前面说到的REXML的漏洞,其他都是一些小修小补,不值一提,但是令人期待的是后续的Rails2.2版本”,今天看到Ryan已经陆续的介绍Rails2.2中的新特性。
    \n1、Shallow Routes
    \n以前在routing里写嵌套的资源为:
    \n
    \nrouting写法
    \n
    \n map.resources :users do |user|  
    \n   user.resources :articles do |article|  
    \n     article.resourcs :comments  
    \n   end  
    \n end  
    \n
    \n
    \n将使得对articles和comments的引用只能是如下格式 /users/1/articles、/users/1/articles/1/comments这样的URL,如果想直接引用资源,就有问题了,在Rails2.2中奖引入一个新的特性shallow route option,可以增加这个功能,routing写法为:
    \n
    \nrouting写法
    \n
    \n map.resources :users, :shallpow => true do |user|  
    \n   user.resources :articles do |article|  
    \n     article.resourcs :comments  
    \n   end  
    \n end  
    \n
    \n
    \n上面这个写法将保留以前的资源引用格式,同时增加如下的引用方法:
    \n
    \nRuby代码
    \n
    \n articles_path #=> '/articles'    
    \n comments_path #=> '/comments'    
    \n article_comments_path(@article) #=> '/articles/1/comments'    
    \n
    \n
    \n详细参考:What's New in Edge Rails: Shallow Routes

    \n\n

    2、Mailer Layouts
    \n在Rails2.2中将加入Mailer布局模板,就像view-template一样,每个mailer可以有一个模板,其默认的是mailer加上_mailer后缀,比如下面:
    \n
    \nRuby代码
    \n
    \n class UserMailer < ActionMailer::Base  
    \n   def registration(user)  
    \n     subject    "You've registered"  
    \n     from       "system@example.com"  
    \n   end  
    \n end  
    \n
    \n
    \n将会自动匹配layouts/user_mailer.html.erb这个布局模板 。当然,你也可以自己手工指定其对应的模板,如下:
    \n
    \n手工指定模板
    \n
    \n class UserMailer < ActionMailer::Base  
    \n   layout 'email'  
    \n   ...  
    \n end  
    \n
    \n
    \n参考:What's New in Edge Rails: Mailer Layouts

    \n\n

    3、Connection Pools
    \n前面说过,在Rails2.2中将会实现线程安全,如此以来,连接池的实现也就不在话下了,在Rails2.2中将增加连接池的特性,使用方法非常简单,直接在database.yml配置即可,如下:
    \n
    \ndatabase.yml
    \n
    \n development:  
    \n   adapter: mysql  
    \n   username: root  
    \n   database: myapp_dev  
    \n   pool: 10  
    \n
    \n
    \n这个特性将极大的提高Rails的性能,非常值得期待。另外,还记得前面我们介绍过的“NeverBlock到底有多快,对比测试说明问题 ”么,同样值得期待。更多特性还有待慢慢介绍。
    \n参考: What's New in Edge Rails: Connection Pools

    \n", "_id"=>387}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"雷击后网络异常分析和处理方法", "body"=>"不久前的一次打雷,把我们住的那里的网络设备全部干坏了,从猫、路由器、网卡,全部干坏了,记录如下,提醒大家以后小心。\r\n\r\n情景重现:\r\n我住的地方有两台电脑,通过一台无线路由,经猫用ADSL上网,一直以来都用的好好的,前不久搬家到7楼(以前住3楼),河隔壁合用一个ADSL,一共四台电脑(两个本本,两个台式机),本本通过无线连接,两个台式机通过有线连接到路由器,用的挺好。\r\n前不久的一个凌晨,深圳暴雨,被一个炸雷惊醒,很响!晚上下班发现网络无法连接,表现为:猫只有一个power灯亮;路由器的WAN和LAN都不亮,两台台式机均显示“网卡被拔出”的红叉叉。\r\n\r\n初步分析:\r\n1、猫的DSL灯不亮,说明信号没进来,看来猫坏了,联系电信的来换了个猫,DSL灯亮了,可以通过本本连接有线上网,猫的问题解除;\r\n2、接下来按照以前的方式走路由器,发现路由器的WAN还是不亮,然后本本有线到路由器上,无法上网,怀疑路由器挂了,幸好买了不久,拿回去换了一个,路由器问题解决;\r\n3、换了路由器后,本本有线连接可以使用,上网正常,但是突然发现两台台式机均无法连接到路由器,还是现实“网线被拔出”的红叉叉,电脑的网卡灯也不亮。\r\n\r\n深入分析:\r\n1、调换本本和台式机的网线,还是老样子,看来不是网线的问题;\r\n2、重装了台式机的网卡驱动,还是老样子,看来不是驱动的问题;\r\n3、两台台式机症状类似,看来是和打雷有关,google了一下,果然,很多人遇到过这样的问题(我还真是第一次遇到),貌似说打雷的时候出现电涌现象,导致网卡损坏。甚至有的会导致主板、显示器都坏掉。\r\n\r\n解决问题:\r\n1、先可以试试是否是主版屏蔽了网卡,在BIOS里面重新加载下板载网卡,是否可以;\r\n2、如果不行,就只能换网卡了,如果用PCI的,得在BIOS里面把板载网卡禁用掉;如果使用USB的,则可以直接使用。\r\n\r\n注意事项:\r\n1、打雷、闪电的时候关闭计算机,拔掉电源,拔掉ADSL线,关掉猫、路由器的电源;\r\n2、晚上睡前,拔掉ADSL,关闭计算机电源。", "created_at"=>2008-09-08 05:36:38 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    不久前的一次打雷,把我们住的那里的网络设备全部干坏了,从猫、路由器、网卡,全部干坏了,记录如下,提醒大家以后小心。
    \n
    \n情景重现:
    \n我住的地方有两台电脑,通过一台无线路由,经猫用ADSL上网,一直以来都用的好好的,前不久搬家到7楼(以前住3楼),河隔壁合用一个ADSL,一共四台电脑(两个本本,两个台式机),本本通过无线连接,两个台式机通过有线连接到路由器,用的挺好。
    \n前不久的一个凌晨,深圳暴雨,被一个炸雷惊醒,很响!晚上下班发现网络无法连接,表现为:猫只有一个power灯亮;路由器的WAN和LAN都不亮,两台台式机均显示“网卡被拔出”的红叉叉。

    \n\n

    初步分析:
    \n1、猫的DSL灯不亮,说明信号没进来,看来猫坏了,联系电信的来换了个猫,DSL灯亮了,可以通过本本连接有线上网,猫的问题解除;
    \n2、接下来按照以前的方式走路由器,发现路由器的WAN还是不亮,然后本本有线到路由器上,无法上网,怀疑路由器挂了,幸好买了不久,拿回去换了一个,路由器问题解决;
    \n3、换了路由器后,本本有线连接可以使用,上网正常,但是突然发现两台台式机均无法连接到路由器,还是现实“网线被拔出”的红叉叉,电脑的网卡灯也不亮。

    \n\n

    深入分析:
    \n1、调换本本和台式机的网线,还是老样子,看来不是网线的问题;
    \n2、重装了台式机的网卡驱动,还是老样子,看来不是驱动的问题;
    \n3、两台台式机症状类似,看来是和打雷有关,google了一下,果然,很多人遇到过这样的问题(我还真是第一次遇到),貌似说打雷的时候出现电涌现象,导致网卡损坏。甚至有的会导致主板、显示器都坏掉。

    \n\n

    解决问题:
    \n1、先可以试试是否是主版屏蔽了网卡,在BIOS里面重新加载下板载网卡,是否可以;
    \n2、如果不行,就只能换网卡了,如果用PCI的,得在BIOS里面把板载网卡禁用掉;如果使用USB的,则可以直接使用。

    \n\n

    注意事项:
    \n1、打雷、闪电的时候关闭计算机,拔掉电源,拔掉ADSL线,关掉猫、路由器的电源;
    \n2、晚上睡前,拔掉ADSL,关闭计算机电源。

    \n", "_id"=>388}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>4, "title"=>"使用gnuplot配合AB绘制性能测试结果图", "body"=>"Apache的AB可以用来做一些性能测试,使用-g参数其结果可以输出到文件,然后使用gnuplot可以绘制相关图片,以更直观的显示。\r\n
    \r\n
    ab -h
    \r\n
      \r\n\t
    1. $ ab -h  
    2. \r\n\t
    3. Usage: ab [options] [http://]hostname[:port]/path  
    4. \r\n\t
    5. Options are:  
    6. \r\n\t
    7.     -n requests     Number of requests to perform  
    8. \r\n\t
    9.     -c concurrency  Number of multiple requests to make  
    10. \r\n\t
    11.     -t timelimit    Seconds to max. wait for responses  
    12. \r\n\t
    13.     -p postfile     File containing data to POST  
    14. \r\n\t
    15.     -T content-type Content-type header for POSTing  
    16. \r\n\t
    17.     -v verbosity    How much troubleshooting info to print  
    18. \r\n\t
    19.     -w              Print out results in HTML tables  
    20. \r\n\t
    21.     -i              Use HEAD instead of GET  
    22. \r\n\t
    23.     -x attributes   String to insert as table attributes  
    24. \r\n\t
    25.     -y attributes   String to insert as tr attributes  
    26. \r\n\t
    27.     -z attributes   String to insert as td or th attributes  
    28. \r\n\t
    29.     -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)  
    30. \r\n\t
    31.     -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'  
    32. \r\n\t
    33.                     Inserted after all normal header lines. (repeatable)  
    34. \r\n\t
    35.     -A attribute    Add Basic WWW Authentication, the attributes  
    36. \r\n\t
    37.                     are a colon separated username and password.  
    38. \r\n\t
    39.     -P attribute    Add Basic Proxy Authentication, the attributes  
    40. \r\n\t
    41.                     are a colon separated username and password.  
    42. \r\n\t
    43.     -X proxy:port   Proxyserver and port number to use  
    44. \r\n\t
    45.     -V              Print version number and exit  
    46. \r\n\t
    47.     -k              Use HTTP KeepAlive feature  
    48. \r\n\t
    49.     -d              Do not show percentiles served table.  
    50. \r\n\t
    51.     -S              Do not show confidence estimators and warnings.  
    52. \r\n\t
    53.     -g filename     Output collected data to gnuplot format file.  
    54. \r\n\t
    55.     -e filename     Output CSV file with percentages served  
    56. \r\n\t
    57.     -h              Display usage information (this message)  
    58. \r\n
    \r\n
    \r\n \r\n
    $ab -g http_benchmark.txt -n 1000 -c 100 http://1stlog.1sters.com/
    \r\n
    \r\n
    \r\n
    http_benchmark.txt
    \r\n
      \r\n\t
    1. $ more http_benchmark.txt  
    2. \r\n\t
    3. starttime       seconds ctime   dtime   ttime   wait  
    4. \r\n\t
    5. Mon Sep 08 11:15:52 2008        1220843752427648        516     94524   95040   94521  
    6. \r\n\t
    7. Mon Sep 08 11:15:52 2008        1220843752944235        525     94500   95025   93995  
    8. \r\n\t
    9. Mon Sep 08 11:15:53 2008        1220843753469652        520     94491   95011   93475  
    10. \r\n\t
    11. Mon Sep 08 11:15:53 2008        1220843753990129        514     94478   94992   92960  
    12. \r\n\t
    13. Mon Sep 08 11:15:54 2008        1220843754505018        511     94471   94982   92449  
    14. \r\n\t
    15. Mon Sep 08 11:15:55 2008        1220843755016428        523     100439  100962  91925  
    16. \r\n
    \r\n
    \r\n
    \r\n
    \r\n``1sters@iceskysl:~> gnuplotset terminal pngset output \"http_benchmark.png\"set xlabel \"request\"set ylabel \"ms\"plot \"http_benchmark.txt\" using 7 with lines title \"ctime\", \\ \"http_benchmark.txt\" using 8 with lines title \"dtime\", \\ \"http_benchmark.txt\" using 9 with lines title \"ttime\", \\\"http_benchmark.txt\" using 10 with lines title \"wait\"\r\n\r\n结果类似:```\r\n\"\"\r\n
    参考文档:http://www.gnuplot.info/download.htmlhttp://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.htmlhttp://www.lotto-kim.net/eng/blog/using_gnuplot_to_show_results_from_ab```\r\n
    \r\n ", "created_at"=>2008-09-08 05:53:22 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Apache的AB可以用来做一些性能测试,使用-g参数其结果可以输出到文件,然后使用gnuplot可以绘制相关图片,以更直观的显示。
    \n
    \nab -h
    \n
    \n $ ab -h  
    \n Usage: ab [options] [http://]hostname[:port]/path  
    \n Options are:  
    \n     -n requests     Number of requests to perform  
    \n     -c concurrency  Number of multiple requests to make  
    \n     -t timelimit    Seconds to max. wait for responses  
    \n     -p postfile     File containing data to POST  
    \n     -T content-type Content-type header for POSTing  
    \n     -v verbosity    How much troubleshooting info to print  
    \n     -w              Print out results in HTML tables  
    \n     -i              Use HEAD instead of GET  
    \n     -x attributes   String to insert as table attributes  
    \n     -y attributes   String to insert as tr attributes  
    \n     -z attributes   String to insert as td or th attributes  
    \n     -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)  
    \n     -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'  
    \n                     Inserted after all normal header lines. (repeatable)  
    \n     -A attribute    Add Basic WWW Authentication, the attributes  
    \n                     are a colon separated username and password.  
    \n     -P attribute    Add Basic Proxy Authentication, the attributes  
    \n                     are a colon separated username and password.  
    \n     -X proxy:port   Proxyserver and port number to use  
    \n     -V              Print version number and exit  
    \n     -k              Use HTTP KeepAlive feature  
    \n     -d              Do not show percentiles served table.  
    \n     -S              Do not show confidence estimators and warnings.  
    \n     -g filename     Output collected data to gnuplot format file.  
    \n     -e filename     Output CSV file with percentages served  
    \n     -h              Display usage information (this message)  
    \n
    \n
    \n 
    \n$ab -g http_benchmark.txt -n 1000 -c 100 http://1stlog.1sters.com/
    \n
    \n
    \nhttp_benchmark.txt
    \n
    \n $ more http_benchmark.txt  
    \n starttime       seconds ctime   dtime   ttime   wait  
    \n Mon Sep 08 11:15:52 2008        1220843752427648        516     94524   95040   94521  
    \n Mon Sep 08 11:15:52 2008        1220843752944235        525     94500   95025   93995  
    \n Mon Sep 08 11:15:53 2008        1220843753469652        520     94491   95011   93475  
    \n Mon Sep 08 11:15:53 2008        1220843753990129        514     94478   94992   92960  
    \n Mon Sep 08 11:15:54 2008        1220843754505018        511     94471   94982   92449  
    \n Mon Sep 08 11:15:55 2008        1220843755016428        523     100439  100962  91925  
    \n
    \n
    \n
    \n
    \n``1sters@iceskysl:~> gnuplotset terminal pngset output "http_benchmark.png"set xlabel "request"set ylabel "ms"plot "http_benchmark.txt" using 7 with lines title "ctime", \\ "http_benchmark.txt" using 8 with lines title "dtime", \\ "http_benchmark.txt" using 9 with lines title "ttime", \\"http_benchmark.txt" using 10 with lines title "wait"

    \n\n

    结果类似:
    \n<img src="http://www.lotto-kim.net/var/ezwebin_site/storage/images/media/images/http_benchmark/1702-1-eng-GB/http_benchmark.png" alt="" />
    \n<pre id="nj1y"><strong>参考文档:</strong>http://www.gnuplot.info/download.htmlhttp://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.htmlhttp://www.lotto-kim.net/eng/blog/using_gnuplot_to_show_results_from_ab

    \n
    \n 

    \n", "_id"=>389}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.1之前的Injection漏洞续篇,union查询显威力", "body"=>"6月份的时候写过一篇文章《Rails2.1之前的Injection漏洞:limit,offset过滤不严》,文章中说到“我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。幸好,Mysql默认的是不许一次API调用执行多条SQL”,当时说这个漏洞在MYSQL中无法利用,其实是错误的。\r\n\r\n虽然在mysql中部允许一次执行多条语句,但是我们是可以变相利用这个漏洞的,采取的方法就是构造union查询,爆出敏感信息。下面看例子:\r\n\r\n比如你的程序中写了这么一条语句:User.find(:all, :limit => params[:limit]),那么我们就可以构造这个params[:limit]为: \"1 UNION (select 1,2,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)\",这句话什么意思?放到前面那个find后,就形成这样的语句:\r\n
    \r\n
    SQL代码
    \r\n
      \r\n\t
    1. select * from users limit 1 UNION (select 1,username,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)  
    2. \r\n
    \r\n
    \r\n怎样?很邪恶吧,了解点安全的朋友都能看明白,不了解的我说半天还不如你去google下什么是union注射,呵呵。\r\n\r\n没升级到2.1.1的赶快升级或者按照如下方式修复吧,否则就有危险了。\r\n
      \r\n\t
    • Review your application whether you allow the user to control :limit or :offset
    • \r\n\t
    • If you are on Rails 2.1.0, please apply this patch or get Rails 2.1.1
    • \r\n\t
    • If you are on the Rails 2.0 or 1.2 branch, apply this backport patch
    • \r\n
    \r\n参考文档:http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter/", "created_at"=>2008-09-09 01:48:40 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    6月份的时候写过一篇文章《Rails2.1之前的Injection漏洞:limit,offset过滤不严》,文章中说到“我们直接从Http的params中取得limit或者offset参数,直接放在SQL的find中,如果在offset中构造邪恶代码的话,肯定会造成大问题。幸好,Mysql默认的是不许一次API调用执行多条SQL”,当时说这个漏洞在MYSQL中无法利用,其实是错误的。

    \n\n

    虽然在mysql中部允许一次执行多条语句,但是我们是可以变相利用这个漏洞的,采取的方法就是构造union查询,爆出敏感信息。下面看例子:

    \n\n

    比如你的程序中写了这么一条语句:User.find(:all, :limit => params[:limit]),那么我们就可以构造这个params[:limit]为: "1 UNION (select 1,2,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)",这句话什么意思?放到前面那个find后,就形成这样的语句:
    \n
    \nSQL代码
    \n
    \n select * from users limit 1 UNION (select 1,username,password,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0 from users)  
    \n
    \n
    \n怎样?很邪恶吧,了解点安全的朋友都能看明白,不了解的我说半天还不如你去google下什么是union注射,呵呵。

    \n\n

    没升级到2.1.1的赶快升级或者按照如下方式修复吧,否则就有危险了。
    \n
    \n Review your application whether you allow the user to control :limit or :offset
    \n If you are on Rails 2.1.0, please apply this patch or get Rails 2.1.1
    \n If you are on the Rails 2.0 or 1.2 branch, apply this backport patch
    \n
    \n参考文档:http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter/

    \n", "_id"=>390}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"[Tips]自动填充测试需要的随机数据", "body"=>"经常遇到一些新功能开发完了,需要测试一些指标,比如性能测试等等,这个时候如果人工填充数据会非常囧的,你可以写rake来自己构造填充数据,你需要处理随机产生等情况,现在不必费心了,使用Faker Gem和populator可以快速的构造需要的数据。\r\n\r\nFaker\r\nA port of Perl‘s Data::Faker library that generates fake data.\r\n\r\nPopulator\r\nPopulate an Active Record database with mass insert.\r\n\r\n安装需要的gem:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. gem install populator  
    2. \r\n\t
    3. gem install faker  
    4. \r\n\t
    5. rake db:populate  
    6. \r\n
    \r\n
    \r\n写rake代码:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. # lib/tasks/populate.rake  
    2. \r\n\t
    3. namespace :db do  
    4. \r\n\t
    5.   desc \"Erase and fill database\"  
    6. \r\n\t
    7.   task :populate => :environment do  
    8. \r\n\t
    9.     require 'populator'  
    10. \r\n\t
    11.     require 'faker'  
    12. \r\n\t
    13.       
    14. \r\n\t
    15.     [Category, Product, Person].each(&:delete_all)  
    16. \r\n\t
    17.       
    18. \r\n\t
    19.     Category.populate 20 do |category|  
    20. \r\n\t
    21.       category.name = Populator.words(1..3).titleize  
    22. \r\n\t
    23.       Product.populate 10..100 do |product|  
    24. \r\n\t
    25.         product.category_id = category.id  
    26. \r\n\t
    27.         product.name = Populator.words(1..5).titleize  
    28. \r\n\t
    29.         product.description = Populator.sentences(2..10)  
    30. \r\n\t
    31.         product.price = [4.99, 19.95, 100]  
    32. \r\n\t
    33.         product.created_at = 2.years.ago..Time.now  
    34. \r\n\t
    35.       end  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39.       
    40. \r\n\t
    41.     Person.populate 100 do |person|  
    42. \r\n\t
    43.       person.name    = Faker::Name.name  
    44. \r\n\t
    45.       person.company = Faker::Company.name  
    46. \r\n\t
    47.       person.email   = Faker::Internet.email  
    48. \r\n\t
    49.       person.phone   = Faker::PhoneNumber.phone_number  
    50. \r\n\t
    51.       person.street  = Faker::Address.street_address  
    52. \r\n\t
    53.       person.city    = Faker::Address.city  
    54. \r\n\t
    55.       person.state   = Faker::Address.us_state_abbr  
    56. \r\n\t
    57.       person.zip     = Faker::Address.zip_code  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.   end  
    62. \r\n\t
    63. end  
    64. \r\n
    \r\n
    \r\n参考:\r\n\r\nhttp://github.com/ryanb/populator/tree/master\r\n\r\nhttp://faker.rubyforge.org/rdoc/\r\n\r\nhttp://railscasts.com/episodes/126-populating-a-database", "created_at"=>2008-09-09 02:25:49 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    经常遇到一些新功能开发完了,需要测试一些指标,比如性能测试等等,这个时候如果人工填充数据会非常囧的,你可以写rake来自己构造填充数据,你需要处理随机产生等情况,现在不必费心了,使用Faker Gem和populator可以快速的构造需要的数据。

    \n\n

    Faker
    \nA port of Perl‘s Data::Faker library that generates fake data.

    \n\n

    Populator
    \nPopulate an Active Record database with mass insert.

    \n\n

    安装需要的gem:
    \n
    \nRuby代码
    \n
    \n gem install populator  
    \n gem install faker  
    \n rake db:populate  
    \n
    \n
    \n写rake代码:
    \n
    \nRuby代码
    \n
    \n # lib/tasks/populate.rake  
    \n namespace :db do  
    \n   desc "Erase and fill database"  
    \n   task :populate => :environment do  
    \n     require 'populator'  
    \n     require 'faker'  
    \n       
    \n     [Category, Product, Person].each(&:delete_all)  
    \n       
    \n     Category.populate 20 do |category|  
    \n       category.name = Populator.words(1..3).titleize  
    \n       Product.populate 10..100 do |product|  
    \n         product.category_id = category.id  
    \n         product.name = Populator.words(1..5).titleize  
    \n         product.description = Populator.sentences(2..10)  
    \n         product.price = [4.99, 19.95, 100]  
    \n         product.created_at = 2.years.ago..Time.now  
    \n       end  
    \n     end  
    \n       
    \n     Person.populate 100 do |person|  
    \n       person.name    = Faker::Name.name  
    \n       person.company = Faker::Company.name  
    \n       person.email   = Faker::Internet.email  
    \n       person.phone   = Faker::PhoneNumber.phone_number  
    \n       person.street  = Faker::Address.street_address  
    \n       person.city    = Faker::Address.city  
    \n       person.state   = Faker::Address.us_state_abbr  
    \n       person.zip     = Faker::Address.zip_code  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \n参考:

    \n\n

    http://github.com/ryanb/populator/tree/master

    \n\n

    http://faker.rubyforge.org/rdoc/

    \n\n

    http://railscasts.com/episodes/126-populating-a-database

    \n", "_id"=>391}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"网站安全开发手册 让每个程序员都提高安全意识", "body"=>"大家看我的个人介绍是“不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…”,我职业是程序员,业余时间会关注一些安全方面的东西,给一本安全杂志编辑一个新漏洞挖掘和分析的栏目,我一直想能通过自己的对安全的理解和对程序员的接触把安全意识带给程序员,写出更安全的系统。\r\n\r\n也一直想策划一本书,把时下里常见的漏洞,漏洞的原因和分析,原理等等,用实际的例子讲解出来,站在程序员的角度来讲述这些漏洞的危害和防范,只是一直没找到空闲时间,也就一直搁浅。\r\n\r\n今天看到动易的开发人员写了一本《网站系统安全开发手册》,大概的浏览了一遍,其共有十三大项,30个小项,主要介绍了输入验证、输出编码、SQL注入、跨站脚本攻击、跨站请求伪造、越权操作、IO操作安全、缓存泄漏、系统加密、信息批漏、日志和监测、Web.config的安全配置等方面的内容,并列明具体的防御手段和方法,从而为网站安全开发人员提供了一本极具实操性的工具书。\r\n\r\n内容不算多,介绍的漏洞也都是时下常见的,有心成为安全的程序员的朋友可以下载看看,会有帮助的。我会仔细阅读,并继续策划我心目中的那本安全开发手册。\r\n\r\n网站系统安全开发手册提供在线下载:http://download.csdn.net/source/599604", "created_at"=>2008-09-09 02:38:51 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    大家看我的个人介绍是“不考虑安全的开发过程就是不完整的过程,而我只是个懂点安全对于互联网充满期待的程序员…”,我职业是程序员,业余时间会关注一些安全方面的东西,给一本安全杂志编辑一个新漏洞挖掘和分析的栏目,我一直想能通过自己的对安全的理解和对程序员的接触把安全意识带给程序员,写出更安全的系统。

    \n\n

    也一直想策划一本书,把时下里常见的漏洞,漏洞的原因和分析,原理等等,用实际的例子讲解出来,站在程序员的角度来讲述这些漏洞的危害和防范,只是一直没找到空闲时间,也就一直搁浅。

    \n\n

    今天看到动易的开发人员写了一本《网站系统安全开发手册》,大概的浏览了一遍,其共有十三大项,30个小项,主要介绍了输入验证、输出编码、SQL注入、跨站脚本攻击、跨站请求伪造、越权操作、IO操作安全、缓存泄漏、系统加密、信息批漏、日志和监测、Web.config的安全配置等方面的内容,并列明具体的防御手段和方法,从而为网站安全开发人员提供了一本极具实操性的工具书。

    \n\n

    内容不算多,介绍的漏洞也都是时下常见的,有心成为安全的程序员的朋友可以下载看看,会有帮助的。我会仔细阅读,并继续策划我心目中的那本安全开发手册。

    \n\n

    网站系统安全开发手册提供在线下载:http://download.csdn.net/source/599604

    \n", "_id"=>392}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"调整ubuntu下的netbeans 6.1为英文界面", "body"=>"在Ubuntu下使用netbeans还是挺不错的,但是最近升级后发现界面变成中文的了,还有些小方块的乱码。乱码很早前遇到过,忘记以前是咋处理了,临时找了下,如下处理可以:\r\n\r\n把/usr/share/fonts/truetype/arphic/下的文件copy一份到$JAVE_HOME/jre/lib/fonts/fallback/下即可。\r\n\r\n但是显示的中文真的不好看,也没有找到调的地方,加上其翻译的实在别扭,害得我老找不到菜单,于是找了个办法把界面又换成英文的,win下貌似可以直接修改etc/netbeans.conf中netbeans_default_options,在其后面添加 --locale en_US即可,但是ubuntu下配置文件不一样,在etc下配置看不明白,于是在的快捷启动方式后面加上 --locale en_US就好了。\r\n\r\n看着英文界面,真亲切呀。\r\n\r\n其他类似的解决:\r\n\r\nhttp://www.javaeye.com/post/518296\r\n\r\nhttp://rednaxelafx.javaeye.com/blog/202287", "created_at"=>2008-09-09 15:41:19 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在Ubuntu下使用netbeans还是挺不错的,但是最近升级后发现界面变成中文的了,还有些小方块的乱码。乱码很早前遇到过,忘记以前是咋处理了,临时找了下,如下处理可以:

    \n\n

    把/usr/share/fonts/truetype/arphic/下的文件copy一份到$JAVE_HOME/jre/lib/fonts/fallback/下即可。

    \n\n

    但是显示的中文真的不好看,也没有找到调的地方,加上其翻译的实在别扭,害得我老找不到菜单,于是找了个办法把界面又换成英文的,win下貌似可以直接修改etc/netbeans.conf中netbeans_default_options,在其后面添加 --locale en_US即可,但是ubuntu下配置文件不一样,在etc下配置看不明白,于是在的快捷启动方式后面加上 --locale en_US就好了。

    \n\n

    看着英文界面,真亲切呀。

    \n\n

    其他类似的解决:

    \n\n

    http://www.javaeye.com/post/518296

    \n\n

    http://rednaxelafx.javaeye.com/blog/202287

    \n", "_id"=>393}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Wicd: Ubuntu8.04终于用上无线了", "body"=>"用了这么久的ubuntu,前几天买了个无线路由,在windows下可以连接无线网络,但是在ubuntu下的那个Network-Manager里一直连不上,看那个无线的指示灯是橙色,以为是驱动不对呢。今天看到“Wicd - 一款非常出色的无线管理器”,发现Wicd比较强大,立马卸掉了Network-Manager(否则安装会提示有冲突),然后下载了deb的下来,安装下就可以使用了(我的是Ubuntu8.04+xfce)。\r\n\"\"\r\n立即探测出我的无线,输入密码,连接,拔掉网线,ping了下google,终于OK。\r\n\r\n参考:\r\nhttp://blog.istef.info/2007/08/19/wicd/\r\nhttp://linuxtoy.org/archives/wicd.html\r\nhttp://wicd.sourceforge.net/", "created_at"=>2008-09-09 15:59:14 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    用了这么久的ubuntu,前几天买了个无线路由,在windows下可以连接无线网络,但是在ubuntu下的那个Network-Manager里一直连不上,看那个无线的指示灯是橙色,以为是驱动不对呢。今天看到“Wicd - 一款非常出色的无线管理器”,发现Wicd比较强大,立马卸掉了Network-Manager(否则安装会提示有冲突),然后下载了deb的下来,安装下就可以使用了(我的是Ubuntu8.04+xfce)。
    \n
    \n立即探测出我的无线,输入密码,连接,拔掉网线,ping了下google,终于OK。
    \n
    \n参考:
    \nhttp://blog.istef.info/2007/08/19/wicd/
    \nhttp://linuxtoy.org/archives/wicd.html
    \nhttp://wicd.sourceforge.net/

    \n", "_id"=>394}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"Rails部署:Nginx+Haproxy+Thin", "body"=>"Nginx和Thin以前都介绍过,这里主要介绍下Haproxy的安装以及配合使用。\r\n\r\n1、下载\r\nwget  http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.3.tar.gz\r\n\r\n2、编译安装\r\nsudo aptitude install libpcre++-dev\r\ntar -zxvf haproxy-1.3.15.3.tar.gz\r\ncd haproxy-1.3.15.3\r\nsudo make TARGET=linux26 CPU=i386 USE_STATIC_PCRE=2\r\nsudo make install\r\ninstall -d /usr/local/sbin\r\ninstall haproxy /usr/local/sbin\r\ninstall -d /usr/local/man/man1\r\ninstall -m 644 doc/haproxy.1 /usr/local/man/man1\r\ninstall -d /usr/local/doc/haproxy\r\nfor x in configuration architecture haproxy-en haproxy-fr; do \\\r\ninstall -m 644 doc/$x.txt /usr/local/doc/haproxy ; \\\r\ndone\r\n\r\n3、配置文件\r\n1)Haproxy配置(/opt/devroot/itechtag/haproxy.conf)\r\n
    \r\n
    Haproxy配置
    \r\n
      \r\n\t
    1. global  
    2. \r\n\t
    3.   daemon  
    4. \r\n\t
    5.   maxconn       4096      # total max connections (dependent on ulimit)  
    6. \r\n\t
    7.   nbproc        2         # number of processing cores  
    8. \r\n\t
    9.    
    10. \r\n\t
    11. defaults  
    12. \r\n\t
    13.   mode              http  
    14. \r\n\t
    15.   clitimeout        60000       # maximum inactivity time on the client side  
    16. \r\n\t
    17.   srvtimeout        30000       # maximum inactivity time on the server side  
    18. \r\n\t
    19.   timeout connect   4000        # maximum time to wait for a connection attempt to a server to succeed  
    20. \r\n\t
    21.    
    22. \r\n\t
    23.   option            httpclose     # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)  
    24. \r\n\t
    25.   option            abortonclose  # enable early dropping of aborted requests from pending queue  
    26. \r\n\t
    27.   option            httpchk       # enable HTTP protocol to check on servers health  
    28. \r\n\t
    29.   option            forwardfor    # enable insert of X-Forwarded-For headers  
    30. \r\n\t
    31.    
    32. \r\n\t
    33.    
    34. \r\n\t
    35.   balance roundrobin            # each server is used in turns, according to assigned weight  
    36. \r\n\t
    37.    
    38. \r\n\t
    39.   stats enable                  # enable web-stats at /haproxy?stats  
    40. \r\n\t
    41.   stats auth        admin:pass  # force HTTP Auth to view stats  
    42. \r\n\t
    43.   stats refresh     5s        # refresh rate of stats page  
    44. \r\n\t
    45.    
    46. \r\n\t
    47. listen rails_proxy 127.0.0.1:8100  
    48. \r\n\t
    49.   # - equal weights on all servers  
    50. \r\n\t
    51.   # - maxconn will queue requests at HAProxy if limit is reached  
    52. \r\n\t
    53.   # - minconn dynamically scales the connection concurrency (bound my maxconn) depending on size of HAProxy queue  
    54. \r\n\t
    55.   # - check health every 20000 microseconds  
    56. \r\n\t
    57.    
    58. \r\n\t
    59.   server web1 127.0.0.1:8000 weight 1 minconn 3 maxconn 6 check inter 20000  
    60. \r\n\t
    61.    
    62. \r\n\t
    63. listen slow_proxy 127.0.0.1:8200  
    64. \r\n\t
    65.   # cluster for slow requests, lower the queues, check less frequently  
    66. \r\n\t
    67.   server web1 127.0.0.1:8000 weight 3 minconn 30 maxconn 300 check inter 20000  
    68. \r\n\t
    69.   server slow1 127.0.0.1:8001 weight 1 minconn 10 maxconn 300 check inter 40000  
    70. \r\n\t
    71.   server slow2 127.0.0.1:8002 weight 1 minconn 1 maxconn 300 check inter 40000  
    72. \r\n\t
    73.   server slow3 127.0.0.1:8003 weight 1 minconn 1 maxconn 300 check inter 40000  
    74. \r\n
    \r\n
    \r\n2)Nginx配置\r\n
    \r\n
    Nginx配置
    \r\n
      \r\n\t
    1. # File generated on 25 May 08  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. #upstream name has to be unique so add on the port number  
    6. \r\n\t
    7. #generate multiple mongrels  
    8. \r\n\t
    9. upstream thin_9000{  
    10. \r\n\t
    11.     server 127.0.0.1:8200;  
    12. \r\n\t
    13.     }  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. server {  
    18. \r\n\t
    19.             listen   80;  
    20. \r\n\t
    21.             server_name localhost;  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.             access_log /opt/devroot/itechtag/log/access.log;  
    26. \r\n\t
    27.             error_log  /opt/devroot/itechtag/log/error.log;  
    28. \r\n\t
    29.   
    30. \r\n\t
    31.             root   /opt/devroot/itechtag/public/;  
    32. \r\n\t
    33.             index  index.html;  
    34. \r\n\t
    35.              
    36. \r\n\t
    37.             location / {  
    38. \r\n\t
    39.                    proxy_set_header  X-Real-IP  $remote_addr;  
    40. \r\n\t
    41.                    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;  
    42. \r\n\t
    43.                    proxy_set_header Host $http_host;  
    44. \r\n\t
    45.                    proxy_redirect false;  
    46. \r\n\t
    47.   
    48. \r\n\t
    49.                    if (-f $request_filename/index.html) {  
    50. \r\n\t
    51.                                            rewrite (.*) $1/index.html break;  
    52. \r\n\t
    53.                           }  
    54. \r\n\t
    55.                           if (-f $request_filename.html) {  
    56. \r\n\t
    57.                                            rewrite (.*) $1.html break;  
    58. \r\n\t
    59.                           }  
    60. \r\n\t
    61.   
    62. \r\n\t
    63.                           if (!-f $request_filename) {  
    64. \r\n\t
    65.                                            proxy_pass http://thin_9000;  
    66. \r\n\t
    67.                                            break;  
    68. \r\n\t
    69.                           }  
    70. \r\n\t
    71.             }  
    72. \r\n\t
    73.   
    74. \r\n\t
    75. }  
    76. \r\n
    \r\n
    \r\n3)thin配置\r\n
    \r\n
    thin配置
    \r\n
      \r\n\t
    1. ---  
    2. \r\n\t
    3. pid: tmp/pids/thin.pid  
    4. \r\n\t
    5. log: log/thin.log  
    6. \r\n\t
    7. port: 8000  
    8. \r\n\t
    9. max_conns: 1024  
    10. \r\n\t
    11. timeout: 30  
    12. \r\n\t
    13. chdir: /opt/devroot/itechtag  
    14. \r\n\t
    15. max_persistent_conns: 512  
    16. \r\n\t
    17. environment: production  
    18. \r\n\t
    19. address: 0.0.0.0  
    20. \r\n\t
    21. servers: 4  
    22. \r\n\t
    23. daemonize: true  
    24. \r\n
    \r\n
    \r\n4、启动\r\nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -p pidfils.oid\r\n\r\n5、停止\r\nkill  $(cat /home/source/haproxy-1.3.15.3/examples/pidfils.oid)\r\n\r\n6、刷新\r\nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -sf $(cat /opt/devroot/itechtag/pidfils.oid)\r\n\r\n7、监控\r\nhttp://127.0.0.1:8200/haproxy?stats\r\n\"\"\r\n8、测试\r\nab -n 2000 -c 200 http://127.0.0.1/\r\n\r\n附录:Haproxy帮助信息\r\niceskysl@IceskYsl:/home/source/haproxy-1.3.15.3$ haproxy\r\nHA-Proxy version 1.3.15.3 2008/09/02\r\nCopyright 2000-2008 Willy Tarreau <w@1wt.eu>\r\n\r\nUsage : haproxy -f <cfgfile> [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]\r\n[ -p <pidfile> ] [ -m <max megs> ]\r\n-v displays version ; -vv shows known build options.\r\n-d enters debug mode ; -db only disables background mode.\r\n-V enters verbose mode (disables quiet mode)\r\n-D goes daemon ; implies -q\r\n-q quiet mode : don't display messages\r\n-c check mode : only check config file and exit\r\n-n sets the maximum total # of connections (2000)\r\n-m limits the usable amount of memory (in MB)\r\n-N sets the default, per-proxy maximum # of connections (2000)\r\n-p writes pids of all children to this file\r\n-de disables epoll() usage even when available\r\n-ds disables speculative epoll() usage even when available\r\n-dp disables poll() usage even when available\r\n-sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.\r\n\r\n参考资料:\r\nhttp://codesnippets.joyent.com/tag/ubuntu", "created_at"=>2008-09-12 01:18:35 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Nginx和Thin以前都介绍过,这里主要介绍下Haproxy的安装以及配合使用。

    \n\n

    1、下载
    \nwget  http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.3.tar.gz

    \n\n

    2、编译安装
    \nsudo aptitude install libpcre++-dev
    \ntar -zxvf haproxy-1.3.15.3.tar.gz
    \ncd haproxy-1.3.15.3
    \nsudo make TARGET=linux26 CPU=i386 USE_STATIC_PCRE=2
    \nsudo make install
    \ninstall -d /usr/local/sbin
    \ninstall haproxy /usr/local/sbin
    \ninstall -d /usr/local/man/man1
    \ninstall -m 644 doc/haproxy.1 /usr/local/man/man1
    \ninstall -d /usr/local/doc/haproxy
    \nfor x in configuration architecture haproxy-en haproxy-fr; do \\
    \ninstall -m 644 doc/$x.txt /usr/local/doc/haproxy ; \\
    \ndone

    \n\n

    3、配置文件
    \n1)Haproxy配置(/opt/devroot/itechtag/haproxy.conf)
    \n
    \nHaproxy配置
    \n
    \n global  
    \n   daemon  
    \n   maxconn       4096      # total max connections (dependent on ulimit)  
    \n   nbproc        2         # number of processing cores  
    \n    
    \n defaults  
    \n   mode              http  
    \n   clitimeout        60000       # maximum inactivity time on the client side  
    \n   srvtimeout        30000       # maximum inactivity time on the server side  
    \n   timeout connect   4000        # maximum time to wait for a connection attempt to a server to succeed  
    \n    
    \n   option            httpclose     # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)  
    \n   option            abortonclose  # enable early dropping of aborted requests from pending queue  
    \n   option            httpchk       # enable HTTP protocol to check on servers health  
    \n   option            forwardfor    # enable insert of X-Forwarded-For headers  
    \n    
    \n    
    \n   balance roundrobin            # each server is used in turns, according to assigned weight  
    \n    
    \n   stats enable                  # enable web-stats at /haproxy?stats  
    \n   stats auth        admin:pass  # force HTTP Auth to view stats  
    \n   stats refresh     5s        # refresh rate of stats page  
    \n    
    \n listen rails_proxy 127.0.0.1:8100  
    \n   # - equal weights on all servers  
    \n   # - maxconn will queue requests at HAProxy if limit is reached  
    \n   # - minconn dynamically scales the connection concurrency (bound my maxconn) depending on size of HAProxy queue  
    \n   # - check health every 20000 microseconds  
    \n    
    \n   server web1 127.0.0.1:8000 weight 1 minconn 3 maxconn 6 check inter 20000  
    \n    
    \n listen slow_proxy 127.0.0.1:8200  
    \n   # cluster for slow requests, lower the queues, check less frequently  
    \n   server web1 127.0.0.1:8000 weight 3 minconn 30 maxconn 300 check inter 20000  
    \n   server slow1 127.0.0.1:8001 weight 1 minconn 10 maxconn 300 check inter 40000  
    \n   server slow2 127.0.0.1:8002 weight 1 minconn 1 maxconn 300 check inter 40000  
    \n   server slow3 127.0.0.1:8003 weight 1 minconn 1 maxconn 300 check inter 40000  
    \n
    \n
    \n2)Nginx配置
    \n
    \nNginx配置
    \n
    \n # File generated on 25 May 08  
    \n   
    \n #upstream name has to be unique so add on the port number  
    \n #generate multiple mongrels  
    \n upstream thin_9000{  
    \n     server 127.0.0.1:8200;  
    \n     }  
    \n   
    \n server {  
    \n             listen   80;  
    \n             server_name localhost;  
    \n   
    \n             access_log /opt/devroot/itechtag/log/access.log;  
    \n             error_log  /opt/devroot/itechtag/log/error.log;  
    \n   
    \n             root   /opt/devroot/itechtag/public/;  
    \n             index  index.html;  
    \n              
    \n             location / {  
    \n                    proxy_set_header  X-Real-IP  $remote_addr;  
    \n                    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;  
    \n                    proxy_set_header Host $http_host;  
    \n                    proxy_redirect false;  
    \n   
    \n                    if (-f $request_filename/index.html) {  
    \n                                            rewrite (.) $1/index.html break;  
    \n                           }  
    \n                           if (-f $request_filename.html) {  
    \n                                            rewrite (.
    ) $1.html break;  
    \n                           }  
    \n   
    \n                           if (!-f $request_filename) {  
    \n                                            proxy_pass http://thin_9000;  
    \n                                            break;  
    \n                           }  
    \n             }  
    \n   
    \n }  
    \n
    \n
    \n3)thin配置
    \n
    \nthin配置
    \n
    \n ---  
    \n pid: tmp/pids/thin.pid  
    \n log: log/thin.log  
    \n port: 8000  
    \n max_conns: 1024  
    \n timeout: 30  
    \n chdir: /opt/devroot/itechtag  
    \n max_persistent_conns: 512  
    \n environment: production  
    \n address: 0.0.0.0  
    \n servers: 4  
    \n daemonize: true  
    \n
    \n
    \n4、启动
    \nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -p pidfils.oid

    \n\n

    5、停止
    \nkill  $(cat /home/source/haproxy-1.3.15.3/examples/pidfils.oid)

    \n\n

    6、刷新
    \nsudo haproxy -f /opt/devroot/itechtag/haproxy.conf -sf $(cat /opt/devroot/itechtag/pidfils.oid)

    \n\n

    7、监控
    \nhttp://127.0.0.1:8200/haproxy?stats
    \n
    \n8、测试
    \nab -n 2000 -c 200 http://127.0.0.1/

    \n\n

    附录:Haproxy帮助信息
    \niceskysl@IceskYsl:/home/source/haproxy-1.3.15.3$ haproxy
    \nHA-Proxy version 1.3.15.3 2008/09/02
    \nCopyright 2000-2008 Willy Tarreau <w@1wt.eu>

    \n\n

    Usage : haproxy -f <cfgfile> [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
    \n[ -p <pidfile> ] [ -m <max megs> ]
    \n-v displays version ; -vv shows known build options.
    \n-d enters debug mode ; -db only disables background mode.
    \n-V enters verbose mode (disables quiet mode)
    \n-D goes daemon ; implies -q
    \n-q quiet mode : don't display messages
    \n-c check mode : only check config file and exit
    \n-n sets the maximum total # of connections (2000)
    \n-m limits the usable amount of memory (in MB)
    \n-N sets the default, per-proxy maximum # of connections (2000)
    \n-p writes pids of all children to this file
    \n-de disables epoll() usage even when available
    \n-ds disables speculative epoll() usage even when available
    \n-dp disables poll() usage even when available
    \n-sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.

    \n\n

    参考资料:
    \nhttp://codesnippets.joyent.com/tag/ubuntu

    \n", "_id"=>395}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"LibFetion: Ubuntu下的飞信", "body"=>"自从用了一段时间的blackberry后,其他都用的不习惯了,更不习惯在上面发短信,于是需要经常开下fetion一些短信,Ubuntu下没有正式的fetion的客户端,今天看到一个叫做LibFetion,试了下,很不错。\r\n
    LibFetion是由邓东东主持开发的飞信应用程序开发库,其大部分代码使用C编写,支持所有POSIX兼容的操作系统。\r\n\r\nLibFetion封装飞信通信协议和功能处理逻辑,给开发者提供简洁、丰富的API接口。使用LibFetion的开发者只需专注于GUI(图形用户界面)的设计开发,就能轻易开发出飞信客户端,能大大提高飞信客户端的开发速度和降低开发难度。 凭借LibFetion的跨平台性,使得飞信在多个操作系统平台上运行,达到“fetion anywhere“。\r\n\r\nLibFetion是针对嵌入式设备系统设计的,它只使用了C库,提供平台线程库接口(缺省使用posix线程库)和网络接口(缺省使用socket)因此具有较强的可移植性。目前 LibFetion已在Linux,Mac OS X,Windows,ucLinux,Ecos操作系统上成功运行。\r\n\r\n如今基于LibFetion开发的PC客户端程序LibFx已经发布 V0.8.1版了,点击下载点击这里更换客户端皮肤资源
    \r\n安装记录如下:\r\niceskysl@IceskYsl:/home/source$ sudo dpkg -i linux_fetion_v0.8.1_8.04_i386.deb\r\n[sudo] password for iceskysl:\r\n选中了曾被取消选择的软件包 linuxfetion。\r\n(正在读取数据库 ... 系统当前总共安装有 207059 个文件和目录。)\r\n正在解压缩 linuxfetion (从 linux_fetion_v0.8.1_8.04_i386.deb) ...\r\n正在设置 linuxfetion (0.8.1) ...\r\niceskysl@IceskYsl:/home/source$", "created_at"=>2008-09-14 16:55:36 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    自从用了一段时间的blackberry后,其他都用的不习惯了,更不习惯在上面发短信,于是需要经常开下fetion一些短信,Ubuntu下没有正式的fetion的客户端,今天看到一个叫做LibFetion,试了下,很不错。
    \nLibFetion是由邓东东主持开发的飞信应用程序开发库,其大部分代码使用C编写,支持所有POSIX兼容的操作系统。

    \n\n

    LibFetion封装飞信通信协议和功能处理逻辑,给开发者提供简洁、丰富的API接口。使用LibFetion的开发者只需专注于GUI(图形用户界面)的设计开发,就能轻易开发出飞信客户端,能大大提高飞信客户端的开发速度和降低开发难度。 凭借LibFetion的跨平台性,使得飞信在多个操作系统平台上运行,达到“fetion anywhere“。

    \n\n

    LibFetion是针对嵌入式设备系统设计的,它只使用了C库,提供平台线程库接口(缺省使用posix线程库)和网络接口(缺省使用socket)因此具有较强的可移植性。目前 LibFetion已在Linux,Mac OS X,Windows,ucLinux,Ecos操作系统上成功运行。

    \n\n

    如今基于LibFetion开发的PC客户端程序LibFx已经发布 V0.8.1版了,点击下载。点击这里更换客户端皮肤资源。
    \n安装记录如下:
    \niceskysl@IceskYsl:/home/source$ sudo dpkg -i linux_fetion_v0.8.1_8.04_i386.deb
    \n[sudo] password for iceskysl:
    \n选中了曾被取消选择的软件包 linuxfetion。
    \n(正在读取数据库 ... 系统当前总共安装有 207059 个文件和目录。)
    \n正在解压缩 linuxfetion (从 linux_fetion_v0.8.1_8.04_i386.deb) ...
    \n正在设置 linuxfetion (0.8.1) ...
    \niceskysl@IceskYsl:/home/source$

    \n", "_id"=>396}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails应用系统的监控规划", "body"=>"每个系统都得有相应的监控措施,你总不想每天都呆在电脑旁,时刻的去刷新页面、检测系统状态,服务器状态,业务状态吧;你总不想天天扛着电脑,时刻准备着上去重启死掉的进程等待吧。\r\n我们需要一套完备的监控措施,针对熟悉的Rails系统,可以把监控划分为如下几个方面的:\r\n1、关键进程监控\r\n该类监控配置监控关键的进程,比如app server的进程,数据库进程等等,配置后可以自动监视相关进程,当某个情况发生时(比如内存耗尽等),自动重启进程,以保证系统正常运行。在Rails应用中,可以做这个事情的有monit,God等。\r\n2、服务器资源监控\r\n该类监控系统的资源使用情况,比如内存或者CPU使用率等等,当出现一些情况的时候(比如内存消耗超过90%,CPU消耗100%等)发出告警信息(Email告警,SMS告警等),可以做这个事情的有很多,比如siteview,Scout等。\r\n3、应用异常告警\r\n当出现500等应用内部异常的时候,发出告警,并附带相关的堆栈信息,以便以开发人员迅速定位问题,解决问题,可以做这个事情的有Exception Notification plugin.等。\r\n\r\n除了这些外,我想还可以做的事一些监控统计信息,比如可以写脚本统计nginx的连接数,Haproxy的统计等。\r\n\r\n参考:\r\nhttp://blog.scoutapp.com/articles/2008/09/09/rails-monitoring-pillars", "created_at"=>2008-09-16 03:53:51 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    每个系统都得有相应的监控措施,你总不想每天都呆在电脑旁,时刻的去刷新页面、检测系统状态,服务器状态,业务状态吧;你总不想天天扛着电脑,时刻准备着上去重启死掉的进程等待吧。
    \n我们需要一套完备的监控措施,针对熟悉的Rails系统,可以把监控划分为如下几个方面的:
    \n1、关键进程监控
    \n该类监控配置监控关键的进程,比如app server的进程,数据库进程等等,配置后可以自动监视相关进程,当某个情况发生时(比如内存耗尽等),自动重启进程,以保证系统正常运行。在Rails应用中,可以做这个事情的有monit,God等。
    \n2、服务器资源监控
    \n该类监控系统的资源使用情况,比如内存或者CPU使用率等等,当出现一些情况的时候(比如内存消耗超过90%,CPU消耗100%等)发出告警信息(Email告警,SMS告警等),可以做这个事情的有很多,比如siteview,Scout等。
    \n3、应用异常告警
    \n当出现500等应用内部异常的时候,发出告警,并附带相关的堆栈信息,以便以开发人员迅速定位问题,解决问题,可以做这个事情的有Exception Notification plugin.等。

    \n\n

    除了这些外,我想还可以做的事一些监控统计信息,比如可以写脚本统计nginx的连接数,Haproxy的统计等。

    \n\n

    参考:
    \nhttp://blog.scoutapp.com/articles/2008/09/09/rails-monitoring-pillars

    \n", "_id"=>397}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"今年我还在期待的两个东西,G1&MacBook", "body"=>"眼看着2008年就要过去了,忙忙碌碌的一年,总的给自己一些奖励,今年剩余时间内还在等待的两个东西,分别如下:\r\n\r\n1、Google手机HTC G1\r\n\r\n自从用了一段时间blackberry以后,再也用不习惯其他的传统手机,但是又被第一个夭折的黑莓搞得后怕,一直没有入手新的,本来打算前几天去买BB8110的,无奈懒得跑路,又耽搁了。看中G1的网络功能,因为我的手机多半是用来上网,看文档,处理mail等等,加上习惯了Google的很多在线服务,我认为G1会把Google的很多服务集成进去的,所以就一直等待。\r\n\r\n\"\"\r\n\r\n有报道说美国运营商T-Mobile将会在今天(9月17日)面向消费者预售这款Google手机,然后会在9月23日在美国纽约正式发布上市。\r\n\r\n值得担心的有两点:不要像iphone一样,被阻挡在门外;不要太贵。\r\n\r\n2、新版的MacBook\r\n\r\n我只是半个mac迷,我买MB是为了更快捷的工作,虽然用了Ubuntu一年多,也还觉得挺满意,但是追求更加高效的工作环境是我梦寐以求的,新版的MB应该会更加轻薄和环保,价格应该不会贵的离谱,可能会比以前的MB更便宜。\r\n\r\n\"\"\r\n\r\n有报道称新一代 MacBook 采用超薄铝制外壳、LED 背光显示屏,并且价格是极具冲击力的“入门级价格”。且在10.14号发布,看看表,时间也没多少了。", "created_at"=>2008-09-17 06:29:50 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    眼看着2008年就要过去了,忙忙碌碌的一年,总的给自己一些奖励,今年剩余时间内还在等待的两个东西,分别如下:

    \n\n

    1、Google手机HTC G1

    \n\n

    自从用了一段时间blackberry以后,再也用不习惯其他的传统手机,但是又被第一个夭折的黑莓搞得后怕,一直没有入手新的,本来打算前几天去买BB8110的,无奈懒得跑路,又耽搁了。看中G1的网络功能,因为我的手机多半是用来上网,看文档,处理mail等等,加上习惯了Google的很多在线服务,我认为G1会把Google的很多服务集成进去的,所以就一直等待。

    \n\n\n

    有报道说美国运营商T-Mobile将会在今天(9月17日)面向消费者预售这款Google手机,然后会在9月23日在美国纽约正式发布上市。

    \n\n

    值得担心的有两点:不要像iphone一样,被阻挡在门外;不要太贵。

    \n\n

    2、新版的MacBook

    \n\n

    我只是半个mac迷,我买MB是为了更快捷的工作,虽然用了Ubuntu一年多,也还觉得挺满意,但是追求更加高效的工作环境是我梦寐以求的,新版的MB应该会更加轻薄和环保,价格应该不会贵的离谱,可能会比以前的MB更便宜。

    \n\n\n

    有报道称新一代 MacBook 采用超薄铝制外壳、LED 背光显示屏,并且价格是极具冲击力的“入门级价格”。且在10.14号发布,看看表,时间也没多少了。

    \n", "_id"=>398}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成SMS功能", "body"=>"大家对于在Rails系统中发送Email或者IM消息都比较熟悉了,接下来还有一个比较有趣的就是直接发送SMS(短信),也就是接收页面上输入的接收者的手机号码和需要发送的消息,以SMS或者WAP的方式发送到用户手机是。\r\n\r\n实现这个功能一般来会所有两个思路,其一是使用ruby-sms这样的类操作移动设备(比如说手机)和网关交互,发送消息。这类一般比较复杂;还有一类是直接调用现成的SMS网关API,按照其API的格式传递参数即可。\r\n\r\n现在这里主要说的是第二类的实现,要实现这个方式的SMS发送,需要找到一家类似的服务商,比如台湾的TWSMS(http://www.twsms.com),然后根据其API或者form格式就可以发送SMS了,这里举两个例子。一个是一个台湾的朋友写的twsms;另外一个是一个老外写的clickatell。其各自的使用方法都很简单,如下\r\n\r\ntwsms:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. require 'twsms'  
    2. \r\n\t
    3. sms = TWSMS.new(\"username\"\"password\")  
    4. \r\n\t
    5. sms.sendSMS(mobile, message)  
    6. \r\n\t
    7. sms.querySMS  
    8. \r\n\t
    9. sms.setMessageId(msgid)  
    10. \r\n\t
    11. sms.querySMS  
    12. \r\n
    \r\n
    \r\nclicktell:\r\n
    \r\n
    ActiveRecord代码
    \r\n
      \r\n\t
    1. require 'clickatell'  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. class SMS  
    6. \r\n\t
    7.   def initialize(config)  
    8. \r\n\t
    9.     @config = config  
    10. \r\n\t
    11.   end  
    12. \r\n\t
    13.   
    14. \r\n\t
    15.   def create(recipient, message_text)  
    16. \r\n\t
    17.     api.send_message(recipient, message_text)  
    18. \r\n\t
    19.   end  
    20. \r\n\t
    21.   
    22. \r\n\t
    23.   private  
    24. \r\n\t
    25.     def api  
    26. \r\n\t
    27.       @api ||= Clickatell::API.authenticate(  
    28. \r\n\t
    29.         @config[:api_key],  
    30. \r\n\t
    31.         @config[:username],  
    32. \r\n\t
    33.         @config[:password]  
    34. \r\n\t
    35.       )  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39. end  
    40. \r\n
    \r\n
    \r\n
    \r\n
    YML代码
    \r\n
      \r\n\t
    1. # config/clickatell.yml  
    2. \r\n\t
    3. api_key: abcdefghi123  
    4. \r\n\t
    5. username: joebloggs  
    6. \r\n\t
    7. password: secret  
    8. \r\n
    \r\n
    \r\n
    \r\n
    加载配置文件
    \r\n
      \r\n\t
    1. # config/environments/production.rb  
    2. \r\n\t
    3. CLICKATELL_CONFIG = YAML.load(File.open(File.join(RAILS_ROOT, 'config''clickatell.yml')))  
    4. \r\n
    \r\n
    \r\n
    \r\n
    Routing配置
    \r\n
      \r\n\t
    1. ActionController::Routing::Routes.draw do |map|  
    2. \r\n\t
    3.   map.resource :sms  
    4. \r\n\t
    5. end  
    6. \r\n
    \r\n
    \r\n
    \r\n
    app/views/sms/new.rhtml
    \r\n
      \r\n\t
    1. <% form_tag '/sms', :method => :post do -%>  
    2. \r\n\t
    3.   <label>Enter the recipients mobile number:</label>  
    4. \r\n\t
    5.   <%= text_field_tag \"recipient\" %>  
    6. \r\n\t
    7.   <label>Enter your message:</label>  
    8. \r\n\t
    9.   <%= text_area_tag \"message_text\" %>  
    10. \r\n\t
    11.   <%= submit_tag \"Send SMS\" %>  
    12. \r\n\t
    13. <% end %>  
    14. \r\n
    \r\n
    \r\n
    \r\n
    Controller代码
    \r\n
      \r\n\t
    1. class SmsController < ApplicationController  
    2. \r\n\t
    3.   def create  
    4. \r\n\t
    5.     sms = SMS.new(CLICKATELL_CONFIG)  
    6. \r\n\t
    7.     sms.create(params[:recipient], params[:message_text])  
    8. \r\n\t
    9.     flash[:notice] = \"Message sent succesfully!\"   
    10. \r\n\t
    11.     redirect_to :back  
    12. \r\n\t
    13.   rescue Clickatell::API::Error => e  
    14. \r\n\t
    15.     flash[:error] = \"Clickatell API error: \#{e.message}\"   
    16. \r\n\t
    17.     redirect_to :back  
    18. \r\n\t
    19.   end  
    20. \r\n\t
    21. end  
    22. \r\n
    \r\n
    \r\n如上说的都是TW或者其他地方的SMS网关的实现,在国内我貌似没看到有类似的服务的,谁看到过,和我说一下哈。\r\n\r\n参考文档:\r\n\r\nhttp://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application\r\n\r\nhttp://clickatell.rubyforge.org/\r\n\r\nhttp://code.google.com/p/twsms/\r\n\r\n\r\n ", "created_at"=>2008-09-18 08:04:15 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    大家对于在Rails系统中发送Email或者IM消息都比较熟悉了,接下来还有一个比较有趣的就是直接发送SMS(短信),也就是接收页面上输入的接收者的手机号码和需要发送的消息,以SMS或者WAP的方式发送到用户手机是。

    \n\n

    实现这个功能一般来会所有两个思路,其一是使用ruby-sms这样的类操作移动设备(比如说手机)和网关交互,发送消息。这类一般比较复杂;还有一类是直接调用现成的SMS网关API,按照其API的格式传递参数即可。

    \n\n

    现在这里主要说的是第二类的实现,要实现这个方式的SMS发送,需要找到一家类似的服务商,比如台湾的TWSMS(http://www.twsms.com),然后根据其API或者form格式就可以发送SMS了,这里举两个例子。一个是一个台湾的朋友写的twsms;另外一个是一个老外写的clickatell。其各自的使用方法都很简单,如下

    \n\n

    twsms:
    \n
    \nRuby代码
    \n
    \n require 'twsms'  
    \n sms = TWSMS.new("username", "password")  
    \n sms.sendSMS(mobile, message)  
    \n sms.querySMS  
    \n sms.setMessageId(msgid)  
    \n sms.querySMS  
    \n
    \n
    \nclicktell:
    \n
    \nActiveRecord代码
    \n
    \n require 'clickatell'  
    \n   
    \n class SMS  
    \n   def initialize(config)  
    \n     @config = config  
    \n   end  
    \n   
    \n   def create(recipient, message_text)  
    \n     api.send_message(recipient, message_text)  
    \n   end  
    \n   
    \n   private  
    \n     def api  
    \n       @api ||= Clickatell::API.authenticate(  
    \n         @config[:api_key],  
    \n         @config[:username],  
    \n         @config[:password]  
    \n       )  
    \n     end  
    \n end  
    \n
    \n
    \n
    \nYML代码
    \n
    \n # config/clickatell.yml  
    \n api_key: abcdefghi123  
    \n username: joebloggs  
    \n password: secret  
    \n
    \n
    \n
    \n加载配置文件
    \n
    \n # config/environments/production.rb  
    \n CLICKATELL_CONFIG = YAML.load(File.open(File.join(RAILS_ROOT, 'config', 'clickatell.yml')))  
    \n
    \n
    \n
    \nRouting配置
    \n
    \n ActionController::Routing::Routes.draw do |map|  
    \n   map.resource :sms  
    \n end  
    \n
    \n
    \n
    \napp/views/sms/new.rhtml
    \n
    \n <% form_tag '/sms', :method => :post do -%>  
    \n   <label>Enter the recipients mobile number:</label>  
    \n   <%= text_field_tag "recipient" %>  
    \n   <label>Enter your message:</label>  
    \n   <%= text_area_tag "message_text" %>  
    \n   <%= submit_tag "Send SMS" %>  
    \n <% end %>  
    \n
    \n
    \n
    \nController代码
    \n
    \n class SmsController < ApplicationController  
    \n   def create  
    \n     sms = SMS.new(CLICKATELL_CONFIG)  
    \n     sms.create(params[:recipient], params[:message_text])  
    \n     flash[:notice] = "Message sent succesfully!"   
    \n     redirect_to :back  
    \n   rescue Clickatell::API::Error => e  
    \n     flash[:error] = "Clickatell API error: \#{e.message}"   
    \n     redirect_to :back  
    \n   end  
    \n end  
    \n
    \n
    \n如上说的都是TW或者其他地方的SMS网关的实现,在国内我貌似没看到有类似的服务的,谁看到过,和我说一下哈。

    \n\n

    参考文档:

    \n\n

    http://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application

    \n\n

    http://clickatell.rubyforge.org/

    \n\n

    http://code.google.com/p/twsms/

    \n\n

     

    \n", "_id"=>399}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["RSpec"], "comments_count"=>0, "category_id"=>2, "title"=>"RSpec: 探寻Ruby的BDD框架", "body"=>"晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。\r\n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。\r\n\r\n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!", "created_at"=>2008-09-18 08:19:01 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    晓得TDD,BDD,RSpec这些东西很久了,也看了不少的资料和教程,但总感觉还在门外徘徊,始终不得其要,真是怪异。应该是没在实际项目中实践过的缘故吧。
    \n本文记录一些RSpec和BDD(Behaviour Driven Development )的资料和文档,给我自己也给各位路过者提供一些资料,感兴趣的仔细看看吧。
    \n
    \n http://rspec.info/
    \n Telling a good story - Rspec stories from the trenches
    \n Slides from RailsConf
    \n rspec plain text stories + webrat = chunky bacon!
    \n http://chinaonrails.com/topic/view/220.html
    \n Story Driven Development with Rails - Part I: Up and Running
    \n
    \n另外,http://rspec.info/documentation/rails/上的资料非常棒。有路过的,玩BDD的朋友还望多多指教,领我进门,多谢!

    \n", "_id"=>400}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完成,有问题请反馈", "body"=>"经常来我BLog的同学可能发现了,最近老是发生 500错误,其原因是DH对资源限制的非常死,又有很多莫名其妙的进程占资源,非常不爽的说,今天下午务正好不想干啥,就在另外一个VPS上装了下PHP的环境,把这个blog迁移过来了。\r\n\r\n考虑到压力其实并不是很大,也为了能省点资源,于是使用的是PHP+nginx来跑PHP的,由于之前都是使用apache跑PHP的,今天还真绕了个小圈子,呵呵。。\r\n\r\n不过还好,也没多大会就把环境搭建好了,再把blog程序打包wget过去,再连原库做次备份,然后把备份的SQL导入到本地DB里面,再修改下连接DB的配置文件,非常省事。\r\n\r\n最后把域名指向改下,再nginx里面添加一个配置来服务这个系统。", "created_at"=>2008-09-21 09:17:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    经常来我BLog的同学可能发现了,最近老是发生 500错误,其原因是DH对资源限制的非常死,又有很多莫名其妙的进程占资源,非常不爽的说,今天下午务正好不想干啥,就在另外一个VPS上装了下PHP的环境,把这个blog迁移过来了。

    \n\n

    考虑到压力其实并不是很大,也为了能省点资源,于是使用的是PHP+nginx来跑PHP的,由于之前都是使用apache跑PHP的,今天还真绕了个小圈子,呵呵。。

    \n\n

    不过还好,也没多大会就把环境搭建好了,再把blog程序打包wget过去,再连原库做次备份,然后把备份的SQL导入到本地DB里面,再修改下连接DB的配置文件,非常省事。

    \n\n

    最后把域名指向改下,再nginx里面添加一个配置来服务这个系统。

    \n", "_id"=>401}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Google Android(T-Mobile版)即将揭开神秘面纱", "body"=>"很早前我就说自我的blackberry8100跌坏以后,就一直没买手机,一直在正Google Android的发布,昨天早上(22号)看到chinaeconomicreview上的“T-Mobile’s Google phone on its way”,按照那个里面的图片,觉得非常不爽,整就一黑莓的造型嘛。于是打算入手黑莓8110.\r\n\r\n\"\"\r\n\r\n熬夜到现在,发现假消息满天飞,sohu上放出一篇试用报告“Google Android手机试用报告网上现身(组图)”,消息肯定是假的,但是希望能切中一些功能吧。\r\n\r\n\"\"\r\n\r\n睡一觉,天亮就可以揭晓最终的答案了,如何接近前面一张图,就不等了,直接入手黑莓8110,如果接近后者,我还会动心的。", "created_at"=>2008-09-22 17:33:41 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    很早前我就说自我的blackberry8100跌坏以后,就一直没买手机,一直在正Google Android的发布,昨天早上(22号)看到chinaeconomicreview上的“T-Mobile’s Google phone on its way”,按照那个里面的图片,觉得非常不爽,整就一黑莓的造型嘛。于是打算入手黑莓8110.

    \n\n\n

    熬夜到现在,发现假消息满天飞,sohu上放出一篇试用报告“Google Android手机试用报告网上现身(组图)”,消息肯定是假的,但是希望能切中一些功能吧。

    \n\n\n

    睡一觉,天亮就可以揭晓最终的答案了,如何接近前面一张图,就不等了,直接入手黑莓8110,如果接近后者,我还会动心的。

    \n", "_id"=>402}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>10, "title"=>"FrontCompiler: 写出更优雅的CSS代码", "body"=>"对于Rails开发者来说,总觉得一大堆的CSS代码非常碍眼,写起来也不是很优雅,有没有更优雅的方法,毫无疑问,是有的。\r\n\r\n先看一段正常的CSS代码:\r\n
    \r\n
    CSS代码
    \r\n
      \r\n\t
    1. div.article div.title {  
    2. \r\n\t
    3.   font-weightbold;  
    4. \r\n\t
    5. }  
    6. \r\n\t
    7. div.article div.title a.author {  
    8. \r\n\t
    9.   padding-left12px;  
    10. \r\n\t
    11.   backgroundurl('user.png'no-repeat left;  
    12. \r\n\t
    13. }  
    14. \r\n\t
    15. div.article div.text {  
    16. \r\n\t
    17.   border1px solid #EEE;  
    18. \r\n\t
    19.   background#FEF;  
    20. \r\n\t
    21. }  
    22. \r\n
    \r\n
    \r\n再看一段有那么点不一样的代码:\r\n
    \r\n
    CSS代码
    \r\n
      \r\n\t
    1. div.article {  
    2. \r\n\t
    3.   div.title {  
    4. \r\n\t
    5.     font-weightbold;  
    6. \r\n\t
    7.       
    8. \r\n\t
    9.     a.author {  
    10. \r\n\t
    11.       padding-left12px;  
    12. \r\n\t
    13.       backgroundurl('user.png'no-repeat left;  
    14. \r\n\t
    15.     }  
    16. \r\n\t
    17.   }  
    18. \r\n\t
    19.   div.text {  
    20. \r\n\t
    21.     border1px solid #EEE;  
    22. \r\n\t
    23.     background#FEF;  
    24. \r\n\t
    25.   }  
    26. \r\n\t
    27. }  
    28. \r\n
    \r\n
    \r\n有啥不一样了么?是否有点发懵呢,呵呵,下面这个写法更清晰和优雅,不是么!但是这样写的话,我们的浏览器是不认识的,怎么办,可以采用第三方的类库来转换即可。现在看到的可以做这个事情的有FrontCompilercss_dryer,除了这个功能外,还有其他的功能,例如FrontCompiler还可以合并多个JS/CSS文件,代码如下:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. @c = FrontCompiler.new  
    2. \r\n\t
    3. @library_code = @c.compact_files(%w{  
    4. \r\n\t
    5.   src/lib.js  
    6. \r\n\t
    7.   src/lib/something.js  
    8. \r\n\t
    9.   src/lib/another.js  
    10. \r\n\t
    11. })  
    12. \r\n
    \r\n
    \r\n其他的功能请参考其各自的主页。\r\n\r\nhttp://st-on-it.blogspot.com/2008/09/nested-styles-with-ruby-and.html\r\n\r\nhttp://github.com/MadRabbit/frontcompiler/tree/master\r\n\r\nhttp://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css", "created_at"=>2008-09-23 06:27:24 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    对于Rails开发者来说,总觉得一大堆的CSS代码非常碍眼,写起来也不是很优雅,有没有更优雅的方法,毫无疑问,是有的。

    \n\n

    先看一段正常的CSS代码:
    \n
    \nCSS代码
    \n
    \n div.article div.title {  
    \n   font-weight: bold;  
    \n }  
    \n div.article div.title a.author {  
    \n   padding-left: 12px;  
    \n   background: url('user.png') no-repeat left;  
    \n }  
    \n div.article div.text {  
    \n   border: 1px solid #EEE;  
    \n   background: #FEF;  
    \n }  
    \n
    \n
    \n再看一段有那么点不一样的代码:
    \n
    \nCSS代码
    \n
    \n div.article {  
    \n   div.title {  
    \n     font-weight: bold;  
    \n       
    \n     a.author {  
    \n       padding-left: 12px;  
    \n       background: url('user.png') no-repeat left;  
    \n     }  
    \n   }  
    \n   div.text {  
    \n     border: 1px solid #EEE;  
    \n     background: #FEF;  
    \n   }  
    \n }  
    \n
    \n
    \n有啥不一样了么?是否有点发懵呢,呵呵,下面这个写法更清晰和优雅,不是么!但是这样写的话,我们的浏览器是不认识的,怎么办,可以采用第三方的类库来转换即可。现在看到的可以做这个事情的有FrontCompiler和css_dryer,除了这个功能外,还有其他的功能,例如FrontCompiler还可以合并多个JS/CSS文件,代码如下:
    \n
    \nRuby代码
    \n
    \n @c = FrontCompiler.new  
    \n @library_code = @c.compact_files(%w{  
    \n   src/lib.js  
    \n   src/lib/something.js  
    \n   src/lib/another.js  
    \n })  
    \n
    \n
    \n其他的功能请参考其各自的主页。

    \n\n

    http://st-on-it.blogspot.com/2008/09/nested-styles-with-ruby-and.html

    \n\n

    http://github.com/MadRabbit/frontcompiler/tree/master

    \n\n

    http://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css

    \n", "_id"=>403}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"YOBO: 周杰伦《魔杰座》首播《稻香》--附歌词", "body"=>"今天YOBO又一次让我惊喜了一次,晚上突然看到周杰伦的08新专辑《魔杰座》中的主打歌《稻香》发布出来了,于是赶紧在Yobo发帖分享,发完后,发现已经有人上传了上去。实在是大惊喜呀。\r\n\r\n下面嵌入yobo的音乐小精灵,把这首歌曲分享给大家:\r\n\r\n \r\n\r\n\r\n\r\n\"\"\r\n\r\n歌词如下:\r\n\r\n「稻 香」\r\n作词:周杰伦 作曲:周杰伦\r\n\r\n对这个世界如果你有太多的抱怨\r\n跌倒了就不敢继续往前走\r\n为什么人要这么的脆弱 堕落\r\n请你打开电视看看\r\n多少人为生命在努力勇敢的走下去\r\n我们是不是该知足\r\n珍惜一切 就算没有拥有\r\n\r\n还记得你说家是唯一的城堡 随着稻香河流继续奔跑\r\n微微笑 小时候的梦我知道\r\n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠\r\n回家吧 回到最初的美好\r\n\r\n不要这么容易就想放弃 就像我说的\r\n追不到的梦想 换个梦不就得了\r\n为自己的人生鲜艳上色 先把爱涂上喜欢的颜色\r\n笑一个吧 功成名就不是目的\r\n让自己快乐快乐这才叫做意义\r\n童年的纸飞机 现在终于飞回我手里\r\n\r\n所谓的那快乐 赤脚在田里追蜻蜓追到累了\r\n偷摘水果被蜜蜂给叮到怕了 谁在偷笑呢\r\n我靠着稻草人吹着风唱着歌睡着了\r\n哦 哦 午后吉它在虫鸣中更清脆\r\n哦 哦 阳光洒在路上就不怕心碎\r\n珍惜一切 就算没有拥有\r\n\r\n还记得你说家是唯一的城堡 随着稻香河流继续奔跑\r\n微微笑 小时候的梦我知道\r\n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠\r\n回家吧 回到最初的美好", "created_at"=>2008-09-23 14:29:30 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    今天YOBO又一次让我惊喜了一次,晚上突然看到周杰伦的08新专辑《魔杰座》中的主打歌《稻香》发布出来了,于是赶紧在Yobo发帖分享,发完后,发现已经有人上传了上去。实在是大惊喜呀。

    \n\n

    下面嵌入yobo的音乐小精灵,把这首歌曲分享给大家:

    \n\n

     

    \n\n\n\n

    歌词如下:

    \n\n

    「稻 香」
    \n作词:周杰伦 作曲:周杰伦

    \n\n

    对这个世界如果你有太多的抱怨
    \n跌倒了就不敢继续往前走
    \n为什么人要这么的脆弱 堕落
    \n请你打开电视看看
    \n多少人为生命在努力勇敢的走下去
    \n我们是不是该知足
    \n珍惜一切 就算没有拥有

    \n\n

    还记得你说家是唯一的城堡 随着稻香河流继续奔跑
    \n微微笑 小时候的梦我知道
    \n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠
    \n回家吧 回到最初的美好

    \n\n

    不要这么容易就想放弃 就像我说的
    \n追不到的梦想 换个梦不就得了
    \n为自己的人生鲜艳上色 先把爱涂上喜欢的颜色
    \n笑一个吧 功成名就不是目的
    \n让自己快乐快乐这才叫做意义
    \n童年的纸飞机 现在终于飞回我手里

    \n\n

    所谓的那快乐 赤脚在田里追蜻蜓追到累了
    \n偷摘水果被蜜蜂给叮到怕了 谁在偷笑呢
    \n我靠着稻草人吹着风唱着歌睡着了
    \n哦 哦 午后吉它在虫鸣中更清脆
    \n哦 哦 阳光洒在路上就不怕心碎
    \n珍惜一切 就算没有拥有

    \n\n

    还记得你说家是唯一的城堡 随着稻香河流继续奔跑
    \n微微笑 小时候的梦我知道
    \n不要哭让萤火虫带着你逃跑 乡间的歌谣永远的依靠
    \n回家吧 回到最初的美好

    \n", "_id"=>404}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Android G1: 我有一次被震撼了", "body"=>"很早前我就说,我今年还在等的2个东西是G1和新版本macbook,虽然G1尚未发布,但是对G1的期待还是很大的,尤其是用了这么多的Google应用(Doc,Gmail,日历,reader,Gtalk,picasa,chrome等),我自然希望能有一部可以随时带着身边的互联网手机。\r\n\r\niphone虽好,但是毕竟Mac的东西还是让人有点点。。。G的东西更加草根化,从G1的这次发布会就可以感受得到,该有的功能全部都有,晚上看不到视频,只能看apple4.us在twitter上的直播。\r\n\r\n看个图片吧:\r\n\r\n\"\"\r\n\r\n该有的功能都有,没有的还可以自己写,自己下,都是免费的,这个很牛,超过iphone不是不可能。可以看看月光写的对比文章http://www.williamlong.info/archives/1508.html\r\n\r\n唯一比较郁闷的是,何时才能在中国看到,按照发布会的说法,T-mobile签2年的价格是179美刀,换成RMB也就1200多点,但是鉴于中国移动的\"围墙“政策,不晓得正式渠道猴年马月才能进来呀,真是悲哀。\r\n\r\nPS:Reacoo说的twhirl这个twitter的客户端确实不赖,看来AIR也修成正果了。", "created_at"=>2008-09-23 15:28:37 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    很早前我就说,我今年还在等的2个东西是G1和新版本macbook,虽然G1尚未发布,但是对G1的期待还是很大的,尤其是用了这么多的Google应用(Doc,Gmail,日历,reader,Gtalk,picasa,chrome等),我自然希望能有一部可以随时带着身边的互联网手机。

    \n\n

    iphone虽好,但是毕竟Mac的东西还是让人有点点。。。G的东西更加草根化,从G1的这次发布会就可以感受得到,该有的功能全部都有,晚上看不到视频,只能看apple4.us在twitter上的直播。

    \n\n

    看个图片吧:

    \n\n\n

    该有的功能都有,没有的还可以自己写,自己下,都是免费的,这个很牛,超过iphone不是不可能。可以看看月光写的对比文章http://www.williamlong.info/archives/1508.html

    \n\n

    唯一比较郁闷的是,何时才能在中国看到,按照发布会的说法,T-mobile签2年的价格是179美刀,换成RMB也就1200多点,但是鉴于中国移动的"围墙“政策,不晓得正式渠道猴年马月才能进来呀,真是悲哀。

    \n\n

    PS:Reacoo说的twhirl这个twitter的客户端确实不赖,看来AIR也修成正果了。

    \n", "_id"=>405}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"Android & Java"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"Android & Java", "updated_at"=>2012-06-24 15:53:14 UTC, "created_at"=>2012-06-24 15:53:14 UTC, "_id"=>12}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android下开发初探,写个网络音乐播放器", "body"=>"很早前就对Android感兴趣了,那时看了点API,觉得比较麻烦,就没深入下去,直到昨天发布G1,才突然觉得这个Android还真强大,翻了下他的API,真牛,今天花了一天时间,把其code上的API和文档大概都过了一遍,虽然还有些具体的不会做,但是整个架构流程和布局模式都很清楚了。\r\n\r\n\"\"\r\n\r\n采用Eclipse导入几个demo看了下,结合文档,非常直观(google的文档和help写的非常到位),晚上就试着自己写个小东西,因为最近对网络音乐比较感兴趣,于是就试着写了一个网络音乐播放器。\r\n\r\nUI就不看了,看段代码\r\n\r\n \r\n
    \r\n
    Java/Android代码
    \r\n
      \r\n\t
    1. private MediaPlayer mMediaPlayer;  
    2. \r\n\t
    3. Uri uri = Uri.parse(\"http://www.jjyyjy.com/wj/he.mp3\");  
    4. \r\n\t
    5. mMediaPlayer = MediaPlayer.create(this, uri);  
    6. \r\n\t
    7. mMediaPlayer.start();  
    8. \r\n
    \r\n
    \r\n然后导入模拟器,可以很顺利的听到歌曲,还很简陋,有时间的话,我会继续开发这个应用。\r\n\r\n ", "created_at"=>2008-09-24 17:30:33 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    很早前就对Android感兴趣了,那时看了点API,觉得比较麻烦,就没深入下去,直到昨天发布G1,才突然觉得这个Android还真强大,翻了下他的API,真牛,今天花了一天时间,把其code上的API和文档大概都过了一遍,虽然还有些具体的不会做,但是整个架构流程和布局模式都很清楚了。

    \n\n\n

    采用Eclipse导入几个demo看了下,结合文档,非常直观(google的文档和help写的非常到位),晚上就试着自己写个小东西,因为最近对网络音乐比较感兴趣,于是就试着写了一个网络音乐播放器。

    \n\n

    UI就不看了,看段代码

    \n\n

     
    \n
    \nJava/Android代码
    \n
    \n private MediaPlayer mMediaPlayer;  
    \n Uri uri = Uri.parse("http://www.jjyyjy.com/wj/he.mp3");  
    \n mMediaPlayer = MediaPlayer.create(this, uri);  
    \n mMediaPlayer.start();  
    \n
    \n
    \n然后导入模拟器,可以很顺利的听到歌曲,还很简陋,有时间的话,我会继续开发这个应用。

    \n\n

     

    \n", "_id"=>406}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"自由行: 阳朔,我来了", "body"=>"都说阳朔是深圳的后花园,我来深圳两年多了,还没去后花园转过,估计在深圳呆不了不久了,再不去又没机会了,匆匆忙忙的梳理了下,准备出发了。\r\n\r\n不想背电脑,手机也坏了,背个包,去散散心吧,都说本命年会多有坎坷,以前还真不信,现在有些相信了,呵呵,没啥大事,散散心就好了。\r\n\r\n没有行程安排,没有工作,没人任务,背包走到哪里是哪里,舒服就找个店住下来,不舒服,去去就回。\r\n\r\n ", "created_at"=>2008-09-27 12:05:09 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    都说阳朔是深圳的后花园,我来深圳两年多了,还没去后花园转过,估计在深圳呆不了不久了,再不去又没机会了,匆匆忙忙的梳理了下,准备出发了。

    \n\n

    不想背电脑,手机也坏了,背个包,去散散心吧,都说本命年会多有坎坷,以前还真不信,现在有些相信了,呵呵,没啥大事,散散心就好了。

    \n\n

    没有行程安排,没有工作,没人任务,背包走到哪里是哪里,舒服就找个店住下来,不舒服,去去就回。

    \n\n

     

    \n", "_id"=>407}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"序列化数据的速度对比: Marshal vs. JSON vs. Eval vs. YAML .ZAML", "body"=>"有的时候,需要序列化一些数据,这个时候,我们可以选择的很多,比如Ruby常用的YAML,以及一些不常用的EVAL等,有人针对其Serializing的速度做了对比测试,结果显示如下:\r\n
    \r\n
    对比结果
    \r\n
      \r\n\t
    1. user system total real  
    2. \r\n\t
    3. array marshal 0.210000 0.010000 0.220000 ( 0.220701)  
    4. \r\n\t
    5. array json 2.180000 0.050000 2.230000 ( 2.288489)  
    6. \r\n\t
    7. array eval 2.090000 0.060000 2.150000 ( 2.240443)  
    8. \r\n\t
    9. array yaml 26.650000 0.350000 27.000000 ( 27.810609)  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. hash marshal 2.000000 0.050000 2.050000 ( 2.114950)  
    14. \r\n\t
    15. hash json 3.700000 0.060000 3.760000 ( 3.881716)  
    16. \r\n\t
    17. hash eval 5.370000 0.140000 5.510000 ( 6.117947)  
    18. \r\n\t
    19. hash yaml 68.220000 0.870000 69.090000 ( 72.370784)  
    20. \r\n
    \r\n
    \r\n毫无疑问,Marshal 是最快的,YAML不是一般的慢。\r\n\r\n但是看到有人写了zaml,其描述为”Fast yaml serialization for Ruby“,号称可以”YAML.dump, 1600% faster“,感兴趣的可以看看。\r\n\r\n参考文档:\r\nhttp://github.com/hallettj/zaml/tree/master\r\nhttp://chinaonrails.com/topic/view/2091.html\r\nhttp://gnomecoder.wordpress.com/2008/09/27/yaml-dump-1600-percent-faster/\r\nhttp://www.pauldix.net/2008/08/serializing-dat.html", "created_at"=>2008-10-05 12:47:54 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    有的时候,需要序列化一些数据,这个时候,我们可以选择的很多,比如Ruby常用的YAML,以及一些不常用的EVAL等,有人针对其Serializing的速度做了对比测试,结果显示如下:
    \n
    \n对比结果
    \n
    \n user system total real  
    \n array marshal 0.210000 0.010000 0.220000 ( 0.220701)  
    \n array json 2.180000 0.050000 2.230000 ( 2.288489)  
    \n array eval 2.090000 0.060000 2.150000 ( 2.240443)  
    \n array yaml 26.650000 0.350000 27.000000 ( 27.810609)  
    \n   
    \n hash marshal 2.000000 0.050000 2.050000 ( 2.114950)  
    \n hash json 3.700000 0.060000 3.760000 ( 3.881716)  
    \n hash eval 5.370000 0.140000 5.510000 ( 6.117947)  
    \n hash yaml 68.220000 0.870000 69.090000 ( 72.370784)  
    \n
    \n
    \n毫无疑问,Marshal 是最快的,YAML不是一般的慢。

    \n\n

    但是看到有人写了zaml,其描述为”Fast yaml serialization for Ruby“,号称可以”YAML.dump, 1600% faster“,感兴趣的可以看看。

    \n\n

    参考文档:
    \nhttp://github.com/hallettj/zaml/tree/master
    \nhttp://chinaonrails.com/topic/view/2091.html
    \nhttp://gnomecoder.wordpress.com/2008/09/27/yaml-dump-1600-percent-faster/
    \nhttp://www.pauldix.net/2008/08/serializing-dat.html

    \n", "_id"=>408}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"采用Ruby提取MP3的metadata信息", "body"=>"昨天有幸认识了terry,看到其blog上有篇文章”消费者对音乐内容Metadata的需求“,其中写到”音乐Metadata是所有数字音乐服务的根基,它的完备性也将直接影响服务的可扩展性。“,最基础也是应用最普遍的是”2.音乐目录元数据,例如歌曲名、专辑名、词曲作者等直接描述音乐作品的信息。这些信息通常会直接体现在各种数字音乐服务上。“。其给出一份消费者对metadata需求的调查研究,如下:\r\n\"\"\r\n今天突然来了兴趣,分析一首歌曲,找到其对应的metadata信息,经过资料查找和分析,目前已经基本完成,主要是读取MP3文件的ID3信息(ID3v1,ID3v1.1以及ID3v2),ID3v1的信息比较好读取,下面会给出一段ruby代码,ID3v2比较复杂,也有比较成熟的开源库,这里就不详细说了,我写在GoogleDoc里了,有感兴趣的可以自行研究或者找我要。\r\n下面是一段读取MP3歌曲的ID3v1.1信息的代码和运算结果:\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. class ID3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. #初始化genre列表信息  
    6. \r\n\t
    7.   genre_list = <<-GENRES  
    8. \r\n\t
    9. Blues  
    10. \r\n\t
    11. Classic Rock  
    12. \r\n\t
    13. ...省略其他的genre...  
    14. \r\n\t
    15.   GENRES  
    16. \r\n\t
    17.   
    18. \r\n\t
    19.   GENRE_LIST = genre_list.split(\"\\n\")  
    20. \r\n\t
    21.   TAGS = [ :title:artist:album:year:comment:track:genre ]  
    22. \r\n\t
    23.   
    24. \r\n\t
    25.   attr_accessor *TAGS  
    26. \r\n\t
    27.   
    28. \r\n\t
    29.   def initialize(filename)  
    30. \r\n\t
    31.     id3 = File.open(filename) do |mp3|  
    32. \r\n\t
    33.       mp3.seek(-128, IO::SEEK_END)  
    34. \r\n\t
    35.       mp3.read  
    36. \r\n\t
    37.     end  
    38. \r\n\t
    39.   
    40. \r\n\t
    41.     raise \"No ID3 tags\" if (id3 !~ /^TAG/ || id3 ~= /^TAG0{125}/)  
    42. \r\n\t
    43.   
    44. \r\n\t
    45.     @title@artist@album@year@comment@genre = id3.unpack('xxxA30A30A30A4A30C1')  
    46. \r\n\t
    47.     @comment@track = @comment.unpack('Z*@28C1'if @comment =~ /\\0.$/  
    48. \r\n\t
    49.   
    50. \r\n\t
    51.     @genre = GENRE_LIST[@genre]  
    52. \r\n\t
    53.   end  
    54. \r\n\t
    55. end  
    56. \r\n\t
    57.   
    58. \r\n\t
    59. if __FILE__ == $0  
    60. \r\n\t
    61.   id3 = ID3.new(ARGV.shift)  
    62. \r\n\t
    63.   ID3::TAGS.each do |tag|  
    64. \r\n\t
    65.     puts \"\#{tag.to_s.capitalize.rjust(8)}: \#{id3.send(tag)}\"  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69. end  
    70. \r\n
    \r\n
    \r\n其运算的结果差不多是这样的:\r\n
    \r\n
    算的结果
    \r\n
      \r\n\t
    1. F:\\IceskYsl>ruby id3_tags.rb ../06.mp3  
    2. \r\n\t
    3.    Title: What I've Done  
    4. \r\n\t
    5.   Artist: Linkin Park  
    6. \r\n\t
    7.    Album: Minutes To Midnight  
    8. \r\n\t
    9.     Year: 2007  
    10. \r\n\t
    11.  Comment: http://www.HiHiCD.com  
    12. \r\n\t
    13.    Track: 0  
    14. \r\n\t
    15.    Genre: Metal  
    16. \r\n
    \r\n
    \r\n发现这是个有意思的事情,呵呵。\r\n\r\n参考文章:\r\nhttp://www.trb.cn/wordpress/index.php/2008/08/28/661/", "created_at"=>2008-10-05 13:15:12 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    昨天有幸认识了terry,看到其blog上有篇文章”消费者对音乐内容Metadata的需求“,其中写到”音乐Metadata是所有数字音乐服务的根基,它的完备性也将直接影响服务的可扩展性。“,最基础也是应用最普遍的是”2.音乐目录元数据,例如歌曲名、专辑名、词曲作者等直接描述音乐作品的信息。这些信息通常会直接体现在各种数字音乐服务上。“。其给出一份消费者对metadata需求的调查研究,如下:
    \n
    \n今天突然来了兴趣,分析一首歌曲,找到其对应的metadata信息,经过资料查找和分析,目前已经基本完成,主要是读取MP3文件的ID3信息(ID3v1,ID3v1.1以及ID3v2),ID3v1的信息比较好读取,下面会给出一段ruby代码,ID3v2比较复杂,也有比较成熟的开源库,这里就不详细说了,我写在GoogleDoc里了,有感兴趣的可以自行研究或者找我要。
    \n下面是一段读取MP3歌曲的ID3v1.1信息的代码和运算结果:
    \n
    \nRuby代码
    \n
    \n class ID3  
    \n   
    \n #初始化genre列表信息  
    \n   genrelist = <<-GENRES  
    \n Blues  
    \n Classic Rock  
    \n ...省略其他的genre...  
    \n   GENRES  
    \n   
    \n   GENRE_LIST = genre_list.split("\\n")  
    \n   TAGS = [ :title, :artist, :album, :year, :comment, :track, :genre ]  
    \n   
    \n   attr_accessor TAGS  
    \n   
    \n   def initialize(filename)  
    \n     id3 = File.open(filename) do |mp3|  
    \n       mp3.seek(-128, IO::SEEK_END)  
    \n       mp3.read  
    \n     end  
    \n   
    \n     raise "No ID3 tags" if (id3 !~ /^TAG/ || id3 ~= /^TAG0{125}/)  
    \n   
    \n     @title, @artist, @album, @year, @comment, @genre = id3.unpack('xxxA30A30A30A4A30C1')  
    \n     @comment, @track = @comment.unpack('Z
    @28C1') if @comment =~ /\\0.$/  
    \n   
    \n     @genre = GENRE_LIST[@genre]  
    \n   end  
    \n end  
    \n   
    \n if 
    FILE_ == $0  
    \n   id3 = ID3.new(ARGV.shift)  
    \n   ID3::TAGS.each do |tag|  
    \n     puts "\#{tag.to_s.capitalize.rjust(8)}: \#{id3.send(tag)}"  
    \n   end  
    \n end  
    \n
    \n
    \n其运算的结果差不多是这样的:
    \n
    \n算的结果
    \n
    \n F:\\IceskYsl>ruby id3_tags.rb ../06.mp3  
    \n    Title: What I've Done  
    \n   Artist: Linkin Park  
    \n    Album: Minutes To Midnight  
    \n     Year: 2007  
    \n  Comment: http://www.HiHiCD.com  
    \n    Track: 0  
    \n    Genre: Metal  
    \n
    \n
    \n发现这是个有意思的事情,呵呵。

    \n\n

    参考文章:
    \nhttp://www.trb.cn/wordpress/index.php/2008/08/28/661/

    \n", "_id"=>409}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"添加一个分类“架构设计 | Architecture”", "body"=>"由于越来越多的关注Architecture方面的东西,而这类内容和以往的“技术归总 | Technic”有些不同,于是增加了一个“架构设计 | Architecture”分类。\r\n该分类主要收纳关于Architecture,Scalability,Load balance, throughput, HA, Performance等方面的理论,模式,以及对其他成熟的Architecture的分析和理解。\r\n希望和大家多交流,分享。", "created_at"=>2008-10-07 02:10:51 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    由于越来越多的关注Architecture方面的东西,而这类内容和以往的“技术归总 | Technic”有些不同,于是增加了一个“架构设计 | Architecture”分类。
    \n该分类主要收纳关于Architecture,Scalability,Load balance, throughput, HA, Performance等方面的理论,模式,以及对其他成熟的Architecture的分析和理解。
    \n希望和大家多交流,分享。

    \n", "_id"=>410}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>9, "title"=>"在Startups时就考虑Scalability", "body"=>"一般说来,项目初期的时候考虑更多的是功能的实现和可用性,而对Scalability考虑的并不是很多,从很多人的Scalability经验分享来看,大家比较认同的一条Scalability路线是基本上类似于:先DB和web server在一台机器上,再分割DB和web server,再集群,再cache,再系统分割,再水平、垂直扩展这样的路线。\r\n\r\n我一直不是很同意这个模式,因为当你有志把系统做大道一定规模的时候,为什么不先做一些Scalability的基础呢,比如功能的切割、子系统的划分等等,为什么非要等到系统压力上来了,再手忙脚乱的去重新规划呢。\r\n\r\n之所以这么说,是因为我做的项目预先会考虑好系统划分,做好接口定义,把不同的功能分割在封装成不同的子系统,子系统和子系统之间通过接口传递消息,而后期的Scalability则可以针对不同的子系统需要灵活选择,比如有的子系统需要较多的内存,而有的子系统CPU吃紧等等。\r\n\r\n今天看到Frank Mashraqi(Director of Business Operations & Technical Strategy for a top 50 website that delivers billions of page views per month.)写了一篇文章“Scalability for Startups: How to Grow Up without Blowing Up”,其“12 Tips for Building a Scalable Startup”列举了一些在Startups时就应该考虑的Scalability因素,值得阅读。其还有一个Doc版本,更加生动的说明了一些东西。\r\n\r\n如果你有类似的经验,欢迎和我讨论和分享。", "created_at"=>2008-10-07 02:28:16 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    一般说来,项目初期的时候考虑更多的是功能的实现和可用性,而对Scalability考虑的并不是很多,从很多人的Scalability经验分享来看,大家比较认同的一条Scalability路线是基本上类似于:先DB和web server在一台机器上,再分割DB和web server,再集群,再cache,再系统分割,再水平、垂直扩展这样的路线。

    \n\n

    我一直不是很同意这个模式,因为当你有志把系统做大道一定规模的时候,为什么不先做一些Scalability的基础呢,比如功能的切割、子系统的划分等等,为什么非要等到系统压力上来了,再手忙脚乱的去重新规划呢。

    \n\n

    之所以这么说,是因为我做的项目预先会考虑好系统划分,做好接口定义,把不同的功能分割在封装成不同的子系统,子系统和子系统之间通过接口传递消息,而后期的Scalability则可以针对不同的子系统需要灵活选择,比如有的子系统需要较多的内存,而有的子系统CPU吃紧等等。

    \n\n

    今天看到Frank Mashraqi(Director of Business Operations & Technical Strategy for a top 50 website that delivers billions of page views per month.)写了一篇文章“Scalability for Startups: How to Grow Up without Blowing Up”,其“12 Tips for Building a Scalable Startup”列举了一些在Startups时就应该考虑的Scalability因素,值得阅读。其还有一个Doc版本,更加生动的说明了一些东西。

    \n\n

    如果你有类似的经验,欢迎和我讨论和分享。

    \n", "_id"=>411}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"为Mysql选择更加合适的硬件环境", "body"=>"记得前段时间,博文的一个朋友做一本Mysql技术书籍时,将其策划的大纲给我看,我提出让他增加一章关于Mysql硬件选择的内容,因为Mysql的性能受硬件影响很大,如何选择一套比较合适的硬件环境相当重要,自然,他接受了我的建议。\r\n只是不知道他策划的这本书何时才能编写完成,不过在2008 MySQL Conference & Expo上,确实看到一篇“Scaling Out MySQL: Hardware Today and Tomorrow”,其Doc已经可以在scribd上看到了,嵌到这里。\r\n\r\n\r\n\r\n其内容大致涉及到CPU,Mem,vendor,storage等方面的选择,摘取几条如下:\r\n
      \r\n\t
    • CPU还是选64位的吧(为了支持更大的内存),Mysql在多核CPU上有些问题;
    • \r\n\t
    • 内存越大越好,反正很便宜,但是关于内存的配置使用还是很有学问的;
    • \r\n\t
    • 硬盘最后是选择15K而不是10K的,在这上面多花点钱是非常值得的;
    • \r\n
    \r\n其他的大家看Doc里面的总结吧,总结好了别忘记share给我哈。\r\n\r\n参考:http://www.dbanotes.net/database/mysql_hardware.html", "created_at"=>2008-10-07 03:18:16 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    记得前段时间,博文的一个朋友做一本Mysql技术书籍时,将其策划的大纲给我看,我提出让他增加一章关于Mysql硬件选择的内容,因为Mysql的性能受硬件影响很大,如何选择一套比较合适的硬件环境相当重要,自然,他接受了我的建议。
    \n只是不知道他策划的这本书何时才能编写完成,不过在2008 MySQL Conference & Expo上,确实看到一篇“Scaling Out MySQL: Hardware Today and Tomorrow”,其Doc已经可以在scribd上看到了,嵌到这里。

    \n\n

    Scaling out MySQL - Hardware today and tomorrow - Upload a Document to Scribd
    \n其内容大致涉及到CPU,Mem,vendor,storage等方面的选择,摘取几条如下:
    \n
    \n CPU还是选64位的吧(为了支持更大的内存),Mysql在多核CPU上有些问题;
    \n 内存越大越好,反正很便宜,但是关于内存的配置使用还是很有学问的;
    \n 硬盘最后是选择15K而不是10K的,在这上面多花点钱是非常值得的;
    \n
    \n其他的大家看Doc里面的总结吧,总结好了别忘记share给我哈。

    \n\n

    参考:http://www.dbanotes.net/database/mysql_hardware.html

    \n", "_id"=>412}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Thin"], "comments_count"=>0, "category_id"=>6, "title"=>"Thin version 1.0.0 is out!", "body"=>"Thin version 1.0.0 (codename That's What She Said) is out!\r\n\r\nYes 1.0! That doesn't mean it's bug free or anything. But, it does\r\nmean that it's been running on a number of servers and no show stopper\r\nbugs have been found since a while.\r\n\r\nAlso see http://macournoyer.wordpress.com/2008/09/30/thin-10/\r\n\r\n== What's new?\r\n\r\n* Fixed vlad.rake to allow TCP or socket [hellekin]\r\n* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]\r\n* rails rack adapter uses File.readable_real? so it recognizes ACL\r\npermissions [Ricardo Chimal]\r\n* Log a warning if Rack application returns nil body [Michael S.\r\nKlishin]\r\n* Handle nil and Time header values correctly [#76 state:resolved]\r\n[tmm1]\r\n* Add Content-Length header to response automatically when possible\r\n[#74 state:resolved] [dkubb]\r\n* Runner now remembers -r, -D and -V parameters so that clustered\r\nservers inherit those and\r\nkeep your parameters.\r\n* Make Set-Cookie header, in Rails adapter, compatible with current\r\nRack spec [Pedro Belo]\r\n[#73, state:resolved]\r\n* Add --no-epoll option to disable epoll usage on Linux [#61\r\nstate:resolved]\r\n* Add --force (-f) option to force stopping of a daemonized server\r\n[#72 state:resolved]\r\n* Update halycon adapter loader [mtodd]\r\n\r\n== Get it!\r\n\r\nInstall Thin from RubyForge:\r\n\r\ngem install thin\r\n\r\nOr using my mirror:\r\n\r\ngem install thin --source http://code.macournoyer.com\r\n\r\n参考文档:\r\nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d", "created_at"=>2008-10-07 09:56:27 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Thin version 1.0.0 (codename That's What She Said) is out!

    \n\n

    Yes 1.0! That doesn't mean it's bug free or anything. But, it does
    \nmean that it's been running on a number of servers and no show stopper
    \nbugs have been found since a while.

    \n\n

    Also see http://macournoyer.wordpress.com/2008/09/30/thin-10/

    \n\n

    == What's new?

    \n\n
      \n
    • Fixed vlad.rake to allow TCP or socket [hellekin]
    • \n
    • Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
    • \n
    • rails rack adapter uses File.readable_real? so it recognizes ACL\npermissions [Ricardo Chimal]
    • \n
    • Log a warning if Rack application returns nil body [Michael S.\nKlishin]
    • \n
    • Handle nil and Time header values correctly [#76 state:resolved]\n[tmm1]
    • \n
    • Add Content-Length header to response automatically when possible\n[#74 state:resolved] [dkubb]
    • \n
    • Runner now remembers -r, -D and -V parameters so that clustered\nservers inherit those and\nkeep your parameters.
    • \n
    • Make Set-Cookie header, in Rails adapter, compatible with current\nRack spec [Pedro Belo]\n[#73, state:resolved]
    • \n
    • Add --no-epoll option to disable epoll usage on Linux [#61\nstate:resolved]
    • \n
    • Add --force (-f) option to force stopping of a daemonized server\n[#72 state:resolved]
    • \n
    • Update halycon adapter loader [mtodd]
    • \n
    \n\n

    == Get it!

    \n\n

    Install Thin from RubyForge:

    \n\n

    gem install thin

    \n\n

    Or using my mirror:

    \n\n

    gem install thin --source http://code.macournoyer.com

    \n\n

    参考文档:
    \nhttp://groups.google.com/group/thin-ruby/browse_thread/thread/402d51a6d9f2651d

    \n", "_id"=>413}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"7 Top Tips for Coding With Currency", "body"=>"As anyone who’s ever made an e-commerce system knows, money is everything. No, really if you don’t get your financial sums right then you can’t hope to build a successful online business (and may find yourself creating potential legal issues with the tax man).\r\n\r\nSo here’s a rundown of the top tips I can give for making your financial calculations that bit easier.\r\n\r\nhttp://www.setfiremedia.com/blog/7-top-tips-for-coding-with-currency", "created_at"=>2008-10-08 09:05:08 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    As anyone who’s ever made an e-commerce system knows, money is everything. No, really if you don’t get your financial sums right then you can’t hope to build a successful online business (and may find yourself creating potential legal issues with the tax man).

    \n\n

    So here’s a rundown of the top tips I can give for making your financial calculations that bit easier.

    \n\n

    http://www.setfiremedia.com/blog/7-top-tips-for-coding-with-currency

    \n", "_id"=>414}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sneetchalizer"], "comments_count"=>0, "category_id"=>2, "title"=>"sneetchalizer: 粘合audio格式转换和tag信息提取的Ruby脚本", "body"=>"前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。\r\n\r\n\"\"\r\n\r\nsneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。\r\n\r\n其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'\r\n\r\n使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:\r\n\r\n1、安装方法\r\n\r\n直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:\r\n
    \r\n
    Manifest:
    \r\n
      \r\n\t
    1. README                - You're reading it now.  
    2. \r\n\t
    3. LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    4. \r\n\t
    5. CHANGES               - sneetchalizer's cvs/svn commit log.  
    6. \r\n\t
    7. sneetchalizer         - The script itself.  
    8. \r\n\t
    9. sneetchalizer.1       - The manpage for sneetchalizer.  
    10. \r\n\t
    11. sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    12. \r\n\t
    13. install.rb            - A quick and dirty script to install the sneetchalizer.  
    14. \r\n
    \r\n
    \r\n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。\r\n\r\n2、参数解释\r\n\r\n不翻译了,都挺简单明了的,如下:\r\n
    \r\n
    XML/HTML代码
    \r\n
      \r\n\t
    1. General options:  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. -h or --help  
    6. \r\n\t
    7.     Print quick or full usage details respectively.  
    8. \r\n\t
    9. -r or --recursive  
    10. \r\n\t
    11.     Search directory arguments recursively for files to convert.  
    12. \r\n\t
    13. -d or --delete  
    14. \r\n\t
    15.     delete input files after successful conversion. May not be safe yet!!!  
    16. \r\n\t
    17. -v or --verbose  
    18. \r\n\t
    19.     makes sneetchalizer more chatty.  
    20. \r\n\t
    21. -s or --show-output  
    22. \r\n\t
    23.     shows output from conversion tool.  
    24. \r\n\t
    25. -p or --pretend  
    26. \r\n\t
    27.     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    28. \r\n\t
    29. -t or --terminate  
    30. \r\n\t
    31.     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    32. \r\n\t
    33. -D ARG or --out-directory=ARG  
    34. \r\n\t
    35.     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    36. \r\n\t
    37. --strict and --pedantic  
    38. \r\n\t
    39.     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    40. \r\n\t
    41. --stasis  
    42. \r\n\t
    43.     Preserve timestamp (mtime) of original file.  
    44. \r\n\t
    45. --threads [N]  
    46. \r\n\t
    47.     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    48. \r\n\t
    49. --sanitize  
    50. \r\n\t
    51.     Removes ,, ;, :, ', \", %, @, #, and ` from filenames and tags.  
    52. \r\n\t
    53. -n [FORMAT] or --rename[=FORMAT]  
    54. \r\n\t
    55.     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    56. \r\n\t
    57.   
    58. \r\n\t
    59.         * %t Song title  
    60. \r\n\t
    61.         * %b Album title  
    62. \r\n\t
    63.         * %n Track number  
    64. \r\n\t
    65.         * %a Artist name  
    66. \r\n\t
    67.         * %y Year  
    68. \r\n\t
    69.         * %g Genre  
    70. \r\n\t
    71.         * %c Comment field  
    72. \r\n\t
    73.   
    74. \r\n\t
    75.     Directories may be created with this command, as in \"%b/%n - %t\". The default value of FORMAT is \"%n %t\".   
    76. \r\n\t
    77.   
    78. \r\n\t
    79. Bitrate/Quality/Compression options:  
    80. \r\n\t
    81.   
    82. \r\n\t
    83. -b or --bitrate  
    84. \r\n\t
    85.     mp3/ogg/m4a bitrate.  
    86. \r\n\t
    87. -q or --quality  
    88. \r\n\t
    89.     mp3/ogg quality.  
    90. \r\n\t
    91.   
    92. \r\n\t
    93. quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    94. \r\n\t
    95.   
    96. \r\n\t
    97. -c or --compression  
    98. \r\n\t
    99.     flac/mac compression level.  
    100. \r\n\t
    101.   
    102. \r\n\t
    103. this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    104. \r\n\t
    105.   
    106. \r\n\t
    107. Format Options:  
    108. \r\n\t
    109.   
    110. \r\n\t
    111. --out=format  
    112. \r\n\t
    113.     output format. Default is wav.  
    114. \r\n\t
    115. --in=format[,format..]  
    116. \r\n\t
    117.     input format(s). Default is wav.  
    118. \r\n\t
    119.   
    120. \r\n\t
    121. Valid output formats are: \"aac\", \"aif\", \"aifc\", \"aiff\", \"aiffc\", \"ape\", \"au\", \"cdr\", \"cdda\", \"copy\", \"flac\", \"m4a\", \"m4b\", \"mpc\", \"mp4\", \"mpp\", \"mp3\", \"mp2\", \"ofr\", \"ofs\", \"ogg\", \"snd\", \"spx\", \"tta\", \"wav\", \"wv\". Valid input formats are all of the above plus \"wma\". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The \"copy\" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    122. \r\n\t
    123.   
    124. \r\n\t
    125. Tagging Options:  
    126. \r\n\t
    127.   
    128. \r\n\t
    129. --tt or --title  
    130. \r\n\t
    131.     Set 'title' tag.  
    132. \r\n\t
    133. --ta or --artist  
    134. \r\n\t
    135.     Set 'artist' tag.  
    136. \r\n\t
    137. --tl or --album  
    138. \r\n\t
    139.     Set 'album' tag.  
    140. \r\n\t
    141. --ty or --year  
    142. \r\n\t
    143.     Set 'year' tag.  
    144. \r\n\t
    145. --tc or --comment  
    146. \r\n\t
    147.     Set 'comment' tag.  
    148. \r\n\t
    149. --tg or --genre  
    150. \r\n\t
    151.     Set 'genre' tag.  
    152. \r\n\t
    153. --tn or --trackn  
    154. \r\n\t
    155.     Set 'track number' tag.  
    156. \r\n\t
    157.   
    158. \r\n\t
    159. The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    160. \r\n\t
    161.   
    162. \r\n\t
    163. Alternative Encoder/Decoder Options:  
    164. \r\n\t
    165.   
    166. \r\n\t
    167. --gogo  
    168. \r\n\t
    169.     use gogo to encode mp3 files.  
    170. \r\n\t
    171. --bladeenc  
    172. \r\n\t
    173.     use bladeenc to encode mp3 files.  
    174. \r\n\t
    175.   
    176. \r\n\t
    177. The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    178. \r\n\t
    179.   
    180. \r\n\t
    181. Special Options:  
    182. \r\n\t
    183.   
    184. \r\n\t
    185. --in-optionhook=ARG  
    186. \r\n\t
    187.     add ARG to infile conversion command. Possibly dangerous!  
    188. \r\n\t
    189. --out-optionhook=ARG  
    190. \r\n\t
    191.     add ARG to outfile conversion command. Possibly dangerous!   
    192. \r\n
    \r\n
    \r\n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。\r\n\r\n3、使用示例\r\n\r\n如下简要的写几个使用的示例:\r\n
    \r\n
    使用示例:
    \r\n
      \r\n\t
    1. $ sneetchalizer song.mp3  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. The most simple possible example, creates 'song.wav'.  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    10. \r\n\t
    11.   
    12. \r\n\t
    13. This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    18. \r\n\t
    19.   
    20. \r\n\t
    21. Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    22. \r\n\t
    23.   
    24. \r\n\t
    25. $ sneetchalizer --out=mp3 --out-optionhook=\"--preset extreme\" /some/wavs  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    34. \r\n\t
    35.   
    36. \r\n\t
    37. Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    38. \r\n\t
    39.   
    40. \r\n\t
    41. $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    42. \r\n\t
    43.   
    44. \r\n\t
    45. Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    46. \r\n
    \r\n
    \r\n4、注意事项\r\n\r\n本脚本只是粘合剂,其他的tool还是需要另外安装的。\r\n\r\n其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。\r\n\r\n\r\n\r\n\r\n ", "created_at"=>2008-10-09 02:49:27 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前几天写了“采用Ruby提取MP3的metadata信息”后,就在寻找成熟的Ruby代码做差不多的事情,今天找到一个sneetchalizer,仔细的看了下,非常强大。

    \n\n\n

    sneetchalizer其实只是个粘合剂,因为在*unix下,audio格式转换的lib已经非常丰富和成熟,例如lame,gogo,bladeenc,mplayer等等就非常好用;另外,关于audio的tag信息和metadata信息的提取也有比较成熟的lib了,类似id3lib-ruby library,wmainfo-rb library,ruby-ogginfo library等等。而sneetchalizer只是把这些tools粘合起来。

    \n\n

    其支持的格式有:'aac' 'aif' 'aifc' 'aiff' 'aiffc' 'ape' 'au' 'caf' 'cdda' 'cdr' 'copy' 'fap' 'flac' 'gsm''ircam' 'm4a' 'm4b' 'mat' 'mat4' 'mat5' 'mp2' 'mp3' 'mp4' 'mpc' 'mpp' 'nist' 'ofr''ofs' 'ogg' 'paf' 'pvf' 'raw' 'sd2' 'sds' 'sf' 'snd' 'spx' 'svx' 'tta' 'voc''vox' 'w64' 'wav' 'wma' 'wv' 'xi'

    \n\n

    使用sneetchalizer可以实现audio文件的格式转换和tag信息提取和写入,详细使用方法参考其主页上说明,下面简要的说说起安装方法和使用参数:

    \n\n

    1、安装方法

    \n\n

    直接下载其gz包,sneetchalizer-0.9.0是现在的最新版本。下载解包后可以看到:
    \n
    \nManifest:
    \n
    \n README                - You're reading it now.  
    \n LICENSE               - A copy of the GPL, under which sneetchalizer is released.  
    \n CHANGES               - sneetchalizer's cvs/svn commit log.  
    \n sneetchalizer         - The script itself.  
    \n sneetchalizer.1       - The manpage for sneetchalizer.  
    \n sneetchalizer.desktop - A KDE service menu for converting with Konqueror.  
    \n install.rb            - A quick and dirty script to install the sneetchalizer.  
    \n
    \n
    \n如果有root权限,可以直接运行install.rb,其会将sneetchalizer拷贝到/usr/bin下,将sneetchalizer.1拷贝到/usr/share/man/man1下。

    \n\n

    2、参数解释

    \n\n

    不翻译了,都挺简单明了的,如下:
    \n
    \nXML/HTML代码
    \n
    \n General options:  
    \n   
    \n -h or --help  
    \n     Print quick or full usage details respectively.  
    \n -r or --recursive  
    \n     Search directory arguments recursively for files to convert.  
    \n -d or --delete  
    \n     delete input files after successful conversion. May not be safe yet!!!  
    \n -v or --verbose  
    \n     makes sneetchalizer more chatty.  
    \n -s or --show-output  
    \n     shows output from conversion tool.  
    \n -p or --pretend  
    \n     don't convert anything. sneetchalizer will go through the motions and print out the commands it would run. Useful for preview- ing a complex command line to ensure it does what you intend. You should interpret this option's output with a grain of salt. For example, if you include the '--sanitize' option, the files will not really be renamed when using --pretend, and as such the command's output will not reflect that the filenames would be changed during an actual run.  
    \n -t or --terminate  
    \n     terminate sneetchalizer options. This is useful if you have to convert '--coolDir' or '-groovySong.mp3'. This is the only option whose order on the command line is significant.  
    \n -D ARG or --out-directory=ARG  
    \n     write all outfiles to a directory argument. This is useful if you want to (re)encode files directly to a mounted portable device.  
    \n --strict and --pedantic  
    \n     many errors that sneetchalizer may encounter are recoverable, such as specifying a directory as argument that contains no files to convert, or conversion failures in general. By default the script will print an error message and move on to the next file. If you use '--strict' then sneetchalizer will bail out at the first sign of trouble except for tag errors. With '--pedantic' the script will stop even on tag errors.   
    \n --stasis  
    \n     Preserve timestamp (mtime) of original file.  
    \n --threads [N]  
    \n     Experimental. Use threads to create concurrent jobs. This option takes an optional integer argument which represents the number of threads to launch. The default is two. Preliminary tests suggest there is little advantage (and even diminishing returns) when setting this number greater than the number of cores/CPUs you have. Due to the asychronous nature of threads the --verbose and --show-output flags will be silently disabled and most screen output is supressed.   
    \n --sanitize  
    \n     Removes ,, ;, :, ', ", %, @, #, and ` from filenames and tags.  
    \n -n [FORMAT] or --rename[=FORMAT]  
    \n     rename all outfiles (and temporary wavs) according to FORMAT. FORMAT is a string with special designators to be pulled from the file tags. The following options are available:  
    \n   
    \n         * %t Song title  
    \n         * %b Album title  
    \n         * %n Track number  
    \n         * %a Artist name  
    \n         * %y Year  
    \n         * %g Genre  
    \n         * %c Comment field  
    \n   
    \n     Directories may be created with this command, as in "%b/%n - %t". The default value of FORMAT is "%n %t".   
    \n   
    \n Bitrate/Quality/Compression options:  
    \n   
    \n -b or --bitrate  
    \n     mp3/ogg/m4a bitrate.  
    \n -q or --quality  
    \n     mp3/ogg quality.  
    \n   
    \n quality and bitrate are passed directly to lame or oggenc depending on mp3 or ogg output format respectively. Both tools can handle either a bitrate or quality argument, so it is important to understand what values are valid for the underlying tool in your specific use case. faac will accept a bitrate argument, but not a quality argument. These options will be silently ignored for any output formats other than mp3, ogg or m4a. Make sure you know what you are doing if you decide to use both in one run, and read each tools manpage for valid values. If these options are omitted the tools builtin defaults are used (-q3 for oggenc and -q5 for lame).  
    \n   
    \n -c or --compression  
    \n     flac/mac compression level.  
    \n   
    \n this option allows you to pass a compression argument to flac and mac. See 'flac --help' and/or 'mac --help' if you don't know what this means.  
    \n   
    \n Format Options:  
    \n   
    \n --out=format  
    \n     output format. Default is wav.  
    \n --in=format[,format..]  
    \n     input format(s). Default is wav.  
    \n   
    \n Valid output formats are: "aac", "aif", "aifc", "aiff", "aiffc", "ape", "au", "cdr", "cdda", "copy", "flac", "m4a", "m4b", "mpc", "mp4", "mpp", "mp3", "mp2", "ofr", "ofs", "ogg", "snd", "spx", "tta", "wav", "wv". Valid input formats are all of the above plus "wma". You can specify multiple input formats using a comma: 'mp3,m4a,wma'. Input format is only neccesary when passing directory arguments, as file arguments are handled by context (read: file extension). The "copy" output option copies files directly, bypassing decoding/encoding steps (useful in conjunction with --rename).  
    \n   
    \n Tagging Options:  
    \n   
    \n --tt or --title  
    \n     Set 'title' tag.  
    \n --ta or --artist  
    \n     Set 'artist' tag.  
    \n --tl or --album  
    \n     Set 'album' tag.  
    \n --ty or --year  
    \n     Set 'year' tag.  
    \n --tc or --comment  
    \n     Set 'comment' tag.  
    \n --tg or --genre  
    \n     Set 'genre' tag.  
    \n --tn or --trackn  
    \n     Set 'track number' tag.  
    \n   
    \n The short and long versions are different in an important way: Using the long version will clobber any existing tags. The short version will only set the tag if the existing tag has no value. Note that these tags will be placed in _every_ outfile during the run.  
    \n   
    \n Alternative Encoder/Decoder Options:  
    \n   
    \n --gogo  
    \n     use gogo to encode mp3 files.  
    \n --bladeenc  
    \n     use bladeenc to encode mp3 files.  
    \n   
    \n The default is still 'lame'. If 'lame' is not found, the script will search for one of these two encoders regardless if these options are passed or not.  
    \n   
    \n Special Options:  
    \n   
    \n --in-optionhook=ARG  
    \n     add ARG to infile conversion command. Possibly dangerous!  
    \n --out-optionhook=ARG  
    \n     add ARG to outfile conversion command. Possibly dangerous!   
    \n
    \n
    \n另外,你可以运行sneetchalizer -h看到简要的使用说明,也可以使用sneetchalizer --help看到详细的使用信息。

    \n\n

    3、使用示例

    \n\n

    如下简要的写几个使用的示例:
    \n
    \n使用示例:
    \n
    \n $ sneetchalizer song.mp3  
    \n   
    \n The most simple possible example, creates 'song.wav'.  
    \n   
    \n $ sneetchalizer --out=ogg --in=flac -q5 /some/music/dir  
    \n   
    \n This example converts every flac file in '/some/music/dir' to ogg format at quality 5.  
    \n   
    \n $ sneetchalizer -d --out=mp3 --in=ogg,m4a,wma -b 160 .  
    \n   
    \n Converts every ogg, m4a, and wma file in the current directory to a 160 kbps constant bitrate mp3 file. The original files are deleted.  
    \n   
    \n $ sneetchalizer --out=mp3 --out-optionhook="--preset extreme" /some/wavs  
    \n   
    \n Here we encode every wav in '/some/wavs' to mp3 format passing '--preset extreme' directly to lame.  
    \n   
    \n $ sneetchalizer --in=ogg --out=ogg --quality=1 norvegianWood.ogg /some/more/oggs  
    \n   
    \n Using the same --in and --out format allows us to resample/encode the file at a different bitrate or quality. Note that this will overwrite the original file so only do this on a copy, or use '-D' to write files to another directory.  
    \n   
    \n $ sneetchalizer --in=ogg --out=m4a -D /mnt/ipod/ /some/oggs  
    \n   
    \n Here we re-encode some ogg files to m4a format and write them to our mounted iPod.   
    \n
    \n
    \n4、注意事项

    \n\n

    本脚本只是粘合剂,其他的tool还是需要另外安装的。

    \n\n

    其他信息请参考其主页说明,如果您有这个方面的问题或经验,欢迎和我讨论。

    \n\n\n

     

    \n", "_id"=>415}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["架构"], "comments_count"=>0, "category_id"=>9, "title"=>"网站架构文章列表(持续更新中)", "body"=>"互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。\n\n对dbanotes等表示感谢。\n\nWikiPedia 技术架构学习分享\nhttp://www.dbanotes.net/opensource/wikipedia_arch.html\n\nYouTube 的架构扩展\nhttp://www.dbanotes.net/opensource/youtube_web_arch.html\n\nLinkedIn 架构笔记\nhttp://www.dbanotes.net/arch/linkedin.html\n\nLinkedIn 架构与开发过程\nhttp://www.dbanotes.net/arch/linkedin_soa.html\n\nInternet Archive 的海量存储浅析\nhttp://www.dbanotes.net/database/internet_archive_storage.html\n\nTailrank 网站架构\nhttp://www.dbanotes.net/review/tailrank_arch.html\n\nTwitter 的架构扩展: 100 倍性能提升\nhttp://www.dbanotes.net/arch/twitter_arch.html\n\n财帮子(caibangzi.com)网站架构\nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html\n\nYupoo! 的网站技术架构\nhttp://www.dbanotes.net/arch/yupoo_arch.html\n\n37Signals 架构\nhttp://www.dbanotes.net/arch/37signals_arch.html\n\nFlickr 的访问统计实现以及其他\nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html\n\nPlentyOfFish 网站架构学习\nhttp://www.dbanotes.net/arch/plentyoffish_arch.html\n\nYahoo!社区架构\nhttp://www.dbanotes.net/arch/yahoo_arch.html\n\n有关 Alexa 与 AOL 部署集群文件系统\nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html\n\neBay 的存储一瞥\nhttp://www.dbanotes.net/arch/ebay_storage.html\n\neBay 的数据量\nhttp://www.dbanotes.net/database/ebay_storage.html\n\neBay 的数据库分布扩展架构\nhttp://www.dbanotes.net/database/ebay_database_scale_out.html\n\neBay 的数据层扩展经验\nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html\n\neBay 的应用服务器规模\nhttp://www.dbanotes.net/web/ebay_application_server.html\n\n性能扩展问题要趁早\nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\nFacebook 的 PHP 性能与扩展性\nhttp://www.dbanotes.net/arch/facebook_php.html\n\nSkype 用 PostgreSQL 支撑海量用户\nhttp://www.dbanotes.net/arch/skype_postgresql.html\n\n闲谈 Web 图片服务器\nhttp://www.dbanotes.net/web/web_image_server.html\n\n说说北京奥运购票系统瘫痪这事儿\nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html\n\nArchitectures You’ve Always Wondered About\nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82\n\neBay’s Architectural Principles\nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf\n\nBuilding a large scale SaaS app\nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf\n\nScaling an early stage startup\nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup\n\n互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)\nhttp://www.flashmov.com/blog_1632.html\n\nQQ游戏百万人同时在线服务器架构实现\nhttp://www.libing.net.cn/read.php?41\n\n大型Web2.0站点构建技术初探\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx\n\nWeb站点数据库分布存储浅谈\nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx\n\nQQ的架构讨论\nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285\n\nNotes from Scaling MySQL - Up or Out\nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/\n\nYapache-Yahoo! Apache 的秘密\nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html\n\nScalability Best Practices: Lessons from eBay\nhttp://www.infoq.com/articles/ebay-scalability-best-practices", "created_at"=>2008-10-09 06:51:05 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    互联网越来越开放,技术人员也越来越乐于分享,分析构架、演变和遇到的问题,虽然说没有真正经历过,很多体验可能会没那么深,但是有些东西提前了解会有诸多好处。在很多地方看到类似的构架分析、分享的文章,统一收集整理如下,遇到其他的,我会持续更新,如果经历允许,我还会写一些读后感或者点评;如果你看到其他的类似文章或者点评,欢迎留言让我知道。

    \n\n

    对dbanotes等表示感谢。

    \n\n

    WikiPedia 技术架构学习分享
    \nhttp://www.dbanotes.net/opensource/wikipedia_arch.html

    \n\n

    YouTube 的架构扩展
    \nhttp://www.dbanotes.net/opensource/youtube_web_arch.html

    \n\n

    LinkedIn 架构笔记
    \nhttp://www.dbanotes.net/arch/linkedin.html

    \n\n

    LinkedIn 架构与开发过程
    \nhttp://www.dbanotes.net/arch/linkedin_soa.html

    \n\n

    Internet Archive 的海量存储浅析
    \nhttp://www.dbanotes.net/database/internet_archive_storage.html

    \n\n

    Tailrank 网站架构
    \nhttp://www.dbanotes.net/review/tailrank_arch.html

    \n\n

    Twitter 的架构扩展: 100 倍性能提升
    \nhttp://www.dbanotes.net/arch/twitter_arch.html

    \n\n

    财帮子(caibangzi.com)网站架构
    \nhttp://www.dbanotes.net/arch/caibangzi_web_arch.html

    \n\n

    Yupoo! 的网站技术架构
    \nhttp://www.dbanotes.net/arch/yupoo_arch.html

    \n\n

    37Signals 架构
    \nhttp://www.dbanotes.net/arch/37signals_arch.html

    \n\n

    Flickr 的访问统计实现以及其他
    \nhttp://www.dbanotes.net/arch/flickr_stats_and_dathan.html

    \n\n

    PlentyOfFish 网站架构学习
    \nhttp://www.dbanotes.net/arch/plentyoffish_arch.html

    \n\n

    Yahoo!社区架构
    \nhttp://www.dbanotes.net/arch/yahoo_arch.html

    \n\n

    有关 Alexa 与 AOL 部署集群文件系统
    \nhttp://www.dbanotes.net/arch/alexa_ibrix_san_file_system.html

    \n\n

    eBay 的存储一瞥
    \nhttp://www.dbanotes.net/arch/ebay_storage.html

    \n\n

    eBay 的数据量
    \nhttp://www.dbanotes.net/database/ebay_storage.html

    \n\n

    eBay 的数据库分布扩展架构
    \nhttp://www.dbanotes.net/database/ebay_database_scale_out.html

    \n\n

    eBay 的数据层扩展经验
    \nhttp://www.dbanotes.net/arch/ebay_db_scale_out.html

    \n\n

    eBay 的应用服务器规模
    \nhttp://www.dbanotes.net/web/ebay_application_server.html

    \n\n

    性能扩展问题要趁早
    \nhttp://www.dbanotes.net/arch/scaling_an_early_stage_startup.html

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    Facebook 的 PHP 性能与扩展性
    \nhttp://www.dbanotes.net/arch/facebook_php.html

    \n\n

    Skype 用 PostgreSQL 支撑海量用户
    \nhttp://www.dbanotes.net/arch/skype_postgresql.html

    \n\n

    闲谈 Web 图片服务器
    \nhttp://www.dbanotes.net/web/web_image_server.html

    \n\n

    说说北京奥运购票系统瘫痪这事儿
    \nhttp://www.dbanotes.net/review/beijing_olympic_ticketes_system_crash.html

    \n\n

    Architectures You’ve Always Wondered About
    \nhttp://qcon.infoq.com/london-2008/tracks/show_track.jsp?trackOID=82

    \n\n

    eBay’s Architectural Principles
    \nhttp://www.eos1.dk/qcon-london-2008/slides/RandyShoup_eBaysArchitecturalPrinciples.pdf

    \n\n

    Building a large scale SaaS app
    \nhttp://www.eos1.dk/qcon-london-2008/slides/Dan_Hanley_Building_a_large_scale_SaaS_app.pdf

    \n\n

    Scaling an early stage startup
    \nhttp://www.scribd.com/doc/429986/Scaling-an-early-stage-startup

    \n\n

    互联星空播客架构(原文在张宴blog上,但是后来文章撤下,很可惜.此为转载)
    \nhttp://www.flashmov.com/blog_1632.html

    \n\n

    QQ游戏百万人同时在线服务器架构实现
    \nhttp://www.libing.net.cn/read.php?41

    \n\n

    大型Web2.0站点构建技术初探
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1890793.aspx

    \n\n

    Web站点数据库分布存储浅谈
    \nhttp://blog.csdn.net/heiyeshuwu/archive/2007/11/18/1891639.aspx

    \n\n

    QQ的架构讨论
    \nhttp://groups.google.com/group/dev4server/browse_thread/thread/0d72668d11c4886b/a6d202489cabf285#a6d202489cabf285

    \n\n

    Notes from Scaling MySQL - Up or Out
    \nhttp://venublog.com/2008/04/16/notes-from-scaling-mysql-up-or-out/

    \n\n

    Yapache-Yahoo! Apache 的秘密
    \nhttp://www.dbanotes.net/web/yapache_yahoo_apache.html

    \n\n

    Scalability Best Practices: Lessons from eBay
    \nhttp://www.infoq.com/articles/ebay-scalability-best-practices

    \n", "_id"=>416}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Gmail"], "comments_count"=>0, "category_id"=>4, "title"=>"Gmail快捷键整理", "body"=>"Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
    快捷键定义作用
    cCompose 撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    <tab> then <Enter>Send message新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    kMove to newer conversation在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    jMove to older conversation在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    nNext message查看邮件时,定位光标到
    pPrevious message移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    o or <Enter>Open打开会话。在“Conversation View”中,也可用于打开消息。
    uReturn to conversation list刷新页面、返回收件箱或返回会话列表
    yArchive*\r\nRemove from current view\r\n

    删除会话或消息。\r\n在收件箱中,<Y>可“存档”选中的会话

    \r\n\r\n
      \r\n\t
    • 在“已加星标示”中,<Y>可取消选中会话的星号;
    • \r\n\t
    • 在查看有标签的邮件时,<Y>可取消标签。
    • \r\n\t
    • 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    • \r\n
    \r\n
    xSelect conversation选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    sStar a message or conversation为会话或消息加星标。
    !Report spam将消息标记为垃圾邮件并从会话中删除
    rReply回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    aReply all回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    fForward转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    <Esc>Escape from input fieldRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    y then oArchive and next存档选中的会话并打开下一个
    g then aGo to 'All Mail'转到“所有邮件”
    g then sGo to 'Starred'转到“已加星标”
    g then cGo to 'Contacts'转到“通讯录”
    g then dGo to 'Drafts'转到“草稿”
    g then iGo to 'Inbox'转到“收件箱”
    /Search将光标定位到搜索栏中的输入框中
    \r\n ", "created_at"=>2008-10-13 07:59:32 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Google的产品很多都深得我心,一直在使用,整理整合了一些Gmail的快捷方式,备忘。
    \n
    \n
    \n
    \n快捷键
    \n定义
    \n作用
    \n
    \n
    \nc
    \nCompose 
    \n撰写新邮件。“Shift+C”打开新窗口撰写新邮件
    \n
    \n
    \n<tab> then <Enter>
    \nSend message
    \n新邮件撰写完后,先<tab>后<Enter>可发送邮件。(在Windows中,使用IE和Firefox有效)
    \n
    \n
    \nk
    \nMove to newer conversation
    \n在收件箱中,向上移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封新邮件
    \n
    \n
    \nj
    \nMove to older conversation
    \n在收件箱中,向下移动光标,按<Enter>查看邮件;在查看邮件时,打开下一封旧邮件
    \n
    \n
    \nn
    \nNext message
    \n查看邮件时,定位光标到
    \n
    \n
    \np
    \nPrevious message
    \n移动光标到前一个消息。<Enter>展开或折叠消息。(只在“会话模式”(Conversation View)中有效)
    \n
    \n
    \no or <Enter>
    \nOpen
    \n打开会话。在“Conversation View”中,也可用于打开消息。
    \n
    \n
    \nu
    \nReturn to conversation list
    \n刷新页面、返回收件箱或返回会话列表
    \n
    \n
    \ny
    \nArchive*
    \nRemove from current view
    \n
    \n删除会话或消息。
    \n在收件箱中,<Y>可“存档”选中的会话

    \n\n

    在“已加星标示”中,<Y>可取消选中会话的星号;
    \n 在查看有标签的邮件时,<Y>可取消标签。
    \n 在“垃圾邮件”、“已发邮件”和“所有邮件”中,<Y>没有作用
    \n
    \n
    \n
    \n
    \nx
    \nSelect conversation
    \n选中会话,配合其他快捷键可为会话存档、添加标签或从下拉菜单中选择其他命令
    \n
    \n
    \ns
    \nStar a message or conversation
    \n为会话或消息加星标。
    \n
    \n
    \n!
    \nReport spam
    \n将消息标记为垃圾邮件并从会话中删除
    \n
    \n
    \nr
    \nReply
    \n回复邮件或会话。“shift+r”可在新窗口中回复消息(只在“会话模式”中有效)
    \n
    \n
    \na
    \nReply all
    \n回复所有收件人。“Shift+a”可打开新窗口中回复。(PConline注:如果邮件有抄送地址,<r>回复发件人,<a>则回复所有抄送地址)
    \n
    \n
    \nf
    \nForward
    \n转发消息。“Shift+f”可打开新窗口转发。(只在“查看消息模式”(“Conversation View”)中有效)
    \n
    \n
    \n<Esc>
    \nEscape from input field
    \nRemoves the cursor from your current input field.(PConline注:在中文版Gmail中暂未有效果)
    \n
    \n
    \ny then o
    \nArchive and next
    \n存档选中的会话并打开下一个
    \n
    \n
    \ng then a
    \nGo to 'All Mail'
    \n转到“所有邮件”
    \n
    \n
    \ng then s
    \nGo to 'Starred'
    \n转到“已加星标”
    \n
    \n
    \ng then c
    \nGo to 'Contacts'
    \n转到“通讯录”
    \n
    \n
    \ng then d
    \nGo to 'Drafts'
    \n转到“草稿”
    \n
    \n
    \ng then i
    \nGo to 'Inbox'
    \n转到“收件箱”
    \n
    \n
    \n/
    \nSearch
    \n将光标定位到搜索栏中的输入框中
    \n
    \n
    \n
    \n 

    \n", "_id"=>417}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["analyzer"], "comments_count"=>0, "category_id"=>7, "title"=>"Request-log-analyzer: Rails&Merb的日志分析", "body"=>"生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :\r\n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)\r\n\r\n安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer\r\n\r\n使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log\r\n\r\n --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring\r\n\r\n示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log\r\n\r\nRequest log analyzer, by Willem van Bergen and Bart ten Brinke\r\n\r\nProcessing all log lines...========================================================================Successfully analyzed 58908 requests from log file\r\n\r\nTimestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).\r\n\r\nTop 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........\r\n\r\nTop 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........\r\n\r\nTop 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........\r\n\r\nTop 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........\r\n\r\nMongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........\r\n\r\nRequests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........\r\n\r\nErrors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method `code' for nil:NilClass```", "created_at"=>2008-10-13 08:45:11 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    生产环境下,需要对环境持续监控以尽快的发现问题,找到耗费资源较多的地方加以改进,比较常见的做法是使用moint或者God实时监控;另外,还可以定期分析日志找到特定的请求,虽然可以是shell来做这件事,但是何必再造轮子呢,因为我们已经有了Request log analyzer :
    \n``简介:This is a simple command line tool to analyze request log files of both Rails andMerb. Its purpose is to find what actions are best candidates for optimization.This tool will parse all requests in the logfile and aggregate theinformation. Once it is finished parsing the log file, it will show therequests that take op most server time. Different metrics are used (cumulativetime, average time, blockers, DB time, etc)

    \n\n

    安装:gem sources -a http://gems.github.comsudo gem install wvanbergen-request-log-analyzer

    \n\n

    使用:Usage: request-log-analyzer [FILE] [OPTION]Analyze the given log FILE with the given OPTIONExample: request-log-analyzer mongrel.log

    \n\n

    --fast, -t: Only use completed requests --guess-database-time, -g: Guesses the database duration of requests if they are not in the log --output, -o: Comma-separated list of reports to show --amount, -c: Displays the top <amount> elements in the reports --colorize, -z: Fancy bash coloring

    \n\n

    示例:Note that this example was shortened for your viewing pleasure.$ request-log-analyzer /var/log/my_app.log

    \n\n

    Request log analyzer, by Willem van Bergen and Bart ten Brinke

    \n\n

    Processing all log lines...========================================================================Successfully analyzed 58908 requests from log file

    \n\n

    Timestamp first request: 2008-07-13T06:25:58+00:00Timestamp last request: 2008-07-20T06:18:53+00:00Total time analyzed: 7 daysMethods: DELETE (1%), GET (50%), POST (22%), PUT (25%).

    \n\n

    Top 10 most requested actions========================================================================/overview/:date/ : 19359 requests/overview/day/:date/ : 6365 requests/overview/:date/set/ : 5589 requests/overview/ : 3985 requests/clients/:id/ : 1976 requests........

    \n\n

    Top 10 actions by time - cumulative========================================================================/overview/:date/ : 9044.582s [19359 requests]/overview/ : 8478.767s [3985 requests]/overview/:date/set/ : 3309.041s [5589 requests]/clients/:id/products/:id/ : 1479.911s [924 requests]/clients/:id/ : 750.080s [1976 requests]........

    \n\n

    Top 10 actions by time - per request mean========================================================================/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]/clients/:id/ : 0.380s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - cumulative time========================================================================/overview/:date/ : 8773.993s [19359 requests]/overview/ : 8394.754s [3985 requests]/overview/:date/set/ : 3307.928s [5589 requests]/clients/:id/products/:id/ : 1425.220s [924 requests]/clients/:id/ : 535.229s [1976 requests]........

    \n\n

    Top 10 worst DB offenders - mean time========================================================================/overview/:id/:id/:id/print/ : 6.994s [448 requests]/overview/ : 2.128s [3985 requests]/clients/:id/products/:id/ : 1.602s [924 requests]/overview/:date/set/ : 0.592s [5589 requests]/overview/:date/ : 0.467s [19359 requests]........

    \n\n

    Mongrel process blockers (> 1.0 seconds)========================================================================/overview/:date/ : 7494.233s [3144 requests]/overview/ : 8320.293s [1549 requests]/overview/:date/set/ : 1149.235s [803 requests]/overview/:id/:id/:id/print/new/ : 613.693s [341 requests]/clients/:id/products/:id/ : 1370.693s [313 requests]........

    \n\n

    Requests graph - per hour======================================================================== ........ 7:00 - 2731 : XXXXXXX 8:00 - 6139 : XXXXXXXXXXXXXXXX 9:00 - 7465 : XXXXXXXXXXXXXXXXXXXX 10:00 - 7118 : XXXXXXXXXXXXXXXXXXX 11:00 - 7409 : XXXXXXXXXXXXXXXXXXX 12:00 - 6450 : XXXXXXXXXXXXXXXXX 13:00 - 5377 : XXXXXXXXXXXXXX 14:00 - 6058 : XXXXXXXXXXXXXXXX 15:00 - 4156 : XXXXXXXXXXX 16:00 - 2767 : XXXXXXX 17:00 - 1598 : XXXX 18:00 - 792 : XX ........

    \n\n

    Errors========================================================================ArgumentError: [237 requests] -> invalid dateStaleObjectError: [28 requests] -> Attempted to update a stale objectRuntimeError: [3 requests] -> Cannot destroy rule before it was createdStatementError: [2 requests] -> Mysql::Error: Deadlock found when trying to get lock; try restarting transactionNoMethodError: [1 requests] -> undefined method code' for nil:NilClass``

    \n", "_id"=>418}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx日志回滚和自动清理", "body"=>"当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。\r\n\r\n其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。\r\n\r\n1、Nginx Log Rotation\r\n\r\nNginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:\r\n``$ mv access.log access.log.0$ kill -USR1 `cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0\r\n\r\n2、自己写脚本#!/bin/shlog_dir=\"/var/log/httpd\"yesterday=`date +%Y%m%d -d '-1 day'`lastday =`date +%Y%m%d -d '-1 month'`/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 `cat /var/run/nginx.pid`/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```\r\n

    其他参考文档:

    \r\n\r\n
      \r\n\t
    1. 日志分割文档
    2. \r\n\t
    3. Apache和Resin产生大容量日志的解决办法
    4. \r\n\t
    5. Nginx的日志回滚
    6. \r\n
    \r\n

    ", "created_at"=>2008-10-14 06:25:53 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    当网站访问量大到一定程度后,其web server会有大量的访问和错误日志,比如apache,nginx等就常常很容易的达到几个G的日志文件,这个时候就会导致诸如磁盘空间紧张,系统反应迟钝等等系列的问题,需要手工清理日志。

    \n\n

    其实我们可以采取一些方法使得其日志自动回滚和删除,这里大概说说,后续再补充。

    \n\n

    1、Nginx Log Rotation

    \n\n

    Nginx有个Log Rotation模块,nginx will re-open it's logs in response to the USR1 signal.参考如下脚本:
    \n`$ mv access.log access.log.0$ kill -USR1cat master.nginx.pid`$ sleep 1$ gzip access.log.0 # do something with access.log.0

    \n\n

    2、自己写脚本#!/bin/shlog_dir="/var/log/httpd"yesterday=date +%Y%m%d -d '-1 day'lastday =date +%Y%m%d -d '-1 month'/bin/rm ${log_dir}/access.${lastday}.log/bin/rm ${log_dir}/error.${lastday}.log/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log/bin/mv ${log_dir}/error.log ${log_dir}/error.${yesterday}.logkill -USR1 cat /var/run/nginx.pid/bin/gzip ${log_dir}/access.${yesterday}.log &/bin/gzip ${log_dir}/error.${yesterday}.log &本脚本来自“Nginx的日志回滚”然后将该脚本保存在/etc/cron.daily目录里,或者在crontab里每日0点时运行。另外,还可以结合awstats进行日志分析,这里就不详细说了,可以参考车东的相关文章。```
    \n其他参考文档:

    \n\n

    日志分割文档
    \n Apache和Resin产生大容量日志的解决办法
    \n Nginx的日志回滚
    \n

    \n", "_id"=>419}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "xml"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby解析XML对比测试(Hpricot VS REXML VS libxml-ruby)", "body"=>"Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。\r\n一、原料\r\n
      \r\n\t
    • posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    • \r\n\t
    • timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    • \r\n
    \r\n二、解析过程\r\n1、REXML\r\n\r\nPros: In the standard library\r\nCons: Slow, I don’t like the name\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rexml/document].each { |x| require x }  
    2. \r\n\t
    3.   
    4. \r\n\t
    5. ##################################  
    6. \r\n\t
    7. # Parsing Delicious API Response #  
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. xml = File.read('posts.xml')  
    12. \r\n\t
    13. puts Benchmark.measure {  
    14. \r\n\t
    15.   doc, posts = REXML::Document.new(xml), []  
    16. \r\n\t
    17.   doc.elements.each('posts/post'do |p|  
    18. \r\n\t
    19.     posts << p.attributes  
    20. \r\n\t
    21.   end  
    22. \r\n\t
    23.   # pp posts  
    24. \r\n\t
    25. }  
    26. \r\n\t
    27.   
    28. \r\n\t
    29. ################################  
    30. \r\n\t
    31. # Parsing Twitter API Response #  
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. xml = File.read('timeline.xml')  
    36. \r\n\t
    37. puts Benchmark.measure {  
    38. \r\n\t
    39.   doc, statuses = REXML::Document.new(xml), []  
    40. \r\n\t
    41.   doc.elements.each('statuses/status'do |s|  
    42. \r\n\t
    43.     h = {:user => {}}  
    44. \r\n\t
    45.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    46. \r\n\t
    47.       h[a.intern] = s.elements[a].text  
    48. \r\n\t
    49.     end  
    50. \r\n\t
    51.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    52. \r\n\t
    53.       h[:user][a.intern] = s.elements['user'].elements[a].text  
    54. \r\n\t
    55.     end  
    56. \r\n\t
    57.     statuses << h  
    58. \r\n\t
    59.   end  
    60. \r\n\t
    61.   # pp statuses  
    62. \r\n\t
    63. }  
    64. \r\n
    \r\n
    \r\n``2、Hpricot```Pros: Cool name, created by _why, faster than REXML, also does HTML, creative APICons: Not as fast as libxml-ruby, more of an HTML parser linguistically (ie: uses innerHTML instead of text or content, etc.)```\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'hpricot''>= 0.6'  
    4. \r\n\t
    5. require 'hpricot'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   doc, posts = Hpricot::XML(xml), []  
    20. \r\n\t
    21.   (doc/:post).each do |p|  
    22. \r\n\t
    23.     posts << p.attributes  
    24. \r\n\t
    25.   end  
    26. \r\n\t
    27.   # pp posts  
    28. \r\n\t
    29. }  
    30. \r\n\t
    31.   
    32. \r\n\t
    33. ################################  
    34. \r\n\t
    35. # Parsing Twitter API Response #  
    36. \r\n\t
    37. ################################  
    38. \r\n\t
    39. xml = File.read('timeline.xml')  
    40. \r\n\t
    41. puts Benchmark.measure {  
    42. \r\n\t
    43.   doc, statuses = Hpricot::XML(xml), []  
    44. \r\n\t
    45.   (doc/:status).each do |s|  
    46. \r\n\t
    47.     h = {:user => {}}  
    48. \r\n\t
    49.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    50. \r\n\t
    51.       h[a.intern] = s.at(a).innerHTML  
    52. \r\n\t
    53.     end  
    54. \r\n\t
    55.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    56. \r\n\t
    57.       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    58. \r\n\t
    59.     end  
    60. \r\n\t
    61.     statuses << h  
    62. \r\n\t
    63.   end  
    64. \r\n\t
    65.   # pp statuses  
    66. \r\n\t
    67. }  
    68. \r\n
    \r\n
    \r\n3、libxml-ruby \r\n\r\nPros: Blistering fast\r\nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box\r\n
    \r\n
    Ruby代码
    \r\n
      \r\n\t
    1. %w[benchmark pp rubygems].each { |x| require x }  
    2. \r\n\t
    3. gem 'libxml-ruby''>= 0.8.3'  
    4. \r\n\t
    5. require 'xml'  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. ##################################  
    10. \r\n\t
    11. # Parsing Delicious API Response #  
    12. \r\n\t
    13. ##################################  
    14. \r\n\t
    15. xml = File.read('posts.xml')  
    16. \r\n\t
    17. puts Benchmark.measure {  
    18. \r\n\t
    19.   parser, parser.string = XML::Parser.new, xml  
    20. \r\n\t
    21.   doc, posts = parser.parse, []  
    22. \r\n\t
    23.   doc.find('//posts/post').each do |p|  
    24. \r\n\t
    25.     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    26. \r\n\t
    27.   end  
    28. \r\n\t
    29.   # pp posts  
    30. \r\n\t
    31. }  
    32. \r\n\t
    33.   
    34. \r\n\t
    35. ################################  
    36. \r\n\t
    37. # Parsing Twitter API Response #  
    38. \r\n\t
    39. ################################  
    40. \r\n\t
    41. xml = File.read('timeline.xml')  
    42. \r\n\t
    43. puts Benchmark.measure {  
    44. \r\n\t
    45.   parser, parser.string = XML::Parser.new, xml  
    46. \r\n\t
    47.   doc, statuses = parser.parse, []  
    48. \r\n\t
    49.   doc.find('//statuses/status').each do |s|  
    50. \r\n\t
    51.     h = {:user => {}}  
    52. \r\n\t
    53.     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    54. \r\n\t
    55.       h[a.intern] = s.find(a).first.content  
    56. \r\n\t
    57.     end  
    58. \r\n\t
    59.     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    60. \r\n\t
    61.       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    62. \r\n\t
    63.     end  
    64. \r\n\t
    65.     statuses << h  
    66. \r\n\t
    67.   end  
    68. \r\n\t
    69.   # pp statuses  
    70. \r\n\t
    71. }  
    72. \r\n
    \r\n
    \r\n``三、结论``````\r\n
    \r\n
    结果如下:
    \r\n
      \r\n\t
    1. =rexml  
    2. \r\n\t
    3. delicious     0.020000   0.000000   0.020000 (  0.021139)  
    4. \r\n\t
    5. twitter       0.940000   0.020000   0.960000 (  0.988666)  
    6. \r\n\t
    7.   
    8. \r\n\t
    9. =hpricot  
    10. \r\n\t
    11. delicious     0.010000   0.000000   0.010000 (  0.005548)  
    12. \r\n\t
    13. twitter       0.250000   0.010000   0.260000 (  0.258320)  
    14. \r\n\t
    15.   
    16. \r\n\t
    17. =libxml-ruby  
    18. \r\n\t
    19. delicious     0.000000   0.000000   0.000000 (  0.007829)  
    20. \r\n\t
    21. twitter       0.030000   0.010000   0.040000 (  0.034040)  
    22. \r\n
    \r\n
    \r\n``参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby``````", "created_at"=>2008-10-15 13:29:22 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Ruby可以很方便的解析XML格式的文档,目前用的比较多的lib主要有三个,分别是:REXML, Hpricot, libxml-ruby,如下选取两个XML文档,分别使用这三个lib解析,感受下各自的速度和易用性。
    \n一、原料
    \n
    \n posts.xml – Uses xml element for object (post) and xml attributes for object attributes
    \n timeline.xml – Uses xml element for object (status) and child xml elements for attributes
    \n
    \n二、解析过程
    \n1、REXML

    \n\n

    Pros: In the standard library
    \nCons: Slow, I don’t like the name
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rexml/document].each { |x| require x }  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = REXML::Document.new(xml), []  
    \n   doc.elements.each('posts/post') do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = REXML::Document.new(xml), []  
    \n   doc.elements.each('statuses/status') do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.elements[a].text  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.elements['user'].elements[a].text  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>2、Hpricot</strong><strong>Pros:</strong> Cool name, created by _why, faster than <span class="caps">REXML</span>, also does <span class="caps">HTML</span>, creative <span class="caps">API</span><strong>Cons:</strong> Not as fast as libxml-ruby, more of an <span class="caps">HTML</span> parser linguistically (ie: uses innerHTML instead of text or content, etc.)``
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'hpricot', '>= 0.6'  
    \n require 'hpricot'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   doc, posts = Hpricot::XML(xml), []  
    \n   (doc/:post).each do |p|  
    \n     posts << p.attributes  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   doc, statuses = Hpricot::XML(xml), []  
    \n   (doc/:status).each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.at(a).innerHTML  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.at('user').at(a).innerHTML  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n3、libxml-ruby

    \n\n

    Pros: Blistering fast
    \nCons: Hpricot has cooler name, REXML and Hpricot both feel easier to use out of the box
    \n
    \nRuby代码
    \n
    \n %w[benchmark pp rubygems].each { |x| require x }  
    \n gem 'libxml-ruby', '>= 0.8.3'  
    \n require 'xml'  
    \n   
    \n ##################################  
    \n # Parsing Delicious API Response #  
    \n ##################################  
    \n xml = File.read('posts.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, posts = parser.parse, []  
    \n   doc.find('//posts/post').each do |p|  
    \n     posts << p.attributes.inject({}) { |h, a| h[a.name] = a.value; h }  
    \n   end  
    \n   # pp posts  
    \n }  
    \n   
    \n ################################  
    \n # Parsing Twitter API Response #  
    \n ################################  
    \n xml = File.read('timeline.xml')  
    \n puts Benchmark.measure {  
    \n   parser, parser.string = XML::Parser.new, xml  
    \n   doc, statuses = parser.parse, []  
    \n   doc.find('//statuses/status').each do |s|  
    \n     h = {:user => {}}  
    \n     %w[created_at id text source truncated in_reply_to_status_id in_reply_to_user_id favorited].each do |a|  
    \n       h[a.intern] = s.find(a).first.content  
    \n     end  
    \n     %w[id name screen_name location description profile_image_url url protected followers_count].each do |a|  
    \n       h[:user][a.intern] = s.find('user').first.find(a).first.content  
    \n     end  
    \n     statuses << h  
    \n   end  
    \n   # pp statuses  
    \n }  
    \n
    \n
    \n<code class="ruby"><strong>三、结论</strong>
    \n<div class="codeText">
    \n<div class="codeHead">结果如下:</div>
    \n<ol class="dp-xml" start="1">
    \n <li class="alt"><span><span>=rexml  </span></span></li>
    \n <li><span>delicious     0.020000   0.000000   0.020000 (  0.021139)  </span></li>
    \n <li class="alt"><span>twitter       0.940000   0.020000   0.960000 (  0.988666)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=hpricot  </span></li>
    \n <li><span>delicious     0.010000   0.000000   0.010000 (  0.005548)  </span></li>
    \n <li class="alt"><span>twitter       0.250000   0.010000   0.260000 (  0.258320)  </span></li>
    \n <li><span>  </span></li>
    \n <li class="alt"><span>=libxml-ruby  </span></li>
    \n <li><span>delicious     0.000000   0.000000   0.000000 (  0.007829)  </span></li>
    \n <li class="alt"><span>twitter       0.030000   0.010000   0.040000 (  0.034040)  </span></li>
    \n</ol>
    \n</div>
    \n``<code class="ruby">参考文档:http://railstips.org/2008/8/12/parsing-xml-with-ruby
    ``

    \n", "_id"=>420}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["github"], "comments_count"=>0, "category_id"=>4, "title"=>"github is blocked !", "body"=>"Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:\r\n\r\n1、在hosts文件添加DNS映射\r\n\r\n65.74.177.129 github.com\r\n65.74.177.129 www.github.com\r\n\r\n2、使用其他的DNS服务器\r\n\r\n可以使用OpenDNS,比较见效。", "created_at"=>2008-10-15 16:09:46 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Github也撞墙了,不发表言论,对于我等天天往github上push/pull代码的人,真是无奈,没办法,自己动手解决一下吧,如下两种方法:

    \n\n

    1、在hosts文件添加DNS映射

    \n\n

    65.74.177.129 github.com
    \n65.74.177.129 www.github.com

    \n\n

    2、使用其他的DNS服务器

    \n\n

    可以使用OpenDNS,比较见效。

    \n", "_id"=>421}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["oauth"], "comments_count"=>0, "category_id"=>4, "title"=>"初识oauth: 为API访问授权提供一个开放的标准", "body"=>"最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。\r\noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。\r\n\r\nOAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.\r\n\r\nOAuth’s Goal\r\nWebsite X can access your protected data at API Y\r\n
      \r\n\t
    • All without sharing your password off-site
    • \r\n\t
    • especially when there isn’t one like with OpenID
    • \r\n
    \r\n其基本流程为:\r\n
      \r\n\t
    1. Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    2. \r\n\t
    3. You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    4. \r\n\t
    5. You store the RequestToken in your database or in the users session object
    6. \r\n\t
    7. You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    8. \r\n\t
    9. Your user is asked by the service provider to authorize your RequestToken
    10. \r\n\t
    11. Your user clicks yes and is redirected to your CallBack URL
    12. \r\n\t
    13. Your callback action exchanges the RequestToken for an AccessToken
    14. \r\n\t
    15. Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    16. \r\n\t
    17. ????
    18. \r\n\t
    19. PROFIT!!!
    20. \r\n
    \r\n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!\r\n\r\n参考文档:\r\n", "created_at"=>2008-10-15 16:28:21 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
    \noauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

    \n\n

    OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.
    \n
    \nOAuth’s Goal
    \nWebsite X can access your protected data at API Y
    \n
    \n All without sharing your password off-site
    \n especially when there isn’t one like with OpenID
    \n
    \n其基本流程为:
    \n
    \n Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
    \n You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
    \n You store the RequestToken in your database or in the users session object
    \n You redirect your user to the service providers authorize_url with the RequestToken’s key appended
    \n Your user is asked by the service provider to authorize your RequestToken
    \n Your user clicks yes and is redirected to your CallBack URL
    \n Your callback action exchanges the RequestToken for an AccessToken
    \n Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
    \n ????
    \n PROFIT!!!
    \n
    \n如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!
    \n
    \n参考文档:
    \n
    \n Developing OAuth clients in Ruby
    \n How to turn your rails site into an OAuth Provider 
    \n OAuth不断获得动力 
    \n Rails plugin for OAuth
    \n OAuth implementation for Ruby
    \n 豆瓣 API 认证授权说明
    \n The How of OAuth --这个PPT挺不错
    \n

    \n", "_id"=>422}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"一个终点会是另外一个新起点", "body"=>"我最终还是离职了,从考虑到最终决定,花了好几个月的时间,期间很多事情、很多人给我很深的影响。\r\n清晰的记得2006年秋天,我拿到Aspire的offer时的欢呼雀跃,还没出酒店就开始电话比尔告诉我被录用了,那个时候,哪里想到会离职,时间真快,可以改变很多东西。\r\n\r\n很多人需要感谢,我Aspire的同事,朋友,在我的第一份工作中给我莫大的鼓励和支持、帮助,关心。能很多程度的包容、理解和鼓励。好多人、好多事,都历历在目。\r\n\r\n工作是老板的,朋友是自己的,我在Aspire匆匆走过,却没有留下什么,真有愧意。有幸认识很多很好的同事、朋友,非常舍不得。\r\n\r\n已经没有回头。一个终点会是另外一个新起点!\r\n\r\n准备启航,请多给我点鼓励和祝福,谢谢!", "created_at"=>2008-10-20 03:27:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    我最终还是离职了,从考虑到最终决定,花了好几个月的时间,期间很多事情、很多人给我很深的影响。
    \n清晰的记得2006年秋天,我拿到Aspire的offer时的欢呼雀跃,还没出酒店就开始电话比尔告诉我被录用了,那个时候,哪里想到会离职,时间真快,可以改变很多东西。

    \n\n

    很多人需要感谢,我Aspire的同事,朋友,在我的第一份工作中给我莫大的鼓励和支持、帮助,关心。能很多程度的包容、理解和鼓励。好多人、好多事,都历历在目。

    \n\n

    工作是老板的,朋友是自己的,我在Aspire匆匆走过,却没有留下什么,真有愧意。有幸认识很多很好的同事、朋友,非常舍不得。

    \n\n

    已经没有回头。一个终点会是另外一个新起点!

    \n\n

    准备启航,请多给我点鼓励和祝福,谢谢!

    \n", "_id"=>423}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["shell"], "comments_count"=>0, "category_id"=>7, "title"=>"晒shell历史,看看哪个使用率最高!", "body"=>"晒历史的脚本:\r\n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head\r\n330 ll\r\n214 cd\r\n72 cat\r\n38 exit\r\n29 more\r\n27 tail\r\n20 vi\r\n17 cp\r\n16 ps\r\n15 down\r\n记录下而已~", "created_at"=>2008-10-20 07:37:36 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    晒历史的脚本:
    \n[ice@bj-web12]$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
    \n330 ll
    \n214 cd
    \n72 cat
    \n38 exit
    \n29 more
    \n27 tail
    \n20 vi
    \n17 cp
    \n16 ps
    \n15 down
    \n记录下而已~

    \n", "_id"=>424}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"新起点,来到北京", "body"=>"早上9:10分飞机,深圳-北京,一大早起来,托起行李就去机场了,一路都很顺利,只是登机后出了些状况,一直不起飞,被告知“航空管制”,一问原因,回答竟然是“XX地方在搞军事演习!”寒,这个理由真囧。\r\n\r\n9:10分的飞机一直到10:40才起飞,还好飞起来以后没啥耽误,2小时50分钟到达北京机场,领了行李,按照之前看的路线去找“机场快线”,25元,不贵,比打车便宜多了,很快就到三元桥,比打车快很多。\r\n\r\n车上接到蔡望琴同学的电话,开始没反应过来,就觉得这个名字好熟悉,呵呵,真是惊讶!怎么会有人知道我刚到北京呢?后来知晓是我在twitter上发的消息被raecoo看到了,呵呵。\r\n\r\n然后拖着行李(一个箱子,一个背包,一本电脑包,还有一个袋子装了一双球鞋和运动鞋)换乘10号线到国贸,找到SOHO小区,找到落脚点。\r\n\r\n一路下来还算顺利。\r\n\r\n晚上同事带去吃饺子,北京的饺子真大呀,比深圳的三个还大,赞。\r\n\r\n接下来就要尽快进入状态了,还有几个朋友要见,还有些事情要处理,终于来到北京了,一个新起点。", "created_at"=>2008-10-21 16:29:40 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    早上9:10分飞机,深圳-北京,一大早起来,托起行李就去机场了,一路都很顺利,只是登机后出了些状况,一直不起飞,被告知“航空管制”,一问原因,回答竟然是“XX地方在搞军事演习!”寒,这个理由真囧。

    \n\n

    9:10分的飞机一直到10:40才起飞,还好飞起来以后没啥耽误,2小时50分钟到达北京机场,领了行李,按照之前看的路线去找“机场快线”,25元,不贵,比打车便宜多了,很快就到三元桥,比打车快很多。

    \n\n

    车上接到蔡望琴同学的电话,开始没反应过来,就觉得这个名字好熟悉,呵呵,真是惊讶!怎么会有人知道我刚到北京呢?后来知晓是我在twitter上发的消息被raecoo看到了,呵呵。

    \n\n

    然后拖着行李(一个箱子,一个背包,一本电脑包,还有一个袋子装了一双球鞋和运动鞋)换乘10号线到国贸,找到SOHO小区,找到落脚点。

    \n\n

    一路下来还算顺利。

    \n\n

    晚上同事带去吃饺子,北京的饺子真大呀,比深圳的三个还大,赞。

    \n\n

    接下来就要尽快进入状态了,还有几个朋友要见,还有些事情要处理,终于来到北京了,一个新起点。

    \n", "_id"=>425}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"在crontab中调用rake task定时跑job", "body"=>"在Rails中可以使用很大插件来实现后台定时JOB,但是最环保的应该是使用crontab来调用rake,也很简单,基本上分成如下几步:\r\n\r\nin the root of my app i have notify_answerers.sh\r\n``#!/bin/shexport PATH='/usr/local/ruby/bin':$PATH cd /opt/dev/Monier/usr/local/ruby/bin/rake nginx:fetch_status RAILS_ENV=production```\r\nin myapp/lib/tasks i have myapp.rake\r\n``namespace :nginx do desc \"Notify answerers of new questions\" task :fetch_status => :environment do Nginx.find(:all).each do |nginx| puts \"nginx=\#{nginx.name}\" nginx.do_fetch_nginx_status_job nginx.update_attribute(:updated_at,Time.now) end endend```\r\nIn my cron file i have:\r\n``*/2 * * * * /bin/sh /opt/dev/Monier/lib/crontabs/fetch_nginx_status.sh```\r\n(use \"crotab -e\" on the server to edit this file)", "created_at"=>2008-10-24 16:51:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在Rails中可以使用很大插件来实现后台定时JOB,但是最环保的应该是使用crontab来调用rake,也很简单,基本上分成如下几步:

    \n\n

    in the root of my app i have notify_answerers.sh
    \n#!/bin/shexport PATH='/usr/local/ruby/bin':$PATH cd /opt/dev/Monier/usr/local/ruby/bin/rake nginx:fetch_status RAILS_ENV=production
    \nin myapp/lib/tasks i have myapp.rake
    \n
    namespace :nginx do desc "Notify answerers of new questions" task :fetch_status =&gt; :environment do Nginx.find(:all).each do |nginx| puts "nginx=\#{nginx.name}" nginx.do_fetch_nginx_status_job nginx.update_attribute(:updated_at,Time.now) end endend
    \nIn my cron file i have:
    \n
    */2 * * * * /bin/sh /opt/dev/Monier/lib/crontabs/fetch_nginx_status.sh```
    \n(use "crotab -e" on the server to edit this file)

    \n", "_id"=>426}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 2.2快来了,期待", "body"=>"

    Rails 2.2中将会有大量值得期待的功能,今天看到其weblog上发布“Rails 2.2 RC1: i18n, thread safety, docs, etag/last-modified, JRuby/1.9 compatibility”,从其标题可以看到,其包含了 i18n,thread safety,docs,etag,JRuby/1.9 compatibility等值得期待的功能。

    \n

    另外看到“Ruby on Rails 2.2 Release Notes”,其比较详细了列举了2.2版本中的新特性,非常棒!

    \n

    马上就要来了,继续期待,期待其线程安全,连接池等特性到底有多牛。

    \n

    等不及的可以先下载下来试试了:

    \n

    ````gem install rails -s http://gems.rubyonrails.org -v 2.2.0```

    \n

     

    ", "created_at"=>2008-10-24 17:57:35 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails 2.2中将会有大量值得期待的功能,今天看到其weblog上发布“Rails 2.2 RC1: i18n, thread safety, docs, etag/last-modified, JRuby/1.9 compatibility”,从其标题可以看到,其包含了 i18n,thread safety,docs,etag,JRuby/1.9 compatibility等值得期待的功能。
    \n另外看到“Ruby on Rails 2.2 Release Notes”,其比较详细了列举了2.2版本中的新特性,非常棒!
    \n马上就要来了,继续期待,期待其线程安全,连接池等特性到底有多牛。
    \n等不及的可以先下载下来试试了:
    \n`gem install rails -s http://gems.rubyonrails.org -v 2.2.0
    \n 

    \n", "_id"=>427}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在attachment_fu中通过URL上传文件", "body"=>"

    attachment_fu很多人都使用过吧,使用其上传文件非常方便(super easy),但是有没有想过通过URL来上传文件呢,比如网上的一张图片,一首歌曲等。

    \n

    按照平时的思路,我们需要下载到本地,保存到硬盘上,打开上传页面,浏览硬盘找到要上传的文件,点击上传,看,多麻烦,是吧!如果可以实现通过URL上传,那么其过程就异常简单了,输入URL,点击上传即可。

    \n

    已经有人提供了思路,也非常简单,多加个url属性即可,C的代码不用修改,举例如下:

    \n

     

    \n
    \n
    # app/models/upload.rb
    \n
      \n
    1. # app/models/upload.rb  
    2. \n
    3.    
    4. \n
    5. class Upload < ActiveRecord::Base  
    6. \n
    7.    
    8. \n
    9.   # ...normal attachment_fu code (has_attachment, etc)...  
    10. \n
    11.    
    12. \n
    13.   # allow uploads via URL  
    14. \n
    15.   require 'open-uri'  
    16. \n
    17.   attr_reader :url  
    18. \n
    19.   def url=(uri)  
    20. \n
    21.     return nil if uri.blank?  
    22. \n
    23.     io = (open(URI.parse(uri)) rescue return nil)  
    24. \n
    25.     (class << io; selfend;).class_eval do  
    26. \n
    27.       define_method(:original_filename) { base_uri.path.split('/').last }  
    28. \n
    29.     end  
    30. \n
    31.     self.uploaded_data = io  
    32. \n
    33.   end  
    34. \n
    35. end  
    36. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. # app/controllers/uploads_controller.rb  
    2. \n
    3.    
    4. \n
    5. class UploadsController < ApplicationController  
    6. \n
    7.    
    8. \n
    9.   # avoid raising exceptions for common errors (e.g. file not found)  
    10. \n
    11.   rescue_from Errno::ENOENT, :with => :url_upload_not_found  
    12. \n
    13.   rescue_from Errno::ETIMEDOUT, :with => :url_upload_not_found  
    14. \n
    15.   rescue_from OpenURI::HTTPError, :with => :url_upload_not_found  
    16. \n
    17.   rescue_from Timeout::Error, :with => :url_upload_not_found  
    18. \n
    19.    
    20. \n
    21.   def new  
    22. \n
    23.     @upload = Upload.new  
    24. \n
    25.   end  
    26. \n
    27.    
    28. \n
    29.   def create  
    30. \n
    31.     @upload = current_user.uploads.build(params[:upload])  
    32. \n
    33.     if @upload.save  
    34. \n
    35.       redirect_to files_path  
    36. \n
    37.     else  
    38. \n
    39.       render :action => "new"  
    40. \n
    41.     end  
    42. \n
    43.   end  
    44. \n
    45.    
    46. \n
    47.   def url_upload_not_found  
    48. \n
    49.     flash[:notice] = "Sorry, the URL you provided was not valid."  
    50. \n
    51.     redirect_to new_upload_path  
    52. \n
    53.   end  
    54. \n
    55. end  
    56. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. # app/views/uploads/new.html.erb  
    2. \n
    3.    
    4. \n
    5. <%= error_messages_for :upload %>  
    6. \n
    7. <% form_for @upload:html => { :multipart => true } do |f| -%>  
    8. \n
    9.   <%= f.file_field :uploaded_data # normal upload, or... %>  
    10. \n
    11.   <%= f.text_field :url # upload via url %>  
    12. \n
    13.   <%= submit_tag "Upload":disable_with => "Upload" %>  
    14. \n
    15. <% end %>  
    16. \n
    \n
    \n

    发现这个人还真勤快,写了代码El Dorado.还做了视频演示;

    \n

     

    \n

    \t\t\t\t
    \nEasy Upload via URL with attachment_fu from Trevor Turk on Vimeo.

    ", "created_at"=>2008-10-25 15:34:50 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    attachment_fu很多人都使用过吧,使用其上传文件非常方便(super easy),但是有没有想过通过URL来上传文件呢,比如网上的一张图片,一首歌曲等。
    \n按照平时的思路,我们需要下载到本地,保存到硬盘上,打开上传页面,浏览硬盘找到要上传的文件,点击上传,看,多麻烦,是吧!如果可以实现通过URL上传,那么其过程就异常简单了,输入URL,点击上传即可。
    \n已经有人提供了思路,也非常简单,多加个url属性即可,C的代码不用修改,举例如下:
    \n 
    \n
    \n# app/models/upload.rb
    \n
    \n # app/models/upload.rb  
    \n    
    \n class Upload < ActiveRecord::Base  
    \n    
    \n   # ...normal attachment_fu code (has_attachment, etc)...  
    \n    
    \n   # allow uploads via URL  
    \n   require 'open-uri'  
    \n   attr_reader :url  
    \n   def url=(uri)  
    \n     return nil if uri.blank?  
    \n     io = (open(URI.parse(uri)) rescue return nil)  
    \n     (class << io; self; end;).class_eval do  
    \n       define_method(:original_filename) { base_uri.path.split('/').last }  
    \n     end  
    \n     self.uploaded_data = io  
    \n   end  
    \n end  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n # app/controllers/uploads_controller.rb  
    \n    
    \n class UploadsController < ApplicationController  
    \n    
    \n   # avoid raising exceptions for common errors (e.g. file not found)  
    \n   rescue_from Errno::ENOENT, :with => :url_upload_not_found  
    \n   rescue_from Errno::ETIMEDOUT, :with => :url_upload_not_found  
    \n   rescue_from OpenURI::HTTPError, :with => :url_upload_not_found  
    \n   rescue_from Timeout::Error, :with => :url_upload_not_found  
    \n    
    \n   def new  
    \n     @upload = Upload.new  
    \n   end  
    \n    
    \n   def create  
    \n     @upload = current_user.uploads.build(params[:upload])  
    \n     if @upload.save  
    \n       redirect_to files_path  
    \n     else  
    \n       render :action => "new"  
    \n     end  
    \n   end  
    \n    
    \n   def url_upload_not_found  
    \n     flash[:notice] = "Sorry, the URL you provided was not valid."  
    \n     redirect_to new_upload_path  
    \n   end  
    \n end  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n # app/views/uploads/new.html.erb  
    \n    
    \n <%= error_messages_for :upload %>  
    \n <% form_for @upload, :html => { :multipart => true } do |f| -%>  
    \n   <%= f.file_field :uploaded_data # normal upload, or... %>  
    \n   <%= f.text_field :url # upload via url %>  
    \n   <%= submit_tag "Upload", :disable_with => "Upload" %>  
    \n <% end %>  
    \n
    \n
    \n发现这个人还真勤快,写了代码El Dorado.还做了视频演示;
    \n 
    \n
    \nEasy Upload via URL with attachment_fu from Trevor Turk on Vimeo.

    \n", "_id"=>428}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"MYSQL的MERGE存储引擎", "body"=>"

    MYSQL的引擎不是一般的多,这次说到的是MERGE,这个引擎有很多特殊的地方:

    \n

    MERGE引擎类型允许你把许多结构相同的表合并为一个表。然后,你可以执行查询,从多个表返回的结果就像从一个表返回的结果一样。每一个合并的表必须有同样的表定义。
    \n
    \nMERGE存储引擎在下面这种使用场合会最为有用,如果需要把日志纪录不停的录入MySQL数据库,并且每天、每周或者每个月都创建一个单一的表,而且要制作来自多个表的合计查询,MERGE表这时会非常有效。然而,这项功能有局限性。你只能合并MyISAM表而且必须严格遵守相同的表定义的限制。虽然这看起来好像是一个大问题,但是,如果你使用另外一种表类型(例如InnoDB),这种合并可能就不需要了。

    \n

    其创建方法如下:

    \n

    他将多个表在逻辑上当作一个表来查询。他建立后有两个文件,
    \n.frm 表结构定义
    \n.mrg union表的名字清单
    \n
    \n两个基本表:
    \nCREATE TABLE TEST_MERGE_1(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \nCREATE TABLE TEST_MERGE_2(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \n
    \nMERGE表的建立:
    \nCREATE TABLE TEST_MERGE(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(TEST_MERGE_1,TEST_MERGE_2) ;

    \n


    \n1. 此表类似于SQL中的union机制。
    \n2. 此表结构必须与基本表完全一致,包括列名、顺序。UNION表必须同属一个DATABASE。
    \n3. 基本表类型必须是MyISAM。
    \n4. 可以通过修改.mrg文件来修改MERGE表,每个基本表的名字占一行。注意:修改后要通过FLUSH TABLES刷新表缓存。
    \n5. 对基本表的更改可以直接反映在此表上。
    \n6. INSERT_METHOD的取值可以是: 0 不允许插入 FIRST 插入到UNION中的第一个表 LAST 插入到UNION中的最后一个表。(4.0之后可用)
    \n7. 定义在它上面的约束没有任何作用,约束是由基本表控制的,例如两个基本表中存在着同样的一个Key值,那么在MERGE表中会有两个一样的Key值。

    \n

     

    \n

    参考资料:

    \n

    http://biz.chinabyte.com/220/2230720.shtml

    \n

    http://info.codepub.com/2008/09/info-21832.html

    ", "created_at"=>2008-11-04 10:31:58 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    MYSQL的引擎不是一般的多,这次说到的是MERGE,这个引擎有很多特殊的地方:
    \nMERGE引擎类型允许你把许多结构相同的表合并为一个表。然后,你可以执行查询,从多个表返回的结果就像从一个表返回的结果一样。每一个合并的表必须有同样的表定义。
    \n
    \nMERGE存储引擎在下面这种使用场合会最为有用,如果需要把日志纪录不停的录入MySQL数据库,并且每天、每周或者每个月都创建一个单一的表,而且要制作来自多个表的合计查询,MERGE表这时会非常有效。然而,这项功能有局限性。你只能合并MyISAM表而且必须严格遵守相同的表定义的限制。虽然这看起来好像是一个大问题,但是,如果你使用另外一种表类型(例如InnoDB),这种合并可能就不需要了。
    \n其创建方法如下:
    \n他将多个表在逻辑上当作一个表来查询。他建立后有两个文件,
    \n.frm 表结构定义
    \n.mrg union表的名字清单
    \n
    \n两个基本表:
    \nCREATE TABLE TEST_MERGE_1(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \nCREATE TABLE TEST_MERGE_2(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MyISAM DEFAULT CHARSET=utf8
    \n
    \nMERGE表的建立:
    \nCREATE TABLE TEST_MERGE(
    \nID INT(5) NOT NULL,
    \nVALUE VARCHAR(100) NOT NULL,
    \nPRIMARY KEY(ID)
    \n) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(TEST_MERGE_1,TEST_MERGE_2) ;
    \n
    \n1. 此表类似于SQL中的union机制。
    \n2. 此表结构必须与基本表完全一致,包括列名、顺序。UNION表必须同属一个DATABASE。
    \n3. 基本表类型必须是MyISAM。
    \n4. 可以通过修改.mrg文件来修改MERGE表,每个基本表的名字占一行。注意:修改后要通过FLUSH TABLES刷新表缓存。
    \n5. 对基本表的更改可以直接反映在此表上。
    \n6. INSERT_METHOD的取值可以是: 0 不允许插入 FIRST 插入到UNION中的第一个表 LAST 插入到UNION中的最后一个表。(4.0之后可用)
    \n7. 定义在它上面的约束没有任何作用,约束是由基本表控制的,例如两个基本表中存在着同样的一个Key值,那么在MERGE表中会有两个一样的Key值。
    \n 
    \n参考资料:
    \nhttp://biz.chinabyte.com/220/2230720.shtml
    \nhttp://info.codepub.com/2008/09/info-21832.html

    \n", "_id"=>429}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Merb 1.0 Released", "body"=>"

    \"\"
    \nmerb的1.0终于出来了,等的实在不易,1.0版的merb已经足够完善了,可以拿来做一些production的东西了,例如以前说到的代替rails做上传文件等等。
    \nrubyinsite已经发了一篇参考资源文件,感兴趣的可以过去瞧瞧,地址如下:Merb 1.0 Released So Here’s 44 Links and Resources To Get You Going

    ", "created_at"=>2008-11-09 04:17:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    merb的1.0终于出来了,等的实在不易,1.0版的merb已经足够完善了,可以拿来做一些production的东西了,例如以前说到的代替rails做上传文件等等。
    \nrubyinsite已经发了一篇参考资源文件,感兴趣的可以过去瞧瞧,地址如下:Merb 1.0 Released So Here’s 44 Links and Resources To Get You Going。

    \n", "_id"=>430}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"升级ubuntu8.10未果", "body"=>"

    ubuntu8.10发布好几天了,最近一直很忙,没时间升级,今天得闲升级,却遇到一些问题,开始是找速度不错的源,后来是遇到/boot下空间 不足的问题,但是我的 /boot是 100M,按常理,应该足够了,其哦已经清理掉每次升级版本留下来的grup,现在只保留了最新一个版本的image,查看/boot下的文件,发现没啥 是大文件,却占了70多M的空间,奇怪,如下:

    \n

    iceskysl@IceskYsl:~$ cd /boot/
    \niceskysl@IceskYsl:/boot$ du sk *
    \ndu: 无法访问“sk”: 没有该文件或目录
    \n416    abi-2.6.24-21-generic
    \n80    config-2.6.24-21-generic
    \n179    grub
    \n7488    initrd.img-2.6.24-21-generic
    \ndu: 无法创建目录“lost+found”: Permission denied
    \n12    lost+found
    \n102    memtest86+.bin
    \n890    System.map-2.6.24-21-generic
    \n1885    vmlinuz-2.6.24-21-generic
    \niceskysl@IceskYsl:/boot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   7409400   2376680  76% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     39780    733172   6% /lib/modules/2.6.24-21-generic/volatile
    \n/dev/sda7                93307     73608     14882  84% /boot
    \n/dev/sda9              9614116   5299748   3825996  59% /home
    \n/dev/sda1             14195576  11835000   2360576  84% /media/sda1
    \n/dev/sda5             15366140  13796572   1569568  90% /media/sda5
    \n可以看到,占了77M的空间,但是du看到的却最大的也只有 8M,其他空间哪里去了?

    ", "created_at"=>2008-11-09 17:31:38 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    ubuntu8.10发布好几天了,最近一直很忙,没时间升级,今天得闲升级,却遇到一些问题,开始是找速度不错的源,后来是遇到/boot下空间 不足的问题,但是我的 /boot是 100M,按常理,应该足够了,其哦已经清理掉每次升级版本留下来的grup,现在只保留了最新一个版本的image,查看/boot下的文件,发现没啥 是大文件,却占了70多M的空间,奇怪,如下:
    \niceskysl@IceskYsl:~$ cd /boot/
    \niceskysl@IceskYsl:/boot$ du sk *
    \ndu: 无法访问“sk”: 没有该文件或目录
    \n416    abi-2.6.24-21-generic
    \n80    config-2.6.24-21-generic
    \n179    grub
    \n7488    initrd.img-2.6.24-21-generic
    \ndu: 无法创建目录“lost+found”: Permission denied
    \n12    lost+found
    \n102    memtest86+.bin
    \n890    System.map-2.6.24-21-generic
    \n1885    vmlinuz-2.6.24-21-generic
    \niceskysl@IceskYsl:/boot$ df
    \n文件系统           1K-块        已用     可用 已用% 挂载点
    \n/dev/sda8             10309796   7409400   2376680  76% /
    \nvarrun                  772952       228    772724   1% /var/run
    \nvarlock                 772952         0    772952   0% /var/lock
    \nudev                    772952        72    772880   1% /dev
    \ndevshm                  772952         0    772952   0% /dev/shm
    \nlrm                     772952     39780    733172   6% /lib/modules/2.6.24-21-generic/volatile
    \n/dev/sda7                93307     73608     14882  84% /boot
    \n/dev/sda9              9614116   5299748   3825996  59% /home
    \n/dev/sda1             14195576  11835000   2360576  84% /media/sda1
    \n/dev/sda5             15366140  13796572   1569568  90% /media/sda5
    \n可以看到,占了77M的空间,但是du看到的却最大的也只有 8M,其他空间哪里去了?

    \n", "_id"=>431}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"memcached维护及其数据遍历实现", "body"=>"

    需要时不时的看看memcached的状态,其自身只提供了get、set等方法啊我们需要使用其提供的方法遍历一下其缓存的内容,其原理请参考《如何对memcache的数据(key-value)进行遍历操作 》和《贴一段遍历memcached缓存对象的小脚本》。

    \n

    memcache的stats命令包括:
    \n
    \n1.        stats 
    \n2.        stats reset 
    \n3.        stats malloc 
    \n4.        stats maps 
    \n5.        stats sizes 
    \n6.        stats slabs 
    \n7.        stats items 
    \n8.        stats cachedump slab_id limit_num 
    \n9.        stats detail [on|off|dump]
    \n

    \n

    说说其实现遍历的原理:

    \n
      \n
    1. telnet到192.168.15.225(局域网测试机器)的memcache服务器;
    2. \n
    3. 执行stats items命令,可以看到出现 很多的items行。
    4. \n
    5. 执行stats cachedump 3 0命令。这里的3表示上面图中items后面的数字,0标示显示全部的数据,如果是1就标示只显示1条。
      \n 下图为执行后的结果,item后面的字符串为key
    6. \n
    7.  通过上面列出的key我们就可以遍历所有的数据了,下面我们取出某一条数据,key为Uc!uLh的数据。
    8. \n
    \n

    来两个遍历的代码:
    \n1、PHP版

    \n

    1.        <?php

    \n

    2.        $host='192.168.15.225';

    \n

    3.        $port=11211;

    \n

    4.        $mem=new Memcache();

    \n

    5.        $mem->connect($host,$port);

    \n

    6.        $items=$mem->getExtendedStats (‘items’);

    \n

    7.        $items=$items["$host:$port"]['items'];

    \n

    8.        for($i=0,$len=count($items);$i<$len;$i++){

    \n

    9.            $number=$items[$i]['number'];

    \n

    10.         $str=$mem->getExtendedStats ("cachedump",$number,0);

    \n

    11.         $line=$str["$host:$port"];

    \n

    12.         if( is_array($line) && count($line)>0){

    \n

    13.             foreach($line as $key=>$value){

    \n

    14.                 echo $key.'=>';

    \n

    15.                 print_r($mem->get($key));

    \n

    16.                 echo "\\r\\n";

    \n

    17.             }

    \n

    18.         }

    \n

    19.     }

    \n

    20.     ?>
    \n
    \n2、RUby版
    \n

    \n
      \n
    1. #!/usr/bin/env ruby  
    2. \n
    3. require 'socket'  
    4. \n
    5.   
    6. \n
    7. # stats  
    8. \n
    9. # stats reset  
    10. \n
    11. # stats malloc  
    12. \n
    13. # stats maps  
    14. \n
    15. # stats sizes  
    16. \n
    17. # stats slabs  
    18. \n
    19. # stats items  
    20. \n
    21. # stats cachedump slab_id limit_num  
    22. \n
    23. # stats detail [on|off|dump]  
    24. \n
    25.   
    26. \n
    27. class Memcache  
    28. \n
    29.   class << self  
    30. \n
    31.     def open(host, port)  
    32. \n
    33.       s = TCPSocket.open(host, port)  
    34. \n
    35.       yield s if block_given?  
    36. \n
    37.     ensure  
    38. \n
    39.       s.close if s  
    40. \n
    41.     end  
    42. \n
    43.     
    44. \n
    45.     def command(command_string, s)  
    46. \n
    47.       s.send(command_string + "\\r\\n", 0)  
    48. \n
    49.       buff = []  
    50. \n
    51.       until ["END""OK""DELETE""ERROR"].include?(line = s.gets.strip) do  
    52. \n
    53.         buff << line   
    54. \n
    55.       end  
    56. \n
    57.       buff  
    58. \n
    59.     end  
    60. \n
    61.     
    62. \n
    63.     def exec(command_string, host = "javaeye", port = 11211)  
    64. \n
    65.       open(host, port) { |socket| command(command_string, socket).each {|line| puts line } }  
    66. \n
    67.     end  
    68. \n
    69.       
    70. \n
    71.     def cache_stats(host = "javaeye", port = 11211)  
    72. \n
    73.       cache_objects = {}  
    74. \n
    75.       open(host, port) do |socket|  
    76. \n
    77.         slabs = []  
    78. \n
    79.         command("stats items", socket).each do |line|  
    80. \n
    81.           slab_id = line.split[1].split(":")[1].to_i  
    82. \n
    83.           slabs << slab_id unless slabs.include?(slab_id)  
    84. \n
    85.         end  
    86. \n
    87.         slabs.each do |slab_id|  
    88. \n
    89.           puts "browse slab \#{slab_id}..."  
    90. \n
    91.           command("stats cachedump \#{slab_id} 0", socket).each do |item|  
    92. \n
    93.             key = item.split[1].split("/")[0].to_s  
    94. \n
    95.             cache_objects.include?(key) ? cache_objects[key] += 1 : cache_objects[key] = 1  
    96. \n
    97.           end  
    98. \n
    99.         end  
    100. \n
    101.       end  
    102. \n
    103.       cache_objects.each_pair {|key, value| puts "\#{key} : \#{value}"}  
    104. \n
    105.     end  
    106. \n
    107.   end  
    108. \n
    109. end  
    110. \n
    111.   
    112. \n
    113. if ARGV.size == 0  
    114. \n
    115.   Memcache.cache_stats  
    116. \n
    117. else  
    118. \n
    119.   Memcache.exec(ARGV.join(" "))  
    120. \n
    121. end 
      \n
    122. \n
    ", "created_at"=>2008-11-09 18:52:03 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    需要时不时的看看memcached的状态,其自身只提供了get、set等方法啊我们需要使用其提供的方法遍历一下其缓存的内容,其原理请参考《如何对memcache的数据(key-value)进行遍历操作 》和《贴一段遍历memcached缓存对象的小脚本》。
    \nmemcache的stats命令包括:
    \n
    \n1.        stats 
    \n2.        stats reset 
    \n3.        stats malloc 
    \n4.        stats maps 
    \n5.        stats sizes 
    \n6.        stats slabs 
    \n7.        stats items 
    \n8.        stats cachedump slab_id limit_num 
    \n9.        stats detail [on|off|dump]
    \n
    \n说说其实现遍历的原理:
    \n
    \n telnet到192.168.15.225(局域网测试机器)的memcache服务器;
    \n 执行stats items命令,可以看到出现 很多的items行。
    \n 执行stats cachedump 3 0命令。这里的3表示上面图中items后面的数字,0标示显示全部的数据,如果是1就标示只显示1条。
    \n 下图为执行后的结果,item后面的字符串为key
    \n  通过上面列出的key我们就可以遍历所有的数据了,下面我们取出某一条数据,key为Uc!uLh的数据。
    \n
    \n来两个遍历的代码:
    \n1、PHP版
    \n1.        <?php/o:p
    \n2.        $host='192.168.15.225';/o:p
    \n3.        $port=11211;/o:p
    \n4.        $mem=new Memcache();/o:p
    \n5.        $mem->connect($host,$port);/o:p
    \n6.        $items=$mem->getExtendedStats (‘items’);/o:p
    \n7.        $items=$items["$host:$port"]['items'];/o:p
    \n8.        for($i=0,$len=count($items);$i<$len;$i++){/o:p
    \n9.            $number=$items[$i]['number'];/o:p
    \n10.         $str=$mem->getExtendedStats ("cachedump",$number,0);/o:p
    \n11.         $line=$str["$host:$port"];/o:p
    \n12.         if( is_array($line) && count($line)>0){/o:p
    \n13.             foreach($line as $key=>$value){/o:p
    \n14.                 echo $key.'=>';/o:p
    \n15.                 print_r($mem->get($key));/o:p
    \n16.                 echo "\\r\\n";/o:p
    \n17.             }/o:p
    \n18.         }/o:p
    \n19.     }/o:p
    \n20.     ?>
    \n
    \n2、RUby版
    \n
    \n
    \n #!/usr/bin/env ruby  
    \n require 'socket'  
    \n   
    \n # stats  
    \n # stats reset  
    \n # stats malloc  
    \n # stats maps  
    \n # stats sizes  
    \n # stats slabs  
    \n # stats items  
    \n # stats cachedump slab_id limit_num  
    \n # stats detail [on|off|dump]  
    \n   
    \n class Memcache  
    \n   class << self  
    \n     def open(host, port)  
    \n       s = TCPSocket.open(host, port)  
    \n       yield s if block_given?  
    \n     ensure  
    \n       s.close if s  
    \n     end  
    \n     
    \n     def command(command_string, s)  
    \n       s.send(command_string + "\\r\\n", 0)  
    \n       buff = []  
    \n       until ["END", "OK", "DELETE", "ERROR"].include?(line = s.gets.strip) do  
    \n         buff << line   
    \n       end  
    \n       buff  
    \n     end  
    \n     
    \n     def exec(command_string, host = "javaeye", port = 11211)  
    \n       open(host, port) { |socket| command(command_string, socket).each {|line| puts line } }  
    \n     end  
    \n       
    \n     def cache_stats(host = "javaeye", port = 11211)  
    \n       cache_objects = {}  
    \n       open(host, port) do |socket|  
    \n         slabs = []  
    \n         command("stats items", socket).each do |line|  
    \n           slab_id = line.split[1].split(":")[1].to_i  
    \n           slabs << slab_id unless slabs.include?(slab_id)  
    \n         end  
    \n         slabs.each do |slab_id|  
    \n           puts "browse slab \#{slab_id}..."  
    \n           command("stats cachedump \#{slab_id} 0", socket).each do |item|  
    \n             key = item.split[1].split("/")[0].to_s  
    \n             cache_objects.include?(key) ? cache_objects[key] += 1 : cache_objects[key] = 1  
    \n           end  
    \n         end  
    \n       end  
    \n       cache_objects.each_pair {|key, value| puts "\#{key} : \#{value}"}  
    \n     end  
    \n   end  
    \n end  
    \n   
    \n if ARGV.size == 0  
    \n   Memcache.cache_stats  
    \n else  
    \n   Memcache.exec(ARGV.join(" "))  
    \n end 
    \n

    \n", "_id"=>432}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"超越深夜宕机,有感机房服务质量", "body"=>"

    深夜,开始升级,突然办公室断网,然后发现WEB服务器SSH不进去,Ping可以ping通,这个机器装了全站的nginx,导致全站都无法访问,非常紧急。

    \n

    打电话让机房重启,打了几十遍都没人接,幸好是在深夜,要不还不被投诉死,无奈,打车去中关村那边的机房,Y的看到三个值班的都在睡觉,FT。

    \n

    找到机柜,找到机器,没找到重启按钮,无奈,扯下电源线,再连接上,OK,重启,,重启后SSH进去,恢复。

    \n

    想那机房也算有口碑的,客服dianhu

    ", "created_at"=>2008-11-14 21:25:18 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    深夜,开始升级,突然办公室断网,然后发现WEB服务器SSH不进去,Ping可以ping通,这个机器装了全站的nginx,导致全站都无法访问,非常紧急。
    \n打电话让机房重启,打了几十遍都没人接,幸好是在深夜,要不还不被投诉死,无奈,打车去中关村那边的机房,Y的看到三个值班的都在睡觉,FT。
    \n找到机柜,找到机器,没找到重启按钮,无奈,扯下电源线,再连接上,OK,重启,,重启后SSH进去,恢复。
    \n想那机房也算有口碑的,客服dianhu

    \n", "_id"=>433}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在Rails中集成Nginx upload module解决上传大文件难题", "body"=>"

    做web开发的都知道用户上传大文件(比如照片,MP3等)需求有如下难题:
    \n1、文件的存储 -这个不难,买个NAS,规划好目录结构,在mount下就可以了;

    \n

    2、上传速度  --这个问题受限与用户带宽、服务器带宽以及服务器的处理时间,用户带宽无法控制,服务器端的带宽需要监控下,只要未达到上限,也不存在问题;还存在的一个问题就是服务器的处理。

    \n

    3、服务端处理 --这个处理包括请求的接收,文件的校验、存放等,如果文件比较大,在Rails中或许就存在一些问题,请求到web服务器,如Nginx后,达到其设定的缓存大小就发给后端的Rails,这样就会占一个链接直到处理完毕,而后端的thin或者其他的app服务器一共就那么点并发,导致上传比较频繁的时候,压力很大。

    \n

    一个比较不错的解决方案是使用Nginx的upload module,其用C编写的,其处理完上传后,将文件存在在设定的临时目录中,然后将文件路径和你设定的一次哦参数透传给后端的Rails;再用Rails处理一些基本的信息,返回处理结果就可以了,如此一个请求的处理时间也就10ms的样子,开2个thin就可以承受很大的压力了。

    \n

    这个实现还是挺简单,需要注意的upload module非默认的Nginx的module,需要另外下载和编译进去,另外还要注意文件存放的临时文件名可能出现同名的现象,在存取的时候需要留意下。

    \n

    \n

    \n
    Example configuration
    \n
      \n
    1. server {  
    2. \n
    3.     client_max_body_size 100m;  
    4. \n
    5.     listen       80;  
    6. \n
    7.   
    8. \n
    9.     # Upload form should be submitted to this location  
    10. \n
    11.     location /upload {  
    12. \n
    13.         # Pass altered request body to this location  
    14. \n
    15.         upload_pass   /test;  
    16. \n
    17.   
    18. \n
    19.         # Store files to this directory  
    20. \n
    21.         # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist  
    22. \n
    23.         upload_store /tmp 1;  
    24. \n
    25.           
    26. \n
    27.         # Allow uploaded files to be read only by user  
    28. \n
    29.         upload_store_access user:r;  
    30. \n
    31.   
    32. \n
    33.         # Set specified fields in request body  
    34. \n
    35.         upload_set_form_field $upload_field_name.name "$upload_file_name";  
    36. \n
    37.         upload_set_form_field $upload_field_name.content_type "$upload_content_type";  
    38. \n
    39.         upload_set_form_field $upload_field_name.path "$upload_tmp_path";  
    40. \n
    41.   
    42. \n
    43.         # Inform backend about hash and size of a file  
    44. \n
    45.         upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";  
    46. \n
    47.         upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";  
    48. \n
    49.   
    50. \n
    51.         upload_pass_form_field "^submit$|^description$";  
    52. \n
    53.   
    54. \n
    55.         upload_cleanup 400 404 499 500-505;  
    56. \n
    57.     }  
    58. \n
    59.   
    60. \n
    61.     # Pass altered request body to a backend  
    62. \n
    63.     location /test {  
    64. \n
    65.         internal;  
    66. \n
    67.         proxy_pass   http://localhost:8080;  
    68. \n
    69.     }  
    70. \n
    71. }  
    72. \n
    73.           
    74. \n
    \n
    \n有类型需求的可以留意下,我们现在用的很爽。

    ", "created_at"=>2008-11-29 06:00:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    做web开发的都知道用户上传大文件(比如照片,MP3等)需求有如下难题:
    \n1、文件的存储 -这个不难,买个NAS,规划好目录结构,在mount下就可以了;
    \n2、上传速度  --这个问题受限与用户带宽、服务器带宽以及服务器的处理时间,用户带宽无法控制,服务器端的带宽需要监控下,只要未达到上限,也不存在问题;还存在的一个问题就是服务器的处理。
    \n3、服务端处理 --这个处理包括请求的接收,文件的校验、存放等,如果文件比较大,在Rails中或许就存在一些问题,请求到web服务器,如Nginx后,达到其设定的缓存大小就发给后端的Rails,这样就会占一个链接直到处理完毕,而后端的thin或者其他的app服务器一共就那么点并发,导致上传比较频繁的时候,压力很大。
    \n一个比较不错的解决方案是使用Nginx的upload module,其用C编写的,其处理完上传后,将文件存在在设定的临时目录中,然后将文件路径和你设定的一次哦参数透传给后端的Rails;再用Rails处理一些基本的信息,返回处理结果就可以了,如此一个请求的处理时间也就10ms的样子,开2个thin就可以承受很大的压力了。
    \n这个实现还是挺简单,需要注意的upload module非默认的Nginx的module,需要另外下载和编译进去,另外还要注意文件存放的临时文件名可能出现同名的现象,在存取的时候需要留意下。
    \n
    \n
    \nExample configuration
    \n
    \n server {  
    \n     client_max_body_size 100m;  
    \n     listen       80;  
    \n   
    \n     # Upload form should be submitted to this location  
    \n     location /upload {  
    \n         # Pass altered request body to this location  
    \n         upload_pass   /test;  
    \n   
    \n         # Store files to this directory  
    \n         # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist  
    \n         upload_store /tmp 1;  
    \n           
    \n         # Allow uploaded files to be read only by user  
    \n         upload_store_access user:r;  
    \n   
    \n         # Set specified fields in request body  
    \n         upload_set_form_field $upload_field_name.name "$upload_file_name";  
    \n         upload_set_form_field $upload_field_name.content_type "$upload_content_type";  
    \n         upload_set_form_field $upload_field_name.path "$upload_tmp_path";  
    \n   
    \n         # Inform backend about hash and size of a file  
    \n         upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";  
    \n         upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";  
    \n   
    \n         upload_pass_form_field "^submit$|^description$";  
    \n   
    \n         upload_cleanup 400 404 499 500-505;  
    \n     }  
    \n   
    \n     # Pass altered request body to a backend  
    \n     location /test {  
    \n         internal;  
    \n         proxy_pass   http://localhost:8080;  
    \n     }  
    \n }  
    \n           
    \n
    \n
    \n有类型需求的可以留意下,我们现在用的很爽。

    \n", "_id"=>434}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Rails2.2风潮来临,资源大列表", "body"=>"

    \"\"

    \n

    Rails的发展速度真的不赖,从上次rails2.1发布到现在不过5个月的时间而已,现在Rails2.2已经发布了,速度不可谓不快,而这次更新涉及到的东西更多,更牛XX。

    \n

    以前已经说过一些Rails2.2的功能,比如线程安全,Etag等,就不说了,网上资源多的是,需要了解的自己链过去看吧,如下列举几个:

    \n

    http://weblog.rubyonrails.org/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs

    \n

    http://railscasts.com/episodes/137-memoization

    \n

    http://media.rubyonrails.org/video/rails_blog_2.mov

    ", "created_at"=>2008-11-29 07:38:32 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails的发展速度真的不赖,从上次rails2.1发布到现在不过5个月的时间而已,现在Rails2.2已经发布了,速度不可谓不快,而这次更新涉及到的东西更多,更牛XX。
    \n以前已经说过一些Rails2.2的功能,比如线程安全,Etag等,就不说了,网上资源多的是,需要了解的自己链过去看吧,如下列举几个:
    \nhttp://weblog.rubyonrails.org/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs
    \nhttp://railscasts.com/episodes/137-memoization
    \nhttp://media.rubyonrails.org/video/rails_blog_2.mov

    \n", "_id"=>435}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rsay: ruby interface to the google translation api", "body"=>"

    有的时候,需要对一些词语做转换(翻译),这个实现方式有两种,一种是使用Ruby或者其他语言做一些语言转换;一种是利用其它平台的接口API,翻译成目标语言。
    \n第二种方式实现起来比较方便,目前比较成熟的是Google translation ,但是其没有REST的接口,一般的做法是直接调用页面,用正则表达式抓取相关内容。
    \n在Ruby中已经有人写出了gem,比较方便,大概步骤如下:
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires json (>= 1.1.3, runtime)
    \ntaojer ~/softback: gem install json
    \nERROR:  While executing gem ... (Errno::EACCES)
    \n    Permission denied - /usr/lib/ruby/gems/1.8/cache/json-1.1.3.gem
    \ntaojer ~/softback: sudo gem install json
    \nBuilding native extensions.  This could take a while...
    \nSuccessfully installed json-1.1.3
    \n1 gem installed
    \nInstalling ri documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \nInstalling RDoc documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires htmlentities (>= 4.0.0, runtime)
    \ntaojer ~/softback: sudo gem install htmlentities
    \nSuccessfully installed htmlentities-4.0.0
    \n1 gem installed
    \nInstalling ri documentation for htmlentities-4.0.0...
    \nInstalling RDoc documentation for htmlentities-4.0.0...
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  While executing gem ... (Gem::FilePermissionError)
    \n    You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.
    \ntaojer ~/softback: sudo gem install  rsay-1.0.0.gem  --local
    \nSuccessfully installed rsay-1.0.0
    \n1 gem installed
    \n
    \n再看个例子,如下:

    \n
    \n
    Ruby代码
    \n
      \n
    1. require "rubygems"  
    2. \n
    3. require "rsay"  
    4. \n
    5. result = Translate.t("Hello my Friend", Language::ENGLISH, Language::ITALIAN)  
    6. \n
    7. puts result  
    8. \n
    9. ------  
    10. \n
    11. taojer ~/tmpfiles: ruby t_c.rb  
    12. \n
    13. Ciao amico mio  
    14. \n
    \n
    \n

    参考:
    \nhttp://code.google.com/p/rsay/

    ", "created_at"=>2008-12-08 14:41:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    有的时候,需要对一些词语做转换(翻译),这个实现方式有两种,一种是使用Ruby或者其他语言做一些语言转换;一种是利用其它平台的接口API,翻译成目标语言。
    \n第二种方式实现起来比较方便,目前比较成熟的是Google translation ,但是其没有REST的接口,一般的做法是直接调用页面,用正则表达式抓取相关内容。
    \n在Ruby中已经有人写出了gem,比较方便,大概步骤如下:
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires json (>= 1.1.3, runtime)
    \ntaojer ~/softback: gem install json
    \nERROR:  While executing gem ... (Errno::EACCES)
    \n    Permission denied - /usr/lib/ruby/gems/1.8/cache/json-1.1.3.gem
    \ntaojer ~/softback: sudo gem install json
    \nBuilding native extensions.  This could take a while...
    \nSuccessfully installed json-1.1.3
    \n1 gem installed
    \nInstalling ri documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \nInstalling RDoc documentation for json-1.1.3...
    \n
    \nNo definition for cState_configure
    \n
    \nNo definition for cState_configure
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  Error installing rsay-1.0.0.gem:
    \n        rsay requires htmlentities (>= 4.0.0, runtime)
    \ntaojer ~/softback: sudo gem install htmlentities
    \nSuccessfully installed htmlentities-4.0.0
    \n1 gem installed
    \nInstalling ri documentation for htmlentities-4.0.0...
    \nInstalling RDoc documentation for htmlentities-4.0.0...
    \ntaojer ~/softback: gem install  rsay-1.0.0.gem  --local
    \nERROR:  While executing gem ... (Gem::FilePermissionError)
    \n    You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.
    \ntaojer ~/softback: sudo gem install  rsay-1.0.0.gem  --local
    \nSuccessfully installed rsay-1.0.0
    \n1 gem installed
    \n
    \n再看个例子,如下:
    \n
    \nRuby代码
    \n
    \n require "rubygems"  
    \n require "rsay"  
    \n result = Translate.t("Hello my Friend", Language::ENGLISH, Language::ITALIAN)  
    \n puts result  
    \n ------  
    \n taojer ~/tmpfiles: ruby t_c.rb  
    \n Ciao amico mio  
    \n
    \n
    \n参考:
    \nhttp://code.google.com/p/rsay/

    \n", "_id"=>436}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"rake: uninitialized constant ActiveRecord", "body"=>"

    写了一个task,执行的时候一直报:

    \n``rake aborted!
    uninitialized constant ActiveRecord
    迷糊了半天,发现task中忘记加“=> :environment”了。
    参考:http://www.ruby-forum.com/topic/143124```", "created_at"=>2008-12-15 06:59:33 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    写了一个task,执行的时候一直报:
    \nrake aborted!<br />uninitialized constant ActiveRecord<br />迷糊了半天,发现task中忘记加&ldquo;=&gt; :environment&rdquo;了。<br />参考:http://www.ruby-forum.com/topic/143124`

    \n", "_id"=>437}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Security"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>8, "title"=>"Music Fingerprint: 音乐指纹认知篇", "body"=>"

    音乐指纹,是采用特定的算法对音乐文件的声波进行分析得到的唯一码,主要用于自动分类和标识音乐文件。
    \n当前国外拥有此项技术专利的公司有GracenoteMusicIP等,其基本原理是通过对音乐文件的全部或部分声波(通常是音乐文件的前几分钟)进行分析产生音乐指纹数据,这部分技术难度并不太大,关键的问题是对音乐指纹进行比对,当前Gracenote已经支持对一首音乐文件的任意部分(至少需要10秒的数据)进行指纹识别。
    \n由MusicIP开发的一个叫libofa的开源音乐指纹生成软件可以从MusicDNS得到,它是通过对音乐文件的前135秒进行分析产生音乐指纹,为了提高匹配的准确性,通常在提交音乐指纹的同时也提取音乐文件的其他信息如MP3文件的ID3信息等。

    \n

    PS:部分播放器号称利用音乐指纹技术来做的歌词同步实际上是通过音乐文件的相关信息(如MP3的ID3信息)来确定该文件,并非真正意义上的音乐指纹技术。

    \n

    这项技术在国内尚未有实际的使用,国内对音频文件分析的时候,一般是采用ID3信息,而对音乐指纹的使用目前还是空白的。不过这个空白很快就被填补了。

    \n

    参考资料:

    \n

    http://code.google.com/p/musicip-libofa/

    \n

    http://blog.jooit.com/?p=1352

    ", "created_at"=>2008-12-21 12:50:56 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    音乐指纹,是采用特定的算法对音乐文件的声波进行分析得到的唯一码,主要用于自动分类和标识音乐文件。
    \n当前国外拥有此项技术专利的公司有Gracenote和MusicIP等,其基本原理是通过对音乐文件的全部或部分声波(通常是音乐文件的前几分钟)进行分析产生音乐指纹数据,这部分技术难度并不太大,关键的问题是对音乐指纹进行比对,当前Gracenote已经支持对一首音乐文件的任意部分(至少需要10秒的数据)进行指纹识别。
    \n由MusicIP开发的一个叫libofa的开源音乐指纹生成软件可以从MusicDNS得到,它是通过对音乐文件的前135秒进行分析产生音乐指纹,为了提高匹配的准确性,通常在提交音乐指纹的同时也提取音乐文件的其他信息如MP3文件的ID3信息等。
    \nPS:部分播放器号称利用音乐指纹技术来做的歌词同步实际上是通过音乐文件的相关信息(如MP3的ID3信息)来确定该文件,并非真正意义上的音乐指纹技术。
    \n这项技术在国内尚未有实际的使用,国内对音频文件分析的时候,一般是采用ID3信息,而对音乐指纹的使用目前还是空白的。不过这个空白很快就被填补了。
    \n参考资料:
    \nhttp://code.google.com/p/musicip-libofa/
    \nhttp://blog.jooit.com/?p=1352

    \n", "_id"=>438}]) +MONGODB iceylog_development['categories'].find({:_id=>8}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>8}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby的圣诞大餐: Merb&Rails合作了", "body"=>"

    Ruby的来两大主流框架都挺不错的,至少我做Ruby,也时常使用merb写东西,在我看来,两者上午有点非常鲜明,但是从来不曾想到raila和merb会合作。个人感觉DHH和Ezra两个领军人物性格差异非常大,DHH看上去更hacker一点,有时会有点偏执和自以为是,有时会和zed就raills缺点炒得热火朝天;而Ezra则显得内敛的多,内敛低调,虚心接受很多建议,自身也非常牛。Ezra更像一个程序员。

    \n

    但是,真的,Merb和rails会在下个版本开始合作,按照merb官方的说法,会将merb很多好的经验带给rails,而merb依然是存在的。很多人对这个消息绝对的感兴趣,一些天天吵着是merb好还是rails好的问题的人也终于可以歇歇了。

    \n

    rails又将迎来哪些大的变革,AR难道也会成插件,会引入merb多少东西,非常值得期待;rails到目前这个版本(2.2.2),明显感觉到发展的瓶颈,这次rails2.2.2的发布,并没有带来想象中的异常强大的东西,国际化和线程安全在ruby1.8上效果不甚理想,国际化也被人口水了一把,再不搞出点花样,估计又有人急了,而这次动作还算大,也算是圣诞的大餐吧,但是应该需要等到明年5月才会发布版本。

    \n

    回头再想想,merb的如意算盘应该是借助rails推广自己的engineyard,也很不错。

    \n

    PS:手指被菜刀划破了,打字真鬼速,囧。。

    \n

    参考信息:

    \n

    http://yehudakatz.com/2008/12/23/rails-and-merb-merge/

    \n

    http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3

    ", "created_at"=>2008-12-24 14:59:44 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Ruby的来两大主流框架都挺不错的,至少我做Ruby,也时常使用merb写东西,在我看来,两者上午有点非常鲜明,但是从来不曾想到raila和merb会合作。个人感觉DHH和Ezra两个领军人物性格差异非常大,DHH看上去更hacker一点,有时会有点偏执和自以为是,有时会和zed就raills缺点炒得热火朝天;而Ezra则显得内敛的多,内敛低调,虚心接受很多建议,自身也非常牛。Ezra更像一个程序员。
    \n但是,真的,Merb和rails会在下个版本开始合作,按照merb官方的说法,会将merb很多好的经验带给rails,而merb依然是存在的。很多人对这个消息绝对的感兴趣,一些天天吵着是merb好还是rails好的问题的人也终于可以歇歇了。
    \nrails又将迎来哪些大的变革,AR难道也会成插件,会引入merb多少东西,非常值得期待;rails到目前这个版本(2.2.2),明显感觉到发展的瓶颈,这次rails2.2.2的发布,并没有带来想象中的异常强大的东西,国际化和线程安全在ruby1.8上效果不甚理想,国际化也被人口水了一把,再不搞出点花样,估计又有人急了,而这次动作还算大,也算是圣诞的大餐吧,但是应该需要等到明年5月才会发布版本。
    \n回头再想想,merb的如意算盘应该是借助rails推广自己的engineyard,也很不错。
    \nPS:手指被菜刀划破了,打字真鬼速,囧。。
    \n参考信息:
    \nhttp://yehudakatz.com/2008/12/23/rails-and-merb-merge/
    \nhttp://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3

    \n", "_id"=>439}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"Android: 好东西终究是要爆发的", "body"=>"我不是专业的手机软件开发者,但是和古老的程序员的hacker精神一样,每个合格的程序员都想出品一款让自己足够骄傲的程序,在PC或者server上已经发展到团队作战的模式,散兵已经没有足够的精力做出多牛X的东西;而Android的的出现又给大家一个不错的平台。\n\n就我个人而言,Android上的开发还是很优雅的,虽然XML的layout还是有点点的简陋,但是相比于在java中写UI要舒服的多,2009年,注定会是移动互联网爆发和充满无限期待的一年,我看好的多媒体应用也终将走上移动设备,3G、wifi的顺利实施会让我们有更多的选择和期待,唯一希望的就是大家都遵守游戏的规则,不要把整个产业链都霸占了,只给自己吃肉,不让他人的喝粥的做法是无法长久的。\n\n想把什么都攥在自己手里的人最后会发现,围墙里的只有他自己一个人。\n\n平安夜,外面会有多热闹,北京的街头被各种彩灯装饰的非常绚丽,然而我却很不习惯如此的面子工程,热闹的街头也很大的风,我还是习惯躲回屋子,冲上一杯咖啡,写写代码,看看书。\n\n写着写着,发现跑题了,平安夜,但愿人人平安。", "created_at"=>2008-12-24 15:17:29 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    我不是专业的手机软件开发者,但是和古老的程序员的hacker精神一样,每个合格的程序员都想出品一款让自己足够骄傲的程序,在PC或者server上已经发展到团队作战的模式,散兵已经没有足够的精力做出多牛X的东西;而Android的的出现又给大家一个不错的平台。

    \n\n

    就我个人而言,Android上的开发还是很优雅的,虽然XML的layout还是有点点的简陋,但是相比于在java中写UI要舒服的多,2009年,注定会是移动互联网爆发和充满无限期待的一年,我看好的多媒体应用也终将走上移动设备,3G、wifi的顺利实施会让我们有更多的选择和期待,唯一希望的就是大家都遵守游戏的规则,不要把整个产业链都霸占了,只给自己吃肉,不让他人的喝粥的做法是无法长久的。

    \n\n

    想把什么都攥在自己手里的人最后会发现,围墙里的只有他自己一个人。

    \n\n

    平安夜,外面会有多热闹,北京的街头被各种彩灯装饰的非常绚丽,然而我却很不习惯如此的面子工程,热闹的街头也很大的风,我还是习惯躲回屋子,冲上一杯咖啡,写写代码,看看书。

    \n\n

    写着写着,发现跑题了,平安夜,但愿人人平安。

    \n", "_id"=>440}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"休假养伤,期间安排", "body"=>"

    大悲大喜的2008年也是我的本命年,中国发生了很多大大小小的或喜或悲的事情,我也发生了很多那些传说会在本命年发生的事情,囧~总之还好,2008年已经过去了。

    \n

    上次去滑雪,无奈的是手腕摔伤了,非常无奈还是右手手腕,现在就是用一个左手打字的,右手还打折石膏呢,医生说了差不多要1-2月才能恢复,算算时间,才过去10天,还要慢慢恢复了,幸好年关了,公司事情不是很多了,主要做产品讨论和技术预研,加上一个手生活多有不便,于是就请假呆在家好好养伤。

    \n

    由于受伤的是右手,不方便IM,有事情的给我发mail吧。。

    \n

    接下来一段时间,一来好好养伤,二来需要接触些新东西,大概列举一下吧:

    \n
      \n
    • 熟悉android,完成预定的目标(可能会让你大吃一惊的)
    • \n
    • 熟悉Erlang,在年后项目中将会使用,今天大概了解了下,语法够怪异的,但是机制是我梦寐的;
    • \n
    • 还要一本《构建可扩展的web站点》需要慢慢体会
    • \n
    • 还有一本中医枕边书,自学自用
    • \n
    • 如果时间允许,还有一半Flex。
    • \n
    \n

    哇,好多,抓紧看书。。

    ", "created_at"=>2009-01-09 02:31:49 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    大悲大喜的2008年也是我的本命年,中国发生了很多大大小小的或喜或悲的事情,我也发生了很多那些传说会在本命年发生的事情,囧~总之还好,2008年已经过去了。
    \n上次去滑雪,无奈的是手腕摔伤了,非常无奈还是右手手腕,现在就是用一个左手打字的,右手还打折石膏呢,医生说了差不多要1-2月才能恢复,算算时间,才过去10天,还要慢慢恢复了,幸好年关了,公司事情不是很多了,主要做产品讨论和技术预研,加上一个手生活多有不便,于是就请假呆在家好好养伤。
    \n由于受伤的是右手,不方便IM,有事情的给我发mail吧。。
    \n接下来一段时间,一来好好养伤,二来需要接触些新东西,大概列举一下吧:
    \n
    \n 熟悉android,完成预定的目标(可能会让你大吃一惊的)
    \n 熟悉Erlang,在年后项目中将会使用,今天大概了解了下,语法够怪异的,但是机制是我梦寐的;
    \n 还要一本《构建可扩展的web站点》需要慢慢体会
    \n 还有一本中医枕边书,自学自用
    \n 如果时间允许,还有一半Flex。
    \n
    \n哇,好多,抓紧看书。。

    \n", "_id"=>441}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"进程&消息: 开始Erlang之旅", "body"=>"

    知道Erlang很久了,在我接触Ruby不久之后就了解了Erlang,但是一直没静下心好好看,恰巧利用这段时间开始我的Erlang之旅吧。

    \n

    说句题外话,Erlang这个名字我很有亲切感,要是熟悉我的人肯定不会奇怪,呵呵。

    \n

    Erlang概述
    \n
    \nErlang不但是一种编程语言,而且它具有比编程语言更加贴近操作系统的一些特性:并发线程、作业调度、内存管理、分布式、网络化等。据说使用Erlang编写的Yaws Web服务器,其并发性能是apache的15倍!(这个没啥好炫耀的吧~)
    \n
    \n这个Erlang初始开源版本包含了Erlang的实现,同时它也是用于构建分布式高可用性系统的Ericsson中间件的最大组成部分。
    \n
    \nErlang具有以下特性:
    \n
    \n并发性 - Erlang具有超强的轻量级进程,这种进程对内存的需求是动态变化的,并且它没有共享内存和通过异步消息传送的通讯。Erlang支持超大量级的并发线程,并且不需要操作系统具有并发机制。
    \n
    \n分布式 - Erlang被设计用于运行在分布式环境下。一个Erlang虚拟机被成为Erlang节点。一个分布式Erlang系统是多个Erlang节点组成的网络(通常每个处理器被作为一个节点)。一个Erlang节点能够创建运行在其它节点上的并行线程,而其它节点可以使用其它操作系统。线程依赖不同节点之间的通讯,这完全和它依赖于单一节点一样。
    \n
    \n健壮性 - Erlang具有多种基本的错误检测能力,它们能够用于构建容错系统。例如,进程能够监控其它进程的状态和活动,甚至这些进程是在其它节点上执行。在分布式系统中的线程能够配置为在其它节点故障的情况下自动进行故障恢复,并在故障节点恢复时自动迁移回到恢复节点。
    \n
    \n软实时性 - Erlang支持可编程的“软”实时系统,这种系统需要反应时间在毫秒级。而在这种系统中,长时间的垃圾收集(garbage collection)延迟是无法接受的,因此Erlang使用了递增式垃圾收集技术。
    \n
    \n热代码升级 - 一些系统不能够由于软件维护而停止运行。Erlang允许程序代码在运行系统中被修改。旧代码能被逐步淘汰而后被新代码替换。在此过渡期间,新旧代码是共存的。这也使得安装bug补丁、在运行系统上升级而不干扰系统操作成为了可能。
    \n
    \n递增式代码装载 - 用户能够控制代码如何被装载的细节。在嵌入式系统中,所有代码通常是在启动时就被完全装载。而在开发系统中,代码是按需装载的,甚至在系统运行时被装载的。如果测试到了未覆盖的bug,那么只有具有bug的代码需要被替换。
    \n
    \n外部接口 - Erlang进程与外部世界之间的通讯使用和在Erlang进程之间相同的消息传送机制。这种机制被用于和操作系统通讯、与其它语言编写的程序交互。如果出于高效率的需要,这种机制的一个特殊版本也允许例如C程序这样的代码直接链接到Erlang运行时系统中来。

    \n

    入门参考文档:

    \n", "created_at"=>2009-01-09 02:44:43 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    知道Erlang很久了,在我接触Ruby不久之后就了解了Erlang,但是一直没静下心好好看,恰巧利用这段时间开始我的Erlang之旅吧。
    \n说句题外话,Erlang这个名字我很有亲切感,要是熟悉我的人肯定不会奇怪,呵呵。
    \nErlang概述
    \n
    \nErlang不但是一种编程语言,而且它具有比编程语言更加贴近操作系统的一些特性:并发线程、作业调度、内存管理、分布式、网络化等。据说使用Erlang编写的Yaws Web服务器,其并发性能是apache的15倍!(这个没啥好炫耀的吧~)
    \n
    \n这个Erlang初始开源版本包含了Erlang的实现,同时它也是用于构建分布式高可用性系统的Ericsson中间件的最大组成部分。
    \n
    \nErlang具有以下特性:
    \n
    \n并发性 - Erlang具有超强的轻量级进程,这种进程对内存的需求是动态变化的,并且它没有共享内存和通过异步消息传送的通讯。Erlang支持超大量级的并发线程,并且不需要操作系统具有并发机制。
    \n
    \n分布式 - Erlang被设计用于运行在分布式环境下。一个Erlang虚拟机被成为Erlang节点。一个分布式Erlang系统是多个Erlang节点组成的网络(通常每个处理器被作为一个节点)。一个Erlang节点能够创建运行在其它节点上的并行线程,而其它节点可以使用其它操作系统。线程依赖不同节点之间的通讯,这完全和它依赖于单一节点一样。
    \n
    \n健壮性 - Erlang具有多种基本的错误检测能力,它们能够用于构建容错系统。例如,进程能够监控其它进程的状态和活动,甚至这些进程是在其它节点上执行。在分布式系统中的线程能够配置为在其它节点故障的情况下自动进行故障恢复,并在故障节点恢复时自动迁移回到恢复节点。
    \n
    \n软实时性 - Erlang支持可编程的“软”实时系统,这种系统需要反应时间在毫秒级。而在这种系统中,长时间的垃圾收集(garbage collection)延迟是无法接受的,因此Erlang使用了递增式垃圾收集技术。
    \n
    \n热代码升级 - 一些系统不能够由于软件维护而停止运行。Erlang允许程序代码在运行系统中被修改。旧代码能被逐步淘汰而后被新代码替换。在此过渡期间,新旧代码是共存的。这也使得安装bug补丁、在运行系统上升级而不干扰系统操作成为了可能。
    \n
    \n递增式代码装载 - 用户能够控制代码如何被装载的细节。在嵌入式系统中,所有代码通常是在启动时就被完全装载。而在开发系统中,代码是按需装载的,甚至在系统运行时被装载的。如果测试到了未覆盖的bug,那么只有具有bug的代码需要被替换。
    \n
    \n外部接口 - Erlang进程与外部世界之间的通讯使用和在Erlang进程之间相同的消息传送机制。这种机制被用于和操作系统通讯、与其它语言编写的程序交互。如果出于高效率的需要,这种机制的一个特殊版本也允许例如C程序这样的代码直接链接到Erlang运行时系统中来。
    \n入门参考文档:
    \n
    \n http://erlang.org/about.html
    \n http://www.matrix.org.cn/resource/article/2007-09-04/2948b459-5ac5-11dc-af81-f34262335978.html
    \n http://erlang-china.org/misc/simplified_erlang.html
    \n http://www.douban.com/subject/3260311/

    \n", "_id"=>442}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"Android的Orientation Sensor三个坐标的含义", "body"=>"

    以前在黑莓手机里面有个GPS跟踪软件非常有趣,可以显示目前的方向,在Android中使用其提供的Sensor非常方便,如下是强制Landscape时候的情况:
    \n
    \nvalues[0]:方位角(水平旋转角),简单的说就是手机的头现在朝向哪个方位,0=北、90=东、180=南、270=西(可是好像不太准)
    \nvalues[1]:纵向旋转角,0=面朝上平置、-90=垂直向上、-180/180=面朝下平置、90=垂直向下
    \nvalues[2]:橫向旋转角,0=朝前、90=往右倒、-90=往左倒

    ", "created_at"=>2009-01-18 06:39:42 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    以前在黑莓手机里面有个GPS跟踪软件非常有趣,可以显示目前的方向,在Android中使用其提供的Sensor非常方便,如下是强制Landscape时候的情况:
    \n
    \nvalues[0]:方位角(水平旋转角),简单的说就是手机的头现在朝向哪个方位,0=北、90=东、180=南、270=西(可是好像不太准)
    \nvalues[1]:纵向旋转角,0=面朝上平置、-90=垂直向上、-180/180=面朝下平置、90=垂直向下
    \nvalues[2]:橫向旋转角,0=朝前、90=往右倒、-90=往左倒

    \n", "_id"=>443}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"在Android中计算GPS两点间的距离/速度", "body"=>"

    Q:how to get distance between two GeoPoints in sdk 1.0 ? MapPoint.distanceSquared(MapPoint) is gone \"Sad\"
    \nthaks!!
    \n

    \n

    A:you'll need to brush up on your trigonometry, and first compute the Haversine function (this is the standard way of doing it). In order to use the Java trig functions, you'll have to first convert all your angles from degrees to radians.
    \nGiven two longitude/latitude pairs, and the earth's average radius (assume 6356.78km for your calculations),
    \nyou can calculate the distance between the 2 points via this Java code:
    \n
    \n \tdouble EarthRad = 6356.78;\t// in km !
    \n// first convert to radians...
    \ndouble geo1_lat = geo1.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo1_lng = geo1.getLongitude()*java.lang.Math.PI/360;
    \ndouble geo2_lat = geo2.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo2_lng = geo2.getLongitude()*java.lang.Math.PI/360;
    \n
    \ndouble deltaLat = java.lang.Math.abs(java.lang.Math.abs(geo2_lat) - java.lang.Math.abs(geo1_lat));
    \ndouble deltaLng = java.lang.Math.abs(java.lang.Math.abs(geo2_lng) - java.lang.Math.abs(geo1_lng));
    \n
    \ndouble dist = 2*EarthRad*java.lang.Math.asin(java.lang.Math.sqrt(haversine(deltaLat)
    \n+ java.lang.Math.cos(pair1_lat)
    \n*java.lang.Math.cos(pair1_lng)*haversine(deltaLng)));
    \n
    \nWhere "dist" now contains the distance between along the earth's surface.
    \nYou can find the Haversine function trig equation by Googling it, then construct a method that returns the appropriate value.

    \n

    Computing the speed is straightforward: you know your sampling frequency, and you now know the distance between the most recent two points, so, employee speed = distance / sampling interval

    \n

    参考:http://www.anddev.org/distance_between_two_geopoints_in_sdk10-t4195.html

    \n

    http://www.anddev.org/calculating_distance_between_two_gps_points-t3708.html

    \n


    \n

    ", "created_at"=>2009-01-18 07:02:07 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Q:how to get distance between two GeoPoints in sdk 1.0 ? MapPoint.distanceSquared(MapPoint) is gone
    \nthaks!!
    \n
    \nA:you'll need to brush up on your trigonometry, and first compute the Haversine function (this is the standard way of doing it). In order to use the Java trig functions, you'll have to first convert all your angles from degrees to radians.
    \nGiven two longitude/latitude pairs, and the earth's average radius (assume 6356.78km for your calculations),
    \nyou can calculate the distance between the 2 points via this Java code:
    \n
    \n double EarthRad = 6356.78; // in km !
    \n// first convert to radians...
    \ndouble geo1_lat = geo1.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo1_lng = geo1.getLongitude()*java.lang.Math.PI/360;
    \ndouble geo2_lat = geo2.getLatitude()*java.lang.Math.PI/360;
    \ndouble geo2_lng = geo2.getLongitude()*java.lang.Math.PI/360;
    \n
    \ndouble deltaLat = java.lang.Math.abs(java.lang.Math.abs(geo2_lat) - java.lang.Math.abs(geo1_lat));
    \ndouble deltaLng = java.lang.Math.abs(java.lang.Math.abs(geo2_lng) - java.lang.Math.abs(geo1_lng));
    \n
    \ndouble dist = 2*EarthRad*java.lang.Math.asin(java.lang.Math.sqrt(haversine(deltaLat)
    \n+ java.lang.Math.cos(pair1_lat)
    \n*java.lang.Math.cos(pair1_lng)*haversine(deltaLng)));
    \n
    \nWhere "dist" now contains the distance between along the earth's surface.
    \nYou can find the Haversine function trig equation by Googling it, then construct a method that returns the appropriate value.
    \nComputing the speed is straightforward: you know your sampling frequency, and you now know the distance between the most recent two points, so, employee speed = distance / sampling interval
    \n参考:http://www.anddev.org/distance_between_two_geopoints_in_sdk10-t4195.html
    \nhttp://www.anddev.org/calculating_distance_between_two_gps_points-t3708.html
    \n

    \n", "_id"=>444}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"在Android中使用Map需要注意的技巧", "body"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:

    \n

    (以下技巧是基于SDK 1.0的)

    \n

    一、申请Apikey,并放在正确的位置

    \n

    这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在

    \n

    1、XML布局文件中

    \n

    <view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />

    \n

    2、java中

    \n

            mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");

    \n

    二、记得导入uses-library

    \n

    由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入

    \n

    <uses-library android:name="com.google.android.maps" />
    \n

    \n

    否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!

    \n

    三、需要给予一定的权限

    \n

    因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>

    \n

    如果需要GPS等应用,还需要

    \n

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    \n

    四、Activity需要继承自MapActivity

    \n

    类似如下代码;

    \n

    package com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}
    \n

    ", "created_at"=>2009-01-18 07:26:23 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在Android中使用GoogleMap非常方便,但是有些小技巧或者注意事项你必须牢记,否则调试半天你也不会找到啥线索,浪费时间不说,更让你狂抓,以下技巧都是我在实际项目中遇到的,不断更新和维护,如果你有类似技巧,欢迎分享:
    \n(以下技巧是基于SDK 1.0的)
    \n一、申请Apikey,并放在正确的位置
    \n这个应该都知道,但是是申请得到的key放哪里很多人不知道,可以放在
    \n1、XML布局文件中
    \n<view android:id="@+id/mv"
    \n   class="com.google.android.maps.MapView"
    \n   android:layout_width="fill_parent"
    \n   android:layout_height="fill_parent"
    \n   android:layout_weight="1"
    \n   android:apiKey="01Yu9W3X3vbpYT3x33chPXXX7U1Z6jy8WYZXNFA"
    \n   />
    \n2、java中
    \n        mMapView = new MapView(this, "01Yu9W3X3vbpYT3x33chPxxx7U1Z6jy8WYZXNFA");
    \n二、记得导入uses-library
    \n 由于1.0版本的修改,使得map包不再是默认的了,使用的时候需要在manifest中的application节点下加入
    \n<uses-library android:name="com.google.android.maps" />
    \n
    \n否则,你将遇到可恶的“java.lang.NoClassDefFoundError: ”,切记!
    \n三、需要给予一定的权限
    \n因为要使用GoogleMAP的service,所以需要
    \n<uses-permission android:name="android.permission.INTERNET"></uses-permission>
    \n如果需要GPS等应用,还需要
    \n<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    \n四、Activity需要继承自MapActivity
    \n类似如下代码;
    \npackage com.iceskysl.showmap;
    \n
    \nimport com.google.android.maps.MapActivity;
    \n
    \nimport android.os.Bundle;
    \n
    \npublic class ShowMap extends MapActivity {
    \n    /** Called when the activity is first created. */
    \n    @Override
    \n    public void onCreate(Bundle savedInstanceState) {
    \n        super.onCreate(savedInstanceState);
    \n        setContentView(R.layout.main);
    \n    }
    \n
    \n    @Override
    \n    protected boolean isRouteDisplayed() {
    \n        // TODO Auto-generated method stub
    \n        return false;
    \n    }
    \n}

    \n", "_id"=>445}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "jarsigner", "Map"], "comments_count"=>0, "category_id"=>11, "title"=>"如何使用jarsigner给Android APK签名", "body"=>"F:\\keytools>\"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe\" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore", "created_at"=>2009-01-21 04:26:10 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    F:\\keytools>"C:\\Program Files\\Java\\jdk1.6.0_10\\bin\\jarsigner.exe" -verbose -keystore keys/iceskysl.keystore  -signedjar iTracks_signed.apk iTracks.apk iceskysl.keystore

    \n", "_id"=>446}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["受伤"], "comments_count"=>0, "category_id"=>5, "title"=>"受伤差不多好了,该上班了", "body"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。

    \r\n

    明天回去工作,新年新气象,希望一切顺利.

    ", "created_at"=>2009-02-02 00:19:33 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    从上次滑雪不慎摔伤,到现在已经一个多月了,从请假休息到现在也差不多一个月的时间了,一个月的时间过得好快。受伤的手腕已经拆除石膏了,绑了一个月的石膏,关节好僵硬,活动起来还真不灵活,还要慢慢做功能恢复训练,希望能早日康复。
    \n明天回去工作,新年新气象,希望一切顺利.

    \n", "_id"=>447}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails2.3 is coming..", "body"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    ", "created_at"=>2009-02-07 04:55:42 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails2.3应该马上就要发布了,从介绍了看,又是一大堆的更新和改进,非常值得期待,正好有个项目,来尝尝鲜,如下:
    \n其他更新请参考:http://guides.rubyonrails.org/2_3_release_notes.html
    \n
    \nMicrosoft Windows XP [版本 5.1.2600]
    \n(C) 版权所有 1985-2001 Microsoft Corp.
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nERROR:  Error installing rails:
    \n        actionpack requires rack (>= 0.9.0, runtime)
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rack
    \nSuccessfully installed rack-0.9.1
    \n1 gem installed
    \nInstalling ri documentation for rack-0.9.1...
    \nInstalling RDoc documentation for rack-0.9.1...
    \n
    \nC:\\Documents and Settings\\Administrator>gem install rails --source http://gems.r
    \nubyonrails.org
    \nSuccessfully installed actionpack-2.3.0
    \nSuccessfully installed actionmailer-2.3.0
    \nSuccessfully installed activeresource-2.3.0
    \nSuccessfully installed rails-2.3.0
    \n4 gems installed
    \nInstalling ri documentation for actionpack-2.3.0...
    \nInstalling ri documentation for actionmailer-2.3.0...
    \nInstalling ri documentation for activeresource-2.3.0...
    \nInstalling RDoc documentation for actionpack-2.3.0...
    \nInstalling RDoc documentation for actionmailer-2.3.0...
    \nInstalling RDoc documentation for activeresource-2.3.0...
    \n
    \nC:\\Documents and Settings\\Administrator>

    \n", "_id"=>448}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "Scopes"], "comments_count"=>0, "category_id"=>11, "title"=>"Dynamic Scopes is si cool~", "body"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:

    \n

        @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:

    \n

    \n

    Order.scoped_by_customer_id(12)
    Order.scoped_by_customer_id(12).find(:all,
    :conditions => "status = 'open'")
    Order.scoped_by_customer_id(12).scoped_by_status("open")
    ```\n

    \n

    \n

    \n

    \n

    参考:

    \n

    http://guides.rubyonrails.org/2_3_release_notes.html

    \n

    http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    ", "created_at"=>2009-02-13 05:56:00 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    早就见过Rails2中增加的Scope功能,但是一直没在意,今天遇到一个需求,想在@user.topics中按照条件返回指定的数量或者排序,发现按照以往的处理方法比较麻烦,也不够优雅,经一朋友指点,觉得Scope应该有戏,仔细看了下,果然适合我的这个场景,代码非常优雅,如下:
    \n    @albums =Album.scoped_by_singer_id(@artist.id).find(:all, :limit => 5)
    \n不多说,应该都看得懂,如果你想了解更加详细的使用方法,你可以去下面的参考资料地址去看看,再举个例子:
    \n
    \nOrder.scoped_by_customer_id(12)Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'")Order.scoped_by_customer_id(12).scoped_by_status("open")```
    \n
    \n
    \n
    \n
    \n Lead Contributor: Yaroslav Markin
    \n
    \n
    \n More Information: What’s New in Edge Rails: Dynamic Scope Methods.
    \n
    \n
    \n
    \n参考:
    \nhttp://guides.rubyonrails.org/2_3_release_notes.html
    \nhttp://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods

    \n", "_id"=>449}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["encode", "Ruby&Rails", "URLDecode"], "comments_count"=>0, "category_id"=>11, "title"=>"Url encode&URLDecode in ruby", "body"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. def URLDecode(str)  
    2. \n
    3.    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    4. \n
    5. end  
    6. \n
    7.    
    8. \n
    9. def URLEncode(str)  
    10. \n
    11.    str.gsub!(/[^\\w$&\\-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    12. \n
    13. end  
    14. \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html

    \n

    看下他的写法:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. # File lib/cgi-lib.rb, line 134  
    2. \n
    3.   def CGI::escape(str)  
    4. \n
    5.     str.gsub(/[^a-zA-Z0-9_\\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    6. \n
    7.   end  
    8. \n
    9.   
    10. \n
    11. # File lib/cgi-lib.rb, line 139  
    12. \n
    13.   def CGI::unescape(str)  
    14. \n
    15.     str.gsub(/\\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    16. \n
    17.   end  
    18. \n
    \n
    \n

    \n

     

    ", "created_at"=>2009-02-17 05:02:02 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在一些API接口传递参数的时候,需要对URL做一些编码,有人写了两个脚本,如下:
    \n
    \n
    \nRuby代码
    \n
    \n def URLDecode(str)  
    \n    str.gsub!(/%[a-fA-F0-9]{2}/) { |x| x = x[1..2].hex.chr }  
    \n end  
    \n    
    \n def URLEncode(str)  
    \n    str.gsub!(/[^\\w$&-+.,\\/:;=?@]/) { |x| x = format("%%%x", x[0]) }  
    \n end  
    \n
    \n
    \n其实不需要这么麻烦,在Ruby中提供了现成的函数,比如CGI::escape, CGI::inescape, CGI::escapeHTML, CGI::inescapeHTML,CGI::unescape()等,详细的可以看:http://www.ruby-doc.org/core/classes/CGI.html
    \n看下他的写法:
    \n
    \n
    \nRuby代码
    \n
    \n # File lib/cgi-lib.rb, line 134  
    \n   def CGI::escape(str)  
    \n     str.gsub(/[^a-zA-Z0-9_-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }  
    \n   end  
    \n   
    \n # File lib/cgi-lib.rb, line 139  
    \n   def CGI::unescape(str)  
    \n     str.gsub(/+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") }  
    \n   end  
    \n
    \n
    \n
    \n 

    \n", "_id"=>450}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Ruby&Rails", "to_xml"], "comments_count"=>0, "category_id"=>11, "title"=>"Rails: Disabling XML character escaping for to_xml & xml builder", "body"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:

    \n
    \n
    Ruby代码
    \n
      \n
    1. module Builder  
    2. \n
    3.   class XmlBase  
    4. \n
    5.     def _escape(text)  
    6. \n
    7.       text  
    8. \n
    9.     end  
    10. \n
    11.   end  
    12. \n
    13. end   
    14. \n
    \n
    \n


    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781

    \n

     

    ", "created_at"=>2009-02-18 17:46:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    In my case, I had to genarate the xml view  for api render,but in rails, i got a &XXX format string for non englisg, it also appears to_xml will automatically escape any entities into their corresponding &XXX representation.  There's a piece in the documentation that says "If $KCODE is set to u and encoding set to UTF8, then escaping will NOT be performed."
    \n
    \nUnfortunately, this doesn't appear to be the case.  Even after following the docs and ensuring that default_charset is indeed UTF-8 (actually the default for Rails nowadays), we still get encoded characters in to_xml output.
    \n
    \nSince our client is UTF-8 aware, we need to pass thru the UTF-8 data intact. The only way we've found to do this is thru the following horrible monkey-patch:
    \n
    \nRuby代码
    \n
    \n module Builder  
    \n   class XmlBase  
    \n     def _escape(text)  
    \n       text  
    \n     end  
    \n   end  
    \n end   
    \n
    \n
    \n
    \nWhat's the proper way to do this?
    \n
    \nPS:
    \nsomebody say that to "set $KCODE='UTF8' in config/environment.rb can solve this issue." but it's not for me.
    \n
    \nmore infos:
    \nhttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781
    \n 

    \n", "_id"=>451}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["random", "ruby"], "comments_count"=>0, "category_id"=>11, "title"=>"Generate a random string", "body"=>"Generates a random string of lowercase letters. Great for email verification codes  or user password salt....\n
    \n
    Ruby代码
    \n
      \n\t
    1. Array.new(6) { (rand(122-97) + 97).chr }.join\n
    2. \n
    \n
    \nor:\n
    \n
    Ruby代码
    \n
      \n\t
    1. def newpass( len )
    2. \n\t
    3. chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a
    4. \n\t
    5. newpass = \"\"
    6. \n\t
    7. 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    8. \n\t
    9. return newpass
    10. \n\t
    11. end
    12. \n
    \n
    ", "created_at"=>2009-02-22 14:15:10 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Generates a random string of lowercase letters. Great for email verification codes  or user password salt....
    \n
    \nRuby代码
    \n
    \n Array.new(6) { (rand(122-97) + 97).chr }.join
    \n
    \n
    \n
    \nor:
    \n
    \nRuby代码
    \n
    \n def newpass( len )
    \n chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    \n newpass = ""
    \n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    \n return newpass
    \n end
    \n

    \n", "_id"=>452}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "Mac"], "comments_count"=>0, "category_id"=>11, "title"=>"Install mysql(&mysql gem) on Mac OSX", "body"=>"

    \n

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n
    2、init some tables:sudo mysql_install_db5
    \n
    3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n

    \n

    Here is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    ", "created_at"=>2009-02-27 04:56:59 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    here is some tips:
    \n
    \n1、Install MYSQL:sudo port install mysql5
    \n2、init some tables:sudo mysql_install_db5
    \n3、install mysql gem:ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
    \n
    \nHere is some userfull resource links:
    \nhttp://www.macruby.org/trac/wiki/Troubleshooting
    \nhttp://www.caibaohua.com/blog/2008/12/02/51/
    \nhttp://haoxiai.net/shujuku/mysql/102114.html

    \n", "_id"=>453}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["mount", "umount"], "comments_count"=>0, "category_id"=>11, "title"=>"mount&umount on unix", "body"=>"

    Some tips for mount&umount ,maybe give you some help..

    \n

    cdrom:
    \n# mount -t is09660 /dev/cdrom /mnt/cdrom
    \n# umount /mnt/cdrom
    \n
    \nfloppy:
    \n# mount /dev/fd0 /mnt/floppy
    \n#umount /mnt/floppy
    \n
    \nusb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat

    \n

    and some usefull resource links and docs here:

    \n

    http://unix-cd.com/unixcd12/article_3967.html

    \n

    http://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    ", "created_at"=>2009-02-27 18:10:57 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Some tips for mount&umount ,maybe give you some help..
    \ncdrom:

    \n\n

    mount -t is09660 /dev/cdrom /mnt/cdrom

    \n\n

    umount /mnt/cdrom

    \n\n

    floppy:

    \n\n

    mount /dev/fd0 /mnt/floppy

    \n\n

    umount /mnt/floppy

    \n\n

    usb:
    \n1.use 'fdisk -l' to show the usb nums,something like '/dev/sda';
    \n2.then use 'mkdir /mnt/usb' to create a dir for mount this usb;
    \n3.at last,use '# mount -t msdos /dev/sda1 /mnt/usb" to mount it.
    \n4.#umount /mnt/usb
    \n
    \nhda:
    \n1.use 'fdisk -l' to show the disk nums,like '/dev/hda1';
    \n2.then use 'make /mnt/vfat' to create a mount point;
    \n3.at last,use '# mount -t vfat /dev/hda1 /mnt/vfat'to mount it..
    \n4.#umount /mnt/vfat
    \nand some usefull resource links and docs here:
    \nhttp://unix-cd.com/unixcd12/article_3967.html
    \nhttp://blog.oracle.com.cn/index.php/121320/viewspace-6733.html

    \n", "_id"=>454}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["screen"], "comments_count"=>0, "category_id"=>11, "title"=>"use screen to manager your sessions", "body"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.

    \n

    \"\"

    \n

    \"\"

    \n

     

    \n

    and here is some resource link url:

    \n

    http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

    \n

    http://tech.ddvip.com/2008-10/122492041983595.html

    ", "created_at"=>2009-03-02 06:49:23 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    you can use nohup and & to let long time task run backgrond,and you can do this with screen ,here is some userfull tips to do this.
    \n
    \n
    \n 
    \nand here is some resource link url:
    \nhttp://www.ibm.com/developerworks/cn/linux/l-cn-screen/
    \nhttp://tech.ddvip.com/2008-10/122492041983595.html

    \n", "_id"=>455}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["files", "nginx", "Ruby&Rails", "X-Accel-Redirect"], "comments_count"=>0, "category_id"=>11, "title"=>"Using nginx to send files with X-Accel-Redirect", "body"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:

    \n
      \n
    1. The header must contain a URI
    2. \n
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. location /files {  
    2. \n
    3.     root /var/www;  
    4. \n
    5.     internal;  
    6. \n
    7. }  
    8. \n
    \n
    \n
    \n
    Ruby代码
    \n
      \n
    1. // Get requested file name  
    2. \n
    3. path = @params["path"]  
    4. \n
    5.   
    6. \n
    7. # ...  
    8. \n
    9. # Perform any required security checks, validation   
    10. \n
    11. # and/or stats accounting  
    12. \n
    13. # ...  
    14. \n
    15.   
    16. \n
    17. # And redirect user to internal location  
    18. \n
    19. response.headers['X-Accel-Redirect'] = "/files/" + path  
    20. \n
    \n
    \n

    \n

    some userfull link resource come here:

    \n\n

     

    ", "created_at"=>2009-03-03 10:49:19 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    In my case, I need do send big files to users, yes, you can do it with nginx,just like others static files,but i need some control for the request action,The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
    \nLighttpd has this feature and there is a mod_xsendfile for Apache2.
    \nNginx also has this feature, but implemented a little bit differently. In Nginx this feature is called X-Accel-Redirect.
    \nThere are two main differences:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n
    \n
    \nRuby代码
    \n
    \n location /files {  
    \n     root /var/www;  
    \n     internal;  
    \n }  
    \n
    \n
    \n
    \nRuby代码
    \n
    \n // Get requested file name  
    \n path = @params["path"]  
    \n   
    \n # ...  
    \n # Perform any required security checks, validation   
    \n # and/or stats accounting  
    \n # ...  
    \n   
    \n # And redirect user to internal location  
    \n response.headers['X-Accel-Redirect'] = "/files/" + path  
    \n
    \n
    \n
    \nsome userfull link resource come here:
    \n
    \n http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
    \n http://wiki.codemongers.com/NginxXSendfile
    \n http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/
    \n
    \n 

    \n", "_id"=>456}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "hardcode", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"I hate hardcode configs in plugins like cache_fu", "body"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:

    \n
    \n
    Ruby代码
    \n
      \n
    1. def setup_memcache(config)  
    2. \n
    3.   config[:namespace] << "-\#{RAILS_ENV}"  
    4. \n
    5.   
    6. \n
    7.   silence_warnings do  
    8. \n
    9.     Object.const_set :CACHE, memcache_klass.new(config)  
    10. \n
    11.   end  
    12. \n
    13.   
    14. \n
    15.   CACHE.servers = Array(config.delete(:servers))  
    16. \n
    17.   
    18. \n
    19.   setup_session_store   if config[:sessions]  
    20. \n
    21.   setup_fragment_store! if config[:fragments]  
    22. \n
    23.   setup_fast_hash!      if config[:fast_hash]  
    24. \n
    25.   setup_fastest_hash!   if config[:fastest_hash]  
    26. \n
    27.   
    28. \n
    29.   CACHE  
    30. \n
    31. end  
    32. \n
    \n
    \n

    shit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....

    \n

    some userfull link resources...

    \n", "created_at"=>2009-03-03 18:16:27 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    I store user sessions in memcache,and then i want do share theres sessions with sub domains,but i notice some strange things when i put session  into memcached,there are:
    \n1. In my older website(rails 2.0),It genenrated sessions key for memcached as \#{namespace}-\#{RAILS_ENV}:"session:\#{id}";
    \n2.In my newer website(reails 2.3),It generated seesions key for memcached just as "\#{namespace}:\#{id}";
    \n
    \nso,i can not get the same seesion datas with diff session keys. i do have spend lots of  time for sove this , i do have some userfull dis,
    \n
    \n1. In rails2.3 ,it's vendor memcache-client-1.5.0.5 in ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-2.3.0\\lib\\active_support\\vendor;
    \n2. you can config namespace in you environment.rb file like "  ActionController::Base.session_options[:namespace] = 'session'"
    \n3. In rails2.0,when you use memcached,you will use cached_fu  and act_as_cache plugins,and you may have a config file in your config dir named memcached.yml, and in this file,you can config defaults,production,test and developer..with lots of filed,like namespace,servers etc..
    \n4. you will notice it generate memcached key as mentioned above.
    \n
    \nI track it,and got this:
    \n
    \nRuby代码
    \n
    \n def setup_memcache(config)  
    \n   config[:namespace] << "-\#{RAILS_ENV}"  
    \n   
    \n   silence_warnings do  
    \n     Object.const_set :CACHE, memcache_klass.new(config)  
    \n   end  
    \n   
    \n   CACHE.servers = Array(config.delete(:servers))  
    \n   
    \n   setup_session_store   if config[:sessions]  
    \n   setup_fragment_store! if config[:fragments]  
    \n   setup_fast_hash!      if config[:fast_hash]  
    \n   setup_fastest_hash!   if config[:fastest_hash]  
    \n   
    \n   CACHE  
    \n end  
    \n
    \n
    \nshit,it append RAILS_ENV to namespace with "-",that's it...I hate some hardcode config in plugin,blalal....
    \nsome userfull link resources...
    \n
    \n http://errtheblog.com/posts/22-sessions-n-such
    \n http://www.raecoo.com/2008/10/25/rails-store-format-in-memcache/
    \n http://www.scribd.com/doc/2203398/Scaling-Rails-with-memcached
    \n http://railscasts.com/episodes/115-caching-in-rails-2-1

    \n", "_id"=>457}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Identifying"], "comments_count"=>0, "category_id"=>11, "title"=>"Get Uniquely Identifying Android Devices without special permissions.", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:

    \n

    In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

    \n
    \n

    String \tANDROID_ID \tThe Android ID (a unique 64-bit value) as a hex string. \t“android_id”

    \n
    \n

    \n

    \n
    C++代码
    \n
      \n
    1. import Android.Provider.Settings.System;  
    2. \n
    3. ...  
    4. \n
    5. String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    6. \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

    \n

    Some userfull link resource come here:

    \n
      \n
    • http://strazzere.com/blog/?tag=android_id
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22
    • \n
    • http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    • \n
    • http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    • \n
    \n

     

    ", "created_at"=>2009-03-04 11:52:30 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,and you can do it like this:
    \nIn Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;
    \n
    \nString ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”
    \n
    \n
    \n
    \nC++代码
    \n
    \n import Android.Provider.Settings.System;  
    \n ...  
    \n String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);  
    \n
    \n
    \nAlso, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.
    \nSome userfull link resource come here:
    \n
    \n http://strazzere.com/blog/?tag=android_id
    \n http://groups.google.com/group/android-developers/browse_thread/thread/93d1c9333fae0e07
    \n http://groups.google.com/group/android-developers/browse_thread/thread/ab70f142148e5801/0af3468a7d92d095?lnk=gst&q=%22mark+murphy%22;
    \n http://groups.google.com/group/android-developers/browse_thread/thread/c0d243345b90c8a5
    \n http://code.google.com/intl/zh-CN/android/reference/android/provider/Settings.System.html#ANDROID_ID
    \n
    \n 

    \n", "_id"=>458}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Build", "Ruby&Rails", "Scale"], "comments_count"=>0, "category_id"=>11, "title"=>"Building&Scaling a Startup on Rails: 12 Things We Learned", "body"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.

    \n
    \n
  • Use cloud storage for static files. --S3,I do not care it 's fine in china.
  • \n
  • Use HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
  • \n
  • Use Sphinx for text search.  --sometimes,you do have others chose.
  • \n
  • Use InnoDB for more crash resistant and faster writes.  --maybe it's right.
  • \n
  • Don't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
  • \n
  • Use memcache later so you find your database bottlenecks now. --this is very important.
  • \n
  • Use mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
  • \n
  • Use asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
  • \n
  • Use monitoring so you'll know when your site went down and why. --that's it,just do it.
  • \n
  • Learn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
  • \n
  • Use new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
  • \n
  • Use new information. Old information can't be trusted.  --and what's this?
  • \n
    \n

    go to http://axonflux.com/building-and-scaling-a-startup for more infos.

    ", "created_at"=>2009-03-08 12:32:11 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Garry Tan, cofounder of Posterous, lists 12 lessons for scaling that apply to more than just Rails,and i mark some word below.
    \n
    \nUse cloud storage for static files. --S3,I do not care it 's fine in china.
    \nUse HTTP Cache Control to tell the browser what it can cache.  --this is true,etag is great.
    \nUse Sphinx for text search.  --sometimes,you do have others chose.
    \nUse InnoDB for more crash resistant and faster writes.  --maybe it's right.
    \nDon't use textbook Rails ActiveRecord objects. Use New Relic to find exactly what is slow in your system. --yep
    \nUse memcache later so you find your database bottlenecks now. --this is very important.
    \nUse mongrel proctitle to find your slow queries. You are only as fast as your slowest queries. -maybe mongrel is not only chose,think about thin,ok?
    \nUse asynchronous job queuing to do work in parallel.  --yes,but sometimes crontab is enough.
    \nUse monitoring so you'll know when your site went down and why. --that's it,just do it.
    \nLearn by reading the source code, fixing problems, and submitting them back to the community.  --very userfull when you got some strange questions..
    \nUse new plugins. Old plugins can't be trusted. --and check chang histroy carefully.
    \nUse new information. Old information can't be trusted.  --and what's this?
    \n
    \ngo to http://axonflux.com/building-and-scaling-a-startup for more infos.

    \n", "_id"=>459}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Debug", "G1"], "comments_count"=>0, "category_id"=>11, "title"=>"Debugging/Installing apps on the G1 ( Real Driver)", "body"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:\n

      \n
    1. On your G1, go to Settings \"Arrow\" Applications \"Arrow\" Development \"Arrow\" [X] USB debugging 
    2. \n
    3. Download this file: android_usb_windows.zip 
    4. \n
    5. Unzip it to a folder 
    6. \n
    7. Connect your G1 with your PC 
    8. \n
    9. When it asks for driver location choose the unzipped folder and install the driver for it.
    10. \n
    11. You'll see sth like "HTC Dream Composite ADB Interface" on success 
    12. \n
    13. (Re)Start Eclipse 
    14. \n
    15. Your G1 should now be listed in the DDMS-Perspective under Devices 
    16. \n
    17. Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    18. \n
    19. Go Debug as usual.
      \n
    20. \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.

    \n

    Btw:
    \nYou can now install (signed)APKs via USB:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess

    \n
    \n


    \nAnd uninstall them:

    \n
    D:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n

     

    ", "created_at"=>2009-03-10 07:21:02 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    I konw,you can dev app and test it on the simulator,but if you had a real driver,G1,you can do debug on it,very great,here is the tips for this:
    \n
    \n On your G1, go to Settings  Applications  Development  [X] USB debugging 
    \n Download this file: android_usb_windows.zip 
    \n Unzip it to a folder 
    \n Connect your G1 with your PC 
    \n When it asks for driver location choose the unzipped folder and install the driver for it.
    \n You'll see sth like "HTC Dream Composite ADB Interface" on success 
    \n (Re)Start Eclipse 
    \n Your G1 should now be listed in the DDMS-Perspective under Devices 
    \n Go to the AndroidManifest.xml of your App and modify it to contain android:debuggable="true" in the <application ... >-Tag ,look like this:<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    \n Go Debug as usual.
    \n
    \n
    \nps: I do not upload the zip file here,you can find it via the link above,but if you can not download it,you can mail me to fetch one.
    \nBtw:
    \nYou can now install (signed)APKs via USB:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb -d install D:\\Workspace\\keytools\\AndNav_signed.apk
    \n1305 KB/s (1975987 bytes in 1.478s)
    \npkg: /data/local/tmp/AndNav_signed.apk
    \nSuccess
    \n
    \n
    \nAnd uninstall them:
    \nD:\\dev\\Android\\android-sdk-windows-1.0_r1\\tools>adb uninstall org.andnav
    \nSuccess
    \n
    \n 

    \n", "_id"=>460}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "IMIE", "Uniquely"], "comments_count"=>0, "category_id"=>11, "title"=>"Got Uniquely Identifying like IMIE code on Android", "body"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :

    \n
    \n
    Java代码
    \n
      \n
    1. public void fetch_status(){  
    2. \n
    3.     TelephonyManager tm = (TelephonyManager) this  
    4. \n
    5.     .getSystemService(Context.TELEPHONY_SERVICE);//      
    6. \n
    7.     String str = "";  
    8. \n
    9.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    10. \n
    11.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    12. \n
    13.     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    14. \n
    15.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    16. \n
    17.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    18. \n
    19.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    20. \n
    21.     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    22. \n
    23.     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    24. \n
    25.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    26. \n
    27.     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    28. \n
    29.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    30. \n
    31.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    32. \n
    33.     str += "SimState = " + tm.getSimState() + "\\n";    
    34. \n
    35.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    36. \n
    37.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    38. \n
    39.     TextView sys = (TextView) findViewById(R.id.sys);  
    40. \n
    41.     sys.setText(str);  
    42. \n
    43. }  
    44. \n
    \n
    \n

    and,your output like here.

    \n

    some userfull resource link:

    \n

    http://developer.android.com/reference/android/telephony/TelephonyManager.html

    ", "created_at"=>2009-03-12 06:22:26 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    In some case,you may want do get  Uniquely Identifying  for a  'real' android phone,such as IMEI code,SimOperator etc, and we all kown ,the IMEI like ID card,and you can use TelephonyManager to get it,some usefull codes like this :
    \n
    \nJava代码
    \n
    \n public void fetch_status(){  
    \n     TelephonyManager tm = (TelephonyManager) this  
    \n     .getSystemService(Context.TELEPHONY_SERVICE);//      
    \n     String str = "";  
    \n     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\\n";    
    \n     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\\n";    
    \n     str += "Line1Number = " + tm.getLine1Number() + "\\n";    
    \n     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\\n";    
    \n     str += "NetworkOperator = " + tm.getNetworkOperator() + "\\n";    
    \n     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\\n";    
    \n     str += "NetworkType = " + tm.getNetworkType() + "\\n";    
    \n     str += "PhoneType = " + tm.getPhoneType() + "\\n";    
    \n     str += "SimCountryIso = " + tm.getSimCountryIso() + "\\n";    
    \n     str += "SimOperator = " + tm.getSimOperator() + "\\n";    
    \n     str += "SimOperatorName = " + tm.getSimOperatorName() + "\\n";    
    \n     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\\n";    
    \n     str += "SimState = " + tm.getSimState() + "\\n";    
    \n     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\\n";    
    \n     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\\n";    
    \n     TextView sys = (TextView) findViewById(R.id.sys);  
    \n     sys.setText(str);  
    \n }  
    \n
    \n
    \nand,your output like here.
    \nsome userfull resource link:
    \nhttp://developer.android.com/reference/android/telephony/TelephonyManager.html

    \n", "_id"=>461}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "Intent"], "comments_count"=>0, "category_id"=>11, "title"=>"Android Intent is so powerful and great.", "body"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:

    \n

    1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

    \n


    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);

    \n


    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);

    \n


    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);

    \n


    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

    \n


    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

    \n


    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);

    \n


    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

    \n


    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");

    \n


    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");

    \n


    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");

    \n


    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 

    \n

    if you have other intent,please share to me ,thx.

    \n

    useful resource link here:

    \n

    http://kuikui.javaeye.com/blog/318627

    ", "created_at"=>2009-03-12 08:33:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Android have lots of intent,it's powerful and useful,here is some tips for you:
    \n1,start web browser
    \nUri myBlogUri = Uri.parse("http://kuikui.javaeye.com";);
    \nreturnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    \n
    \n2,Google map
    \nUri mapUri = Uri.parse("geo:38.899533,-77.036476");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, mapUri);
    \n
    \n3,show dialer tel
    \nUri telUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_DIAL, telUri);
    \n
    \n4,start call dialar
    \nUri callUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_CALL, callUri);
    \n
    \n5,uninstall apk
    \nUri uninstallUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
    \n
    \n6,install apk
    \nUri installUri = Uri.fromParts("package", "xxx", null);
    \nreturnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
    \n
    \n7,play audio
    \nUri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, playUri);
    \n
    \n8,show send email ui
    \nUri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
    \n
    \n9,send email
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nString[] tos = { "shenrenkui@gmail.com" };
    \nString[] ccs = { "shenrenkui@gmail.com" };
    \nreturnIt.putExtra(Intent.EXTRA_EMAIL, tos);
    \nreturnIt.putExtra(Intent.EXTRA_CC, ccs);
    \nreturnIt.putExtra(Intent.EXTRA_TEXT, "body");
    \nreturnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
    \nreturnIt.setType("message/rfc882");
    \nIntent.createChooser(returnIt, "Choose Email Client");
    \n
    \n10,send sms
    \nUri smsUri = Uri.parse("tel:100861");
    \nreturnIt = new Intent(Intent.ACTION_VIEW, smsUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.setType("vnd.android-dir/mms-sms");
    \n
    \n11,send email
    \nUri smsToUri = Uri.parse("smsto://100861");
    \nreturnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \n
    \n12,send mms
    \nUri mmsUri = Uri.parse("content://media/external/images/media/23");
    \nreturnIt = new Intent(Intent.ACTION_SEND);
    \nreturnIt.putExtra("sms_body", "shenrenkui");
    \nreturnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
    \nreturnIt.setType("image/png"); 
    \nif you have other intent,please share to me ,thx.
    \nuseful resource link here:
    \nhttp://kuikui.javaeye.com/blog/318627

    \n", "_id"=>462}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ip_conntrack", "packet"], "comments_count"=>0, "category_id"=>11, "title"=>"About ip_conntrack: table full, dropping packet messages suppressed", "body"=>"

    Here is a mp3 files server,
    \n\n

    restart it ,and got some messages in /var/log/message ,like this:
    \n
    \n
    Mar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \n
    Mar 31 12:58:52 garden last message repeated 3 times
    \n
    Mar 31 13:11:36 garden last message repeated 2 times
    \n
    Mar 31 13:15:44 garden last message repeated 3 times
    \n
     
    \n
    --and restart here ------
    \n
    Apr  1 01:47:49 garden syslogd 1.4.1: restart.
    \n
    Apr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \n
    Apr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n
    65536
    \n
     
    \n
    got ip_conntrack timeout setting:
    \n
    \n
    [root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n
    432000
    \n
    \n

    \nand you can sove it like this:
    \n\n
    vi /etc/sysctl.conf 
    \n
    #Add this
    \n
    net.ipv4.ip_conntrack_max = 655360 
    \n
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n

    \nany ideas?

    ", "created_at"=>2009-04-07 05:32:41 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Here is a mp3 files server,
    \n
    \nrestart it ,and got some messages in /var/log/message ,like this:
    \n
    \nMar 31 12:34:24 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:40:11 garden kernel: ip_conntrack: table full, dropping packet.
    \nMar 31 12:58:52 garden last message repeated 3 times
    \nMar 31 13:11:36 garden last message repeated 2 times
    \nMar 31 13:15:44 garden last message repeated 3 times
    \n 
    \n--and restart here ------
    \nApr  1 01:47:49 garden syslogd 1.4.1: restart.
    \nApr  1 01:47:49 garden kernel: klogd 1.4.1, log source = /proc/kmsg started.
    \nApr  1 01:47:49 garden kernel: Linux version 2.6.18-92.1.17.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Nov 4 13:43:30 EST 2008
    \n
    \n
    \nlooks like something wrong about "ip_conntrack",and i do some check like this:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/ip_conntrack_max
    \n65536
    \n 
    \ngot ip_conntrack timeout setting:
    \n
    \n[root@garden log]# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
    \n432000
    \n
    \n
    \nand you can sove it like this:
    \n
    \nvi /etc/sysctl.conf 
    \n#Add this
    \nnet.ipv4.ip_conntrack_max = 655360 
    \nnet.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
    \n
    \nand then ,refrech it.
    \nsysctl -p
    \n
    \nany ideas?

    \n", "_id"=>463}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["域名"], "comments_count"=>0, "category_id"=>5, "title"=>"域名差点又丢了,真危险", "body"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。

    \r\n

    一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。

    \r\n

    然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。

    \r\n

    回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    ", "created_at"=>2009-04-19 18:02:16 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    丢域名已经不是一次两次了,这次差点又把这个域名丢了,真危险呀,这些天一直都比较忙,好像好几天没来写Blog了,今天下午打开一看,发现一个陌生的页面,完蛋,突然想起,域名应该是到期了。
    \n一查记录,果然,18号到期,今天已经19号了,一遍想咋连个提醒邮件都没呢,郁闷之余,赶紧续费,幸好我有当时买郁闷的代码的帐号和密码,直接登录管理控制台,充值,续费。
    \n然后就比较顺利了,等到晚上的时候,发现我的域名又可以正常解析了。
    \n回头想想,差点又丢了,还是早点转回玩万网,再转出去吧。

    \n", "_id"=>464}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["csv", "FasterCSV", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Use FasterCSV to import data into csv file in ruby.", "body"=>"

    some tips is here.

    \n
    \n
    Ruby代码
    \n
      \n
    1. def self.imp_init_owner_data  
    2. \n
    3.   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    4. \n
    5.   FasterCSV.open(fp, "w"do |csv|  
    6. \n
    7.     InumberCate.find_all_by_typee("owner").each do |owner|  
    8. \n
    9.       csv << [owner.name,owner.id]  
    10. \n
    11.     end  
    12. \n
    13.   end  
    14. \n
    15. end  
    16. \n
    \n
    \n

    install fastercsv  gems like this..
    \n

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. iceskysl ~/webroot: gem install fastercsv  
    2. \n
    3. Successfully installed fastercsv-1.4.0  
    4. \n
    5. 1 gem installed  
    6. \n
    7. Installing ri documentation for fastercsv-1.4.0...  
    8. \n
    9. Installing RDoc documentation for fastercsv-1.4.0...  
    10. \n
    11. iceskysl ~/webroot: cd ..  
    12. \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    ", "created_at"=>2009-04-22 17:12:15 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    some tips is here.
    \n
    \nRuby代码
    \n
    \n def self.imp_init_owner_data  
    \n   fp = "\#{RAILS_ROOT}/datas/inumbers/ini_owner.csv"  
    \n   FasterCSV.open(fp, "w") do |csv|  
    \n     InumberCate.find_all_by_typee("owner").each do |owner|  
    \n       csv << [owner.name,owner.id]  
    \n     end  
    \n   end  
    \n end  
    \n
    \n
    \ninstall fastercsv  gems like this..
    \n
    \n
    \n
    \nRuby代码
    \n
    \n iceskysl ~/webroot: gem install fastercsv  
    \n Successfully installed fastercsv-1.4.0  
    \n 1 gem installed  
    \n Installing ri documentation for fastercsv-1.4.0...  
    \n Installing RDoc documentation for fastercsv-1.4.0...  
    \n iceskysl ~/webroot: cd ..  
    \n
    \n
    \nand do not forget to add "require 'fastercsv'" in your class file.

    \n", "_id"=>465}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Debian"], "comments_count"=>0, "category_id"=>11, "title"=>"Auto update sources.list on Debian", "body"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:

    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    ", "created_at"=>2009-04-24 16:43:23 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    you can use apt-spy to update sources.list ,here is some step and tips.
    \n1.open  /etc/apt/sources.list and add this
    \ndeb http://http.us.debian.org/debian/ stable main
    \n2.do "apt-get update"
    \n3.then "apt-get install apt-spy"
    \n4.then "apt-spy update"
    \n5.last,"apt-spy -d unstable -a asia -t 5"
    \n
    \nref:
    \nhttp://http.us.debian.org/debian/README.mirrors.txt

    \n", "_id"=>466}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>11, "title"=>"How can I find out what is generating iowait on my server?", "body"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n

    \n
    Ruby代码
    \n
      \n
    1. [root@5-3 ~]# /etc/init.d/syslog stop  
    2. \n
    3. Shutting down kernel logger: [  OK  ]  
    4. \n
    5. Shutting down system logger: [  OK  ]  
    6. \n
    7. [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    8. \n
    9. [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    10. \n
    11.     202 kjournald  
    12. \n
    13.      16 egrep  
    14. \n
    15.       9 irqbalance  
    16. \n
    17.       9 bash  
    18. \n
    19.       2 java  
    20. \n
    21.       1 sda  
    22. \n
    23.       1 mailserver  
    24. \n
    25. [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    26. \n
    27. [root@5-3 ~]# /etc/init.d/syslog start  
    28. \n
    29. Starting system logger: [  OK  ]  
    30. \n
    31. Starting kernel logger: [  OK  ]  
    32. \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.

    \n

    Don’t forget to set things back to their normal state when you’re done!

    \n
    \n
    XML/HTML代码
    \n
      \n
    1. # echo 0 > /proc/sys/vm/block_dump  
    2. \n
    3. # /etc/init.d/syslog start 
      \n
    4. \n
    \n
    \n


    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/

    \n

     

    \n

    http://www.cppblog.com/go-benny/archive/2008/04/23/47908.html

    \n

     

    ", "created_at"=>2009-04-24 16:59:35 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and  a guy changed the regexes to fit Red Hat and CentOS systems a bit better:
    \n
    \nRuby代码
    \n
    \n [root@5-3 ~]# /etc/init.d/syslog stop  
    \n Shutting down kernel logger: [  OK  ]  
    \n Shutting down system logger: [  OK  ]  
    \n [root@5-3 ~]# echo 1 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head  
    \n     202 kjournald  
    \n      16 egrep  
    \n       9 irqbalance  
    \n       9 bash  
    \n       2 java  
    \n       1 sda  
    \n       1 mailserver  
    \n [root@5-3 ~]# echo 0 > /proc/sys/vm/block_dump  
    \n [root@5-3 ~]# /etc/init.d/syslog start  
    \n Starting system logger: [  OK  ]  
    \n Starting kernel logger: [  OK  ]  
    \n
    \n
    \nIn my specific situation, it looks like kjournald  is the biggest abuser of my disk.
    \nDon’t forget to set things back to their normal state when you’re done!
    \n
    \nXML/HTML代码
    \n
    \n # echo 0 > /proc/sys/vm/block_dump  
    \n # /etc/init.d/syslog start 
    \n
    \n
    \n
    \n
    \nref:
    \nhttp://rackerhacker.com/2008/03/11/hunting-down-elusive-sources-of-iowait/
    \nhttp://blog.eikke.com/index.php/ikke/2007/03/22/who_s_abusing_my_sata_controller
    \nhttp://hi.baidu.com/dipsey/blog/item/900bbbaf3e46dcc97cd92aba.html
    \nhttp://www.ducea.com/2009/03/11/howto-install-iotop-on-debian-etch/
    \n 
    \nhttp://www.cppblog.com/go-benny/archive/2008/04/23/47908.html
    \n 

    \n", "_id"=>467}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["EXIF", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Read EXIF messages from a Image file with ruby.", "body"=>"

    today, i register into bigfoot,and notice some interesting info like this:

    \n

    EXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。

    \n

    so i  find some libs to do this with ruby,and here is some useful codes:

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. require 'rubygems'  
    2. \n
    3. require 'exifr'  
    4. \n
    5.     image_file = ARGV.first  
    6. \n
    7.     exif_info = nil  
    8. \n
    9.     case image_file.downcase  
    10. \n
    11.     when /.jpg\\Z/  
    12. \n
    13.         exif_info = EXIFR::JPEG.new(image_file)  
    14. \n
    15.     when /.tiff?\\Z/  
    16. \n
    17.         exif_info = EXIFR::TIFF.new(image_file)  
    18. \n
    19.     end  
    20. \n
    21.   
    22. \n
    23.     puts "Standard items".center(72)  
    24. \n
    25.     puts "=" * 72  
    26. \n
    27.     puts "                          File : \#{image_file}"  
    28. \n
    29.     puts "                        Height : \#{exif_info.height}"  
    30. \n
    31.     puts "                         Width : \#{exif_info.width}"  
    32. \n
    33.     puts  
    34. \n
    35.   
    36. \n
    37.     if exif_info.exif? then  
    38. \n
    39.         puts "EXIF information".center(72)  
    40. \n
    41.         puts "=" * 72  
    42. \n
    43.         h = exif_info.exif.to_hash  
    44. \n
    45.         h.each_pair do |k,v|  
    46. \n
    47.             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    48. \n
    49.         end  
    50. \n
    51.     else  
    52. \n
    53.         puts "No EXIF information in this image"  
    54. \n
    55.     end  
    56. \n
    \n
    \nand output like this:

    \n

    F:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69

    \n

    great,yep?

    \n

    and some resources here:

    \n

    \n

      \n
    • Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    • \n
    • Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    • \n
    • Ruby-Exiv2 (Ruby binding for exiv2)
    • \n
    • Libexif (C Library)
    • \n
    • Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    • \n
    • ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    • \n
    • Mini-Exiftool (a gem which uses the exiftool CLI)
    • \n
    \n

    \n

     

    ", "created_at"=>2009-04-25 16:40:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    today, i register into bigfoot,and notice some interesting info like this:
    \nEXIF 是 Exchangeable Image File Format 的缩写。
    \n数码相机在拍摄时,会将一些信息保存到照片文件中,这些信息包括相机厂商和型号、拍摄时间及当前照片的曝光参数(快门速度、光圈、ISO、焦距等等)。
    \nso i  find some libs to do this with ruby,and here is some useful codes:
    \n
    \n
    \nRuby代码
    \n
    \n require 'rubygems'  
    \n require 'exifr'  
    \n     image_file = ARGV.first  
    \n     exif_info = nil  
    \n     case image_file.downcase  
    \n     when /.jpg\\Z/  
    \n         exif_info = EXIFR::JPEG.new(image_file)  
    \n     when /.tiff?\\Z/  
    \n         exif_info = EXIFR::TIFF.new(image_file)  
    \n     end  
    \n   
    \n     puts "Standard items".center(72)  
    \n     puts "="  72  
    \n     puts "                          File : \#{image_file}"  
    \n     puts "                        Height : \#{exif_info.height}"  
    \n     puts "                         Width : \#{exif_info.width}"  
    \n     puts  
    \n   
    \n     if exif_info.exif? then  
    \n         puts "EXIF information".center(72)  
    \n         puts "=" 
     72  
    \n         h = exif_info.exif.to_hash  
    \n         h.each_pair do |k,v|  
    \n             puts "\#{k.to_s.rjust(30)} : \#{v}"  
    \n         end  
    \n     else  
    \n         puts "No EXIF information in this image"  
    \n     end  
    \n
    \n
    \nand output like this:
    \nF:\\codes\\ruby\\exif>ruby exif-test.rb.rb S6003504.JPG
    \n                             Standard items
    \n========================================================================
    \n                          File : S6003504.JPG
    \n                        Height : 1200
    \n                         Width : 1600
    \n
    \n                            EXIF information
    \n========================================================================
    \n     compressed_bits_per_pixel : 453653/120000
    \n                   orientation : #<EXIFR::TIFF::Orientation:0x2e20e44>
    \n                exposure_index : 1
    \n                  x_resolution : 96
    \n                 exposure_mode : 0
    \n           shutter_speed_value : 21/4
    \n                 exposure_time : 1/45
    \n                sensing_method : 2
    \n                   color_space : 1
    \n                 metering_mode : 5
    \n             image_description : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                  y_resolution : 96
    \n               resolution_unit : 2
    \n                 white_balance : 0
    \n                aperture_value : 79/25
    \n                      f_number : 3
    \n                    saturation : 0
    \n             pixel_x_dimension : 1600
    \n                  light_source : 0
    \n            date_time_original : Sat Feb 28 23:36:58 +0800 2009
    \n                          make : Samsung Techwin
    \n            digital_zoom_ratio : 1
    \n              exposure_program : 2
    \n            ycb_cr_positioning : 2
    \n                     sharpness : 0
    \n             pixel_y_dimension : 1200
    \n                         flash : 24
    \n           date_time_digitized : Sat Feb 28 23:36:58 +0800 2009
    \n                         model : <Digimax S600 / Kenox S600 / Digimax Cyber 630>
    \n                      software : 611131
    \n                     copyright : COPYRIGHT, 2006
    \n     focal_length_in_35mm_film : 43
    \n           exposure_bias_value : 0
    \n            related_sound_file : RelatedSound
    \n                  focal_length : 36/5
    \n                     date_time : Sat Feb 28 23:36:58 +0800 2009
    \n            scene_capture_type : 0
    \n            max_aperture_value : 79/25
    \n             iso_speed_ratings : 69
    \ngreat,yep?
    \nand some resources here:
    \n
    \n
    \n Exifr (Exif Reader. Read EXIF information from JPEG and TIFF)
    \n Exiv2 (C++ Library, Read and Write EXIF information. No write support for TIFF)
    \n Ruby-Exiv2 (Ruby binding for exiv2)
    \n Libexif (C Library)
    \n Libexif-Ruby (Ruby interface for libexif, did not test it but I read somewhere that it only supports reading)
    \n ExifTool (Perl LIbrary/CLI for reading/writing meta information)
    \n Mini-Exiftool (a gem which uses the exiftool CLI)
    \n
    \n
    \n 

    \n", "_id"=>468}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "Ruby&Rails", "tips"], "comments_count"=>0, "category_id"=>11, "title"=>"Some useful tips for god usage", "body"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.

    \n

    \n

    \n
    Ruby代码
    \n
      \n
    1. [iceskysl@ws_api]# god --help  
    2. \n
    3.   Usage:  
    4. \n
    5.     Starting:  
    6. \n
    7.       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    8. \n
    9.         
    10. \n
    11.     Querying:  
    12. \n
    13.       god <command> <argument> [-p <port>]  
    14. \n
    15.       god <command> [-p <port>]  
    16. \n
    17.       god -v  
    18. \n
    19.       god -V (must be run as root to be accurate on Linux)  
    20. \n
    21.         
    22. \n
    23.     Commands:  
    24. \n
    25.       start <task or group name>         start task or group  
    26. \n
    27.       restart <task or group name>       restart task or group  
    28. \n
    29.       stop <task or group name>          stop task or group  
    30. \n
    31.       monitor <task or group name>       monitor task or group  
    32. \n
    33.       unmonitor <task or group name>     unmonitor task or group  
    34. \n
    35.       remove <task or group name>        remove task or group from god  
    36. \n
    37.       load <file>                        load a config into a running god  
    38. \n
    39.       log <task name>                    show realtime log for given task  
    40. \n
    41.       status                             show status of each task  
    42. \n
    43.       quit                               stop god  
    44. \n
    45.       terminate                          stop god and all tasks  
    46. \n
    47.       check                              run self diagnostic  
    48. \n
    49.         
    50. \n
    51.     Options:  
    52. \n
    53.     -c, --config-file CONFIG         Configuration file  
    54. \n
    55.     -p, --port PORT                  Communications port (default 17165)  
    56. \n
    57.     -b, --auto-bind                  Auto-bind to an unused port number  
    58. \n
    59.     -P, --pid FILE                   Where to write the PID file  
    60. \n
    61.     -l, --log FILE                   Where to write the log file  
    62. \n
    63.     -D, --no-daemonize               Don't daemonize  
    64. \n
    65.     -v, --version                    Print the version number and exit  
    66. \n
    67.     -V                               Print extended version and build information  
    68. \n
    69.         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    70. \n
    71.         --no-syslog                  Disable output to syslog  
    72. \n
    73.         --attach PID                 Quit god when the attached process dies  
    74. \n
    75.         --no-events                  Disable the event system  
    76. \n
    77.         --bleakhouse                 Enable bleakhouse profiling  
    78. \n
    79. [iceskysl@ws_api]  
    80. \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD

    \n

    \n

    God allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:

    \n
      \n
    • Existng Watches with the same name``` as the incoming Watches will be overidden by the new config.
    • \n
    • All paths must be either absolute or relative to the path from which god was started.
    • \n
    \n

    To load a config into a running god, issue the following command:

    \n
    $ sudo god load path/to/config.god
    # god load /data/www/api/config/config_thin_api.god```\n

    Config files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).

    \n

    \n

    2.show logs

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. [iceskysl@ws_api]# god log thin-thin-7514  
    2. \n
    3. I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    4. \n
    5. I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    6. \n
    7. I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    8. \n
    9. I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    10. \n
    11. I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    12. \n
    13. I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    14. \n
    \n
    \n

    \n

    resource links:

    \n

    http://god.rubyforge.org/

    \n

     

    ", "created_at"=>2009-04-30 08:25:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    some days before,i  posted a article 《God: 比Monit更好用的monitoring》,today,i will post more useful tips for God.
    \n
    \n
    \nRuby代码
    \n
    \n [iceskysl@ws_api]# god --help  
    \n   Usage:  
    \n     Starting:  
    \n       god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]  
    \n         
    \n     Querying:  
    \n       god <command> <argument> [-p <port>]  
    \n       god <command> [-p <port>]  
    \n       god -v  
    \n       god -V (must be run as root to be accurate on Linux)  
    \n         
    \n     Commands:  
    \n       start <task or group name>         start task or group  
    \n       restart <task or group name>       restart task or group  
    \n       stop <task or group name>          stop task or group  
    \n       monitor <task or group name>       monitor task or group  
    \n       unmonitor <task or group name>     unmonitor task or group  
    \n       remove <task or group name>        remove task or group from god  
    \n       load <file>                        load a config into a running god  
    \n       log <task name>                    show realtime log for given task  
    \n       status                             show status of each task  
    \n       quit                               stop god  
    \n       terminate                          stop god and all tasks  
    \n       check                              run self diagnostic  
    \n         
    \n     Options:  
    \n     -c, --config-file CONFIG         Configuration file  
    \n     -p, --port PORT                  Communications port (default 17165)  
    \n     -b, --auto-bind                  Auto-bind to an unused port number  
    \n     -P, --pid FILE                   Where to write the PID file  
    \n     -l, --log FILE                   Where to write the log file  
    \n     -D, --no-daemonize               Don't daemonize  
    \n     -v, --version                    Print the version number and exit  
    \n     -V                               Print extended version and build information  
    \n         --log-level LEVEL            Log level [debug|info|warn|error|fatal]  
    \n         --no-syslog                  Disable output to syslog  
    \n         --attach PID                 Quit god when the attached process dies  
    \n         --no-events                  Disable the event system  
    \n         --bleakhouse                 Enable bleakhouse profiling  
    \n [iceskysl@ws_api]#   
    \n
    \n
    \n1.DYNAMICALLY LOADING CONFIG FILES INTO AN ALREADY RUNNING GOD
    \n
    \nGod allows you to load or reload configurations into an already running instance. There are a few things to consider when doing this:
    \n
    \n Existng Watches with the same name<span class="Apple-converted-space">&nbsp;</span>as the incoming Watches will be overidden by the new config.</li>
    \n <li style="margin: 0px; font-size: 13px;">All paths must be either absolute or relative to the path from which god was started.</li>
    \n</ul>
    \n<p style="margin: 0px 0px 1em; font-size: 13px;">To load a config into a running god, issue the following command:</p>
    \n<pre style="border: 1px solid rgb(204, 204, 204); margin: 1em 0px; padding: 1em; font-size: 10px; line-height: 1.3; background-color: rgb(239, 239, 239);">$ sudo god load path/to/config.god<br /># god load /data/www/api/config/config_thin_api.god

    \nConfig files that are loaded dynamically can contain anything that a normal config file contains, however, global options such as God.pid_file_directory``` blocks will be ignored (and produce a warning in the logs).
    \n
    \n2.show logs
    \n
    \n
    \nXML/HTML代码
    \n
    \n [iceskysl@ws_api]# god log thin-thin-7514  
    \n I, [2009-04-28T08:24:16.705870 #23174]  INFO -- : thin-thin-7514 moved 'up' to 'up'  
    \n I, [2009-04-28T08:24:16.706346 #23174]  INFO -- : thin-thin-7514 [trigger] process is not running (ProcessRunning)  
    \n I, [2009-04-28T08:24:16.888477 #23174]  INFO -- : thin-thin-7514 sent email to iceskysl@gmail.com (Email)  
    \n I, [2009-04-28T08:24:16.888642 #23174]  INFO -- : thin-thin-7514 move 'up' to 'start'  
    \n I, [2009-04-28T08:24:16.888976 #23174]  INFO -- : thin-thin-7514 before_start: no pid file to delete (CleanPidFile)  
    \n I, [2009-04-28T08:24:16.889109 #23174]  INFO -- : thin-thin-7514 start: thin start -C /data/www/web/current/config/thin.yml -o 7514  
    \n
    \n
    \n
    \nresource links:
    \nhttp://god.rubyforge.org/
    \n 

    \n", "_id"=>469}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Inflector", "NameError", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"NameError: uninitialized constant Inflector", "body"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)

    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n

    \n
    inflections.rb (Rails 2.1.0)
    \n
      \n
    1.  
      \n
    2. \n
    3.  Inflector.inflections do |inflect|  
    4. \n
    5.   .  
    6. \n
    7.   .  
    8. \n
    9.   .  
    10. \n
    11.  end  
    12. \n
    \n
    \n
    \n
    \n
    inflections.rb (Rails 2.2.2)
    \n
      \n
    1. ActiveSupport::Inflector.inflections do |inflect|  
    2. \n
    3.  .  
    4. \n
    5.  .  
    6. \n
    7.  .  
    8. \n
    9. end  
    10. \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    ", "created_at"=>2009-05-05 13:37:01 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:
    \n
    \n/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in
    \n`load_missing_constant': uninitialized constant Inflector (NameError)
    \n
    \nthe usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is yourApp/config/initializers/inflections.rb
    \n
    \n
    \ninflections.rb (Rails 2.1.0)
    \n
    \n  
    \n
    \n  Inflector.inflections do |inflect|  
    \n   .  
    \n   .  
    \n   .  
    \n  end  
    \n
    \n
    \n
    \n
    \ninflections.rb (Rails 2.2.2)
    \n
    \n ActiveSupport::Inflector.inflections do |inflect|  
    \n  .  
    \n  .  
    \n  .  
    \n end  
    \n
    \n
    \nthe situation changing Inflector to ActiveSupport::Inflector was enough to solve the problem.

    \n", "_id"=>470}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["God", "ruby", "Ruby&Rails"], "comments_count"=>0, "category_id"=>11, "title"=>"Socket Errno::EAFNOSUPPORT with God in ruby", "body"=>"

    when i start god.sh,then give some error msg like this:

    \n

    \n

    \n
    XML/HTML代码
    \n
      \n
    1. I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    2. \n
    3. /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)  
    4. \n
    5.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open'  
    6. \n
    7.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in `open_server_inaddr_any'  
    8. \n
    9.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in `open_server'  
    10. \n
    11.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in `open_server'  
    12. \n
    13.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `each'  
    14. \n
    15.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in `open_server'  
    16. \n
    17.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'  
    18. \n
    19.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `new'  
    20. \n
    21.     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'  
    22. \n
    23.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in `start'  
    24. \n
    25.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in `initialize'  
    26. \n
    27.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `new'  
    28. \n
    29.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in `start'  
    30. \n
    31.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    32. \n
    33.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    34. \n
    35.     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    36. \n
    \n
    \nok,then i find some userful messsage,like here:

    \n

    Errno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket

    \n

    and here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!
    \n

    ", "created_at"=>2009-05-16 13:48:50 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    when i start god.sh,then give some error msg like this:
    \n
    \n
    \nXML/HTML代码
    \n
    \n I [2009-05-16 21:25:41]  INFO: Using pid file directory: /var/run/god  
    \n /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in initialize':&nbsp;Address&nbsp;family&nbsp;not&nbsp;supported&nbsp;by&nbsp;protocol&nbsp;-&nbsp;socket(2)&nbsp;(Errno::EAFNOSUPPORT)&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in&nbsp;
    open'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:850:in open_server_inaddr_any'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:863:in&nbsp;
    open_server'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:759:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in&nbsp;
    each'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:757:in open_server'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1340:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/1.8/drb/drb.rb:1628:in&nbsp;
    start_service'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:78:in start'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/socket.rb:43:in&nbsp;
    initialize'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in new'&nbsp;&nbsp;</span></li>
    \n <li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;/usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:607:in&nbsp;
    start'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:633:in `at_exit'  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god.rb:666  
    \n     from /usr/local/ruby/lib/ruby/gems/1.8/gems/god-0.7.13/bin/../lib/god/cli/run.rb:87  
    \n
    \n
    \nok,then i find some userful messsage,like here:
    \nErrno::EAFNOSUPPORT - the specified sockaddr isnot a valid address for the family of the calling socket
    \nand here, i notice where is the problen,the god find hostname,name map it to ip address,then create some sockets on the ip,and the error point is here,so i nano my /etc/hosts file,and add map for hostname and 127.0.0.1,that's it!

    \n", "_id"=>471}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["书"], "comments_count"=>0, "category_id"=>6, "title"=>"我写的书:《Google Android开发入门与实战》等即将上市.", "body"=>"这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。\r\n\r\n写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。\r\n\r\n其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Working_with_Controllers”,第10章“ActionView”,第13章“Session__Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。\r\n\r\n《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。\r\n\r\n\"\"\r\n\r\n本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。\r\n\r\n《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:\r\n\r\n\"\"\r\n\r\n \r\n
    本书内容特点:     * 国内第一本原创Android图书     * 完全基于Android最新的SDK1.5     * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手     * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源     * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。```\r\n
        样章下载:http://www.eoeandroid.com/viewthread.php?tid=314&extra=page%3D1    视频下载:http://www.eoeandroid.com/viewthread.php?tid=328&extra=page%3D1```\r\nPS:\r\n\r\n这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,\r\n\r\n请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;\r\n\r\n如果你想对我个人说些什么,那非常欢迎。", "created_at"=>2009-05-19 19:09:11 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    这篇文章是非技术性的,所以使用中文写,免得写了大家看不懂,呵呵。

    \n\n

    写书不是第一次,出版却是第一本,至于原因,就不详述了,去年9月开始参与一些图书的翻译和撰写中,截至到目前,这段时间一共参与了三本书,按照参与的先后顺序,分别是《The Rails Way》,《Google API 编程.开发.实例》以及《Google Android开发入门与实战》。

    \n\n

    其中《The Rails Way》是做为译者参与,其他翻译者都是国内第一批Rails技术人员,分散在全国各地,还有一名译者在加拿大,我一共翻译了5章内容,分别是第2章“Workingwith_Controllers”,第10章“ActionView”,第13章“Session_Session_Management”,第15章“XML_and_ActiveResource”和第16章“ActionMailer”,翻译很早前就结束了,目前好像还在审稿、校核工作,由YiTan在跟,至于何时出版,我还真不知道。

    \n\n

    《Google API 编程.开发.实例》我是从去年9月份介入,开始参与选题和策划,截至撰写相关内容,因为我自身是Google重度使用者,平时也比较多的使用和了解GoogleAPI,所以写起来得心应手,一共写了“Google Account Authentication”,“Google AJAX Language API”,“Google Chart API”,“Blogger Data API”,“Feedburner API”,“Google Code Search Data API”和“Google Book Search Book Viewability API”这些章节,前前后后也花了不少零碎的时间。其他作者大多都Google内部的同学,本书已经进入出版流程,由博文视点出版社策划出版,应该在6.5号Google开发者大会上可以看到,如下是本书第一版封面。

    \n\n\n

    本书特点:本书覆盖了Google绝大多数的API,其中针对每个API就其原理、用法做了详细说明,最后基本上都有实际的例子演示如何使用。

    \n\n

    《Google Android开发入门与实战》是08年11月份开始撰写的,和另外一个朋友一起,两个人陆续的差不多用了半年时间,在09年4月份差不多全部写完,后面主要是都在校核和审稿,由人民邮电出版社出版,5月底6月初即可上市,封面如下:

    \n\n\n

     
    \n本书内容特点: * 国内第一本原创Android图书 * 完全基于Android最新的SDK1.5 * 全书除了大量小型案例之外还包含了5个Android平台下的完整商业实例及源码分析,分别是RSS阅读器、      基于GoogleMap的个人GPS、豆瓣客户端、在线音乐播放器、手机信息助手 * 随书附赠的光盘中包含300分钟的详细教学视频以及Android开发必备的开发资源 * 读者对于此书内容的疑问可以访问http://www.eoeandroid.com社区,作者团队将会及时解答,不在这里解答,谢谢。
    \n<pre class="note" style="font-family: monospace; font-size: 1em;">    样章下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=314&amp;extra=page%3D1</a>    视频下载:<a style="color: #666699; text-decoration: none; cursor: pointer;" href="http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1" rel="nofollow" target="_blank">http://www.eoeandroid.com/viewthread.php?tid=328&amp;extra=page%3D1</a>

    \nPS:

    \n\n

    这里只是我个人技术随笔,理论上不保证在这里解答图书中问题,如果你对图书有问题,

    \n\n

    请前往其支持社区“《Google Android开发入门与实战》专版”寻求解答;

    \n\n

    如果你想对我个人说些什么,那非常欢迎。

    \n", "_id"=>472}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["SQLite"], "comments_count"=>0, "category_id"=>11, "title"=>"Installing SQLite 3 on Windows", "body"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here

    \n

    and now,you can open a cmd shell,and input sqlite3 like this:
    \n

    \n

    C:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions

    \n

    and some help infos is here:

    \n

    sqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    ", "created_at"=>2009-05-24 02:11:13 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Install SQLite3 for Windows by downloading the following 2 zip files and unzipping them into /WINDOWS/system32
    \nhttp://www.sqlite.org/sqlite-3_6_14_1.zip
    \nhttp://www.sqlite.org/sqlitedll-3_6_14_1.zip
    \nIf those don't work try the official download site here
    \nand now,you can open a cmd shell,and input sqlite3 like this:
    \n
    \nC:\\Documents and Settings\\Administrator>sqlite3
    \nSQLite version 3.5.9
    \nEnter ".help" for instructions
    \nand some help infos is here:
    \nsqlite> .help
    \n.bail ON|OFF           Stop after hitting an error.  Default OFF
    \n.databases             List names and files of attached databases
    \n.dump ?TABLE? ...      Dump the database in an SQL text format
    \n.echo ON|OFF           Turn command echo on or off
    \n.exit                  Exit this program
    \n.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
    \n.header(s) ON|OFF      Turn display of headers on or off
    \n.help                  Show this message
    \n.import FILE TABLE     Import data from FILE into TABLE
    \n.indices TABLE         Show names of all indices on TABLE
    \n.load FILE ?ENTRY?     Load an extension library
    \n.mode MODE ?TABLE?     Set output mode where MODE is one of:
    \n                         csv      Comma-separated values
    \n                         column   Left-aligned columns.  (See .width)
    \n                         html     HTML <table> code
    \n                         insert   SQL insert statements for TABLE
    \n                         line     One value per line
    \n                         list     Values delimited by .separator string
    \n                         tabs     Tab-separated values
    \n                         tcl      TCL list elements
    \n.nullvalue STRING      Print STRING in place of NULL values
    \n.output FILENAME       Send output to FILENAME
    \n.output stdout         Send output to the screen
    \n.prompt MAIN CONTINUE  Replace the standard prompts
    \n.quit                  Exit this program
    \n.read FILENAME         Execute SQL in FILENAME
    \n.schema ?TABLE?        Show the CREATE statements
    \n.separator STRING      Change separator used by output mode and .import
    \n.show                  Show the current values for various settings
    \n.tables ?PATTERN?      List names of tables matching a LIKE pattern
    \n.timeout MS            Try opening locked tables for MS milliseconds
    \n.width NUM NUM ...     Set column widths for "column" mode

    \n", "_id"=>473}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GDD", "Google API"], "comments_count"=>0, "category_id"=>6, "title"=>"《Google API大全:编程·开发·实例》将在6月5日的GDD上面世", "body"=>"不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。\r\n\r\n回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。\r\n\r\n本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。\r\n\r\n《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。\r\n\r\n“Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。\r\n\r\n\"\"\r\n\r\n本书相关的链接:\r\n\r\n互动出版网:http://www.china-pub.com/195616 \r\n豆瓣 :http://www.douban.com/subject/3764948/ \r\n\r\n配套源代码和相关的说明\r\nhttp://code.google.com/p/google-api-broadview/ \r\n\r\n推荐序 \r\nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx \r\nhttp://bvbook.javaeye.com/blog/398813 \r\n\r\n \r\n\r\n本书作者、编辑们的博客记录\r\nhttp://www.gaoang.com/archives/125\r\nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html\r\nhttp://diuera.blogbus.com/logs/40249425.html\r\nhttp://iceskysl.1sters.com/?action=show&id=471\r\nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/\r\n\r\n \r\n\r\n ", "created_at"=>2009-06-03 18:58:52 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    不久前的一个深夜,在GT上收到diuera的消息,说自己在乌镇旅游,收到博文关于GOOGLE API》将于出版的消息,写了一篇《Google的葡萄熟了》策划手记;再前些日子请了些假回老家呆了几天,没有网络的日子里我和外界保持同步的唯一途径是在我的blackberry和G1上收Gmail,收到高昂发的邮件说《GOOGLE API》如期,将在本周五,也就是6月5日的Google 2009 年开发者日大会上正式发布,格外欣慰。

    \n\n

    回想这本书从策划到发布差不多快8个多月的时间,从去年9月的样子原博文编辑diuera策划这本书,找到我的时候,加入编写,而后作者群一路飙升,到今年全部书稿全部结束的时候,作者有12位之多,其中数位Google公司的一线工程师,还有几位活跃在技术社区的开发者一起合著了《Google API大全:编程·开发·实例》,其历时之久和作者的数量都让我非常的吃惊。

    \n\n

    本书的撰写过程得益Google自身的很多服务,比如Google Doc,Google Group等等,在撰写的过程中,可以非常顺利、自然、流畅的协作。

    \n\n

    《Google API大全:编程·开发·实例》这本书是国内的第一本较为完整的介绍Google API的书,内容囊括了所有主要的Google API,并用大量的实例展示了Google API的应用方法。想更快的了解这些强大的API,本书无疑是个很好的枕边书。

    \n\n

    “Google改变了我的生活方式,Google API改变了我的工作方式,感谢Google,感谢一起编写本书的朋友们。”是我写给本书的一句话,做为一个比较活跃的技术工作者,我被Google深深的影响着。

    \n\n\n

    本书相关的链接:

    \n\n

    互动出版网:http://www.china-pub.com/195616
    \n豆瓣 :http://www.douban.com/subject/3764948/

    \n\n

    配套源代码和相关的说明
    \nhttp://code.google.com/p/google-api-broadview/

    \n\n

    推荐序
    \nhttp://blog.csdn.net/bvbook/archive/2009/05/31/4227452.aspx
    \nhttp://bvbook.javaeye.com/blog/398813

    \n\n

     

    \n\n

    本书作者、编辑们的博客记录
    \nhttp://www.gaoang.com/archives/125
    \nhttp://www.cnblogs.com/guanhe/archive/2009/06/01/1493789.html
    \nhttp://diuera.blogbus.com/logs/40249425.html
    \nhttp://iceskysl.1sters.com/?action=show&id=471;
    \nhttp://blog.liuhongwei.cn/my-opensource/google-api-bible-release/

    \n\n

     

    \n\n

     

    \n", "_id"=>474}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["lftp", "limit-rate"], "comments_count"=>0, "category_id"=>11, "title"=>"set limit-rate fot lftp upload&downlod", "body"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:

    \n

    http://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006

    \n

    http://blog.chinaunix.net/u/24834/showart_520018.html

    \n

     

    \n


    \n

    ", "created_at"=>2009-06-08 05:03:37 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    add this line into /etc/lftp.conf
    \nset net:limit-rate 10240000,40960
    \n
    \nthat's limit upload rate to 10M,and download to 40K
    \n
    \nsome useful resource:
    \nhttp://plog.longwin.com.tw/my_note-app-setting/2006/04/02/lftp_limit_conf_2006
    \nhttp://blog.chinaunix.net/u/24834/showart_520018.html
    \n 
    \n

    \n", "_id"=>475}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "MERGE", "truncate"], "comments_count"=>0, "category_id"=>11, "title"=>"【Mysql】truncate MERGE table的过程", "body"=>" \n
    数据库告警空间不足,看了下数据文件\n
    \n
    db1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n
    2187    rails_logs_081023.MYD
    \n
    1447    rails_logs_081023.MYI
    \n
    \n
    687     uwa_sessions_080808.MYD
    \n
    607     uwa_sessions_080808.MYI
    \n
    591     uplay_daily_stats.MYI
    \n
    351     uplay_daily_stats.MYD
    \n
    313     uplay_tmp_logs.MYD
    \n
    \n
    原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n
    -rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n
    -rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n
    -rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n
    原来有2G多的大小,看看有多少数据
    \n
    \n
    mysql> select count(id) from rails_logs_081023;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |  11042292 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    wow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    ERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n
    出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \n
    mysql> truncate table  rails_logs;
    \n
    ERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n
    呀,还是出错,文件不可写?Errcode: 17
    \n
    查下资料,原来:
    \n
    System error: 17 = File exists
    \n
    \n
    这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n
    那就先把这个MERGE表干掉,再创建:
    \n
    先看下这个表是咋定义的:
    \n
    mysql>  show create table rails_logs;
    \n
    \n
    记录下SQL,接着drop掉。
    \n
    mysql> DROP  table rails_logs;
    \n
    Query OK, 0 rows affected (0.36 sec)
    \n
    \n
    再truncate我的目标表
    \n
    mysql> truncate table  rails_logs_081023;
    \n
    Query OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n
    够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n
    最后确认下这表没啥问题:
    \n
    \n
    mysql> select count(id) from rails_logs;
    \n
    +-----------+
    \n
    | count(id) |
    \n
    +-----------+
    \n
    |         0 |
    \n
    +-----------+
    \n
    1 row in set (0.00 sec)
    \n
    \n
    OK,搞定,空间有了,天下太平了。
    \n
    \n
    附录:如何删除大表
    \n
    \n
    问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n
    这就需要用truncate table来搞定了,如下:
    \n
    select 5条数据 into #临时表 from 1亿条数据的牛X表
    \n
    truncate table 1亿条数据的牛X表
    \n
    --让它牛X,不到10毫秒干掉它。
    \n
    insert 1亿条数据的牛X表 select * from #临时表
    \n
    drop table #临时表
    \n
    \n
    \n
    \n
    参考资料:
    \n\n
    \n
    大表删除数据的思路
    \n\n
    \nmysql 的 MERGE存储引擎\n\n
    \nTruncate table,Delete,与Drop table的区别\n\n
    \n
    MySQL删除表中大批量的数据
    \n\n
    ", "created_at"=>2009-06-08 13:12:55 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    数据库告警空间不足,看了下数据文件
    \n
    \ndb1:/var/lib/mysql/yobo_beta_log # du -sm * | sort -nr | more
    \n
    \n2187    rails_logs_081023.MYD
    \n1447    rails_logs_081023.MYI
    \n
    \n687     uwa_sessions_080808.MYD
    \n607     uwa_sessions_080808.MYI
    \n591     uplay_daily_stats.MYI
    \n351     uplay_daily_stats.MYD
    \n313     uplay_tmp_logs.MYD
    \n
    \n原来有个日志表文件这么大,看看有多大
    \n
    \n
    \n-rw-r-----+ 1 4294967294 4294967294      13082 Jun  8 20:20 rails_logs_081023.frm
    \n-rw-r-----+ 1 4294967294 4294967294 2290840288 Jun  8 20:24 rails_logs_081023.MYD
    \n-rw-r-----+ 1 4294967294 4294967294 1515332608 Jun  8 20:27 rails_logs_081023.MYI
    \n
    \n原来有2G多的大小,看看有多少数据
    \n
    \nmysql> select count(id) from rails_logs_081023;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|  11042292 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nwow,千万级的,看来够大,这个没啥用,先备份下数据文件,然后truncate掉
    \nmysql> truncate table  rails_logs_081023;
    \nERROR 1105 (HY000): MyISAM table 'rails_logs_081023' is in use (most likely by a MERGE table). Try FLUSH TABLES.
    \n
    \n出错了,这边表貌似被MERGE用了,查了一下,果然是被rails_logs这个表MERGE着用了,那我直接truncate这个rails_logs试试看。
    \nmysql> truncate table  rails_logs;
    \nERROR 1 (HY000): Can't create/write to file './iceskysl_beta_log/rails_logs.MRG' (Errcode: 17)
    \n
    \n呀,还是出错,文件不可写?Errcode: 17
    \n查下资料,原来:
    \nSystem error: 17 = File exists
    \n
    \n这咋回事,再查资料,原来.MRG是创建MERGE表的时候创建的,已经存在了。
    \n
    \n那就先把这个MERGE表干掉,再创建:
    \n先看下这个表是咋定义的:
    \nmysql>  show create table rails_logs;
    \n
    \n记录下SQL,接着drop掉。
    \nmysql> DROP  table rails_logs;
    \nQuery OK, 0 rows affected (0.36 sec)
    \n
    \n再truncate我的目标表
    \nmysql> truncate table  rails_logs_081023;
    \nQuery OK, 0 rows affected (4.22 sec)
    \n
    \n
    \n够快的,11042292条数据4S搞定,接着再创建下这个MERGE表,执行下上面记录的SQL就好了。
    \n
    \n最后确认下这表没啥问题:
    \n
    \nmysql> select count(id) from rails_logs;
    \n+-----------+
    \n| count(id) |
    \n+-----------+
    \n|         0 |
    \n+-----------+
    \n1 row in set (0.00 sec)
    \n
    \nOK,搞定,空间有了,天下太平了。
    \n
    \n附录:如何删除大表
    \n
    \n问题:有一个拥有1亿条数据的表,只需要保留其中的5条,其他删除,如何做?
    \n这就需要用truncate table来搞定了,如下:
    \nselect 5条数据 into #临时表 from 1亿条数据的牛X表
    \ntruncate table 1亿条数据的牛X表
    \n--让它牛X,不到10毫秒干掉它。
    \ninsert 1亿条数据的牛X表 select * from #临时表
    \ndrop table #临时表
    \n
    \n
    \n
    \n参考资料:
    \nhttp://www.vbulletin.com/forum/archive/index.php/t-210887.html
    \n
    \n大表删除数据的思路
    \nhttp://www.mysqlsupport.cn/node/21
    \n
    \nmysql 的 MERGE存储引擎
    \nhttp://bbs.hxxsh.com/thread-52688-1-8.html
    \n
    \nTruncate table,Delete,与Drop table的区别
    \nhttp://gaijing814.javaeye.com/blog/403243
    \n
    \nMySQL删除表中大批量的数据
    \nhttp://www.javayou.com/diary/146633154

    \n", "_id"=>476}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"遭遇爬虫,关闭所有文章的评论", "body"=>"遭遇万恶的爬虫和网络灌水机,奇怪的是我的验证码无法挡住,每篇文章都被垃圾灌了几百给回复,我懒得改这套blog系统的代码,早上把DB里的垃圾回复都删掉了,同时将所有文章的回复都关闭了,望周知。\r\n\r\n如果您需要和我交流,可以通过右侧方式联系到我。", "created_at"=>2009-06-18 03:04:22 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    遭遇万恶的爬虫和网络灌水机,奇怪的是我的验证码无法挡住,每篇文章都被垃圾灌了几百给回复,我懒得改这套blog系统的代码,早上把DB里的垃圾回复都删掉了,同时将所有文章的回复都关闭了,望周知。

    \n\n

    如果您需要和我交流,可以通过右侧方式联系到我。

    \n", "_id"=>477}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Get POSSIBLE BREAK-IN ATTEMPT msg when i ssh to s server", "body"=>"

    when i ssh to a server,i get some message like this:

    \n

    Address 192.168.5.12 maps to localhost, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!

    \n

    Solution:

    \n

    Modify the "/etc/ssh/ssh_config" file at localhost

    \n

     GSSAPIAuthentication no

    \n

    exp:

    \n

    ssh 192.168.1.110时报错上述错,本地是192.168.1.20 ,则修改本地192.168.1.20中的/etc/ssh/ssh_config,把参数GSSAPIAuthentication no修改就可以了。。或者修改服务器端192.168.1.110上的/etc/ssh/sshd_config ,把参数GSSAPIAuthentication no改了也可以。要注意的是/etc/ssh/ssh_config和/etc/ssh/sshd_confg的区别。

    ", "created_at"=>2009-06-19 02:17:03 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    when i ssh to a server,i get some message like this:
    \nAddress 192.168.5.12 maps to localhost, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!
    \nSolution:
    \nModify the "/etc/ssh/ssh_config" file at localhost
    \n GSSAPIAuthentication no
    \nexp:
    \nssh 192.168.1.110时报错上述错,本地是192.168.1.20 ,则修改本地192.168.1.20中的/etc/ssh/ssh_config,把参数GSSAPIAuthentication no修改就可以了。。或者修改服务器端192.168.1.110上的/etc/ssh/sshd_config ,把参数GSSAPIAuthentication no改了也可以。要注意的是/etc/ssh/ssh_config和/etc/ssh/sshd_confg的区别。

    \n", "_id"=>478}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"MMarket发布会, 中国移动应用商店正式亮相", "body"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版
    \n

    ", "created_at"=>2009-08-16 19:32:25 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    接到发布会主办方卓望数码(深圳)通知,此次MM发布会会议举办是是8月17日下午14:30-16:00,地点在北京市东二环光华路9号-世贸天阶时尚大厦5层多功能厅。
    \n本次MM发布会参与者需要受邀请,参会人员需要持有入场证券,在一楼领取。
    \n
    \n明天是否有人同去。
    \n
    \n另,接eoe通知,明天早上eoeMobile团队将发布其国内著名的第三方应用商店平台eoeMarket的2.0版,届时将有如下更新:
    \n      1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n      2.添加了核心功能  我的eoeMarket 模块
    \n      3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n      4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n      5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件
    \n
    \n更多详细信息,请参考 eoeMarket 在中国移动的MMarket发布前发布2.0版

    \n", "_id"=>479}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoe", "eoemarket", "mmarket"], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMarket 在中国移动的MMarket发布前发布2.0版", "body"=>"eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。\n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。\n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。\neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:\n\n8.9–>rice 1.5版本\n8.16–>wheat 2.0 版本\n8.23–>corn 2.5 版本\n8.30–>potato 3.0 版本\n\n大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。\nwheat 2.0 版本主要的更新如下:\n

    1.错误提示信息采用 服务器端 返回的 error 提示信息\n2.添加了核心功能 我的eoeMarket 模块\n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息\n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息\n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件\n\n下边截图一些,更多功能大家赶紧去体验\n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。\n\n2)点击进入 My eoeMarket 后的界面如下:\n\n3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。\n\n4) about us.\n\n5.eoeMarket 的主界面\n\n6.什么是eoeMarket?", "created_at"=>2009-08-16 19:35:18 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    eoeMarket发布了2.0的Wheat(小麦)版本。2.0的版本是一个里程碑的版本。客户端和web端都有了比较大的完善。而且从2.0版本开始eoeMarket的注册不再受限了。大家现在可以自由的注册eoeMarket.要是现在还没有注册的人赶紧去抢注一个好号吧。
    \n8.17日是中国移动的MMarket发布的日子,我们很高兴看到官方的market正式的发布了。在网上我看到有一些人用过eoeMarket说eoeMarket是MMarket(美眉market)的一个重要的竞争对手,在这里我想澄清一点eoeMarket是一个第三方的Android应用发布平台,它应该是MMarket的一个很好的补充,而不应该和Market是竞争关系。
    \n有人说eoeMarket是山寨的google Market,对于这点我们有不同的看法。googleMarket从用户的使用性上做的比较差,连评论都要在手机上来看。但是eoeMarket在google Market功能的基础上,增加和探索了更多的对用户友好的本地化功能,比如应用收藏和应用推荐功能。
    \neoeMarket目前正在迅速的发展和完善。我们来回顾和澄清一下eoeMarket的发布路线图:

    \n\n

    8.9–>rice 1.5版本
    \n8.16–>wheat 2.0 版本
    \n8.23–>corn 2.5 版本
    \n8.30–>potato 3.0 版本

    \n\n

    大家可以看到eoeMarket基本上每一周就会有一个版本,我们会保证在兼容以前版本的基础上增加更好的有用的本土化功能,和完善相关功能。eoeMarket的工作人员真的很辛苦,为了给广大android开发者提供一个好的第三方发布平台,日夜兼程,马不停蹄。有些开发人员甚至晚上自愿工作通宵。向这些eoeMarket的开发人员致敬。
    \nwheat 2.0 版本主要的更新如下:
    \n1.错误提示信息采用 服务器端 返回的 error 提示信息
    \n2.添加了核心功能 我的eoeMarket 模块
    \n3.我的下载,可以查看我从eoeMarket下载的应用列表和详细信息
    \n4.我的收藏,可以从服务器获取到我收藏的应用列表和详细信息
    \n5.个性推荐,根据用户的安装和收藏列表,推荐适合你的应用软件

    \n\n

    下边截图一些,更多功能大家赶紧去体验
    \n1) eoeMarket客户端首界面。大家发现了,有一个新的功能。

    \n\n

    2)点击进入 My eoeMarket 后的界面如下:

    \n\n

    3)点击进入widget下载页面,用户可以去下载好玩,好用的widget了。

    \n\n

    4) about us.

    \n\n

    5.eoeMarket 的主界面

    \n\n

    6.什么是eoeMarket?

    \n", "_id"=>480}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["sablog", "wp"], "comments_count"=>0, "category_id"=>5, "title"=>"博客迁移到WP", "body"=>"我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。\r\n\r\n忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。\r\n\r\n希望这个可以用上一段时间。", "created_at"=>2009-08-23 21:59:59 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    我的blog写了很久了,之前使用的国内一个安全团队写的Sablog-x,一直用着比较舒服,但是后来觉得满足不了我的需要了,比如防爬虫,灌水机机制不够,编辑器不支持chrome等。

    \n\n

    忍了很久,一直没动手,是不想手工转我之前的文章,今天忍无可忍,动手了,找了一段转换代码,再修改修改,还挺顺利,把以前的内容转过来了。

    \n\n

    希望这个可以用上一段时间。

    \n", "_id"=>481}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"回到深圳,安静的体会生活...", "body"=>"时隔几个月之后,我再次回到深圳,一切都还是那么熟悉,前两天去办理护照,坐在公交车上,快速的浏览深圳的感觉,很好,这是个充满活力的城市,和北京的感觉截然不同。\n深圳是年轻的,跳动的,每个人都在演绎着自己的角色~这次回来要呆上很长一段时间,在10月中旬,会去一次马来西亚,然后到合肥举办婚礼,再就要回老家呆上几天。\n在深圳,安静的体会生活...", "created_at"=>2009-09-22 02:38:50 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    时隔几个月之后,我再次回到深圳,一切都还是那么熟悉,前两天去办理护照,坐在公交车上,快速的浏览深圳的感觉,很好,这是个充满活力的城市,和北京的感觉截然不同。
    \n深圳是年轻的,跳动的,每个人都在演绎着自己的角色~这次回来要呆上很长一段时间,在10月中旬,会去一次马来西亚,然后到合肥举办婚礼,再就要回老家呆上几天。
    \n在深圳,安静的体会生活...

    \n", "_id"=>482}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>12, "title"=>"android market的通信协议还是比较安全的", "body"=>"今天起了大大早,搬出十八般武器研究起android market的数据通讯,想看看是数据传输的方式以加以借鉴和参考。\n最终结果是Sniffer到数据通信了,但是无法破解其使用的协议,最终很多内容无法还原,如此看来其走的肯定是一套私有的协议,那么下一步就是,有时间的话反编译android market客户端的源代码,看看其协议是怎么样的。\n截图一张:\n\"TM截图未命名\"", "created_at"=>2009-09-24 02:00:39 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    今天起了大大早,搬出十八般武器研究起android market的数据通讯,想看看是数据传输的方式以加以借鉴和参考。
    \n最终结果是Sniffer到数据通信了,但是无法破解其使用的协议,最终很多内容无法还原,如此看来其走的肯定是一套私有的协议,那么下一步就是,有时间的话反编译android market客户端的源代码,看看其协议是怎么样的。
    \n截图一张:

    \n", "_id"=>483}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cURL", "twitter"], "comments_count"=>0, "category_id"=>11, "title"=>"Updating Twitter with cURL", "body"=>"
    curl -u email:passw -d status=\"text\" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when \"http:\" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.\n\nOf course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.\n\nfrom:\nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2", "created_at"=>2009-09-27 18:26:17 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    curl -u email:passw -d status="text" http://twitter.com/statuses/update.xml
    \ncURL figures out which protocol to use from the URL you provide, and when "http:" is specified will, unless otherwise instructed (using -0), default to using HTTP 1.1. The first argument, -u, instructs cURL to use the next two parameters (separated by a colon) as the account name and password for basic authentication. The next argument, -d, specifies the data (maximum 140 characters) to be sent via a POST request.

    \n\n

    Of course what cURL expects is a response to the POST request so the result will be the requested page (update.xml) sent to stdout. This page will be encoded according to the file type used in the request, thus as we just requested update.xml we’ll get XML-formatted data. The alternatives are JSON (JavaScript Object Notation), RSS and Atom formats.

    \n\n

    from:
    \nhttp://www.networkworld.com/columnists/2008/052108-gearhead.html?page=2

    \n", "_id"=>484}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx"], "comments_count"=>0, "category_id"=>11, "title"=>"解决Nginx的413 Request Entity Too Large的方法", "body"=>"项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!\n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加\n\n\n
    client_max_body_size 20m;
    \n\n最好也调整下:\n
    keepalive_timeout 105;
    \n免得链接超时被关!\n\n\n该文件一般在/etc/nginx/nginx.conf", "created_at"=>2009-10-04 16:44:28 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    项目中使用nginx,上传一个大文件,出来错误提示,413 Request Entity Too Large!
    \n查了下资料,解决方法:打开nginx主配置文件nginx.conf,找到http{}段,添加

    \n\n

    client_max_body_size 20m;

    \n\n

    最好也调整下:
    \n keepalive_timeout 105;
    \n免得链接超时被关!

    \n\n

    该文件一般在/etc/nginx/nginx.conf

    \n", "_id"=>485}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"eoeMobile实习生计划", "body"=>"开始招实习生了,有兴趣的帮忙留意和推荐下。\n\neoeMobile是一支立足于移动互联网,平均年龄大概在25岁左右的创业公司,在eoeMobile里你会天天享受和eoeMobile一起实现目标的兴奋和快乐,这里没有死板而无趣没用的制度,也没有如履薄冰的分层级的感觉,在这里我们平等,互助,尊重,高效,这里就是你实现梦想的起点。\n\n不同阶段我们会有不同的实习生计划,目前需要的实习生如下:\n\n【网站前端 (front end) 实习工程师, 设计师】\n1,CS/EE或相关专业本科\n2,必须熟悉HTML, CSS,JS\n3,对界面设计极为敏感,关注细节的完美主义者优先\n4,关注WEB2.0应用和移动平台技术发展\n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感\n\nP.S. 加入eoeMobile,你将成为国内顶级移动互联网开发团队一员,在高速发展的最新移动平台上做创新应用\n\n【Android实习工程师】 \n1,CS/EE或相关专业本科或研究生;本科成绩优秀,或有实习工作经验\n2,必须熟悉Java语言,可以使用linux工作环境\n3,熟悉MySQL, Rails, HTML,CSS, subversion(svn)者优先\n4,有移动平台开发经验者优先\n5,关注WEB2.0应用和移动平台技术(Android, iphone, webkit)发展\n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感。\n7. 喜欢做有挑战的事情,不服输,不达目标誓不罢休。\n8. 有幽默感者优先。\n加入eoeMobile你就会和大量优秀而又有趣的人并肩工作,你就可以看到大量Android商战的源码,你可以以更快的速度成长。\n\neoeMobile正在快速发展中,我们相信eoeMobile在我们的努力下会有很大的发展舞台(请有兴趣应聘的工程师将中文或英文简历发至 iceskysl@eoemobile.com )", "created_at"=>2009-10-09 23:54:14 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    开始招实习生了,有兴趣的帮忙留意和推荐下。

    \n\n

    eoeMobile是一支立足于移动互联网,平均年龄大概在25岁左右的创业公司,在eoeMobile里你会天天享受和eoeMobile一起实现目标的兴奋和快乐,这里没有死板而无趣没用的制度,也没有如履薄冰的分层级的感觉,在这里我们平等,互助,尊重,高效,这里就是你实现梦想的起点。

    \n\n

    不同阶段我们会有不同的实习生计划,目前需要的实习生如下:

    \n\n

    【网站前端 (front end) 实习工程师, 设计师】
    \n1,CS/EE或相关专业本科
    \n2,必须熟悉HTML, CSS,JS
    \n3,对界面设计极为敏感,关注细节的完美主义者优先
    \n4,关注WEB2.0应用和移动平台技术发展
    \n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感

    \n\n

    P.S. 加入eoeMobile,你将成为国内顶级移动互联网开发团队一员,在高速发展的最新移动平台上做创新应用

    \n\n

    【Android实习工程师】
    \n1,CS/EE或相关专业本科或研究生;本科成绩优秀,或有实习工作经验
    \n2,必须熟悉Java语言,可以使用linux工作环境
    \n3,熟悉MySQL, Rails, HTML,CSS, subversion(svn)者优先
    \n4,有移动平台开发经验者优先
    \n5,关注WEB2.0应用和移动平台技术(Android, iphone, webkit)发展
    \n6,有创业激情!求知欲强,学习能力强,有高度责任感和集体荣誉感。
    \n7. 喜欢做有挑战的事情,不服输,不达目标誓不罢休。
    \n8. 有幽默感者优先。
    \n加入eoeMobile你就会和大量优秀而又有趣的人并肩工作,你就可以看到大量Android商战的源码,你可以以更快的速度成长。

    \n\n

    eoeMobile正在快速发展中,我们相信eoeMobile在我们的努力下会有很大的发展舞台(请有兴趣应聘的工程师将中文或英文简历发至 iceskysl@eoemobile.com )

    \n", "_id"=>486}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"Unicorn: Rack HTTP server for fast clients and Unix", "body"=>"\"\"\n\nUnicorn是一个几乎使用纯Ruby编写的HTTP server,主要用于Rack应用。Unicon的创建作者是Eric Wong,它基于Mongrel(包括Ragel/C HTTP分析器),采用同样的许可-Ruby license和GPL2,但对Mongrel进行了改良。\n
      \n\t
    • Unicorn设计的初衷是为了Rack,Unix,更快的客户端,易于调试等;
    • \n\t
    • 很好的兼容了Ruby 1.8和Ruby 1.9,并且对Rubinius的支持也在计划之内;
    • \n\t
    • 流程管理: Unicorn会重新启动出错的应用。你无需管理多个进程或端口,Unicorn可以管理任意数量的进程;
    • \n\t
    • 负载平衡:完全使用操作系统内核;
    • \n\t
    • 支持所有Rack应用;
    • \n\t
    • 简单方面的Ruby DSL配置;
    • \n\t
    • ……
    • \n
    \n

    点击阅读详情:\n\n\n\n

    \n", "created_at"=>2009-10-11 00:52:20 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Unicorn是一个几乎使用纯Ruby编写的HTTP server,主要用于Rack应用。Unicon的创建作者是Eric Wong,它基于Mongrel(包括Ragel/C HTTP分析器),采用同样的许可-Ruby license和GPL2,但对Mongrel进行了改良。
    \n
    \n Unicorn设计的初衷是为了Rack,Unix,更快的客户端,易于调试等;
    \n 很好的兼容了Ruby 1.8和Ruby 1.9,并且对Rubinius的支持也在计划之内;
    \n 流程管理: Unicorn会重新启动出错的应用。你无需管理多个进程或端口,Unicorn可以管理任意数量的进程;
    \n 负载平衡:完全使用操作系统内核;
    \n 支持所有Rack应用;
    \n 简单方面的Ruby DSL配置;
    \n ……
    \n
    \n点击阅读详情:

    \n\n

    I like Unicorn because it's Unix
    \n RailsConf 2009: powered by OMG UNICORNS!!!!
    \n

    \n", "_id"=>487}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails-2.3.4"], "comments_count"=>0, "category_id"=>6, "title"=>"rails-2.3.4 发布了", "body"=>"Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.\n\nC:\\Documents and Settings\\Administrator>gem install rails\nSuccessfully installed activesupport-2.3.4\nSuccessfully installed activerecord-2.3.4\nSuccessfully installed actionpack-2.3.4\nSuccessfully installed actionmailer-2.3.4\nSuccessfully installed activeresource-2.3.4\nSuccessfully installed rails-2.3.4\n6 gems installed\nInstalling ri documentation for activesupport-2.3.4...\nInstalling ri documentation for activerecord-2.3.4...\nInstalling ri documentation for actionpack-2.3.4...\nInstalling ri documentation for actionmailer-2.3.4...\nInstalling ri documentation for activeresource-2.3.4...\nInstalling RDoc documentation for activesupport-2.3.4...\nInstalling RDoc documentation for activerecord-2.3.4...\nInstalling RDoc documentation for actionpack-2.3.4...\nInstalling RDoc documentation for actionmailer-2.3.4...\nInstalling RDoc documentation for activeresource-2.3.4...\n\n详细信息:\n\nhttp://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4", "created_at"=>2009-10-14 07:47:04 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Ruby on Rails 2.3.4, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

    \n\n

    C:\\Documents and Settings\\Administrator>gem install rails
    \nSuccessfully installed activesupport-2.3.4
    \nSuccessfully installed activerecord-2.3.4
    \nSuccessfully installed actionpack-2.3.4
    \nSuccessfully installed actionmailer-2.3.4
    \nSuccessfully installed activeresource-2.3.4
    \nSuccessfully installed rails-2.3.4
    \n6 gems installed
    \nInstalling ri documentation for activesupport-2.3.4...
    \nInstalling ri documentation for activerecord-2.3.4...
    \nInstalling ri documentation for actionpack-2.3.4...
    \nInstalling ri documentation for actionmailer-2.3.4...
    \nInstalling ri documentation for activeresource-2.3.4...
    \nInstalling RDoc documentation for activesupport-2.3.4...
    \nInstalling RDoc documentation for activerecord-2.3.4...
    \nInstalling RDoc documentation for actionpack-2.3.4...
    \nInstalling RDoc documentation for actionmailer-2.3.4...
    \nInstalling RDoc documentation for activeresource-2.3.4...

    \n\n

    详细信息:

    \n\n

    http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

    \n", "_id"=>488}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"第一次去香港随笔", "body"=>"在深圳呆了3年了,一直没去过香港,前段时间办护照的时候,顺带把港澳通行证也办了下,找了个时间去那边转了下,总体来说,和我想象中的还有些不一样。\n\n深圳去香港比较方便,在我住的不远的地方,就没半个小时一趟直通香港的大巴车,到佐敦下车,票价也不是很贵,单程60,来回90,非常方便。\n\n8点爬起来,拿着信用卡就去车站了,买票,上车,8点半出发,途径深圳湾大桥,在海关排了一会队,都比较顺利,也熟悉了过关的手续。到达香港佐敦10点半不到,由于第一次来,也没仔细查地图,下了车还是有点小晕,幸好在不远处发现一个7-11,闪进去买了点早餐,换了点港币(亏了),然后就一边吃东西,一遍瞎逛,满街卖珠宝和银行,真不愧是金融中心。\n\n吃完早餐,路过一个书局,跑进去找了地图研究了一把,把地铁搞清楚差不多就不晕了,出来直奔地铁,买票去旺角,电影里经常看到这个地方,2站,香港地铁很完善,但是里面的设计也不是很清晰,我拿了卡,试了几次才晓得要塞进去,再从另外一个地冒出来,和北京的直接刷,深圳的地铁笔还是很不一样的。\n\n出了旺角地铁,迎面而来的就是熙熙攘攘的街道和人了,数码产品,衣服,银行,珠宝等等非常多,眼花缭乱,不多停留,凭感觉找到主干道,办事!\n\n办完事,在街上瞎逛,竟然遇到了轮子的宣传,狂汗!买了些化妆品,买了些特产,去找回来的车,6点半回来,过关,也没人检查,8点半到我住的地方。\n\n由于时间不多,加上第一次不是很熟悉,另外几个地方诸如中环,铜锣湾,湾仔这些地方都还没去,下次去的时候再去。\n\n总体感受,还没看到非常现代化的大楼,见到的是比较原始面貌的,这也许就是以前的香港吧。", "created_at"=>2009-10-15 04:51:32 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在深圳呆了3年了,一直没去过香港,前段时间办护照的时候,顺带把港澳通行证也办了下,找了个时间去那边转了下,总体来说,和我想象中的还有些不一样。

    \n\n

    深圳去香港比较方便,在我住的不远的地方,就没半个小时一趟直通香港的大巴车,到佐敦下车,票价也不是很贵,单程60,来回90,非常方便。

    \n\n

    8点爬起来,拿着信用卡就去车站了,买票,上车,8点半出发,途径深圳湾大桥,在海关排了一会队,都比较顺利,也熟悉了过关的手续。到达香港佐敦10点半不到,由于第一次来,也没仔细查地图,下了车还是有点小晕,幸好在不远处发现一个7-11,闪进去买了点早餐,换了点港币(亏了),然后就一边吃东西,一遍瞎逛,满街卖珠宝和银行,真不愧是金融中心。

    \n\n

    吃完早餐,路过一个书局,跑进去找了地图研究了一把,把地铁搞清楚差不多就不晕了,出来直奔地铁,买票去旺角,电影里经常看到这个地方,2站,香港地铁很完善,但是里面的设计也不是很清晰,我拿了卡,试了几次才晓得要塞进去,再从另外一个地冒出来,和北京的直接刷,深圳的地铁笔还是很不一样的。

    \n\n

    出了旺角地铁,迎面而来的就是熙熙攘攘的街道和人了,数码产品,衣服,银行,珠宝等等非常多,眼花缭乱,不多停留,凭感觉找到主干道,办事!

    \n\n

    办完事,在街上瞎逛,竟然遇到了轮子的宣传,狂汗!买了些化妆品,买了些特产,去找回来的车,6点半回来,过关,也没人检查,8点半到我住的地方。

    \n\n

    由于时间不多,加上第一次不是很熟悉,另外几个地方诸如中环,铜锣湾,湾仔这些地方都还没去,下次去的时候再去。

    \n\n

    总体感受,还没看到非常现代化的大楼,见到的是比较原始面貌的,这也许就是以前的香港吧。

    \n", "_id"=>489}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"笔记本要罢工了。", "body"=>"结婚后,还没来得及整理下生活,最近几日都在路上,酒席一场接着一场,赶的很。\n不幸的是跟随我3年多的笔记本罢工了,开始是电池无法使用了,接着是系统在一次断电后崩溃了,然后硬盘好像也有点不对劲,加上早就罢工被我拆除的光驱,现在剩下的部件好像不多了。\n真要换本了,好像。", "created_at"=>2009-10-30 09:00:38 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    结婚后,还没来得及整理下生活,最近几日都在路上,酒席一场接着一场,赶的很。
    \n不幸的是跟随我3年多的笔记本罢工了,开始是电池无法使用了,接着是系统在一次断电后崩溃了,然后硬盘好像也有点不对劲,加上早就罢工被我拆除的光驱,现在剩下的部件好像不多了。
    \n真要换本了,好像。

    \n", "_id"=>490}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"开始使用mac pro", "body"=>"前面说道,我用了3年多的本本终于再办完他最后一件重要的事情后罢工了,在tina的坚持下,我终于败家了一把,使用上了mac pro,机器是自己去香港买的,价格比大陆行货便宜不少,由于之对mac系统了解不是很多,所以使用起来还不是非常的顺手。\n\n自我感觉mac非常适合懒人,因为其帮你做了很多事情,不需要你自己再去折腾,但是对我这种比较爱折腾的人,还是有些不适应,win xp倒是被我折腾的很顺手。\n\n偶也算加入mac一族了,但是感觉没有我想象中的那么激动~\n\nps:昨天去村子里买了一个键膜,发现很不好用,搞得我手指超级疲劳,就丢一边去了,还是原始的键盘敲着舒服。", "created_at"=>2009-11-08 03:01:52 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前面说道,我用了3年多的本本终于再办完他最后一件重要的事情后罢工了,在tina的坚持下,我终于败家了一把,使用上了mac pro,机器是自己去香港买的,价格比大陆行货便宜不少,由于之对mac系统了解不是很多,所以使用起来还不是非常的顺手。

    \n\n

    自我感觉mac非常适合懒人,因为其帮你做了很多事情,不需要你自己再去折腾,但是对我这种比较爱折腾的人,还是有些不适应,win xp倒是被我折腾的很顺手。

    \n\n

    偶也算加入mac一族了,但是感觉没有我想象中的那么激动~

    \n\n

    ps:昨天去村子里买了一个键膜,发现很不好用,搞得我手指超级疲劳,就丢一边去了,还是原始的键盘敲着舒服。

    \n", "_id"=>491}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"如何让 Safari 默认使用新标签打开链接", "body"=>"xi喜欢chorme而不喜欢safari的原因之一就是safari每次打开链接都是新窗口,除非你按着Command,很不习惯,然后我找了半天也没再其设置中找到可以设置的地方,搞得我桌面上经常一大堆的safari窗口。\n\n于是开始寻找如何修改可以似的safari默认打开的链接是在信标签中的,于是找到如下方法:\n\n方法:\n\n1、打开 Terminal,Finder -> Applications -> Utilitys -> Terminal。。\n\n2、粘贴下面这段代码到 Terminal 中并回车,进行执行,即完成了激活。\n\ndefaults write com.apple.Safari TargetedClicksCreateTabs -bool true\n\n3、要撤销这个设置,你只需在 Terminal 中执行下面这条命令就行。\n\ndefaults delete com.apple.Safari TargetedClicksCreateTabs\n\n注意,在执行这两个命令后,重启 Safari 浏览器就ok了。", "created_at"=>2009-11-08 03:06:48 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    xi喜欢chorme而不喜欢safari的原因之一就是safari每次打开链接都是新窗口,除非你按着Command,很不习惯,然后我找了半天也没再其设置中找到可以设置的地方,搞得我桌面上经常一大堆的safari窗口。

    \n\n

    于是开始寻找如何修改可以似的safari默认打开的链接是在信标签中的,于是找到如下方法:

    \n\n

    方法:

    \n\n

    1、打开 Terminal,Finder -> Applications -> Utilitys -> Terminal。。

    \n\n

    2、粘贴下面这段代码到 Terminal 中并回车,进行执行,即完成了激活。

    \n\n

    defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

    \n\n

    3、要撤销这个设置,你只需在 Terminal 中执行下面这条命令就行。

    \n\n

    defaults delete com.apple.Safari TargetedClicksCreateTabs

    \n\n

    注意,在执行这两个命令后,重启 Safari 浏览器就ok了。

    \n", "_id"=>492}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"install mercurial and Go Programming Language", "body"=>"Having installed mercurial via easy_install,\n
    eoe:~ IceskYsl$ sudo easy_install mercurial\nPassword:\nSearching for mercurial\nReading http://pypi.python.org/simple/mercurial/\nReading http://www.selenic.com/mercurial\nBest match: mercurial 1.3.1
    \nany hg command fails with:\nValueError: unknown locale: UTF-8\n\nThis is mercurial 1.3.1and Python 2.6.1, but its seem that its caused by Leopard’s Term.app not setting the local encoding correctly. To resolve this, add the following to .profile:\n
    export LC_ALL=en_US.UTF-8\nexport LANG=en_US.UTF-8
    \nthen i clone the code for Go Programming Language\n
    eoe:system IceskYsl$ printenv LANG\neoe:system IceskYsl$ export LC_ALL=en_US.UTF-8\neoe:system IceskYsl$ export LANG=en_US.UTF-8\neoe:system IceskYsl$ hg clone -r release https://go.googlecode.com/hg/ go\nrequesting all changes\nadding changesets\nadding manifests\nadding file changes\nadded 3976 changesets with 16799 changes to 2931 files\nupdating working directory\n1640 files updated, 0 files merged, 0 files removed, 0 files unresolved
    \nhttp://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/", "created_at"=>2009-11-12 17:53:55 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Having installed mercurial via easy_install,
    \neoe:~ IceskYsl$ sudo easy_install mercurial
    \nPassword:
    \nSearching for mercurial
    \nReading http://pypi.python.org/simple/mercurial/
    \nReading http://www.selenic.com/mercurial
    \nBest match: mercurial 1.3.1
    \nany hg command fails with:
    \nValueError: unknown locale: UTF-8

    \n\n

    This is mercurial 1.3.1and Python 2.6.1, but its seem that its caused by Leopard’s Term.app not setting the local encoding correctly. To resolve this, add the following to .profile:
    \nexport LC_ALL=en_US.UTF-8
    \nexport LANG=en_US.UTF-8
    \nthen i clone the code for Go Programming Language
    \neoe:system IceskYsl$ printenv LANG
    \neoe:system IceskYsl$ export LC_ALL=en_US.UTF-8
    \neoe:system IceskYsl$ export LANG=en_US.UTF-8
    \neoe:system IceskYsl$ hg clone -r release https://go.googlecode.com/hg/ go
    \nrequesting all changes
    \nadding changesets
    \nadding manifests
    \nadding file changes
    \nadded 3976 changesets with 16799 changes to 2931 files
    \nupdating working directory
    \n1640 files updated, 0 files merged, 0 files removed, 0 files unresolved
    \nhttp://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/

    \n", "_id"=>493}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"how to avoid Net::SMTPFatalError (555 5.5.2 Syntax error.", "body"=>"i can not get notify email from my ExceptionNotifier in rails project,i notice some useful msg in the production logs:\n
    Net::SMTPFatalError (555 5.5.2 Syntax error. b17sm72261fka.43
    \n\n google....\n
    @from = \"\#{sender}\"\n If I submit an email id, It is giving error as\n (Net::SMTPFatalError) \"555 5.5.2 Syntax error. d29sm1994943and.38\\n\"\n\nThe from line is the problem. The Net::SMTP library was recently changed\nso it adds angle brackets to your sender, so you cannot have any in your\nstring. Try this as a workaround:\n@from = \"a...@xxxxxxx\"
    \n\nso,just fix it like this:\nExceptionNotifier.sender_address = %(\"iceskysl\" )\nto\nExceptionNotifier.sender_address = %(iceskysl@eoemobile.com)", "created_at"=>2009-11-12 19:58:54 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    i can not get notify email from my ExceptionNotifier in rails project,i notice some useful msg in the production logs:
    \nNet::SMTPFatalError (555 5.5.2 Syntax error. b17sm72261fka.43

    \n\n

    google....
    \n@from = "\#{sender}a...@xxxxxxx"
    \n If I submit an email id, It is giving error as
    \n (Net::SMTPFatalError) "555 5.5.2 Syntax error. d29sm1994943and.38\\n"

    \n\n

    The from line is the problem. The Net::SMTP library was recently changed
    \nso it adds angle brackets to your sender, so you cannot have any in your
    \nstring. Try this as a workaround:
    \n@from = "a...@xxxxxxx"

    \n\n

    so,just fix it like this:
    \nExceptionNotifier.sender_address = %("iceskysl" iceskysl@eoemobile.com)
    \nto
    \nExceptionNotifier.sender_address = %(iceskysl@eoemobile.com)

    \n", "_id"=>494}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cvs", "Mac", "svn"], "comments_count"=>0, "category_id"=>11, "title"=>"清理svn的垃圾文件.svn文件夹", "body"=>"有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:\n
    find . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。\n\ncvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:\n
    find . -name .cvs | xargs rm -rf
    ", "created_at"=>2009-11-17 08:22:20 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    有时候把svn的代码传到服务器,会不小心传上svn的系统文件,这些文件都是用于版本控制的,在生产环境,总有点不爽。在linux下可以用一个命令删除,命令如下:
    \nfind . -name .svn | xargs rm -rf
    \n上述命令要在代码所在目录运行。

    \n\n

    cvs的版本控制,也会有类似问题,方法类似,换一下名字,如下:
    \nfind . -name .cvs | xargs rm -rf

    \n", "_id"=>495}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["package", "ubuntu", "uninstall"], "comments_count"=>0, "category_id"=>7, "title"=>"Uninstall / Delete / Remove Package", "body"=>"Just use the following syntax:\n\nsudo apt-get remove {package-name}\n\nFor example remove package called mplayer, enter:\n$ sudo apt-get remove mplayer\n\nRemove package called lighttpd along with all configuration files, enter:\n$ sudo apt-get --purge remove lighttpd\n\nTo list all installed package, enter:\\\ndpkg --list\ndpkg --list | less\ndpkg --list | grep -i 'http'", "created_at"=>2009-11-22 18:48:23 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Just use the following syntax:

    \n\n

    sudo apt-get remove {package-name}

    \n\n

    For example remove package called mplayer, enter:
    \n$ sudo apt-get remove mplayer

    \n\n

    Remove package called lighttpd along with all configuration files, enter:
    \n$ sudo apt-get --purge remove lighttpd

    \n\n

    To list all installed package, enter:\\
    \ndpkg --list
    \ndpkg --list | less
    \ndpkg --list | grep -i 'http'

    \n", "_id"=>496}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delegate", "ImageMagick"], "comments_count"=>0, "category_id"=>7, "title"=>"ImageMagick够折腾得,no decode delegate", "body"=>"估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.\n记录下我参考过得资料:\nhttp://www.imagemagick.org/script/command-line-processing.php\nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/\nhttp://infrastacks.com/?p=57\nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html\nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html\nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html\nhttp://www.cnscn.org/htm_data/602/0705/8717.html\nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe\n我读最后一个问题印象深刻\n\"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works).\"\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG\n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\n and supplement 61 which adds JPEG-2000 encoding.\n JNG* PNG rw- JPEG Network Graphics\n JP2* JP2 rw- JPEG-2000 File Format Syntax\n JPC* JPC rw- JPEG-2000 Code Stream Syntax\n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n JPX* JPX rw- JPEG-2000 File Format Syntax\n PGX* PGX r-- JPEG-2000 VM Format\n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)\n\n看到其需要得JPEG得lib是70,但是我装得是\n\nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep \"magick\"\nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs\nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library\nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop\nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library\nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil\nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library\nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library\nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby\nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby", "created_at"=>2009-11-22 20:30:32 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    估计RP出问题了,以前安装和今天在mac上安装都很顺利,但是在服务器上装得时候,出现一大堆得问题,极度诡异,最后查了N多资料,改了N多东西,也不晓得最后是哪个生效了,终于折腾好了.
    \n记录下我参考过得资料:
    \nhttp://www.imagemagick.org/script/command-line-processing.php
    \nhttp://wanguan2000.blog.ubuntu.org.cn/2009/01/04/ubuntu-下rmagick的安装/
    \nhttp://infrastacks.com/?p=57
    \nhttp://hi.baidu.com/yttxuehui/blog/item/9f1a21978d6fa96a55fb96d5.html
    \nhttp://www.blogjava.net/fl1429/archive/2009/06/17/282895.html
    \nhttp://hi.baidu.com/countryroadtao/blog/item/225c72dad2adc16cd0164e97.html
    \nhttp://www.cnscn.org/htm_data/602/0705/8717.html
    \nhttp://stackoverflow.com/questions/1483968/imagemagick-convert-error-wrong-jpeg-library-version-library-is-62-caller-expe
    \n我读最后一个问题印象深刻
    \n"Looks like it is reading the wrong jpeg ibrary, but I have jpeg 7 installed. How do i tell ImageMagick to look up the right JPEG library version(I don't care 62 or 70 as long as it works)."
    \nroot@li84-64:/data/soft/ImageMagick-6.5.7-9# convert -list format | grep JPEG
    \n see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
    \n and supplement 61 which adds JPEG-2000 encoding.
    \n JNG* PNG rw- JPEG Network Graphics
    \n JP2* JP2 rw- JPEG-2000 File Format Syntax
    \n JPC* JPC rw- JPEG-2000 Code Stream Syntax
    \n JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPG* JPEG rw- Joint Photographic Experts Group JFIF format (70)
    \n JPX* JPX rw- JPEG-2000 File Format Syntax
    \n PGX* PGX r-- JPEG-2000 VM Format
    \n PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (70)

    \n\n

    看到其需要得JPEG得lib是70,但是我装得是

    \n\n

    root@li84-64:/data/soft/ImageMagick-6.5.7-9# dpkg --list | grep "magick"
    \nrc imagemagick 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation programs
    \nii libmagick++10 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library
    \nii libmagick++9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 C++ API to the ImageMagick library - develop
    \nii libmagick10 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library
    \nii libmagick9-dev 7:6.3.7.9.dfsg1-2ubuntu1.1 image manipulation library - development fil
    \nii libmagickcore1 7:6.4.5.4.dfsg1-1ubuntu3.1 low-level image manipulation library
    \nii libmagickwand1 7:6.4.5.4.dfsg1-1ubuntu3.1 image manipulation library
    \nii librmagick-ruby 1.15.11-1ubuntu1 ImageMagick API for Ruby
    \nii librmagick-ruby1.8 1.15.11-1ubuntu1 ImageMagick API for Ruby

    \n", "_id"=>497}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["find", "inject", "rails", "ruby", "select"], "comments_count"=>0, "category_id"=>5, "title"=>"用Ruby在已知数组中找到和目标最匹配得元素", "body"=>"有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:\n首先看下inject这个函数\n````\nenum.inject(initial) {| memo, obj | block } => obj\nenum.inject {| memo, obj | block } => obj\nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).\n\n # Sum some numbers\n (5..10).inject {|sum, n| sum + n } #=> 45\n # Multiply some numbers\n (5..10).inject(1) {|product, n| product * n } #=> 151200\n\n # find the longest word\n longest = %w{ cat sheep bear }.inject do |memo,word|\n memo.length > word.length ? memo : word\n end\n longest #=> \"sheep\"\n\n # find the length of the longest word\n longest = %w{ cat sheep bear }.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end\n longest #=> 5\n```\n\n然后根据我得需求,写出一个函数如下:\n````\n # find the min abs size\n def self.select_h(h)\n if ALL_FORMATS.include?(h)\n return h\n else\n ok_size = ALL_FORMATS.inject do |i,j|\n (i-h).abs < (j-h).abs ? i : j\n end\n return ok_size\n end\n end\n```\n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。", "created_at"=>2009-11-24 08:06:13 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    有个需求,给定一个数组,然后给出一个变量,需要在这个数组中找到和这个变量得值最接近得那个元素,开始用find或者select都不是很合适,最后找到inject,很好得解决了这个需求,现在记录下:
    \n首先看下inject这个函数
    \n````
    \nenum.inject(initial) {| memo, obj | block } => obj
    \nenum.inject {| memo, obj | block } => obj
    \nCombines the elements of enum by applying the block to an accumulator value (memo) and each element in turn. At each step, memo is set to the value returned by the block. The first form lets you supply an initial value for memo. The second form uses the first element of the collection as a the initial value (and skips that element while iterating).

    \n\n

    # Sum some numbers
    \n (5..10).inject {|sum, n| sum + n } #=> 45
    \n # Multiply some numbers
    \n (5..10).inject(1) {|product, n| product * n } #=> 151200

    \n\n

    # find the longest word
    \n longest = %w{ cat sheep bear }.inject do |memo,word|
    \n memo.length > word.length ? memo : word
    \n end
    \n longest #=> "sheep"

    \n\n

    # find the length of the longest word
    \n longest = %w{ cat sheep bear }.inject(0) do |memo,word|
    \n memo >= word.length ? memo : word.length
    \n end
    \n longest #=> 5
    \n```

    \n\n

    然后根据我得需求,写出一个函数如下:
    \n`
    \n # find the min abs size
    \n def self.select_h(h)
    \n if ALL_FORMATS.include?(h)
    \n return h
    \n else
    \n ok_size = ALL_FORMATS.inject do |i,j|
    \n (i-h).abs < (j-h).abs ? i : j
    \n end
    \n return ok_size
    \n end
    \n end
    \n

    \n首先看是否包含这个变量,如果又,直接返回,如果没有就inject来取一个最合适得。

    \n", "_id"=>498}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Facebooker error UnableToLoadAdapter", "body"=>"If you see an error that looks like\n
    /home/brickfactor/facebooker_tutorial/vendor/plugins/facebooker/lib/facebooker\n/adapters/adapter_base.rb:43:in `load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)\n/RAILS_APP/vendor/plugins/facebooker/lib/facebooker/adapters/adapter_base.rb:43:in `load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:121:in `load_adapter'\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:65:in `apply_configuration'\nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:45:in `load_configuration'\nfrom /RAILS_APP/vendor/plugins/facebooker/rails/../init.rb:6
    \nIts because you haven’t configured config/facebooker.yml file correctly, or at all. (Most tutorials etc. have you creating and editing this file after you install facebooker)", "created_at"=>2009-11-26 13:31:29 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    If you see an error that looks like
    \n/home/brickfactor/facebooker_tutorial/vendor/plugins/facebooker/lib/facebooker
    \n/adapters/adapter_base.rb:43:in load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)
    \n/RAILS_APP/vendor/plugins/facebooker/lib/facebooker/adapters/adapter_base.rb:43:in
    load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:121:in load_adapter'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:65:in
    apply_configuration'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/lib/facebooker.rb:45:in `load_configuration'
    \nfrom /RAILS_APP/vendor/plugins/facebooker/rails/../init.rb:6
    \nIts because you haven’t configured config/facebooker.yml file correctly, or at all. (Most tutorials etc. have you creating and editing this file after you install facebooker)

    \n", "_id"=>499}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"blog迁移完,继续写", "body"=>"前段时间原来用的slicehost的VPS不想用了,其速度越来越慢,特别是SSH的时候超级慢,导致我每次SSH都是煎熬,终于下定决心抛弃。\n后来购买了linode,说实在的,linode比slicehost要好用,特别是数据migrate的时候,真是一件幸福的事情,本来linode的VPS早就买了,只是这些天从北京到深圳,一直有很多事情在折腾,也没来得及将之前的blog内容恢复。\n昨天夜里看到闲逛到一个朋友的地盘,其记录了4年的广州生活,旅游,点点滴滴,很不错,今天得闲就把自己的blog恢复了~\n还好,数据我全部都备份了,导入导出还算顺利,折腾了一会PHP,倒是顺利,这个blog还是主要记录我的技术话题,生活blog内容不在这里写很多。\n回头看下,我这个blog貌似从2007年5月就开始写了,到现在也差不多2年多了~", "created_at"=>2010-01-13 00:42:39 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前段时间原来用的slicehost的VPS不想用了,其速度越来越慢,特别是SSH的时候超级慢,导致我每次SSH都是煎熬,终于下定决心抛弃。
    \n后来购买了linode,说实在的,linode比slicehost要好用,特别是数据migrate的时候,真是一件幸福的事情,本来linode的VPS早就买了,只是这些天从北京到深圳,一直有很多事情在折腾,也没来得及将之前的blog内容恢复。
    \n昨天夜里看到闲逛到一个朋友的地盘,其记录了4年的广州生活,旅游,点点滴滴,很不错,今天得闲就把自己的blog恢复了~
    \n还好,数据我全部都备份了,导入导出还算顺利,折腾了一会PHP,倒是顺利,这个blog还是主要记录我的技术话题,生活blog内容不在这里写很多。
    \n回头看下,我这个blog貌似从2007年5月就开始写了,到现在也差不多2年多了~

    \n", "_id"=>500}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["fcgi", "nginx", "php"], "comments_count"=>0, "category_id"=>7, "title"=>"nginx+spawn-fcgi+php", "body"=>"由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下\n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\n然后修改下php.ini的upload_max_filesize,就差不多OK了~", "created_at"=>2010-01-13 00:56:43 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
    \n
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    然后修改下php.ini的upload_max_filesize,就差不多OK了~

    \n", "_id"=>501}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["友链"], "comments_count"=>0, "category_id"=>5, "title"=>"友链没了,需要链接的请留言", "body"=>"数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。", "created_at"=>2010-01-13 01:18:05 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    数据导出的时候只顾导出文章和评论,没注意到友情联系,加上有一些链接已经失效了,也就不想回去找了,需要链接的朋友给我留言,看到后我会添加的。

    \n", "_id"=>502}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["GD", "php", "ubuntu"], "comments_count"=>0, "category_id"=>7, "title"=>"Install GD Support for PHP in Ubuntu", "body"=>"I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:\n\nOpen terminal and type in the following command:\n
    $ sudo apt-get install php5-gd
    \n\nNow restart Apache\n
    # sudo /etc/init.d/apache2 restart
    \n\nor restart spawn-fcgi\n
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
    \n\nThere you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!", "created_at"=>2010-01-13 02:25:36 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it's say i didn’t have GD support for PHP5 installed on my server. so i need to do:

    \n\n

    Open terminal and type in the following command:
    \n$ sudo apt-get install php5-gd

    \n\n

    Now restart Apache
    \n# sudo /etc/init.d/apache2 restart

    \n\n

    or restart spawn-fcgi
    \n/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10

    \n\n

    There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

    \n", "_id"=>503}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Fixing Ruby no such file to load readline error in centOS", "body"=>"Does this error message look familar when you script/console?\n````[iceskysl@li1248 current]$ ./script/console production\nLoading production environment (Rails 2.3.5)\n/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)\n from /usr/local/lib/ruby/1.8/irb/completion.rb:10\n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'\n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'\n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'\n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'\n from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'\n from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'\n from /usr/local/bin/irb:13```\nthis happens when readline is somehow different than your current version of ruby or corrupted. The quick fix is to recompile readline. To do it in CentOS with yum:\n````$> yum install readline-devel -y\n$> cd /root/src/ruby-1.8.6-p114/ext/readline/\n$> ruby extconf.rb\n$> make\n$> sudo make install ```\nNow you should have script/console working.", "created_at"=>2010-01-19 21:46:28 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Does this error message look familar when you script/console?
    \n[iceskysl@li1248 current]$ ./script/console production
    \nLoading production environment (Rails 2.3.5)
    \n/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
    \n from /usr/local/lib/ruby/1.8/irb/completion.rb:10
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
    \n from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
    \n from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
    \n from /usr/local/bin/irb:13```
    \nthis happens when readline is somehow different than your current version of ruby or corrupted. The quick fix is to recompile readline. To do it in CentOS with yum:
    \n
    $> yum install readline-devel -y
    \n$> cd /root/src/ruby-1.8.6-p114/ext/readline/
    \n$> ruby extconf.rb
    \n$> make
    \n$> sudo make install ```
    \nNow you should have script/console working.

    \n", "_id"=>504}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Swap"], "comments_count"=>0, "category_id"=>7, "title"=>"Swap Space in centOS", "body"=>"Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.\n\nSwap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.\n\nSwap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.\n\nSo, if:\n\nM = Amount of RAM in GB, and S = Amount of swap in GB, then\n
    If M < 2\n\tS = M *2\nElse\n\tS = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.\n\nFor systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).\n\nsource:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html", "created_at"=>2010-01-21 02:01:34 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

    \n\n

    Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

    \n\n

    Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

    \n\n

    So, if:

    \n\n

    M = Amount of RAM in GB, and S = Amount of swap in GB, then
    \nIf M < 2
    \n S = M *2
    \nElse
    \n S = M + 2
    \nUsing this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

    \n\n

    For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

    \n\n

    source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html

    \n", "_id"=>505}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["劫持", "电信"], "comments_count"=>0, "category_id"=>5, "title"=>"深圳电信耍流氓,劫持浏览器", "body"=>"今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下\nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.\n\n看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。\n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:\n
    \nip138.com IP查询(搜索IP地址的地理位置)\n您查询的IP:121.15.207.133\n本站主数据:广东省深圳市 电信\n参考数据一:广东省深圳市 电信\n参考数据二:广东省深圳市 电信\n
    \n\n是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。\n不晓得邪恶的电信又在监控啥数据,明天警告一下去。", "created_at"=>2010-01-23 05:40:48 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    今天无意发现在浏览器的左下角经常出现一个页面无法打开的提示,如下
    \nThe webpage at http://121.15.207.133:4022/logo.jpg?p=undefined|778|1276|24|800|1280might be temporarily down or it may have moved permanently to a new web address.

    \n\n

    看其样式是请求了一个121.15.207.133上的一个logo图片,然后传入了几个参数,但是这个图片的服务器貌似除了电问题,导致请求不到。
    \n无缘无故的,咋会去请求这个玩意呢,查了吓这个IP归属,属于:
    \n
    \nip138.com IP查询(搜索IP地址的地理位置)
    \n您查询的IP:121.15.207.133
    \n本站主数据:广东省深圳市 电信
    \n参考数据一:广东省深圳市 电信
    \n参考数据二:广东省深圳市 电信

    \n\n

    是深圳电信的,Google下这个IP地址,发现有人(不多)也提到了这个问题,顺藤摸瓜找到月光的一篇2007年文章《中国电信又开始耍流氓啦》,描述的差不多是同样的情况。
    \n不晓得邪恶的电信又在监控啥数据,明天警告一下去。

    \n", "_id"=>506}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["C", "ruby", "RubyInline"], "comments_count"=>0, "category_id"=>2, "title"=>"RubyInline, Making Making Things Faster Easier", "body"=>"发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文\nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html\n\nToday on ruby-talk, I caught a thread called \"For Performance, Write it in C\". I'd like to present a slight amendment to that thesis. Let me explain.\n\nIt all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):\n\n#!/usr/bin/ruby\n\nfor num in 1..10_000 do\nis_prime = 1\nfor x in 2..(num - 1) do\nif (num % x == 0)\nis_prime = x\nbreak\nend\nend\nif is_prime == 1\nputs \"\#{num} is a prime number\"\nelse\nputs \"\#{num} equals \#{is_prime} * \#{num/is_prime}\"\nend\nend\nHow fast is it? Well, time says:\n\n$ time ./primes.rb > /dev/null\n\nreal 0m2.905s\nuser 0m2.716s\nsys 0m0.004s\n$\n\nCertainly, nothing to write home about, but not too far from Perl or Python either.\nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).\n\n$ ruby -rprofile primes.rb > /dev/null\n% cumulative self self total\ntime seconds seconds calls ms/call ms/call name\n63.64 0.14 0.14 101 1.39 3.56 Range#each\n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%\n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==\n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts\n4.55 0.21 0.01 200 0.05 0.05 IO#write\n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s\n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/\n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-\n0.00 0.22 0.00 1 0.00 220.00 #toplevel\n$\n\nWhich tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?\nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:\n\n#!/usr/bin/ruby\n\nrequire \"rubygems\"\nrequire \"inline\"\n\nclass Primes\ninline do |builder|\nbuilder.c '\nint prime(int num) {\nint x;\nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts \"\#{num} is a prime number\" else puts \"\#{num} equals \#{is_prime} * \#{num/is_prime}\" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null\n\nreal 0m0.328s\nuser 0m0.288s\nsys 0m0.020s\n\nAn order of magnitude improvement. Not too shabby.\nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).", "created_at"=>2010-01-24 10:51:47 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    发现一篇好文,讲的是如何使用RubyInline,在Ruby中直接嵌入C并运行,相比之前些lib,要方便的多,由于这个文章在墙外,就转了一份过来,可以翻墙的可以去看原文
    \nhttp://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html

    \n\n

    Today on ruby-talk, I caught a thread called "For Performance, Write it in C". I'd like to present a slight amendment to that thesis. Let me explain.

    \n\n

    It all started with an email at work. Someone was passing around a bunch of prime number printers in various languages (C, Java, C#, Perl, and Python). They all used the same (ugly) algorithm, and were supposed to show just how 'performant the languages were. Since I'm the local Ruby evangelist, I was asked to write a Ruby version. Here's what I came up with (warning, ugly algorithm ahead):

    \n\n

    !/usr/bin/ruby

    \n\n

    for num in 1..10_000 do
    \nis_prime = 1
    \nfor x in 2..(num - 1) do
    \nif (num % x == 0)
    \nis_prime = x
    \nbreak
    \nend
    \nend
    \nif is_prime == 1
    \nputs "\#{num} is a prime number"
    \nelse
    \nputs "\#{num} equals \#{is_prime} * \#{num/is_prime}"
    \nend
    \nend
    \nHow fast is it? Well, time says:

    \n\n

    $ time ./primes.rb > /dev/null

    \n\n

    real 0m2.905s
    \nuser 0m2.716s
    \nsys 0m0.004s
    \n$

    \n\n

    Certainly, nothing to write home about, but not too far from Perl or Python either.
    \nWanting to improve it, and not being able to touch the algorithm (we want to be comparing apples to quinces after all, not apples to oranges). I know my only hope is to find the bottleneck(s) and rewrite it (them?) in C. My first step is to grab Ruby's profiler and see what it says (oh, by the way, I reduced the value of num to 100 so that this would complete in my lifetime ... the profiler is slow).

    \n\n

    $ ruby -rprofile primes.rb > /dev/null
    \n% cumulative self self total
    \ntime seconds seconds calls ms/call ms/call name
    \n63.64 0.14 0.14 101 1.39 3.56 Range#each
    \n13.64 0.17 0.03 1133 0.03 0.03 Fixnum#%
    \n9.09 0.19 0.02 1233 0.02 0.02 Fixnum#==
    \n4.55 0.20 0.01 100 0.10 0.20 Kernel.puts
    \n4.55 0.21 0.01 200 0.05 0.05 IO#write
    \n4.55 0.22 0.01 248 0.04 0.04 Fixnum#to_s
    \n0.00 0.22 0.00 74 0.00 0.00 Fixnum#/
    \n0.00 0.22 0.00 100 0.00 0.00 Fixnum#-
    \n0.00 0.22 0.00 1 0.00 220.00 #toplevel
    \n$

    \n\n

    Which tells me that most of my time is spent in each (well, it's actually spent in the block I sent to each. It's taking a whopping 1.39 msec per call, compared to .0X msec for everything else. What would happen if I rewrote just that block?
    \nEnter RubyInline (A great tool written by zenspider and Eric Hodel). I'm not a C wiz by any stretch of the imagination, but this stuff is pretty easy to bang out. My new code looks like this:

    \n\n

    !/usr/bin/ruby

    \n\n

    require "rubygems"
    \nrequire "inline"

    \n\n

    class Primes
    \ninline do |builder|
    \nbuilder.c '
    \nint prime(int num) {
    \nint x;
    \nfor (x = 2; x < (num - 1) ; x++) { if (num == 2) { return 1; } if (num % x == 0) { return x; } } return 1; }' end end p = Primes.new for num in 2..10_000 do is_prime = p.prime(num) if is_prime == 1 puts "\#{num} is a prime number" else puts "\#{num} equals \#{is_prime} * \#{num/is_prime}" end end Not too ugly. At least I can still see what's happening. The main loop being in Ruby helps a lot too (especially if this were a much bigger program). How much of a difference does it make? time says: $ time ./cprimes.rb > /dev/null

    \n\n

    real 0m0.328s
    \nuser 0m0.288s
    \nsys 0m0.020s

    \n\n

    An order of magnitude improvement. Not too shabby.
    \nWhat's the lesson here? Optimize what you need to (and only what you need to), profile find out what that is (it may be slow, but profiling is your friend), and use the right tools (rewriting a bit of code with RubyInline is way better than rewriting the whole app in C).

    \n", "_id"=>507}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "find_by"], "comments_count"=>0, "category_id"=>2, "title"=>"cache_fu's find_by_xx解决办法", "body"=>"在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。\n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下\n
    @client =Client.caches(:find_by_api_key,:with => api_key)
    \n\n如果监控下日志,你会发现如下的日志:\n
    Processing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]\n Parameters: {\"api_key\"=>\"T3yQ0zcNmhpBwWUbfxeAmA\", \"id\"=>\"20\", \"user_id\"=>\"1\"}\n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)\n Client Columns (1.7ms) SHOW FIELDS FROM `clients`\n Client Load Scrooged (0.3ms) SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`api_key` = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1\n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)\n
    \n\n很明显,非常方便!", "created_at"=>2010-01-25 01:17:58 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    在项目里用了memcached和cache_fu,其默认的 get_cache(id)还是非常方便的,但是对于另外一个用的比较多的find_by_xx这样的,貌似没看到有现成的方法可以使用。
    \n看到其提供了caches方法,其可以接收参数with参数,那么就可以直接利用了,方法如下
    \n@client =Client.caches(:find_by_api_key,:with => api_key)

    \n\n

    如果监控下日志,你会发现如下的日志:
    \nProcessing Android::Wallpapers::V3::PhotoController#share (for 192.168.1.103 at 2010-01-25 16:33:53) [GET]
    \n Parameters: {"api_key"=>"T3yQ0zcNmhpBwWUbfxeAmA", "id"=>"20", "user_id"=>"1"}
    \n==> Got Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA from cache. (0.00081)
    \n Client Columns (1.7ms) SHOW FIELDS FROM clients
    \n Client Load Scrooged (0.3ms) SELECT clients.id FROM clients WHERE (clients.api_key = 'T3yQ0zcNmhpBwWUbfxeAmA') LIMIT 1
    \n==> Set Client:find_by_api_key:T3yQ0zcNmhpBwWUbfxeAmA to cache. (0.00352)

    \n\n

    很明显,非常方便!

    \n", "_id"=>508}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Make a short link with Bit.ly", "body"=>"link = 'http://www.wired.com'\nshort_link = open('http://bit.ly/api?url=' + link, \"UserAgent\" => \"Ruby-ShortLinkCreator\").read\n# => \"http://bit.ly/AvxfY\"\n参考资料:\nhttp://code.google.com/p/bitly-api/wiki/ApiDocumentation\nhttp://j.mp/\nhttp://code.google.com/p/bitlyj/\nhttp://github.com/philnash/bitly", "created_at"=>2010-01-25 05:49:36 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    link = 'http://www.wired.com'
    \nshort_link = open('http://bit.ly/api?url=' + link, "UserAgent" => "Ruby-ShortLinkCreator").read

    \n\n

    => "http://bit.ly/AvxfY"

    \n\n

    参考资料:
    \nhttp://code.google.com/p/bitly-api/wiki/ApiDocumentation
    \nhttp://j.mp/
    \nhttp://code.google.com/p/bitlyj/
    \nhttp://github.com/philnash/bitly

    \n", "_id"=>509}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iowait"], "comments_count"=>0, "category_id"=>7, "title"=>"linux下抓出哪个进程造成的iowait很高的方法", "body"=>"抓哪个进程干坏事前要先停掉syslog\n/etc/init.d/rsyslog stop\necho 1 > /proc/sys/vm/block_dump\ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head\n1423 kjournald\n1075 pdflush\n209 indexer\n3 cronolog\n1 rnald\n1 mysqld\n不要忘记在抓完之后关掉block_dump和启动syslog\necho 0 > /proc/sys/vm/block_dump\n/etc/init.d/rsyslog start", "created_at"=>2010-01-30 06:46:19 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    抓哪个进程干坏事前要先停掉syslog
    \n/etc/init.d/rsyslog stop
    \necho 1 > /proc/sys/vm/block_dump
    \ndmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
    \n1423 kjournald
    \n1075 pdflush
    \n209 indexer
    \n3 cronolog
    \n1 rnald
    \n1 mysqld
    \n不要忘记在抓完之后关掉block_dump和启动syslog
    \necho 0 > /proc/sys/vm/block_dump
    \n/etc/init.d/rsyslog start

    \n", "_id"=>510}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["3G", "无线上网卡"], "comments_count"=>0, "category_id"=>5, "title"=>"实测无线上网卡,偶进入3G时代", "body"=>"我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。\n\n然后又过了多久后,3G终于发放,3个运营商,1家1张;\n\n然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。\n\n然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。\n\n插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。\n\n关了wifi,测试速度,比我预想的要好,参考图:\n\n\"\"\n\n下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下\n\n99% [============> ] 95,496,072 252K/s eta(英国中部时\n100%[============>] 95,545,644 252K/s in 7m 23s\n\n2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])\n\n然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下\n\n正在保存至: “Tailing-Aaron.mov.2”\n\n0% [ ] 409,534 126K/s eta(英国中部时\n\n0% [ ] 429,526 124K/s eta(英国中部时\n\n0% [ ] 456,658 124K/s eta(英国中部时\n\n竟然不如无线上网卡的速度~\n\n用上无线上网卡,应该算进入3G时代了。\n\nPS:\n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~", "created_at"=>2010-02-01 18:56:48 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    我记得从我06念开始工作时,当时公司里面就在测所谓的3G产品,一直到我08念离开第一家公司的时候,还是再喊3G牌照发放。

    \n\n

    然后又过了多久后,3G终于发放,3个运营商,1家1张;

    \n\n

    然后有过了不记得多少时间,用了一个杭州的3G联通的卡,在G1手机上,没感觉啥时3G,只是相同资费,多点流量的感觉。

    \n\n

    然后再过了记不清多少时间,我自己在深圳电信营业厅买了一个电信3G无线上网卡,为啥选电信,也是大致比较了下3家,无疑这款不分漫游,不限流量按时间计费的无线网卡适合我的需求,只是电信的无线数据终端贵的离谱(好像也是市场价),淘宝了一个华为EC1261的,便宜不少,顺风送的,很快,第二天早上就送到了。

    \n\n

    插卡,连USB,测试,很顺利,本来比较担心mac下支持的不好,还好只碰到了“找不到设备”,Google一把,又乱找了一通,找到一个设置的地方,新建一个连接,号码#777,密码用户名card(都默认填写好了),点击连接就连上了。

    \n\n

    关了wifi,测试速度,比我预想的要好,参考图:

    \n\n\n

    下了一个100M的东西,花了7分多,速度在200K之上,还比较稳定,如下

    \n\n

    99% [============> ] 95,496,072 252K/s eta(英国中部时
    \n100%[============>] 95,545,644 252K/s in 7m 23s

    \n\n

    2010-02-02 10:26:17 (211 KB/s) - 已保存 “Tailing-Aaron.mov” [95545644/95545644])

    \n\n

    然后在测试下我本地wifi(电信4M带宽)速度,惨不忍睹,如下

    \n\n

    正在保存至: “Tailing-Aaron.mov.2”

    \n\n

    0% [ ] 409,534 126K/s eta(英国中部时

    \n\n

    0% [ ] 429,526 124K/s eta(英国中部时

    \n\n

    0% [ ] 456,658 124K/s eta(英国中部时

    \n\n

    竟然不如无线上网卡的速度~

    \n\n

    用上无线上网卡,应该算进入3G时代了。

    \n\n

    PS:
    \n唯一不满意的地方就是这个无线网卡的设备有点大,我mac就2USB,被他占了一个后,另外一个耶盖住一点点,鼠标的USB插不进去了,难道还要买个USB分线器,冏~

    \n", "_id"=>511}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["centOS", "Database", "my.cnf"], "comments_count"=>0, "category_id"=>11, "title"=>"实例优化mysql配置文件my.cnf", "body"=>"这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。\n\n晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。\n机器配置:\nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G\n\nmy.cnf配置\n
    \n# Example MySQL config file for large systems.\n#\n# This is for a large system with memory = 512M where the system runs mainly\n# MySQL.\n#\n# You can copy this file to\n# /etc/my.cnf to set global options,\n# mysql-data-dir/my.cnf to set server-specific options (in this\n# installation this directory is /var/lib/mysql) or\n# ~/.my.cnf to set user-specific options.\n#\n# In this file, you can use all long options that a program supports.\n# If you want to know which options a program supports, run the program\n# with the \"--help\" option.\n\n# The following options will be passed to all MySQL clients\n[client]\nport = 3306\nsocket = /var/lib/mysql/mysql.sock\n\n# Here follows entries for some specific programs\n\n# The MySQL server\n[mysqld]\ndatadir=/var/lib/mysql\nsocket=/var/lib/mysql/mysql.sock\nuser=mysql\nskip-locking\n\n# By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),\n# please decrease its value according to your application needs.\nwait_timeout=60\n# Increase connect_timeout from 5 to 10\nconnect_timeout=10\n# Decrease interactive_timeout from 28800 to 100\ninteractive_timeout=120\n# Increase join_buffer_size from 131072 to 1M\njoin_buffer_size=1M\n# Increase query_cache_size from 0 to 128M\nquery_cache_size=32M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M\n# Increase max allowed packet size from 1M to 16M\nmax_allowed_packet=2M\n# Increase table cache cache from 256 to 1024\ntable_cache=1024\n# Increase sort buffer size from 1M\nsort_buffer_size=2M\n# Increase read buffer size from 1M\nread_buffer_size=2M\n# Increase read_rnd_buffer_size to 4M\nread_rnd_buffer_size=4M\n\n#Other settings\nsort_buffer_size=8M\nkey_buffer = 256M\nkey_buffer_size=64M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 8\n# Try number of CPU's*2 for thread_concurrency\nthread_concurrency = 2\n\n\n# Don't listen on a TCP/IP port at all. This can be a security enhancement,\n# if all processes that need to connect to mysqld run on the same host.\n# All interaction with mysqld must be made via Unix sockets or named pipes.\n# Note that using this option without enabling named pipes on Windows\n# (via the \"enable-named-pipe\" option) will render mysqld useless!\n#\n#skip-networking\n\n# Disable Federated by default\nskip-federated\n\nold_passwords=1\n\n#for slow queries\nlog-slow-queries = /var/log/mysql-slow.log\nlong_query_time = 3\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[mysql]\nno-auto-rehash\n# Remove the next comment character if you are not familiar with SQL\n#safe-updates\n\n[isamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[myisamchk]\nkey_buffer = 128M\nsort_buffer_size = 128M\nread_buffer = 2M\nwrite_buffer = 2M\n\n[mysqlhotcopy]\ninteractive-timeout\n\n[mysqld_safe]\nlog-error=/var/log/mysqld.log\npid-file=/var/run/mysqld/mysqld.pid\n
    ", "created_at"=>2010-02-03 03:08:13 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    这些天给我们的一个产品的服务器端加上了memcached,发现性能相当好,在newrelic上监控到每个请求差不多能稳定在100ms以下,开上10个ruby实例,每分钟处理几千个请求不是问题,但是耶发现munin的监控,MYSQL在过期缓冲的时候还是又慢查询,因为我有个表应该又100W的数据了。

    \n\n

    晓得MYSQL默认的一些配置不合适,只是一直没来得及调整,今天查了下资料,讲相关的配置调整了下,调整后的如下,如果你是又这方面的经验,发现不合理的还请指出,谢谢。
    \n机器配置:
    \nCentOS release 5.3,CPU(Intel(R) Xeon(R) CPU L5420 @ 2.50GHz) RAM 3G,disk 200G

    \n\n

    my.cnf配置

    \n\n

    Example MySQL config file for large systems.

    \n\n

    This is for a large system with memory = 512M where the system runs mainly

    \n\n

    MySQL.

    \n\n

    You can copy this file to

    \n\n

    /etc/my.cnf to set global options,

    \n\n

    mysql-data-dir/my.cnf to set server-specific options (in this

    \n\n

    installation this directory is /var/lib/mysql) or

    \n\n

    ~/.my.cnf to set user-specific options.

    \n\n

    In this file, you can use all long options that a program supports.

    \n\n

    If you want to know which options a program supports, run the program

    \n\n

    with the "--help" option.

    \n\n

    The following options will be passed to all MySQL clients

    \n\n

    [client]
    \nport = 3306
    \nsocket = /var/lib/mysql/mysql.sock

    \n\n

    Here follows entries for some specific programs

    \n\n

    The MySQL server

    \n\n

    [mysqld]
    \ndatadir=/var/lib/mysql
    \nsocket=/var/lib/mysql/mysql.sock
    \nuser=mysql
    \nskip-locking

    \n\n

    By default, the wait_timeout value is 28800. Unless you want MySQL to keep waiting for 28800 seconds (480 minutes or 8 hours),

    \n\n

    please decrease its value according to your application needs.

    \n\n

    wait_timeout=60

    \n\n

    Increase connect_timeout from 5 to 10

    \n\n

    connect_timeout=10

    \n\n

    Decrease interactive_timeout from 28800 to 100

    \n\n

    interactive_timeout=120

    \n\n

    Increase join_buffer_size from 131072 to 1M

    \n\n

    join_buffer_size=1M

    \n\n

    Increase query_cache_size from 0 to 128M

    \n\n

    query_cache_size=32M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M

    \n\n

    Increase max allowed packet size from 1M to 16M

    \n\n

    max_allowed_packet=2M

    \n\n

    Increase table cache cache from 256 to 1024

    \n\n

    table_cache=1024

    \n\n

    Increase sort buffer size from 1M

    \n\n

    sort_buffer_size=2M

    \n\n

    Increase read buffer size from 1M

    \n\n

    read_buffer_size=2M

    \n\n

    Increase read_rnd_buffer_size to 4M

    \n\n

    read_rnd_buffer_size=4M

    \n\n

    Other settings

    \n\n

    sort_buffer_size=8M
    \nkey_buffer = 256M
    \nkey_buffer_size=64M
    \nmyisam_sort_buffer_size = 64M
    \nthread_cache_size = 8

    \n\n

    Try number of CPU's*2 for thread_concurrency

    \n\n

    thread_concurrency = 2

    \n\n

    Don't listen on a TCP/IP port at all. This can be a security enhancement,

    \n\n

    if all processes that need to connect to mysqld run on the same host.

    \n\n

    All interaction with mysqld must be made via Unix sockets or named pipes.

    \n\n

    Note that using this option without enabling named pipes on Windows

    \n\n

    (via the "enable-named-pipe" option) will render mysqld useless!

    \n\n

    skip-networking

    \n\n

    Disable Federated by default

    \n\n

    skip-federated

    \n\n

    old_passwords=1

    \n\n

    for slow queries

    \n\n

    log-slow-queries = /var/log/mysql-slow.log
    \nlong_query_time = 3

    \n\n

    [mysqldump]
    \nquick
    \nmax_allowed_packet = 16M

    \n\n

    [mysql]
    \nno-auto-rehash

    \n\n

    Remove the next comment character if you are not familiar with SQL

    \n\n

    safe-updates

    \n\n

    [isamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [myisamchk]
    \nkey_buffer = 128M
    \nsort_buffer_size = 128M
    \nread_buffer = 2M
    \nwrite_buffer = 2M

    \n\n

    [mysqlhotcopy]
    \ninteractive-timeout

    \n\n

    [mysqld_safe]
    \nlog-error=/var/log/mysqld.log
    \npid-file=/var/run/mysqld/mysqld.pid

    \n", "_id"=>512}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "max_length_for_sort_data", "Performance", "sort_buffer_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql sort 性能优化:max_length_for_sort_data", "body"=>"发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下\n
    mysql> SHOW VARIABLES like \"%sort%\";\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| max_length_for_sort_data | 1024 |\n| max_sort_length | 1024 |\n| myisam_max_sort_file_size | 2146435072 |\n| myisam_sort_buffer_size | 67108864 |\n| sort_buffer_size | 8388608 |\n+---------------------------+------------+\n5 rows in set (0.00 sec)
    \n\n不晓得是做啥用的,查了下资料:\n
    http://forge.mysql.com/wiki/MySQL_Internals_Algorithms\n\nUsing the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)
    \n\nmysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差", "created_at"=>2010-02-03 03:30:44 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    发现VARIABLES里有个max_length_for_sort_data,其值是1024,感觉很小,如下
    \nmysql> SHOW VARIABLES like "%sort%";
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| max_length_for_sort_data | 1024 |
    \n| max_sort_length | 1024 |
    \n| myisam_max_sort_file_size | 2146435072 |
    \n| myisam_sort_buffer_size | 67108864 |
    \n| sort_buffer_size | 8388608 |
    \n+---------------------------+------------+
    \n5 rows in set (0.00 sec)

    \n\n

    不晓得是做啥用的,查了下资料:
    \nhttp://forge.mysql.com/wiki/MySQL_Internals_Algorithms

    \n\n

    Using the modified filesort algorithm, the tuples are longer than the pairs used in the original method, and fewer of them fit in the sort buffer (the size of which is given by sort_buffer_size). As a result, it is possible for the extra I/O to make the modified approach slower, not faster. To avoid a slowdown, the optimization is used only if the total size of the extra columns in the sort tuple does not exceed the value of the max_length_for_sort_data system variable. (A symptom of setting the value of this variable too high is that you should see high disk activity and low CPU activity.)

    \n\n

    mysql的filesort有两个方法,MySQL 4.1之前是使用方法A, 之后版本会使用改进的算法B, 但使用方法B的前提是列长度的值小于max_length_for_sort_data, 但我们系统中的列的长度的值会大于1024. 因此也就是说在sort的时候, 是在使用方法A, 而方法A的性能比较差

    \n", "_id"=>513}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "filesort"], "comments_count"=>0, "category_id"=>11, "title"=>"What does Using filesort mean in MySQL?", "body"=>"一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。\n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:\n
    The usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。\n\n
    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。\n\n参考资料:\nWhat does Using filesort mean in MySQL?\nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/\n\nHow MySQL executes ORDER BY\nhttp://s.petrunia.net/blog/?p=24", "created_at"=>2010-02-03 03:51:36 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    一直以来,只要我看到explain出来的结果有“Using filesort ”,我就要想方设法的优化和改善,因为我以前以为这个的意思就是使用文件系统来排序(那该多慢呀!),其实不是这样的。
    \n在mysqlperformanceblog上看到一篇文章《What does Using filesort mean in MySQL?》其中作者说自己每次面世的时候都会问“what does Using filesort mean in EXPLAIN,” 结果没有一个人回答的是对的,结果让其比较郁闷,就写了这个文章说明:
    \nThe usual answer is something like “rows are being placed into a temporary table which is too big to fit in memory, so it gets sorted on disk.” Unfortunately, this is not the same thing. First of all, this is Using temporary. Secondly, temporary tables may go to disk if they are too big, but EXPLAIN doesn’t show that. (If I interview you, I might ask you what “too big” means, or I might ask you the other reason temporary tables go to disk!)
    \n通常的解释是:选择出来的记录太多了,需要排序时内存中放不下了,所以会存储在磁盘中,并通过操作磁盘的文件的方式来排序。但是呢,这是不对的。

    \n\n

    The truth is, filesort is badly named. Anytime a sort can’t be performed from an index, it’s a filesort. It has nothing to do with files. Filesort should be called “sort.” It is quicksort at heart.
    \n正解是,filesort这个名字有问题,容易给人误解,在mysql中,任何不能通过index进行的sort都称之为filesort,这里的filesort和文件没有任何关系,应该称之为“sort”而不是“filesort”,它的内部实现就是快速排序。

    \n\n

    参考资料:
    \nWhat does Using filesort mean in MySQL?
    \nhttp://www.mysqlperformanceblog.com/2009/03/05/what-does-using-filesort-mean-in-mysql/

    \n\n

    How MySQL executes ORDER BY
    \nhttp://s.petrunia.net/blog/?p=24

    \n", "_id"=>514}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "variables"], "comments_count"=>0, "category_id"=>11, "title"=>"Mysql动态修改参数", "body"=>"mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。\n\n修改会话级变量\n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set SESSION命令设置会话级变量的新值\n\nmysql> set SESSION sort_buffer_size=7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\n--修改会话级变量对当前会话来说立刻生效\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\nmysql> exit\nBye\n退出重新连接后,此参数恢复原值\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n修改全局变量\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 40 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n\n用set GLOBAL 命令设置全局变量\n\nmysql> set GLOBAL sort_buffer_size = 7000000;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 6291448 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n当前此参数的值并不发生变化,先退出,然后重新连进去\nmysql> exit\nBye\n[root@devdbc_stb root]# mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41 to server version: 5.0.37-log\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n\nmysql> show variables like '%sort_buffer_size%';\n+---------------------------+------------+\n| Variable_name | Value |\n+---------------------------+------------+\n| sort_buffer_size | 7000000 |\n+---------------------------+------------+\n1 rows in set (0.00 sec)\n新的参数值生效", "created_at"=>2010-02-03 04:00:12 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

    \n\n

    修改会话级变量
    \n用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set SESSION命令设置会话级变量的新值

    \n\n

    mysql> set SESSION sort_buffer_size=7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    --修改会话级变量对当前会话来说立刻生效
    \nmysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    mysql> exit
    \nBye
    \n退出重新连接后,此参数恢复原值
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    修改全局变量
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 40 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)

    \n\n

    用set GLOBAL 命令设置全局变量

    \n\n

    mysql> set GLOBAL sort_buffer_size = 7000000;
    \nQuery OK, 0 rows affected (0.00 sec)

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 6291448 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n当前此参数的值并不发生变化,先退出,然后重新连进去
    \nmysql> exit
    \nBye
    \n[root@devdbc_stb root]# mysql
    \nWelcome to the MySQL monitor. Commands end with ; or \\g.
    \nYour MySQL connection id is 41 to server version: 5.0.37-log

    \n\n

    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

    \n\n

    mysql> show variables like '%sort_buffer_size%';
    \n+---------------------------+------------+
    \n| Variable_name | Value |
    \n+---------------------------+------------+
    \n| sort_buffer_size | 7000000 |
    \n+---------------------------+------------+
    \n1 rows in set (0.00 sec)
    \n新的参数值生效

    \n", "_id"=>515}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["客户端"], "comments_count"=>0, "category_id"=>5, "title"=>"android版本的客户端发布了", "body"=>"WP终于发布了android的客户端,以后可以随时发表博客了。\n这个客户端还真不赖。", "created_at"=>2010-02-04 16:55:13 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    WP终于发布了android的客户端,以后可以随时发表博客了。
    \n这个客户端还真不赖。

    \n", "_id"=>516}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Textmate", "theme"], "comments_count"=>0, "category_id"=>4, "title"=>"Installing a New Textmate Theme", "body"=>"To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)\n\nRails Envy TextMate Theme\n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme\n\nUser Submitted Themes\n http://wiki.macromates.com/Themes/UserSubmittedThemes", "created_at"=>2010-02-04 18:24:02 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    To install a new theme, select one of the .tmTheme links listed below, download it to your desktop and double-click on the file. This will place it in ~/Library/Application Support/TextMate/Themes, at which point the new theme will appear in the list found in Preferences → Fonts & Colors. This will also set it as the active theme. (Once the theme is installed, you may remove the .tmTheme from your desktop.)

    \n\n

    Rails Envy TextMate Theme
    \n http://railsenvy.com/2008/9/18/rails-envy-textmate-theme

    \n\n

    User Submitted Themes
    \n http://wiki.macromates.com/Themes/UserSubmittedThemes

    \n", "_id"=>517}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Bundle", "git", "Textmate"], "comments_count"=>0, "category_id"=>11, "title"=>"The Git TextMate Bundle", "body"=>"TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:\n\nInstallation\n
    mkdir -p ~/Library/Application\\ Support/TextMate/Bundles\n cd ~/Library/Application\\ Support/TextMate/Bundles\n git clone git://github.com/jcf/git-tmbundle Git.tmbundle
    \n\nrestart teatmate and it's done!\n\nIn the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)\nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.\nUpdate your bundle by running the “Update Git Bundle” command.", "created_at"=>2010-02-04 23:39:24 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:

    \n\n

    Installation
    \nmkdir -p ~/Library/Application\\ Support/TextMate/Bundles
    \n cd ~/Library/Application\\ Support/TextMate/Bundles
    \n git clone git://github.com/jcf/git-tmbundle Git.tmbundle

    \n\n

    restart teatmate and it's done!

    \n\n

    In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
    \nMany shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
    \nUpdate your bundle by running the “Update Git Bundle” command.

    \n", "_id"=>518}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Terminal", "Visor"], "comments_count"=>0, "category_id"=>11, "title"=>"Visor for OSX,随处调出Terminal", "body"=>"如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。\n可以从这里下载 http://visor.binaryage.com/\n这个软件需要SIMBL ,如果你没有安装,要先安装这个。\nhttp://www.culater.net/software/SIMBL/SIMBL.php\n
    SIMBL (SIMple Bundle Loader) - pronounced like \"symbol\" or \"cymbal\" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`\nvisor: http://visor.binaryage.com/\n\nInstallation\n\n\n
    Install SIMBL and make sure you have latest SIMBL 0.9.x\nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)\nRelaunch Terminal.app - You should now see the Visor Status Menu Item\nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key\nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.\n\nTo hide Visor, you can either:\nre-trigger with your key-combo\noptionally you can click off of the Visor window
    ", "created_at"=>2010-02-05 00:03:45 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
    \n可以从这里下载 http://visor.binaryage.com/
    \n这个软件需要SIMBL ,如果你没有安装,要先安装这个。
    \nhttp://www.culater.net/software/SIMBL/SIMBL.php
    \nSIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
    \n之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
    \nvisor: http://visor.binaryage.com/

    \n\n

    Installation

    \n\n

    Install SIMBL and make sure you have latest SIMBL 0.9.x
    \nPlace Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
    \nRelaunch Terminal.app - You should now see the Visor Status Menu Item
    \nConfigure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences ... and edit your keyboard hot-key
    \nYou can now trigger Visor with your hot-key from any application to get an instant terminal session.

    \n\n

    To hide Visor, you can either:
    \nre-trigger with your key-combo
    \noptionally you can click off of the Visor window

    \n", "_id"=>519}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "query_cache_size"], "comments_count"=>0, "category_id"=>11, "title"=>"mysql实例优化效果", "body"=>"前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)\n
    # Increase query_cache_size from 0 to 128M\nquery_cache_size=128M\n# Increase query cache limit from 1048576 to 2M\nquery_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:\n\"\"", "created_at"=>2010-02-05 00:49:22 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
    \n# Increase query_cache_size from 0 to 128M
    \nquery_cache_size=128M

    \n\n

    Increase query cache limit from 1048576 to 2M

    \n\n

    query_cache_limit=2M
    \n看到效果很明显,如下是munin的监控图:

    \n", "_id"=>520}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "rails 3.0"], "comments_count"=>0, "category_id"=>2, "title"=>"Rails 3.0: Beta release & Rails3 Tutorials", "body"=>"我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!\n\n这次升级需要新装很多的gem,如下:\n
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n\ngem install rails --pre
    \n期间遇到一个错误:\n
    Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:\n## Rails 3 Tutorials & Blog Posts\n\n## Rails 3 Presentations & Conference Talks\n\n## Rails 3 Books\n
      \n\t
    • Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    • \n\t
    • Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi
    • \n
    \n## Rails 3 Commentary\n", "created_at"=>2010-02-05 01:52:19 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!

    \n\n

    这次升级需要新装很多的gem,如下:
    \ngem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    \ngem install rails --pre
    \n期间遇到一个错误:
    \nDue to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
    \n然后这边有N多关于Rails3的资料供参考:

    \n\n

    Rails 3 Tutorials & Blog Posts

    \n\n

    Edging your way towards Ruby 1.9.1 and Rails 3.0pre
    \n Unobtrusive JavaScript in Rails 3 by Zach Carter
    \n A Fresh Cup: Seed Data in Rails 3 tutorial – feature summary + code example by Mike Gunderloy.
    \n Rails3: Stepping off of the golden path slides by Matt Aimonetti
    \n Rails Magazine – RailsConf 2009 Edition page 5 has a section called The Unofficial Guide to What’s New in Rails 3 by Rupak Ganguly
    \n Jason Ting’s RailsConf 2009 Notes includes some basic notes about Rails 3
    \n Noel Rappin: Railsconf 09 – After the RailsConfening article
    \n Yehuda Katz: Railsconf Wrapup blog – contains links to jQuery talk by Katz at RailsConf 09
    \n How to Begin Playing With Rails 3 by Oscar Del Ben
    \n My Five Favorite Things About Rails 3 by Yehuda Katz
    \n Rails 3: The Great Decoupling by Yehuda Katz
    \n Rails Edge Architecture by Yehuda Katz
    \n How to Build Sinatra on Rails 3 by Yehuda Katz

    \n\n

    Rails 3 Presentations & Conference Talks

    \n\n

    Yehuda: What to Expect in Rails 3.0 webcast recording
    \n Scotland on Rails: Yehuda on Rails & Merb Merge video. For more Scotland on Rails videos, check out this Ruby Inside post.
    \n Yehuda Katz on Rails 3 and beyond interview by Mark Coleman
    \n RailsConf: Yehuda – The Russian Doll Pattern video
    \n RailsConf 09: DHH Keynote video – DHH previews unobtrusive javascript, default escaping & more.

    \n\n

    Rails 3 Books

    \n\n

    Rails 3 in Action by Yehuda Katz and Mike Gunderloy. Currently available is their Early Access Edition, which gives you access to chapters as they are written.
    \n Beginning Rails 3 by Jeffrey Allan Hardy , Cloves Carneiro Jr. & Rida Al Barazi

    \n\n

    Rails 3 Commentary

    \n\n

    Internet News: Rails 3 Gets Supersized With Merb
    \n eWeek: Rubyists Unite Ruby on Rails and Merb to Merge in Rails 3
    \n CIO: Rails 3 to add security enhancement
    \n Yehuda Katz: Rails and Merb Merge
    \n RubyOnRails.org: Rails + Merb Merge Announcement

    \n", "_id"=>521}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{:name=>"02. 产品设计 | PM"}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"categories"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['categories'].insert([{"sort"=>0, "posts_count"=>0, "name"=>"02. 产品设计 | PM", "updated_at"=>2012-06-24 15:53:14 UTC, "created_at"=>2012-06-24 15:53:14 UTC, "_id"=>13}]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Axure", "Balsamiq Mockups", "原型设计"], "comments_count"=>0, "category_id"=>13, "title"=>"Balsamiq Mockups,理想的原型设计工具", "body"=>"由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。\n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。\n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:\n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;\n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;\n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;\n使用xml语言来记录和保存界面元素和布局,\n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;\n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);\n可以将设计导出成PNG格式的图片;\n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;\n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;\n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。\n\n以下是关于Balsamiq Mockups的一些特点:\n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;\n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。\n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -\n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;\n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);\n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。\n\n另外还有跨平台与多版本两个优点:\n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;\n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本\n\n软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop\n\nYou can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.\n\"demo\"", "created_at"=>2010-02-21 18:39:26 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    由于经常要讨论产品,包括web和手机(\bAandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
    \n比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
    \n虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
    \n操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
    \n预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
    \n界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
    \n使用xml语言来记录和保存界面元素和布局,
    \n这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
    \n可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
    \n可以将设计导出成PNG格式的图片;
    \n可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
    \n跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
    \n不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。

    \n\n

    以下是关于Balsamiq Mockups的一些特点:
    \n易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
    \n可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
    \n控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
    \n新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
    \n可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
    \n其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。

    \n\n

    另外还有跨平台与多版本两个优点:
    \n跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
    \n多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本

    \n\n

    软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop

    \n\n

    You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

    \n", "_id"=>522}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Database", "socket"], "comments_count"=>0, "category_id"=>3, "title"=>"Can’t connect to local MySQL server through socket 解决办法", "body"=>"Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)\n\n1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.\n另外看看是不是权限问题.\n\n2、确定你的mysql.sock是不是在那个位置,\nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock\n\n3、试试:service mysqld start\n\n4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql\n\n[root@localhost ~]# /etc/init.d/mysqld start\n启动 MySQL: [ 确定 ]\n[root@localhost ~]# mysql -uroot -p", "created_at"=>2010-02-23 21:24:14 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)

    \n\n

    1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
    \n另外看看是不是权限问题.

    \n\n

    2、确定你的mysql.sock是不是在那个位置,
    \nmysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

    \n\n

    3、试试:service mysqld start

    \n\n

    4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

    \n\n

    [root@localhost ~]# /etc/init.d/mysqld start
    \n启动 MySQL: [ 确定 ]
    \n[root@localhost ~]# mysql -uroot -p

    \n", "_id"=>523}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Passenger", "REE"], "comments_count"=>0, "category_id"=>2, "title"=>"Download Ruby Enterprise Edition(REE)", "body"=>"前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。\nStep 1: Download\nSource code: version 1.8.7-2010.01\nStep 2: Install\nExtract it:\ntar xzvf ruby-enterprise-X.X.X.tar.gz\nRun the installer (completely safe, none of your system files will be touched!):\n./ruby-enterprise-X.X.X/installer\n
    Welcome to the Ruby Enterprise Edition installer
    \n
    This installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \n
    Don't worry, none of your system files will be touched if you don't want them
    \n
    to, so there is no risk that things will screw up.
    \n
    You can expect this from the installation process:
    \n
    1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \n
    system.
    \n
    2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \n
    Edition instead of regular Ruby.
    \n
    Press Enter to continue, or Ctrl-C to abort.
    \n
    Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.\nYou can expect this from the installation process:\n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.\n\n2. Ruby on Rails will be installed for Ruby Enterprise Edition.\n\n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.\nPress Enter to continue, or Ctrl-C to abort.
    \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby\nFollow the instructions that the Ruby Enterprise Edition installer gave you.", "created_at"=>2010-03-03 16:53:29 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
    \nStep 1: Download
    \nSource code: version 1.8.7-2010.01
    \nStep 2: Install
    \nExtract it:
    \ntar xzvf ruby-enterprise-X.X.X.tar.gz
    \nRun the installer (completely safe, none of your system files will be touched!):
    \n./ruby-enterprise-X.X.X/installer
    \nWelcome to the Ruby Enterprise Edition installer
    \nThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.
    \nDon't worry, none of your system files will be touched if you don't want them
    \nto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this
    \nsystem.
    \n2. Ruby on Rails will be installed for Ruby Enterprise Edition.
    \n3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
    \nEdition instead of regular Ruby.
    \nPress Enter to continue, or Ctrl-C to abort.
    \nWelcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don't worry, none of your system files will be touched if you don't want themto, so there is no risk that things will screw up.
    \nYou can expect this from the installation process:
    \n1. Ruby Enterprise Edition will be compiled and optimized for speed for this     system.

    \n\n
      \n
    1. Ruby on Rails will be installed for Ruby Enterprise Edition.

    2. \n
    3. You will learn how to tell Phusion Passenger to use Ruby Enterprise     Edition instead of regular Ruby.
      \nPress Enter to continue, or Ctrl-C to abort.
      \nStep 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
      \nFollow the instructions that the Ruby Enterprise Edition installer gave you.

    4. \n
    \n", "_id"=>524}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"02. 产品设计 | PM"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Border-radius", "css3"], "comments_count"=>0, "category_id"=>13, "title"=>"Border-radius: create rounded corners with CSS!", "body"=>"W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:\n\nMozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.\nThe code for this example above is actually quite simple:\n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:\n\nMozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.\nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.\nThese are handled by / should be handled by:\n\n````-moz-border-radius-topleft / -webkit-border-top-left-radius\n-moz-border-radius-topright / -webkit-border-top-right-radius\n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius\n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius```", "created_at"=>2010-03-05 10:38:13 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
    \nThe code for this example above is actually quite simple:
    \n
    \nThese different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:

    \n\n

    Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
    \nMozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
    \nThese are handled by / should be handled by:

    \n\n

    `-moz-border-radius-topleft / -webkit-border-top-left-radius
    \n-moz-border-radius-topright / -webkit-border-top-right-radius
    \n-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
    \n-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

    \n", "_id"=>525}]) +MONGODB iceylog_development['categories'].find({:_id=>13}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>13}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["multi", "rails"], "comments_count"=>0, "category_id"=>3, "title"=>"rails multi database,在Rails中一次连接多个数据库", "body"=>"有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了\n\n1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod\n2. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend", "created_at"=>2010-03-06 03:19:06 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了

    \n\n
      \n
    1. 设置database的config\nextradb_production:\nadapter: mysql\nhost: localhost\nusername: root\npassword: blabla\ndatabase: extradb_prod
    2. \n
    3. 在相关得 Model 利用 estabilish_connection 去做连接即可\nclass lala < ActiveRecord::Base\nestablish_connection :extradb_production\nend
    4. \n
    \n", "_id"=>526}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Gem::Exception,update to rails 3.0 bate", "body"=>"上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到\n
    eoe:~ IceskYsl$ rails -v\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n\tfrom /usr/bin/rails:19
    \n\n看来还是有问题,看看都装了啥gems,如下\neoe:~ IceskYsl$ gem list\n\n*** LOCAL GEMS ***\n\nabstract (1.0.0)\nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)\nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)\nactionwebservice (1.2.6)\nactivemodel (3.0.0.beta)\nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)\nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)\nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)\n奇怪,没看到railties,看来这个没装上,我再装一次。\neoe:~ IceskYsl$ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\neoe:~ IceskYsl$ rails -v\nRails 3.0.0.beta\n\nok,可以了!\n\n参考资料:\nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html\nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/\nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935", "created_at"=>2010-03-06 05:35:57 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
    \neoe:~ IceskYsl$ rails -v
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    看来还是有问题,看看都装了啥gems,如下
    \neoe:~ IceskYsl$ gem list

    \n\n

    *** LOCAL GEMS ***

    \n\n

    abstract (1.0.0)
    \nactionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
    \nactionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
    \nactionwebservice (1.2.6)
    \nactivemodel (3.0.0.beta)
    \nactiverecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
    \nactiveresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
    \nactivesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
    \n奇怪,没看到railties,看来这个没装上,我再装一次。
    \neoe:~ IceskYsl$ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \neoe:~ IceskYsl$ rails -v
    \nRails 3.0.0.beta

    \n\n

    ok,可以了!

    \n\n

    参考资料:
    \nhttp://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
    \nhttp://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
    \nhttp://d.hatena.ne.jp/h-nakao/20100210/1265775935

    \n", "_id"=>527}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["action_mailer_optional_tls", "Gmail", "Redmine"], "comments_count"=>0, "category_id"=>2, "title"=>"Setup Redmine to send email using GMail", "body"=>"Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。\n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:\n1. Install the action_mailer_optional_tls plugin\nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.\n\nTo install this plugin, use the script/plugin command in your Redmine directory:\n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git\n\n2. Configure your email.yml\n# File: config/email.yml\nproduction:\n delivery_method: :smtp\n smtp_settings:\n tls: true\n address: \"smtp.gmail.com\"\n port: 587\n domain: \"www.YOURDOAMIN.com\" # 'your.domain.com' for GoogleApps\n authentication: :plain\n user_name: \"username@youdomain.com\"\n password: \"password\"\n\n3. Start up Redmine and test your Email\nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:\nLogin as an administrator\nGo to the Administration panel\nGo into the Settings and select the \"Email notifications\" tab\nIn the bottom right, click the link to \"Send a test email\"", "created_at"=>2010-03-14 18:31:57 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    Redmine是用Rails写的一套很不错的项目管理系统,其提供了诸多很方便实用的功能,诸如里程碑管理,BUG跟踪,代码库变更管理等等。
    \n搭建以后在管理面板中测试邮件不通,主要原因是由于采用的Gmail的邮箱,于是找到一些解决方案,如下:
    \n1. Install the action_mailer_optional_tls plugin
    \nThe action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

    \n\n

    To install this plugin, use the script/plugin command in your Redmine directory:
    \n ./script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

    \n\n

    2. Configure your email.yml

    \n\n

    File: config/email.yml

    \n\n

    production:
    \n delivery_method: :smtp
    \n smtp_settings:
    \n tls: true
    \n address: "smtp.gmail.com"
    \n port: 587
    \n domain: "www.YOURDOAMIN.com" # 'your.domain.com' for GoogleApps
    \n authentication: :plain
    \n user_name: "username@youdomain.com"
    \n password: "password"

    \n\n

    3. Start up Redmine and test your Email
    \nNext it's time to start up Redmine and to send a test email. Make sure that you start Redmine in the same mode as you configured above (e.g. production). To send a test email:
    \nLogin as an administrator
    \nGo to the Administration panel
    \nGo into the Settings and select the "Email notifications" tab
    \nIn the bottom right, click the link to "Send a test email"

    \n", "_id"=>528}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["1sters", "Godaddy", "万网", "域名转出"], "comments_count"=>0, "category_id"=>5, "title"=>"1sters.com域名成功转出到Godaddy", "body"=>"终于收到邮件:\n
    Congratulations! The transfer request for the following domain name(s) has been completed:\n1STERS.COM
    \n\n历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。\n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。\n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。\n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:\n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;\n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。\n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;\n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;\n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;\n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;\n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;\n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)\n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);\n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。\n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;\n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;\n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。\n\n故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:\n1.万网的很多手续都是人为设置的障碍;\n2.万网很惧ICAAN的;\n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;\n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;\n5.交涉过程需要做好功课,做到有理有据", "created_at"=>2010-03-15 21:30:44 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    终于收到邮件:
    \nCongratulations! The transfer request for the following domain name(s) has been completed:
    \n1STERS.COM

    \n\n

    历尽很多次的交涉,希望和失望,气愤和感慨,我的域名1sters.com终于转出到Godaddy了,终于有了一个满意的结果。
    \n期间发生了很多事情,大致提几个,域名开始是在万网的一个三级代理(之前网上认识的一个朋友)注册的,而他是在一个很不正规的,不靠谱的二级代理商注册的;后来我这个朋友不怎么上网,我差点续费无门丢失域名,还好联系到要到了他的三级代理的帐号,才一直在那个二级代理那边续费一直使用到今天。
    \n但是越来越觉得不安全(从代理那边可以做任何事情),于是一直想转出,查了N多资料后得到的结论是:万网不是一个好说话的主,转出手续复杂的很。像我这个在代理注册的还得线转回万网,才可以办理转出手续,转出手续中包括邮寄N多证明材料,无语。
    \n过程很复杂,我从开始操作得时候记录过一个Doc文档,内容很精彩,但是比较杂乱,等我有空了整理出来,这里说几个关节点:
    \n1. 万网要求我必须将找注册得那个代理商将域名转回到万网我自己得ID上才可以办理转出;
    \n2. 代理商以这个为理由,要收我200块钱手续费(BS一下),被我以正规理由否决后,立马提价到400,hoho,不欢而散(我肯定会说要投诉他)。
    \n3.两边踢皮球,我没抱太大希望,一边寻找好得域名重新注册,一方面看是否又其他途径解决问题;
    \n4.然后发现很多人提到可以去ICAAN投诉万网,于是按照网上得投诉范本,投诉了一次;
    \n5.然后就被其他事忙忘了,自然我也注册了新得域名(ysler.com)备用;
    \n6.N天后收到那个代理商转来得邮件,惊奇得发现投诉起作用了,ICAAN找了万网麻烦,万网就去找那个代理商得麻烦,以为代理商投诉得,自然最后就找到了我;
    \n7.万网要我和代理商协调转回到万网,再给我办转出,协调结果,代理商坚持要我给100元手续费,再次被我否决,再次不欢而散;
    \n8.我给万网和代理商发了邮件,阐述问题,并告诉他们如果在这样踢皮球得话,我会一直去ICCAN投诉(后来没时间投诉了,呵呵)
    \n9.过了几天,邮件貌似生效了,万网一个客服给我邮件,发来了转移密码(我也没邮件身份证明材料等);
    \n10.喜,感觉去Godaddy办理转入(之前办理过一次,被万网拒绝转出了),然后给万网发邮件,说我得转出申请已经提交,尽快给我通过。
    \n11.收到万网回复,说已经通过,13后将生效,然后等到14号发现还没成功,给Godaddy得support一封邮件,问问是咋回事;
    \n12.不得不说,Godaddy得服务号很多,立即帮我查了原因,并告诉我现在需要5-7天得时间才能转过去;
    \n13.再等,今天16号终于收到Godaddy的转出成功通知邮件,这个域名我终于放心了。

    \n\n

    故事的梗概就是这样,期间很多次的交涉很有意思的,以后再分享,这里得出几个结论:
    \n1.万网的很多手续都是人为设置的障碍;
    \n2.万网很惧ICAAN的;
    \n3.万网的服务质量提高了不少,但是还需要摆好心态,把自己的口碑做上去,现在的口碑很差了;
    \n4.代理商的诸多的手续费之类的坚决不低头,不合理的就不给;
    \n5.交涉过程需要做好功课,做到有理有据

    \n", "_id"=>529}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["concat", "Database"], "comments_count"=>0, "category_id"=>3, "title"=>"MySQL CONCAT", "body"=>"MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:\nmysql> SELECT CONCAT('FIRST ', 'SECOND');\n+----------------------------+\n| CONCAT('FIRST ', 'SECOND') |\n+----------------------------+\n| FIRST SECOND |\n+----------------------------+\n1 row in set (0.00 sec)\n\nie.\nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,\"400\",title) from photos where state > 10 ' > photos_400.txt", "created_at"=>2010-03-19 20:34:34 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    MySQL CONCAT function is used to concatenate two strings to form a single string. Try out following example:
    \nmysql> SELECT CONCAT('FIRST ', 'SECOND');
    \n+----------------------------+
    \n| CONCAT('FIRST ', 'SECOND') |
    \n+----------------------------+
    \n| FIRST SECOND |
    \n+----------------------------+
    \n1 row in set (0.00 sec)

    \n\n

    ie.
    \nmysql -u eoewallpapers -p123456123 wallpapers -e 'set names 'utf8'; select CONCAT(base_url,"400",title) from photos where state > 10 ' > photos_400.txt

    \n", "_id"=>530}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["APIs", "eoe", "eoeAndroid", "eoemarket", "天翼工厂"], "comments_count"=>0, "category_id"=>6, "title"=>"天翼工厂的APIs是个思路,因缺失根基使得其只有华丽的外表", "body"=>"以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!\nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?\n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~", "created_at"=>2010-03-21 06:36:43 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    以前有听人说过电线的天翼工厂(天翼空间)是华为和中兴搭建的,其APIs的好棒~今天得闲,过去看了一眼,第一眼看上去,确实很不错,点了几个仔细看了看后发现其实只是一个面子工程,华丽的外表下没有多少实质性的东西,不外乎就是把市面上可以看到的API仔细的罗列了一边基本信息(和古老的公司黄页有点想象),但是其连基本信息都没提供全,越看越觉得差劲!
    \nAPIs的价值在哪里?不外乎是提供数据接口,进而指导开发者进行开发和实战,最终能培养开发者,产生好的内容(应用),但是这是一个从基础开始的过程,需要不断的培养和引导,但是你罗列一堆apis价值在哪里,不外乎可以给领导看上去量大,多!呵呵,KPI?
    \n我们后面也会做这个方面的事情,但是我们思路肯定和这个不一样,切入点也不一样,我们会从一个或者几个API开始,这些API需要是成熟的,或者实际自己可控的,对开发者进行1-3轮的培养,让其熟悉这个概念和使用流程,然后还会总结开发一些通用的jar包简化开发,然后再引入其他第三方的apis,这个时候才是积累出成果的时候,天翼工厂的做法很急功近利!仔细分析,也是不难理解的,他们缺少大量的开发者,不像eoe已经通过教程,eoeAndroid社区和开发者建立了很良好的信任关系,可以持续的培养和引导,这也就是eoe做的优势所在,如果我们开始做,一定做的比天翼好,而且我们做出来后,其产品可以在eoeMarket里直接发布,推荐~

    \n", "_id"=>531}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"为了不忘却的Google记忆", "body"=>"北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?\n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!\n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!", "created_at"=>2010-03-23 07:02:54 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    北京时间2010年凌晨3点半,还没睡,看到Google Buzz里有人喊“还没睡的赶紧来见证这一刻,一辈子只有这么一次”,得知Google宣布了最终的决定,退出大陆市场,转战香港,这其实不像老美能想的出来的招,哪位高人指点过Google?
    \n网上充裕着无数的论调和舆论,早就不能相信所谓的媒体和舆论,我们有着自己的思维和判断力,也无需辩论是非,也别抱着任何期盼!多了一份麻木,学会淡定,再淡定!
    \n其实我很少用Google.cn,我生活在互联网,我的互联网没有国界~为了不忘却这个特殊的纪念日,我还是呢喃一篇,不要忘却Google的记忆!

    \n", "_id"=>532}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["acts_as_taggable_on_steroids", "ruby", "will_paginate"], "comments_count"=>0, "category_id"=>2, "title"=>"acts_as_taggable_on_steroids 与 will_paginate 的整合分页", "body"=>"用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:\noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => \"updated_at DESC\").merge(:page => params[:page] ||1,:per_page =>20 )\n@products = Product.paginate(options)", "created_at"=>2010-03-23 23:07:25 UTC, "updated_at"=>2012-06-24 15:53:14 UTC, "body_html"=>"

    用了acts_as_taggable_on_steroid和will_paginate插件,发现不能分页,查找解决办法,如下得最方便:
    \noptions = Product.find_options_for_find_tagged_with(params[:tag_name],:order => "updated_at DESC").merge(:page => params[:page] ||1,:per_page =>20 )
    \n@products = Product.paginate(options)

    \n", "_id"=>533}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["cache_fu", "expire", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"expire_list_cache in cache_fu", "body"=>"cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:\n\n````#expire_list_cache\n def expire_caches\n Song.expire_cache(self.id)\n ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n AppStat.expire_cache(\"app_stat\#{self.id}\")\n 0.upto(PAGES) do |page|\n SongScreenshot.expire_cache(\"song_screenshots\#{self.id}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_status_state:11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"list_items_in_category_status_state:\#{self.category_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n Song.expire_cache(\"items_in_autthor:\#{self.author_id}11\#{\"updated_at desc\"}\#{page}\#{PER_PAGE}\")\n end\n end```", "created_at"=>2010-03-24 22:15:05 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    cache_fu在过期单个记录的时候很方便,但是对以那些列表分页的就有点弱了,没法过滤以制定前缀的key来过滤,所以变通下,需要用过loop来过滤,如下是个例子:

    \n
      def expire_caches\n    Song.expire_cache(self.id)\n    ApkFile.expire_cache(self.main_apk_file_id) if self.main_apk_file_id\n    AppStat.expire_cache("app_stat\#{self.id}")\n    0.upto(PAGES) do |page|\n      SongScreenshot.expire_cache("song_screenshots\#{self.id}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_status_state:11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("list_items_in_category_status_state:\#{self.category_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n      Song.expire_cache("items_in_autthor:\#{self.author_id}11\#{"updated_at desc"}\#{page}\#{PER_PAGE}")\n    end\n  end```\n
    \n
    \n", "_id"=>534}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["iTerm", "LSCOLORS", "Mac"], "comments_count"=>0, "category_id"=>7, "title"=>"MAC+iTerm定制目录显示颜色和提示符", "body"=>"很简单,就是在.bash_profile下加了三行.\nexport CLICOLOR=1\nexport LSCOLORS=exfxcxdxbxegedabagacad\n\n另外加了一行个性化提示符.\nexport PS1=\"\\[\\e[32;1;40m\\]\\u@\\H \\w \\$ \\[\\e[0m\\]\"\n\n相关的文章参见:\nhttp://mac.linsheng.me/archives/530.html\nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/\nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html\n\n配置\n\n那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。\n\n~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。\n\nalias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。\n\nCLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。\nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:\n\ndirectory\nsymbolic link\nsocket\npipe\nexecutable\nblock special\ncharacter special\nexecutable with setuid bit set\nexecutable with setgid bit set\ndirectory writable to others, with sticky bit\ndirectory writable to others, without sticky bit\nLSCOLORS中,字母代表的颜色如下:\n\na 黑色\nb 红色\nc 绿色\nd 棕色\ne 蓝色\nf 洋红色\ng 青色\nh 浅灰色\nA 黑色粗体\nB 红色粗体\nC 绿色粗体\nD 棕色粗体\nE 蓝色粗体\nF 洋红色粗体\nG 青色粗体\nH 浅灰色粗体\nx 系统默认颜色\n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了", "created_at"=>2010-03-30 20:34:48 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    很简单,就是在.bash_profile下加了三行.
    \nexport CLICOLOR=1
    \nexport LSCOLORS=exfxcxdxbxegedabagacad

    \n\n

    另外加了一行个性化提示符.
    \nexport PS1="[\\e[32;1;40m]\\u@\\H \\w \\$ [\\e[0m]"

    \n\n

    相关的文章参见:
    \nhttp://mac.linsheng.me/archives/530.html
    \nhttp://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
    \nhttp://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html

    \n\n

    配置

    \n\n

    那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。

    \n\n

    ~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。

    \n\n

    alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。

    \n\n

    CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
    \nLSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:

    \n\n

    directory
    \nsymbolic link
    \nsocket
    \npipe
    \nexecutable
    \nblock special
    \ncharacter special
    \nexecutable with setuid bit set
    \nexecutable with setgid bit set
    \ndirectory writable to others, with sticky bit
    \ndirectory writable to others, without sticky bit
    \nLSCOLORS中,字母代表的颜色如下:

    \n\n

    a 黑色
    \nb 红色
    \nc 绿色
    \nd 棕色
    \ne 蓝色
    \nf 洋红色
    \ng 青色
    \nh 浅灰色
    \nA 黑色粗体
    \nB 红色粗体
    \nC 绿色粗体
    \nD 棕色粗体
    \nE 蓝色粗体
    \nF 洋红色粗体
    \nG 青色粗体
    \nH 浅灰色粗体
    \nx 系统默认颜色
    \n所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了

    \n", "_id"=>535}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["10.6.3", "rails3", "railties"], "comments_count"=>0, "category_id"=>7, "title"=>"解决升级mac OS 10.6.3后rails3无法启动的问题", "body"=>"昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\nfrom /usr/bin/rails:19\n\n这个错误我之前安装rails3的时候遇到过,解决如下:\n1.先尝试下重新安装rails\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre\nPassword:\nSuccessfully installed treetop-1.4.5\n1 gem installed\nInstalling ri documentation for treetop-1.4.5...\nInstalling RDoc documentation for treetop-1.4.5..\n发现多了个treetop的gem,查查是啥:\n
    Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
    \n\n再次执行rails,发现\n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)\n from /usr/bin/rails:19\n\n还是不行,那就是railties的问题了,重新装下\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre\nSuccessfully installed railties-3.0.0.beta\n1 gem installed\nInstalling ri documentation for railties-3.0.0.beta...\nInstalling RDoc documentation for railties-3.0.0.beta...\nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v\nRails 3.0.0.beta\n\nOK,可以了~", "created_at"=>2010-03-31 22:01:38 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \nfrom /usr/bin/rails:19

    \n\n

    这个错误我之前安装rails3的时候遇到过,解决如下:
    \n1.先尝试下重新安装rails
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails --pre
    \nPassword:
    \nSuccessfully installed treetop-1.4.5
    \n1 gem installed
    \nInstalling ri documentation for treetop-1.4.5...
    \nInstalling RDoc documentation for treetop-1.4.5..
    \n发现多了个treetop的gem,查查是啥:
    \nTreetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.

    \n\n

    再次执行rails,发现
    \n/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for rails-3.0.0.beta (Gem::Exception)
    \n from /usr/bin/rails:19

    \n\n

    还是不行,那就是railties的问题了,重新装下
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties --pre
    \nSuccessfully installed railties-3.0.0.beta
    \n1 gem installed
    \nInstalling ri documentation for railties-3.0.0.beta...
    \nInstalling RDoc documentation for railties-3.0.0.beta...
    \nIceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
    \nRails 3.0.0.beta

    \n\n

    OK,可以了~

    \n", "_id"=>536}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails", "断点续传"], "comments_count"=>0, "category_id"=>2, "title"=>"在rails下实现多线程下载和断点续传", "body"=>"最近一个项目用到了断点续传的需求,找了一些资料,\nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应\n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了\n(必要的地方我都写了注释,欢迎大家提出建议和意见)\n记录一下相关的code:\n
    \nmodule ActionController\n  module Streaming\n    protected\n      def send_file(path, options = {})\n        raise MissingFile, \"Cannot read file \#{path}\" unless File.file?(path) and File.readable?(path)\n\n        options[:length]   ||= File.size(path) # 文件长度\n        options[:filename] ||= File.basename(path) # 文件名称\n\n        options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n        options[:to] ||= options[:length] # 结束位置\n\n        m_send_file_headers! options # 设置必要的 http 头\n\n        @performed_render = false\n\n        if options[:stream]\n          render :status => options[:status], :text => Proc.new { |response, output|\n            logger.info \"Streaming file \#{path}\" unless logger.nil?\n            len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n            File.open(path, 'rb') do |file|\n              file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n              while buf = file.read(len)\n                output.write(buf)\n              end\n            end\n          }\n        else\n          logger.info \"Sending file \#{path}\" unless logger.nil?\n          File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n        end\n      end\n\n    private\n      def m_send_file_headers!(options)\n        options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n        [:length, :type, :disposition].each do |arg|\n          raise ArgumentError, \":\#{arg} option required\" if options[arg].nil?\n        end\n\n        disposition = options[:disposition].dup || 'attachment'\n\n        disposition <<= %(; filename=\"\#{options[:filename]}\") if options[:filename]\n\n\t# 先输出一些通用的HTTP头\n        headers.update(\n          'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n          'Content-Disposition'       => disposition,\n          'Content-Transfer-Encoding' => 'binary'\n        )\n\n\t# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n\t# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n        if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n          options[:from] = $1\n          options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n\t  # 匹配成功,设置status 为 206\n          options[:status] = 206\n\n\t  # 一下3个http 头仅在多线程下载是有用\n          headers['Accept-Ranges'] = 'bytes'\n          headers['content-Range'] = \"bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}\" # 格式为 bytes from-to/total\n          headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n        else\n\t  # 非多现场下载\n          options[:status] = 200 # 请求正常标志\n          headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n        end\n\n        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n      end\n  end\nend\n```\n\n用法:\n 
    \nclass FileController 〈 ApplicationController\ndef download\n#logger.debug request.env['Range'];\n#    request.env.each do |key, value|\n#      logger.debug key + '--------' + value\n#    end\nsend_file 'public/jdk.tgz'\nend\nend\n```", "created_at"=>2010-04-17 04:01:25 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    最近一个项目用到了断点续传的需求,找了一些资料,
    \nror下文件下载是通过send_file完成的,但是如果使用多线程并支持断点续传的客户端(FlashGet等),send_file是不能正确工作的,原因在于,send_file函数没有对HTTP协议的Range头做相应的支持,并且也不支持HTTP/1.1 206 Partial Content相应
    \n我修改了send_file函数,并做了一个plugin 将起解压到vendor/plugins/就可以了
    \n(必要的地方我都写了注释,欢迎大家提出建议和意见)
    \n记录一下相关的code:
    \n
    \nmodule ActionController
    \n module Streaming
    \n protected
    \n def send_file(path, options = {})
    \n raise MissingFile, "Cannot read file \#{path}" unless File.file?(path) and File.readable?(path)

    \n
        options[:length]   ||= File.size(path) # 文件长度\n    options[:filename] ||= File.basename(path) # 文件名称\n\n    options[:from] ||= 0 # 首偏移量(从哪里开始下载)\n    options[:to] ||= options[:length] # 结束位置\n\n    m_send_file_headers! options # 设置必要的 http 头\n\n    @performed_render = false\n\n    if options[:stream]\n      render :status => options[:status], :text => Proc.new { |response, output|\n        logger.info "Streaming file \#{path}" unless logger.nil?\n        len = options[:buffer_size] || 8192 # 原来的实现是4K, 不过APUE 上说,8K 要好一些,所有我调整了一下\n        File.open(path, 'rb') do |file|\n          file.seek(options[:from].to_i, IO::SEEK_SET) if options[:status] == 206 # 如果是多线程下载,则将流定位到首偏移量位置,从此处开始传输\n          while buf = file.read(len)\n            output.write(buf)\n          end\n        end\n      }\n    else\n      logger.info "Sending file \#{path}" unless logger.nil?\n      File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n    end\n  end\n\nprivate\n  def m_send_file_headers!(options)\n    options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))\n    [:length, :type, :disposition].each do |arg|\n      raise ArgumentError, ":\#{arg} option required" if options[arg].nil?\n    end\n\n    disposition = options[:disposition].dup || 'attachment'\n\n    disposition <<= %(; filename="\#{options[:filename]}") if options[:filename]\n\n# 先输出一些通用的HTTP头\n    headers.update(\n      'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\\r' with some browsers\n      'Content-Disposition'       => disposition,\n      'Content-Transfer-Encoding' => 'binary'\n    )\n\n# 判断是否存在Range头,并使用正则表达式匹配 from 和 to\n# 如果匹配成功,则表示客户端使用多线程下载,同时一定要将http status 设置为 206\n    if request.env['HTTP_RANGE'] =~ /bytes=(\\d+)-(\\d*)/ then # 注意后一个\\d*,有一些多线程客户端并不完全符合http协议的要求(例如FlashGet)\n      options[:from] = $1\n      options[:to] = $2 unless $2.nil? # 如果客户端不标准,就将 to 设置为文件末尾\n\n  # 匹配成功,设置status 为 206\n      options[:status] = 206\n\n  # 一下3个http 头仅在多线程下载是有用\n      headers['Accept-Ranges'] = 'bytes'\n      headers['content-Range'] = "bytes \#{options[:from]}-\#{options[:to]}/\#{options[:length]}" # 格式为 bytes from-to/total\n      headers['Content-Length'] = options[:to].to_i - options[:from].to_i + 1 # 注意 在多线程下载下,Content-Length 为传输的实际字节数(从0开始算起,所有要+1)\n    else\n  # 非多现场下载\n      options[:status] = 200 # 请求正常标志\n      headers['Content-Length'] = options[:length] # 非多线程下载下,Content-Length为文件长度\n    end\n\n    headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'\n  end\n
    \n
    \n\n

    end
    \nend
    \n```

    \n\n

    用法:
    \n
    \nclass FileController 〈 ApplicationController
    \ndef download

    \n\n

    logger.debug request.env['Range'];

    \n\n

    request.env.each do |key, value|

    \n\n

    logger.debug key + '--------' + value

    \n\n

    end

    \n\n

    send_file 'public/jdk.tgz'
    \nend
    \nend
    \n```

    \n", "_id"=>537}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"使用Nginx的X-Accel-Redirect在Rails中发送文件", "body"=>"很多时候,我们会遇到需要一些业务逻辑(例如鉴权)后才将文件发送给客户端,那么如果将附件保存在public目录下将是非常不合适的,为了安全起见,你最好是将其保存在客户端无法直接访问的到的目录下,在处理完业务逻辑后,在将文件发送给客户端,Rails中提供了 send_XXXX来发送文件;\n\n但是使用Rails的app server(thin,mongrel,passenger etc.)来发送文件(特别是大文件)一直都不是一个靠谱的方案,rails提供的send_file和send_data在理论上是可以工作的,但是其会阻塞进程,消耗内存,等等系列的弊端,而诸如apache,Lighttpd,Nginx等web server在处理静态文件上有着得天独厚的优势。\n\n于是聪明的人们就想,可以使用app server处理业务逻辑,然后再让web server来接管处理剩下的文件发送,所以就有了mod_xsendfile for Apache2Lighttp中提供的X-Sendfile功能,Nginx自然也有类似的功能,只是其名字不叫X-Sendfile,而是叫X-Accel-Redirect(这个名字好像更容易理解)。 这里主要说Nginx,Apache的自行查阅资料,先了解下原理:\n
      \n\t
    1. The header must contain a URI
    2. \n\t
    3. The location should be defined as internal; to prevent the client going directly to the URI
    4. \n
    \n定义一段配置:\n``location /protected/ {\n internal;\n root /some/path;\n}```\n``然后在你的应用中:```\n``\n``add_header(\"X-Accel-Redirect: /protected/iso.img\");```\n``然后Nginx就接管了你的请求,发送/some/path/protected/iso.img这个文件。```\n``原理了解了,看看如何使用更快捷,自然是用插件,有人写出了一个插件:X-Accel-Redirect```\n``\n
    \n
    = X-Accel-Redirect
    \nThis Rails plugin allows users to take advantage of nginx's X-Accel-Redirect header, similar to X-Send-File.```\n
    == Install\nYou should install it as a plugin, running this command on your projects root directory:\n     $ script/plugin install git://github.com/goncalossilva/X-Accel-Redirect.git```\n
    == Usage\nX-Accel-Redirect has an equivalent method to Rails <i>send_file</i>, called <b>x_accel_redirect</b>. Using is as easy as:\n     x_accel_redirect \"/path/to/file\", :filename => \"filename\"\nAll <i>send_file</i> options are available using this method. Now you can even let your old <b>:x_sendfile</b> option since the plugin will discard it.```\n
    ```\n
    参考:
    ```\n``\n``wiki.nginx.org/NginxXSendfile```\n``\n

    USING NGINX TO SEND FILES WITH X-ACCEL-REDIRECT

    \n
    ```\nThe complete nginx solution to sending flowers and files with rails ```\n``[译]利用Nginx的X-Accel-Redirect头实现下载控制(附带php和rails实例)```", "created_at"=>2010-04-17 18:06:38 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    很多时候,我们会遇到需要一些业务逻辑(例如鉴权)后才将文件发送给客户端,那么如果将附件保存在public目录下将是非常不合适的,为了安全起见,你最好是将其保存在客户端无法直接访问的到的目录下,在处理完业务逻辑后,在将文件发送给客户端,Rails中提供了 send_XXXX来发送文件;

    \n\n

    但是使用Rails的app server(thin,mongrel,passenger etc.)来发送文件(特别是大文件)一直都不是一个靠谱的方案,rails提供的send_file和send_data在理论上是可以工作的,但是其会阻塞进程,消耗内存,等等系列的弊端,而诸如apache,Lighttpd,Nginx等web server在处理静态文件上有着得天独厚的优势。

    \n\n

    于是聪明的人们就想,可以使用app server处理业务逻辑,然后再让web server来接管处理剩下的文件发送,所以就有了mod_xsendfile for Apache2和Lighttp中提供的X-Sendfile功能,Nginx自然也有类似的功能,只是其名字不叫X-Sendfile,而是叫X-Accel-Redirect(这个名字好像更容易理解)。 这里主要说Nginx,Apache的自行查阅资料,先了解下原理:
    \n
    \n The header must contain a URI
    \n The location should be defined as internal; to prevent the client going directly to the URI
    \n
    \n定义一段配置:
    \n<a href="/NginxHttpCoreModule#location">location</a> /protected/ {
    \n <a href="/NginxHttpCoreModule#internal">internal</a>;
    \n <a href="/NginxHttpCoreModule#root">root</a> /some/path;
    \n}

    \n
    然后在你的应用中:
    \n

    \nadd_header("X-Accel-Redirect: /protected/iso.img");
    \n
    然后Nginx就接管了你的请求,发送<strong>/some/path/protected/iso.img</strong>这个文件。
    \n
    原理了解了,看看如何使用更快捷,自然是用插件,有人写出了一个插件:X-Accel-Redirect
    \n``
    \n<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">
    \n<div id="_mcePaste">= X-Accel-Redirect</div>
    \nThis Rails plugin allows users to take advantage of nginx's X-Accel-Redirect header, similar to X-Send-File.

    \n== Install
    \nYou should install it as a plugin, running this command on your projects root directory:
    \n $ script/plugin install git://github.com/goncalossilva/X-Accel-Redirect.git
    \n<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">== Usage
    \nX-Accel-Redirect has an equivalent method to Rails &lt;i&gt;send_file&lt;/i&gt;, called &lt;b&gt;x_accel_redirect&lt;/b&gt;. Using is as easy as:
    \n x_accel_redirect "/path/to/file", :filename =&gt; "filename"
    \nAll &lt;i&gt;send_file&lt;/i&gt; options are available using this method. Now you can even let your old &lt;b&gt;:x_sendfile&lt;/b&gt; option since the plugin will discard it.

    \n
    \n<div id="_mcePaste"><strong>参考:</strong></div>

    \n
    \n
    wiki.nginx.org/NginxXSendfile
    \n``<span style="font-family: Georgia, Times, 'Times New Roman', serif; line-height: 21px; white-space: normal; color: #21211e; font-size: 13px;">
    \n<h1 class="entry-title" style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; font-weight: bold; clear: both; text-transform: uppercase; letter-spacing: 2px; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a href="http://www.motionstandingstill.com/using-nginx-to-send-files-with-x-accel-redirect/2008-09-03/">USING NGINX TO SEND FILES WITH X-ACCEL-REDIRECT</a></h1>
    \n</span>

    \nThe complete nginx solution to sending flowers and files with rails
    \n``<a href="http://bianbian.org/technology/linux/154.html">[译]利用Nginx的X-Accel-Redirect头实现下载控制(附带php和rails实例)</a>

    \n", "_id"=>538}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"publish a rails plugin:Nginx-X-Accel-Redirect", "body"=>"前面2个文章说到了在Rails中使用send_file实现断点续传《在rails下实现多线程下载和断点续传》和利用Nginx的X-Accel-Redirect实现发送大文件《使用Nginx的X-Accel-Redirect在Rails中发送文件》,项目中需要两个功能,就把他整合起来,同时发布到github上了,Nginx-X-Accel-Redirect。\n\n简介:\nThis Rails plugin allows users to take advantage of nginx’s X-Accel-Redirect header, similar to X-Send-File and Content-Range.\n\n安装:\n$ script/plugin install git://github.com/IceskYsl/Nginx-X-Accel-Redirect.git\n\n使用:\nx_accel_redirect \"/path/to/file\", :filename => \"filename\",:root=>\"/path/to/root\"\n\n详细信息:github.com/IceskYsl/Nginx-X-Accel-Redirect", "created_at"=>2010-04-17 21:37:59 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    前面2个文章说到了在Rails中使用send_file实现断点续传《在rails下实现多线程下载和断点续传》和利用Nginx的X-Accel-Redirect实现发送大文件《使用Nginx的X-Accel-Redirect在Rails中发送文件》,项目中需要两个功能,就把他整合起来,同时发布到github上了,Nginx-X-Accel-Redirect。

    \n\n

    简介:
    \nThis Rails plugin allows users to take advantage of nginx’s X-Accel-Redirect header, similar to X-Send-File and Content-Range.

    \n\n

    安装:
    \n$ script/plugin install git://github.com/IceskYsl/Nginx-X-Accel-Redirect.git

    \n\n

    使用:
    \nx_accel_redirect "/path/to/file", :filename => "filename",:root=>"/path/to/root"

    \n\n

    详细信息:github.com/IceskYsl/Nginx-X-Accel-Redirect

    \n", "_id"=>539}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"restful_authentication的加密真复杂", "body"=>"以前一个项目中直接使用了restful_authentication,耶没怎么管生成的密码是啥样的,最近有几个系统要对接,需要统一用户,于是看了下restful_authentication的密码加密原则,发现其真是负责,一共分成下面几个部分:\n\n1.定义了一个40位的REST_AUTH_SITE_KEY和一样我常量10的REST_AUTH_DIGEST_STRETCHES;\n\n2.随机生成一个salt,其salt生成的规则是secure_digest(Time.now, (1..10).map{ rand.to_s }),而secure_digest是Digest::SHA1.hexdigest来生成的,也是40位。\n\n3.将salt和原始密码,混合前面定义的REST_AUTH_SITE_KEY,反复加密REST_AUTH_DIGEST_STRETCHES次,得到最终的一个digest就是密码了。\n\n够复杂~ 为啥搞这么负责呢,直接随机salt加双MD5不可逆加密也应该够用了吧。", "created_at"=>2010-04-18 10:29:06 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    以前一个项目中直接使用了restful_authentication,耶没怎么管生成的密码是啥样的,最近有几个系统要对接,需要统一用户,于是看了下restful_authentication的密码加密原则,发现其真是负责,一共分成下面几个部分:

    \n\n

    1.定义了一个40位的REST_AUTH_SITE_KEY和一样我常量10的REST_AUTH_DIGEST_STRETCHES;

    \n\n

    2.随机生成一个salt,其salt生成的规则是secure_digest(Time.now, (1..10).map{ rand.to_s }),而secure_digest是Digest::SHA1.hexdigest来生成的,也是40位。

    \n\n

    3.将salt和原始密码,混合前面定义的REST_AUTH_SITE_KEY,反复加密REST_AUTH_DIGEST_STRETCHES次,得到最终的一个digest就是密码了。

    \n\n

    够复杂~ 为啥搞这么负责呢,直接随机salt加双MD5不可逆加密也应该够用了吧。

    \n", "_id"=>540}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Paperclip,按日期划分目录方法", "body"=>"一个项目用到了图片上传,不想自己写处理过程了,于是就找找可以使用的插件,看到了Paperclip,大概了看了下代码和使用介绍,比较简洁。\n\n装上测试了下,整个过程比较顺利,很快就集成了需要的功能,但是具体到我的需求 上,花了点时间,我的需求也比较常见,就是大量的图片不能就存在一个文件夹下(否则这么多的小文件会带来很多的隐患),于是看代码找找其是否支持分目录的方案,我直接基本上都是按时间来分成诸如\"2010/0428/\"这样的目录,但是找了一圈,发现其提供了timestamp的一个变量,但是其结果比较糟糕,文件夹中还会根据当代的locale出现一些等下,不太合适;\n\n然后看到其提供了一个:id_partition的参数,其意思是:\n
    # Returns the id of the instance in a split path form. e.g. returns\n\n# 000/001/234 for an id of 1234.
    \n
    和我预期的差不多,如果决定这个数字还不够,可以修改其代码,如下:
    \n
    \n
    def id_partition attachment, style_name
    \n
    (\"%09d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    你可以再加3位(这下应该足够了,千亿级别的了),分成四个等级
    \n
    \n
    def id_partition attachment, style_name
    \n
    (\"%12d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    \n
    \n
    然后我们可以按照这个方式专辑实现安装日期类分目录的,代码如下:
    \n
    \n
    # Returns the timestamp of the instance in a split path form. e.g. returns
    \n
    # 2010/0428 for an id of 2010.04.28
    \n
    def timestamp_partition attachment, style_name
    \n
    attachment.instance_read(:updated_at).strftime(\"%Y/%m%d/\")
    \n
    # (\"%09d\" % attachment.instance.id).scan(/\\d{3}/).join(\"/\")
    \n
    end
    \n
    \n
    然后给model加上:
    \n
    \n
    has_attached_file :logo, :styles => {:thumb => '64x64>', :small => \"150x150>\" },
    \n
    :url => \"/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension\",
    \n
    :path => \":rails_root/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension\"
    \n
    \n
    \n
    其得到的结果类似:
    \n
    \n
    [paperclip] Saving attachments.
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg
    \n
    [paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg
    \n[paperclip] Saving attachments.[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg\n\n参考:\n\nhttp://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/\n\nhttp://cn.asciicasts.com/episodes/134-paperclip\n\nhttp://github.com/thoughtbot/paperclip\n\nhttp://gist.github.com/165072", "created_at"=>2010-04-27 11:11:25 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    一个项目用到了图片上传,不想自己写处理过程了,于是就找找可以使用的插件,看到了Paperclip,大概了看了下代码和使用介绍,比较简洁。

    \n\n

    装上测试了下,整个过程比较顺利,很快就集成了需要的功能,但是具体到我的需求 上,花了点时间,我的需求也比较常见,就是大量的图片不能就存在一个文件夹下(否则这么多的小文件会带来很多的隐患),于是看代码找找其是否支持分目录的方案,我直接基本上都是按时间来分成诸如"2010/0428/"这样的目录,但是找了一圈,发现其提供了timestamp的一个变量,但是其结果比较糟糕,文件夹中还会根据当代的locale出现一些等下,不太合适;

    \n\n

    然后看到其提供了一个:id_partition的参数,其意思是:
    \n# Returns the id of the instance in a split path form. e.g. returns

    \n\n

    000/001/234 for an id of 1234.

    \n\n

    和我预期的差不多,如果决定这个数字还不够,可以修改其代码,如下:
    \n
    \ndef id_partition attachment, style_name
    \n("%09d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n你可以再加3位(这下应该足够了,千亿级别的了),分成四个等级
    \n
    \ndef id_partition attachment, style_name
    \n("%12d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n
    \n
    \n然后我们可以按照这个方式专辑实现安装日期类分目录的,代码如下:
    \n
    \n# Returns the timestamp of the instance in a split path form. e.g. returns
    \n# 2010/0428 for an id of 2010.04.28
    \ndef timestamp_partition attachment, style_name
    \nattachment.instance_read(:updated_at).strftime("%Y/%m%d/")
    \n# ("%09d" % attachment.instance.id).scan(/\\d{3}/).join("/")
    \nend
    \n
    \n然后给model加上:
    \n
    \nhas_attached_file :logo, :styles => {:thumb => '64x64>', :small => "150x150>" },
    \n:url => "/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension",
    \n:path => ":rails_root/upload/:class/:attachment/:timestamp_partition/:id/:style/:basename.:extension"
    \n
    \n
    \n其得到的结果类似:
    \n
    \n[paperclip] Saving attachments.
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg
    \n[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg
    \n[paperclip] Saving attachments.[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/original/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/thumb/me.jpg[paperclip] saving /svnroot/eoe/dev/rails/eoemarket/eoeMarket/upload/shops/logos/2010/0428//5/small/me.jpg

    \n\n

    参考:

    \n\n

    http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/

    \n\n

    http://cn.asciicasts.com/episodes/134-paperclip

    \n\n

    http://github.com/thoughtbot/paperclip

    \n\n

    http://gist.github.com/165072

    \n", "_id"=>541}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "milestone", "充电"], "comments_count"=>0, "category_id"=>12, "title"=>"在mac下通过USB给Motorola milestone充电", "body"=>"带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:\n\n按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。\n\n原因不晓,感兴趣的自己链过去了解~", "created_at"=>2010-05-03 17:24:48 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    带了一个moto 的 milestone回来,到家发现我的mac无法给他充电,查了好大一会,找到一个解决的办法,如下:

    \n\n

    按照http://blog.gruby.com/2006/11/27/charging-a-motorola-razr-over-usb/ 这个文章说的,下载一个motocharger.app.zip ,然后解压放在applications目录下,运行就可以充电了。

    \n\n

    原因不晓,感兴趣的自己链过去了解~

    \n", "_id"=>542}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Encrypt & Decrypt in ruby", "body"=>"``require 'openssl'\nrequire 'digest/sha1'\nc = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\nc.encrypt\n# your pass is what is used to encrypt/decrypt\nc.key = key = Digest::SHA1.hexdigest(\"yourpass\")\nc.iv = iv = c.random_iv\ne = c.update(\"crypt this\")\ne << c.final\nputs \"encrypted: \#{e}\\n\"\nc = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\nc.decrypt\nc.key = key\nc.iv = iv\nd = c.update(e)\nd << c.final\nputs \"decrypted: \#{d}\\n\"```\n`````\n``\n``require 'openssl'\n\nkeyfile = 'test.key'\ncertfile = 'test.crt'\ndata = \"this is a test\"\n\ncert = OpenSSL::X509::Certificate.new(File.read(certfile))\nkey = OpenSSL::PKey::RSA.new(File.read(keyfile))\ncipher = OpenSSL::Cipher::AES.new(\"128-CBC\")\n\ntmp = OpenSSL::PKCS7.encrypt([cert], data, cipher,\nOpenSSL::PKCS7::BINARY)\np7 = OpenSSL::PKCS7::PKCS7.new(tmp.to_der)\n\n## Data will be stored as string so emulate that here\np7s = p7.to_s\n\n## Create pkcs7 object out of pkcs7 data\np7 = OpenSSL::PKCS7::PKCS7.new(p7s)\ndec = p7.decrypt(key,cert)\nprint dec```\n```\nhttp://nunojob.wordpress.com/2008/12/08/rsa-encrypt-decrypt-in-ruby/\n\nhttp://www.ruby-forum.com/topic/79319", "created_at"=>2010-05-14 21:58:00 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    ``require 'openssl'
    \nrequire 'digest/sha1'
    \nc = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
    \nc.encrypt

    \n\n

    your pass is what is used to encrypt/decrypt

    \n\n

    c.key = key = Digest::SHA1.hexdigest("yourpass")
    \nc.iv = iv = c.random_iv
    \ne = c.update("crypt this")
    \ne << c.final
    \nputs "encrypted: \#{e}\\n"
    \nc = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
    \nc.decrypt
    \nc.key = key
    \nc.iv = iv
    \nd = c.update(e)
    \nd << c.final
    \nputs "decrypted: \#{d}\\n"
    \n

    \n

    \n``require 'openssl'

    \n\n

    keyfile = 'test.key'
    \ncertfile = 'test.crt'
    \ndata = "this is a test"

    \n\n

    cert = OpenSSL::X509::Certificate.new(File.read(certfile))
    \nkey = OpenSSL::PKey::RSA.new(File.read(keyfile))
    \ncipher = OpenSSL::Cipher::AES.new("128-CBC")

    \n\n

    tmp = OpenSSL::PKCS7.encrypt([cert], data, cipher,
    \nOpenSSL::PKCS7::BINARY)
    \np7 = OpenSSL::PKCS7::PKCS7.new(tmp.to_der)

    \n\n

    Data will be stored as string so emulate that here

    \n\n

    p7s = p7.to_s

    \n\n

    Create pkcs7 object out of pkcs7 data

    \n\n

    p7 = OpenSSL::PKCS7::PKCS7.new(p7s)
    \ndec = p7.decrypt(key,cert)
    \nprint dec
    \n

    \nhttp://nunojob.wordpress.com/2008/12/08/rsa-encrypt-decrypt-in-ruby/

    \n\n

    http://www.ruby-forum.com/topic/79319

    \n", "_id"=>543}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在ruby中使用des aes rsa 加密解密等安全技术", "body"=>"终结下来三大类\n\n1,md5 sha1等消息摘要\n\n用的很多,比较熟悉,只是用于验证消息的完整性,而消息本省的传递确是明码的,除非想登录密码md5,那要服务器客户端两边都有。如果需要传输数据给另一方,而这段数据又不希望明文发就得使用密钥了。\n\n2,des等 ,私有密钥加密数据\n\n只要约定密钥,然后在通过这个密钥对信息加密然后传送,另一方通过密钥对加密信息解密。\n\n3,rsa , 公钥和密钥结合的高级货\n\n公钥不是大家都使用的,而是可以公开的,我开始误会错了搞不懂。通过rsa生成一对密钥,公钥和私钥,通过公钥加密的数据,只有私钥才能解开。那在网络中可以随便告诉客户端公钥,然后对方通过公钥加密后传加密信息,即使地球人都知道公钥也不要紧,因为私钥是保密的,解不开得到了加密信息也没办法。当然私钥加密后信息,公钥也可以解开,但速度上差成百上千倍。\n\nruby中通过openssl这个自带的标准库来实现。举了几个例子,des和rsa的\n\n#!/usr/bin/ruby\n\nrequire \"openssl\"\n#doc see http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html\n\nclass Encrypt\n KEY = \"aaaabbbb\"\n IV = \"aaaavvvv\"\n def des_encrypt(plaintext)\n c = OpenSSL::Cipher::Cipher.new(\"DES-CBC\")\n c.encrypt\n c.key = KEY\n c.iv = IV\n ret = c.update(plaintext)\n ret << c.final\n end\n\n def des_decrypt(encrypt_value)\n c = OpenSSL::Cipher::Cipher.new(\"DES-CBC\")\n c.decrypt\n c.key = KEY\n c.iv = IV\n ret = c.update(encrypt_value)\n ret << c.final\n end\n\n def get_rsa_key\n rsa = OpenSSL::PKey::RSA.new(1024)\n # public_key only can public_encrypt or public_decrypt no private_encrypt nor private_decrypt\n #rsa.public_key.to_pem the class of return value is String\n [rsa.public_key.to_pem , rsa.to_pem]\n end\n\n def rsa_private_encrypt(value , rsakey)\n rsa = OpenSSL::PKey::RSA.new(rsakey)\n rsa.private_encrypt(value)\n end\n\n def rsa_private_decrypt(value , rsakey)\n rsa = OpenSSL::PKey::RSA.new(rsakey)\n rsa.private_decrypt(value)\n end\n\n def rsa_public_encrypt(value , publickey)\n rsa = OpenSSL::PKey::RSA.new(publickey)\n rsa.public_encrypt(value)\n end\n\n def rsa_public_decrypt(value , publickey)\n rsa = OpenSSL::PKey::RSA.new(publickey)\n rsa.public_decrypt(value)\n end\nend\n\ndef testrun\n e = Encrypt.new\n text = \"a secret message\"\n puts \"text:\#{text}\"\n value = e.des_encrypt(text)\n puts \"des_encrypt:\#{value}\"\n des_decrypt = e.des_decrypt(value)\n puts \"des_decrypt:\#{des_decrypt}\"\n\n puts \"-------------------------\"\n publickey , privatekey = e.get_rsa_key\n puts \"publickey:\\n\#{publickey} \\n privatekey=\\n\#{privatekey}\"\n\n value1 = e.rsa_private_encrypt(text , privatekey)\n puts \"rsa_private_encrypt:\#{value1}\"\n rsa_public_decrypt = e.rsa_public_decrypt(value1 , publickey)\n puts \"rsa_public_decrypt:\#{rsa_public_decrypt}\"\n\n value2 = e.rsa_public_encrypt(\"another message\" , publickey)\n puts \"rsa_public_encrypt:\#{value2}\"\n rsa_private_decrypt = e.rsa_private_decrypt(value2 , privatekey)\n puts \"rsa_private_decrypt:\#{rsa_private_decrypt}\"\n\n puts \"----------------------------\"\n rsa = OpenSSL::PKey::RSA.new(1024 , 7)\n value3 = rsa.private_encrypt(\"myself key\")\n puts rsa.public_decrypt(value3)\nend\n\ntestrun\n\n测试结果:\nIceskYsl@eoe ~/Desktop $ ruby encrypt.rb\ntext:a secret message\ndes_encrypt:羻\"j}####9\"q###A##\ndes_decrypt:a secret message\n-------------------------\npublickey:\n-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBALrAGpm39jexyrrkYuM6kyP0z+pBlY/i3WnIYHrR3PDk9af2GsuIUwqg\nvhKRMxv5EZh1CShec++DfRAaBHwM2zCcHA1rDqrzqoSMdyCav+wbVwkSblqGb6gz\nQ4Zk/nM73mF1PaOkZvlpKN7B5H7BsUN2ngpaz4u9MxMm0Tn1guIVAgMBAAE=\n-----END RSA PUBLIC KEY-----\n\n privatekey=\n-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQC6wBqZt/Y3scq65GLjOpMj9M/qQZWP4t1pyGB60dzw5PWn9hrL\niFMKoL4SkTMb+RGYdQkoXnPvg30QGgR8DNswnBwNaw6q86qEjHcgmr/sG1cJEm5a\nhm+oM0OGZP5zO95hdT2jpGb5aSjeweR+wbFDdp4KWs+LvTMTJtE59YLiFQIDAQAB\nAoGBAKbgsSR5yfBc1J8LJP6OQhvYUM6xCngILvivEN/PltJAlvAfMDR+Pk558z9e\nNsChYcLNmoBTXuBBrEjuJuG/D0GpOmLadoZYDjlciJxj3Y9w85EvfRssdYGsBvIY\nksHVfsYEKJXp41ORux1jZgJXsnxn9276F7Unam65mPyUleiFAkEA8LMpAfgc3y4f\niHiDSon0AcgoIyH4eiiyxGPQEavIVgD2njRCM2pg3Z2uS3c/Et+EAaLjy9N1Cfy6\nplZRwHuXqwJBAMafCjgUQaqFisJNSUWWsENVzjmfk2pnGK1TJot3BtpN67rX1dcC\nQ3cNWbVhoF6zp6y+Kn/Lrdx1N+eNvhLOrT8CQQCl09jZuXUysVUaMWTKkrZgD+TP\nJ5VHnAhlUxrDQeU4k1tU7U36nDx2Ei9FYLc8qm8IrY9hGqLUqaBx/qA+CygXAkAu\nsAGp7vEEkUFtrNcVWXdzTH8eQmlXcIZ3b302+TKOLBTGJafpU2niWSwGG72jpR07\n2LOKuKjUkmUis8nDB/vnAkAxTVKBDYhfInF1/8/bhDAeqrWLifJUmxLEmO9WSRWm\nI5ZodXZIaNOBRCSZToQSdfPbhWtQ68sWGNbI0YYwm3OZ\n-----END RSA PRIVATE KEY-----\nrsa_private_encrypt:#k4#e|########\u0557#F#####0 ###3\n ## õë######o#####\u007F')\nc###########m##7e¼####u $>#######hU\u007FKc(#ۯ#####Us0T#######\n rsa_public_decrypt:a secret message\nrsa_public_encrypt:t####H\n \"#########'#H7############O#j####H###v#]Q`TR###Hs#U%####L###Z#####rѽ##\n ###F##(#X##˵#3####rsa_private_decrypt:another message\n----------------------------\nmyself key", "created_at"=>2010-05-14 23:02:22 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    终结下来三大类

    \n\n

    1,md5 sha1等消息摘要

    \n\n

    用的很多,比较熟悉,只是用于验证消息的完整性,而消息本省的传递确是明码的,除非想登录密码md5,那要服务器客户端两边都有。如果需要传输数据给另一方,而这段数据又不希望明文发就得使用密钥了。

    \n\n

    2,des等 ,私有密钥加密数据

    \n\n

    只要约定密钥,然后在通过这个密钥对信息加密然后传送,另一方通过密钥对加密信息解密。

    \n\n

    3,rsa , 公钥和密钥结合的高级货

    \n\n

    公钥不是大家都使用的,而是可以公开的,我开始误会错了搞不懂。通过rsa生成一对密钥,公钥和私钥,通过公钥加密的数据,只有私钥才能解开。那在网络中可以随便告诉客户端公钥,然后对方通过公钥加密后传加密信息,即使地球人都知道公钥也不要紧,因为私钥是保密的,解不开得到了加密信息也没办法。当然私钥加密后信息,公钥也可以解开,但速度上差成百上千倍。

    \n\n

    ruby中通过openssl这个自带的标准库来实现。举了几个例子,des和rsa的

    \n\n

    !/usr/bin/ruby

    \n\n

    require "openssl"

    \n\n

    doc see http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html

    \n\n

    class Encrypt
    \n KEY = "aaaabbbb"
    \n IV = "aaaavvvv"
    \n def des_encrypt(plaintext)
    \n c = OpenSSL::Cipher::Cipher.new("DES-CBC")
    \n c.encrypt
    \n c.key = KEY
    \n c.iv = IV
    \n ret = c.update(plaintext)
    \n ret << c.final
    \n end

    \n
    def des_decrypt(encrypt_value)\n    c = OpenSSL::Cipher::Cipher.new("DES-CBC")\n    c.decrypt\n    c.key = KEY\n    c.iv = IV\n    ret = c.update(encrypt_value)\n    ret << c.final\nend\n\ndef get_rsa_key\n    rsa = OpenSSL::PKey::RSA.new(1024)\n    # public_key only can public_encrypt or public_decrypt no private_encrypt nor private_decrypt\n    #rsa.public_key.to_pem the class of return value is String\n    [rsa.public_key.to_pem , rsa.to_pem]\nend\n\ndef rsa_private_encrypt(value , rsakey)\n    rsa = OpenSSL::PKey::RSA.new(rsakey)\n    rsa.private_encrypt(value)\nend\n\ndef rsa_private_decrypt(value , rsakey)\n    rsa = OpenSSL::PKey::RSA.new(rsakey)\n    rsa.private_decrypt(value)\nend\n\ndef rsa_public_encrypt(value , publickey)\n    rsa = OpenSSL::PKey::RSA.new(publickey)\n    rsa.public_encrypt(value)\nend\n\ndef rsa_public_decrypt(value , publickey)\n   rsa = OpenSSL::PKey::RSA.new(publickey)\n   rsa.public_decrypt(value)\nend\n
    \n
    \n\n

    end

    \n\n

    def testrun
    \n e = Encrypt.new
    \n text = "a secret message"
    \n puts "text:\#{text}"
    \n value = e.des_encrypt(text)
    \n puts "des_encrypt:\#{value}"
    \n des_decrypt = e.des_decrypt(value)
    \n puts "des_decrypt:\#{des_decrypt}"

    \n
    puts "-------------------------"\npublickey , privatekey = e.get_rsa_key\nputs "publickey:\\n\#{publickey} \\n privatekey=\\n\#{privatekey}"\n\nvalue1 = e.rsa_private_encrypt(text , privatekey)\nputs "rsa_private_encrypt:\#{value1}"\nrsa_public_decrypt = e.rsa_public_decrypt(value1 , publickey)\nputs "rsa_public_decrypt:\#{rsa_public_decrypt}"\n\nvalue2 = e.rsa_public_encrypt("another message" , publickey)\nputs "rsa_public_encrypt:\#{value2}"\nrsa_private_decrypt =  e.rsa_private_decrypt(value2 , privatekey)\nputs "rsa_private_decrypt:\#{rsa_private_decrypt}"\n\nputs "----------------------------"\nrsa = OpenSSL::PKey::RSA.new(1024 , 7)\nvalue3 = rsa.private_encrypt("myself key")\nputs rsa.public_decrypt(value3)\n
    \n
    \n\n

    end

    \n\n

    testrun

    \n\n

    测试结果:
    \nIceskYsl@eoe ~/Desktop $ ruby encrypt.rb
    \ntext:a secret message
    \ndes_encrypt:羻"j}####9"q###A##

    \n\n

    des_decrypt:a secret message

    \n\n

    publickey:
    \n-----BEGIN RSA PUBLIC KEY-----
    \nMIGJAoGBALrAGpm39jexyrrkYuM6kyP0z+pBlY/i3WnIYHrR3PDk9af2GsuIUwqg
    \nvhKRMxv5EZh1CShec++DfRAaBHwM2zCcHA1rDqrzqoSMdyCav+wbVwkSblqGb6gz
    \nQ4Zk/nM73mF1PaOkZvlpKN7B5H7BsUN2ngpaz4u9MxMm0Tn1guIVAgMBAAE=
    \n-----END RSA PUBLIC KEY-----

    \n\n

    privatekey=
    \n-----BEGIN RSA PRIVATE KEY-----
    \nMIICXQIBAAKBgQC6wBqZt/Y3scq65GLjOpMj9M/qQZWP4t1pyGB60dzw5PWn9hrL
    \niFMKoL4SkTMb+RGYdQkoXnPvg30QGgR8DNswnBwNaw6q86qEjHcgmr/sG1cJEm5a
    \nhm+oM0OGZP5zO95hdT2jpGb5aSjeweR+wbFDdp4KWs+LvTMTJtE59YLiFQIDAQAB
    \nAoGBAKbgsSR5yfBc1J8LJP6OQhvYUM6xCngILvivEN/PltJAlvAfMDR+Pk558z9e
    \nNsChYcLNmoBTXuBBrEjuJuG/D0GpOmLadoZYDjlciJxj3Y9w85EvfRssdYGsBvIY
    \nksHVfsYEKJXp41ORux1jZgJXsnxn9276F7Unam65mPyUleiFAkEA8LMpAfgc3y4f
    \niHiDSon0AcgoIyH4eiiyxGPQEavIVgD2njRCM2pg3Z2uS3c/Et+EAaLjy9N1Cfy6
    \nplZRwHuXqwJBAMafCjgUQaqFisJNSUWWsENVzjmfk2pnGK1TJot3BtpN67rX1dcC
    \nQ3cNWbVhoF6zp6y+Kn/Lrdx1N+eNvhLOrT8CQQCl09jZuXUysVUaMWTKkrZgD+TP
    \nJ5VHnAhlUxrDQeU4k1tU7U36nDx2Ei9FYLc8qm8IrY9hGqLUqaBx/qA+CygXAkAu
    \nsAGp7vEEkUFtrNcVWXdzTH8eQmlXcIZ3b302+TKOLBTGJafpU2niWSwGG72jpR07
    \n2LOKuKjUkmUis8nDB/vnAkAxTVKBDYhfInF1/8/bhDAeqrWLifJUmxLEmO9WSRWm
    \nI5ZodXZIaNOBRCSZToQSdfPbhWtQ68sWGNbI0YYwm3OZ
    \n-----END RSA PRIVATE KEY-----
    \nrsa_private_encrypt:#k4#e|########\u0557#F#####0 ###3
    \n ## õë######o#####\u007F')
    \nc###########m##7e¼####u $>#######hU\u007FKc(#ۯ#####Us0T#######
    \n rsa_public_decrypt:a secret message
    \nrsa_public_encrypt:t####H
    \n "#########'#H7############O#j####H###v#]Q`TR###Hs#U%####L###Z#####rѽ##

    \n\n

    ###F##(#X##˵#3####rsa_private_decrypt:another message

    \n\n

    myself key

    \n", "_id"=>544}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["feed", "I18n"], "comments_count"=>0, "category_id"=>2, "title"=>"利用Rails中的国际化规则生成feed消息", "body"=>"近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。\n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:\nclass FeedAction\n\n #APP:1 - 99\n APP_DOWNLOAD = 1 #Download\n APP_FAV = 2 #Favorites\n APP_PAY = 3\n APP_INSTALL = 4\n\n2. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\n FEED_ACTION:\n APP_DOWNLOAD: \"下载了\"\n APP_FAV: \"收藏了\"\n APP_PAY: \"购买了\"\n APP_RATE: \"打了{{rate}}星\"\n\n3.生成消息输出的时候,直接\n>> I18n.locale = 'zh'\n>> I18n.t 'FEED_ACTION.APP_PAY'\n=> \"购买了\"\n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2\n=> \"打了2星\"", "created_at"=>2010-05-26 09:29:41 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    近日需要实现feed(动态)消息,同时需要支持多语言,本来没什么难的,做一个多态表,然后存储消息的目标对象,再规定好一些动作,入库或者出库的时候拼装下就好了。这里有个比较有趣的是如何最大限度的重用代码或者规则,最后实现中借鉴了Rails国际化的规则。
    \n1. 首先定义针对目标可以做的操作,用常量定义好(考虑到数量不会很多,且不会经常变化,就不存数据库),例如:
    \nclass FeedAction

    \n\n

    #APP:1 - 99
    \n APP_DOWNLOAD = 1 #Download
    \n APP_FAV = 2 #Favorites
    \n APP_PAY = 3
    \n APP_INSTALL = 4

    \n\n
      \n
    1. 对定义好的操作名为key,撰写其对应语言的动作描述,写zh.yml或者en.yml文件,例如:\nzh:\nFEED_ACTION:\n APP_DOWNLOAD: "下载了"\n APP_FAV: "收藏了"\n APP_PAY: "购买了"\n APP_RATE: "打了{{rate}}星"
    2. \n
    \n\n

    3.生成消息输出的时候,直接
    \n>> I18n.locale = 'zh'
    \n>> I18n.t 'FEED_ACTION.APP_PAY'
    \n=> "购买了"
    \n>> I18n.t 'FEED_ACTION.APP_RATE',:rate=>2
    \n=> "打了2星"

    \n", "_id"=>545}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"md5sum", "body"=>"MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5 全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相同的报文摘要的可能性是非常非常之小的。\n在linux或Unix上,md5sum是用来计算和校验文件报文摘要的工具程序。一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行。\n1、使用md5sum来产生指纹(报文摘要)命令如下:\nmd5sum filename > filename.md5\n或者\nmd5sum filename >>filename.md5\n\n示例:\n[www@iceskysl 20100527]$ md5sum update.zip.1\ncd32d060d5e4d1891dfa4d6552cc57bb update.zip.1\n\n也可以把多个文件的报文摘要输出到一个md5文件中,这要使用通配符*,比如某目录下有几个iso文件,要把这几个iso文件的摘要输出到iso.md5文件中,命令如下:\nmd5sum *.iso > iso.md5\n\n2、使用md5报文摘要验证文件,方法有二:\n把下载的文件file和该文件的file.md5报文摘要文件放在同一个目录下,然后用如下命令进行验证:\nmd5sum -c file.md5\n然后如果验证成功,则会输出:正确", "created_at"=>2010-06-01 22:11:30 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5 全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相同的报文摘要的可能性是非常非常之小的。
    \n在linux或Unix上,md5sum是用来计算和校验文件报文摘要的工具程序。一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行。
    \n1、使用md5sum来产生指纹(报文摘要)命令如下:
    \nmd5sum filename > filename.md5
    \n或者
    \nmd5sum filename >>filename.md5

    \n\n

    示例:
    \n[www@iceskysl 20100527]$ md5sum update.zip.1
    \ncd32d060d5e4d1891dfa4d6552cc57bb update.zip.1

    \n\n

    也可以把多个文件的报文摘要输出到一个md5文件中,这要使用通配符*,比如某目录下有几个iso文件,要把这几个iso文件的摘要输出到iso.md5文件中,命令如下:
    \nmd5sum *.iso > iso.md5

    \n\n

    2、使用md5报文摘要验证文件,方法有二:
    \n把下载的文件file和该文件的file.md5报文摘要文件放在同一个目录下,然后用如下命令进行验证:
    \nmd5sum -c file.md5
    \n然后如果验证成功,则会输出:正确

    \n", "_id"=>546}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["delayed_job", "dj"], "comments_count"=>0, "category_id"=>2, "title"=>"delayed_job in rails", "body"=>"Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.\n\nref:\nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/\nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job\nhttp://github.com/tobi/delayed_job", "created_at"=>2010-06-07 22:43:03 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

    \n\n

    ref:
    \nhttp://adamfortuna.com/2009/08/17/the-amazingness-of-delayed_job-for-rails/
    \nhttp://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job
    \nhttp://github.com/tobi/delayed_job

    \n", "_id"=>547}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"TEXT fields in MySQL", "body"=>"MySQL TEXT fields have a limit of 65,000 bytes. If you insert anything larger than that in to a normal TEXT field mySQL will silently truncate your data without telling you (meaning software checks are probably a good idea). MEDIUMTEXT will store 16 million characters and LONGTEXT can handle over 4 trillion, but this information does not appear to be readily available in the online mySQL manual (although it is hinted at in this table). Something to bare in mind when designing database applications.\n\nMyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).\n\nref::http://www.electrictoolbox.com/maximum-length-mysql-text-field-types/\nTEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.\n\nThe maximum amount of data that can be stored in each data type is as follows:\n\nTINYTEXT\t256 bytes\nTEXT\t65,535 bytes\t~64kb\nMEDIUMTEXT\t 16,777,215 bytes\t~16MB\nBIGTEXT\t4,294,967,295 bytes\t~4GB\nIn most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.", "created_at"=>2010-06-27 20:56:02 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    MySQL TEXT fields have a limit of 65,000 bytes. If you insert anything larger than that in to a normal TEXT field mySQL will silently truncate your data without telling you (meaning software checks are probably a good idea). MEDIUMTEXT will store 16 million characters and LONGTEXT can handle over 4 trillion, but this information does not appear to be readily available in the online mySQL manual (although it is hinted at in this table). Something to bare in mind when designing database applications.

    \n\n

    MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).

    \n\n

    ref::http://www.electrictoolbox.com/maximum-length-mysql-text-field-types/
    \nTEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.

    \n\n

    The maximum amount of data that can be stored in each data type is as follows:

    \n\n

    TINYTEXT 256 bytes
    \nTEXT 65,535 bytes ~64kb
    \nMEDIUMTEXT 16,777,215 bytes ~16MB
    \nBIGTEXT 4,294,967,295 bytes ~4GB
    \nIn most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.

    \n", "_id"=>548}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "csdn", "tup"], "comments_count"=>0, "category_id"=>12, "title"=>"参加CSDN组织的TUP首期活动:移动开发实践", "body"=>"\"http://www.eoeandroid.com/attachments/month_1006/100628151169669bb4f7b7d8c5.jpg\"\n2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。\n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;\n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。\n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。\n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。\n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!", "created_at"=>2010-06-28 09:24:48 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    2010年6约27日,周日下午,由CSDN和《程序员》杂志联合策划组织,旨在与业界人士分享IT产品背后的技术和用户体验故事的线下活动TUP(Technology, User Experience, Product)系列活动日前在北京丽亭华苑酒店成功举办,首期活动以“移动开发实践”为主题。
    \n受CSDN&《程序员》总编刘江邀请,我去分享了自己对android方面的一些体会和心得,本来预期200人参加的活动,从wudi那边看到报名的有500多人,最终选了300多人参与了活动,场面还是比较火爆的,到处站的都是人,CSDN在国内技术圈还是有不错影响力的;
    \n活动从下午1电30分正式开始,刘江主持,介绍了TUP的核心价值,然后我是第一个演讲的,我和大家分享的题目是《Google Android盈利模式探析及其应用突围之道》,和大家分享了android目前的市场;可行的一些盈利模式,我的观点是现阶段,广告和应用中收费(注意不是收费应用)是两个比较成熟的模式,除此之外还有做平台,做培训,咨询等等模式可以尝试;借着和大家分享了应用突围之道,举了两个例子,说明如何让你的应用在众多应用中脱颖而出(分析数据很重要),最后和大家分享了android的发展趋势,我个人觉得android终端多元化,终端网络化的趋势很明显,那么带来的就是应用的巨大需求(个性化,国际化,本地化的),从而使得android人才缺口非常大。
    \n从大家的提问和会后的交流来看,很多人还是比较迷茫的,对现况的迷茫,对市场的迷茫,比如国内外大大小小的软件商店很多人就看不明白,原因很简单,看到的都是表表象,透过表象,把握住本质就很清晰了。
    \n比较冏的是名片带少了,后来给不少人手工写了联系方式,本来后面还有个互动交流的环节,由于临时有些事情,没来得及参加就撤退了,有些遗憾。
    \n今天各大媒体的报道都出来,看到基本商都是用的我topic里的一个观点“andoid应用突”》做为报道点,希望大家能顺利突围!

    \n", "_id"=>549}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Tips"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Linkid", "mo", "mt"], "comments_count"=>0, "category_id"=>4, "title"=>"MO,MT,Linkid的关系", "body"=>"做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID\n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original\n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated\n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。\n\n所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。", "created_at"=>2010-07-14 08:57:07 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    做移动互联网的过程中,有这样一些词是必须知道的,如MO,MT,GSM,LINKID
    \n上行(MO)上行的意思就是短信发送到服务器端 MO又称 Mobile Original
    \n下行(MT)下行的意思就是短信从服务器端发回到手机上,MT又称Mobile Terminated
    \n简单的说,从手机发起一个的过程叫上行(MO),到手机结束的过程叫下行(MT),比如,平时给你的朋友发送一条短信,对你来说就是上行(MO),而对你的朋友来说,就是下行(MT)。在企业、行业应用中,从系统给手机发送信息的过程叫下行(MT),而手机发送信息给系统的过程叫上行(MO)。

    \n\n

    所有用户点播的业务,用户MO(上行)消息通过网关送到MISC鉴权批价后,MISC会自动生成一个随机数linkid随后通过网关传给SP,当SP收到MO(上行)消息后下发MT(下行)消息给用户时必须在Submit包的linkid字段填上MO(上行)消息包里面带的linkid信息(Reserve值:设定的回复内容)。

    \n", "_id"=>550}]) +MONGODB iceylog_development['categories'].find({:_id=>4}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>4}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["eoemarket", "优亿市场"], "comments_count"=>0, "category_id"=>6, "title"=>"优亿市场(eoeMarket)推出“新版本兼容性大扫荡”活动!", "body"=>"\"\"\n==活动简介==\n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。\n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。\n活动地址:http://www.eoemarket.com/activities/release_bate_version\n\n== 参与前的准备==\n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);\n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);\n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;\n\n==安装优亿市场 (eoeMarket)==\n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。\n\n==活动内容==\n1、参与对象:所有 Android用户(玩家,开发者,公司等);\n2、参与方式:参与的用户按照本报告内容测试反馈;\n3、我们会在官方网站公布被测试的机型 及其结果;\n\n==更多资料==\n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!\n官方网站:http://www.eoemarket.com/", "created_at"=>2010-07-17 20:57:30 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    ==活动简介==
    \n我们希望更多的中国的android用户能获得更多优秀的本土化android应用和游戏,得到更好的服务和更贴心的体验,期望 您能安装和体验一下易联致远的优亿市场(eoeMarket),并为我们提供更多的反馈信息。
    \n为此,优亿市场(eoeMarket)运营团队特别 推出“新版本兼容性大扫荡”活动,旨在使得优亿市场(eoeMarket)能运行在更多android设备上,服务更多的android用户。
    \n活动地址:http://www.eoemarket.com/activities/release_bate_version

    \n\n

    == 参与前的准备==
    \n1. 您需要有一款运行android(ophone或乐phone等等)系统的设备(手机, MID或Pad等);
    \n2. 您的设备需要有联网功能(通过gprs,edeg,3g或wifi等);
    \n3. 您需要装上最新版本的优亿市场(eoeMarket),如果您尚未安装,请参考下面的《安装优亿市场》;

    \n\n

    ==安装优亿市场 (eoeMarket)==
    \n在设备上打开浏览器,输入网址: eoemarket.com/a 即可下载最新版本的优亿市场(eoeMarket),下载完成后点击即可安装。

    \n\n

    ==活动内容==
    \n1、参与对象:所有 Android用户(玩家,开发者,公司等);
    \n2、参与方式:参与的用户按照本报告内容测试反馈;
    \n3、我们会在官方网站公布被测试的机型 及其结果;

    \n\n

    ==更多资料==
    \n优亿市场(eoeMarket)是由北京易联致远(eoeMobile)和开发者紧密合作、给玩家提 供优秀Android应用的集软件发布、搜索、推荐、安装等于一体的软件商店平台。其为国内最早发布的\bAndroid软件商店(2009年7月发布第一 版),已经发布超过1500款优秀的本土应用(游戏)!现在公测的是其2010年7月18日最新发布的公测版!
    \n官方网站:http://www.eoemarket.com/

    \n", "_id"=>551}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"参加“Orange开发者日“活动", "body"=>"\"\"\n参加了7月6日在法电参加“Orange开发者日“活动,此次活动的重点是寻找Android应用程序,分享Android应用开发的经验,参与活动的有Orange AppShop的总部和北京的成员、联通应用商城的负责人员、摩托罗拉应用商店的负责人员、和参加活动的应用开发者。我在会上有个主题,主要介绍了优亿市场(eoemarket)这个产品,于会的差不多有200多人,认识一些很熟悉但未见面的老朋友。参加了会后的商务一对一,orange的工作人员对我们的产品提了不少好的建议。", "created_at"=>2010-07-17 21:04:05 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    参加了7月6日在法电参加“Orange开发者日“活动,此次活动的重点是寻找Android应用程序,分享Android应用开发的经验,参与活动的有Orange AppShop的总部和北京的成员、联通应用商城的负责人员、摩托罗拉应用商店的负责人员、和参加活动的应用开发者。我在会上有个主题,主要介绍了优亿市场(eoemarket)这个产品,于会的差不多有200多人,认识一些很熟悉但未见面的老朋友。参加了会后的商务一对一,orange的工作人员对我们的产品提了不少好的建议。

    \n", "_id"=>552}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "书籍", "创赢路线"], "comments_count"=>0, "category_id"=>6, "title"=>"第二本android书籍《It's Android TIME: 创赢路线》上市", "body"=>"\"It's\r\n昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。\r\n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。\r\n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。\r\n\r\n推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html\r\n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html\r\n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html\r\n\r\n详细目录:\r\nhttp://www.eoeandroid.com/thread-25465-1-1.html\r\n\r\n预定购买:\r\nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898", "created_at"=>2010-07-18 00:25:20 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    昨天出版社说《It's Android TIME: 创赢路线与产品开发实战》得书印刷出来了,给我们快递一些过来,早上到公司就收到走宅急送送来得一个箱子,打开果然是《It's Android TIME: 创赢路线于产品开始实战》,第二本android书籍终于要上市了。
    \n这本书主要是我策划和组织的,召集了10多个人参与了编写,全书600来页,共16章,从去年10月份开始策划,到现在的7月份,时间还真不短。
    \n本书立足点不再是单纯的技术,大家应该知道,我写的第一本书《Google Andori开发入门也实战》是国内最早的android书籍,09年6月上市,是09年计算机销量TOP50,刚接到出版社电话,说又重印了2000本,那本书主要是将如何入门android开发,讲的都比较基础,让大家入门android;而本书《It's Android TIME: 创赢路线与产品开发实战》主要阐述如何分析android的市场,如何找到市场,做出产品,以及和android技术相关的内容,诸如UI设计,赢利模式探讨,传统软件突围等等,不仅仅只是技术。当然,也还是以技术为主,讲了基础开发,底层开发,游戏开发,开发平台产品,源码编译和修改等等,其中我们分析了很多的数据,花了不少心思的。

    \n\n

    推荐序1(Frost&Sullivan中国区总裁 王煜全):http://www.eoeandroid.com/thread-25461-1-1.html
    \n推荐序2(我学网(开复学生网)负责人 王开源):http://www.eoeandroid.com/thread-25462-1-1.html
    \n推荐序3(Android技术专家 高焕堂):http://www.eoeandroid.com/thread-25463-1-1.html

    \n\n

    详细目录:
    \nhttp://www.eoeandroid.com/thread-25465-1-1.html

    \n\n

    预定购买:
    \nChina-pub互动出版购买地址(预定) :http://www.china-pub.com/196898

    \n", "_id"=>553}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>6, "title"=>"纪念我的第一本Android技术书籍销量过万", "body"=>"\"\"\r\n 《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。\r\n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:\r\n
      \r\n\t
    • 2009年6月第一次印刷:5000册
    • \r\n\t
    • 2009年10月第二次印刷:1500册
    • \r\n\t
    • 2009年12月第三次印刷:1500册
    • \r\n\t
    • 2010年3月第四次印刷:1500册
    • \r\n\t
    • 2010年7月第五次印刷:2000册
    • \r\n
    \r\n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。\r\n\r\n对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。", "created_at"=>2010-07-18 00:47:51 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    《Google Android开发入门与实战》是我主导撰写的第一本技术书籍(之前的《Google API 大全》我是参与者),20096月上市后,我GF聊天时问我,对这本书有什么期待,我说:我的期待时做为技术书籍能销量超过1万本。
    \n到2010年7月的时候,这个期待实现了,人民邮电的编辑张涛说“咱那本书又加印了2000册”,喜,终于过万,回忆下:
    \n
    \n 2009年6月第一次印刷:5000册
    \n 2009年10月第二次印刷:1500册
    \n 2009年12月第三次印刷:1500册
    \n 2010年3月第四次印刷:1500册
    \n 2010年7月第五次印刷:2000册
    \n
    \n这样总数11500册,加上翻译成繁体中文在台湾上市的数量,已经突破预期的1万册大关,做为一个计算类书籍,这个成绩我还是很满意的;至于其被读者提到的排版不精美,内容偏简单等问题,也是在预期之中的。

    \n\n

    对于我主导的第二本书《It’s Android TIME: 创赢路线与产品开发实战》,我还是这个预期,能销出1万本,何时能达到呢,期待中。

    \n", "_id"=>554}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["log", "rails3", "slice_before"], "comments_count"=>0, "category_id"=>2, "title"=>"Parse Rails 3 log file using Enumerable#slice_before", "body"=>"``def parse_rails_log_file(file)\n # Remove all empty lines\n lines = file.each_line.map(&:strip).reject(&:empty?)\n\n # Use +Enumerable#slice_before+ to slice log file into sections for each request\n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|\n # Only include successfully finished actions in report\n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]\n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) \"(?<action>.+?)\" for/, :action]\n totals[action_name] ||= 0\n totals[action_name] += duration.to_i\n end\n end\nend\n\nif __FILE__ == $PROGRAM_NAME\n require \"pp\"\n puts \"Parsing Rails 3 log file (extracting cumulative running time per request path):\"\n puts \"=================\"\n\n log_file = <<-LOG_FILE\n Started GET \"/index\" for 192.168.74.1 at 2010-03-09 11:37:40\n Processing by UpdatesController#index as HTML\n Update Load (0.5ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (16.7ms)\n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)\n\n Started POST \"/updates\" for 192.168.74.1 at 2010-03-09 11:37:43\n Processing by UpdatesController#create as HTML\n Parameters: {\"commit\"=>\"Save changes\"}\n Update Load (0.4ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.3ms)\n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:51\n Processing by UpdatesController#index as HTML\n\n TypeError (exception class/object expected):\n app/controllers/updates_controller.rb:3:in `raise'\n app/controllers/updates_controller.rb:3:in `index'\n\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)\n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)\n\n Started GET \"/updates\" for 192.168.74.1 at 2010-03-09 11:45:58\n Processing by UpdatesController#index as HTML\n Update Load (0.3ms) SELECT `updates`.* FROM `updates` ORDER BY created_at DESC\n Rendered updates/index.html.erb (1.1ms)\n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)\n LOG_FILE\n\n pp parse_rails_log_file(log_file) # => {\"/index\"=>71, \"/updates\"=>160}\nend```", "created_at"=>2010-07-26 21:42:33 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    ``def parse_rails_log_file(file)
    \n # Remove all empty lines
    \n lines = file.each_line.map(&:strip).reject(&:empty?)

    \n\n

    # Use +Enumerable#slice_before+ to slice log file into sections for each request
    \n lines.slice_before(/Started (GET|POST|PUT|DELETE)/).each_with_object({}) do |request_log, totals|
    \n # Only include successfully finished actions in report
    \n if duration = request_log.last[/Completed 200 OK in (?<duration>\\d+)ms/, :duration]
    \n action_name = request_log.first[/Started (GET|POST|PUT|DELETE) "(?<action>.+?)" for/, :action]
    \n totals[action_name] ||= 0
    \n totals[action_name] += duration.to_i
    \n end
    \n end
    \nend

    \n\n

    if FILE == $PROGRAM_NAME
    \n require "pp"
    \n puts "Parsing Rails 3 log file (extracting cumulative running time per request path):"
    \n puts "================="

    \n\n

    log_file = <<-LOG_FILE
    \n Started GET "/index" for 192.168.74.1 at 2010-03-09 11:37:40
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.5ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (16.7ms)
    \n Completed 200 OK in 71ms (Views: 44.3ms | ActiveRecord: 0.5ms)

    \n\n

    Started POST "/updates" for 192.168.74.1 at 2010-03-09 11:37:43
    \n Processing by UpdatesController#create as HTML
    \n Parameters: {"commit"=>"Save changes"}
    \n Update Load (0.4ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.3ms)
    \n Completed 200 OK in 60ms (Views: 32.1ms | ActiveRecord: 0.4ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:51
    \n Processing by UpdatesController#index as HTML

    \n\n

    TypeError (exception class/object expected):
    \n app/controllers/updates_controller.rb:3:in raise'
    \n app/controllers/updates_controller.rb:3:in
    index'

    \n\n

    Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
    \n Rendered /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within /usr/local/rvm/gems/ruby-1.9.2-head/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb (23.9ms)

    \n\n

    Started GET "/updates" for 192.168.74.1 at 2010-03-09 11:45:58
    \n Processing by UpdatesController#index as HTML
    \n Update Load (0.3ms) SELECT updates.* FROM updates ORDER BY created_at DESC
    \n Rendered updates/index.html.erb (1.1ms)
    \n Completed 200 OK in 100ms (Views: 29.3ms | ActiveRecord: 0.3ms)
    \n LOG_FILE

    \n\n

    pp parse_rails_log_file(log_file) # => {"/index"=>71, "/updates"=>160}
    \nend```

    \n", "_id"=>555}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android"], "comments_count"=>0, "category_id"=>5, "title"=>"关于“偷窃数据的Android壁纸应用”的相关申明", "body"=>"今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:\n\n“拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”\n\n在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。\n

    现就相关事宜申明如下:

    \n一、我开发的所有程序都没有侵犯到用户的隐私。\n\n在这个应用中,申请的全部权限为:\n
    <uses-permission android:name=\"android.permission.INTERNET\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    \n
    <uses-permission android:name=\"android.permission.SET_WALLPAPER\" />
    \n
    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />
    \n
    <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。\n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。\n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。\n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!\n\n二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。\n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。\n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。\n\n我的软件需要的权限:\n\"\"\n\n看看background(另外一款壁纸的应用)申请的权限:\n\"\"\n\nHandcent SMS申请的权限:\n\n\"\"\n\n短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。\n\n三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!\n\n该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!\n\n四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。\n\n随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。\n\n在此,本人郑重申明,该应用没有获取任何诸如浏览历史记录,短信,语音邮件密码等这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。\n\nps:\n\n如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!\n

    update:

    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:\n\n\"\"\n\n而现在的文章被修改为:\n\n\"\"\n\n看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。\n\n按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。\n\n再次update!!!\n\n通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!\n\n同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。\n\n其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。\n\n我非常无语~\n\n2010年8月4日第二次次update!\n\n多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。\n\n1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:\n\nOur investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.\n\n我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。\n\n2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。\n\n3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。\n\n4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。\n\n这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。", "created_at"=>2010-07-29 08:41:39 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    今天在GoogleTalk上朋友发来消息,说有人撰写文章指出我以前开发的一款更换手机壁纸的应用(嵌入了admob和google的广告)中存在偷窃用户隐私数据行为时,我简直不敢相信这是真的;当看到新闻的详细内容时,我更是被震惊了。以下是那段转载文章的原话:

    \n\n

    “拉斯维加斯黑帽大会上,Lookout 的安全人员指出,一个伪装成Android手机壁纸应用的偷窃个人信息程序已经被下载了百万次,它会收集您的个人资料,并将其发送到一个来自中国深圳的神秘网站imnet.us中。安全人员(Kevin MaHaffey)估计这款程序是由正常的壁纸应用修改而来,黑客将其上传到Android Market,希望装饰自己手机的用户因此而中招。泄漏的数据包括浏览历史记录,短信,手机的SIM卡号码,用户识别号,语音邮件,甚至是密码,他警告称每个人都应该警惕来自手机上的威胁。”

    \n\n

    在看完这条消息后,我立马检查了所有代码,防止这款应用在我不知情的情况下,被他人加入恶意代码,但我一无所获。
    \n现就相关事宜申明如下:
    \n一、我开发的所有程序都没有侵犯到用户的隐私。

    \n\n

    在这个应用中,申请的全部权限为:
    \n<uses-permission android:name="android.permission.INTERNET" />
    \n<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    \n<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    \n<uses-permission android:name="android.permission.SET_WALLPAPER" />
    \n<uses-permission android:name="android.permission.READ_PHONE_STATE" />
    \n<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    \n懂点Android技术的都知道,这些权限都是为了让该软件的功能,能够正常工作所必须的权限(连接网络,获取网络状态,下载壁纸时读写SD卡,设置壁纸,读取手机状态)和Admob的广告精准推送所需要的权限(位置信息,读取手机状态)。
    \n至于获取用户浏览历史记录、短信、语音邮件密码的这些明显侵犯用户隐私的行为,完全是子虚乌有。一方面并没要申请相关的权限;另一方面我还真不知道怎样获取这些敏感信息。另外,admob的精准广告服务中可能是会针对用户的地理位置等信息推送更准确的广告服务。
    \n关于这款应用能获取的设备标识号是用来区分设备的唯一性,免去用户注册的麻烦,而能给用户提供收藏图片的功能;而诸如获取手机屏幕大小是为了能够智能适配合适的图片。在这些设备信息中,请问哪一条会侵犯到用户的隐私。
    \n另外说我可以获取浏览历史信息,这简直就是个天大的笑话。如果懂一点程序的就会知道,要获取浏览器信息必须在程序里申请com.android.browser.permission.READ_HISTORY_BOOKMARKS权限。我的程序完全没有获取到权限,怎么能够获取到历史信息,真是笑话!!!

    \n\n

    二、Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的。
    \n Android手机的权限管理,在任何没有刷过第三方rom的手机上是很严格的,在没有相关权限的情况下,要获取那些信息,是完全不可能的。就算是被刷过Rom的手机,也只有具有该ROM制作人的加密签名的程序,才能完成一些不安全的操作。
    \n我所需要的权限在用户安装的时候会很明确的告诉用户,下面我就给大家展示一下我应用申请的权限和另外一个著名的壁纸的应用background和一款管理短信的应用申请的权限。

    \n\n

    我的软件需要的权限:

    \n\n

    看看background(另外一款壁纸的应用)申请的权限:

    \n\n

    Handcent SMS申请的权限:

    \n\n\n

    短信有短信的权限,联系人有联系人的权限,我都没要申请,请问我如何获取相关的信息。

    \n\n

    三、应用主要面向外国用户,但绝对没有获取那些高敏感度的隐私信息!

    \n\n

    该应用主要面向外国用户(国内由于网络原因无法正常使用),连接服务器端能够获取到精确适配终端的图片,这是一款非常有用,也深受用户喜爱的应用。它确实拥有数量众多(几百万)的用户,但绝对没有获取那些高敏感度的隐私信息!我每天都收到很多用户的反馈邮件告诉我这个软件多么棒,给他们带来多少乐趣!

    \n\n

    四、我本人始终与业界同仁一道,希望建立诚实守信、和谐共生的Android产业生态系统。

    \n\n

    随着Android开放性操作平台手机的广泛使用,其应用软件开发市场正呈现蓬勃发展景象。对于提醒用户警惕来自手机上的威胁,我本人向来都是强烈支持的!本人一直始终与业界同仁一道,一直为共建诚实守信、和谐共生的Android产业生态系统而努力,将力量专注于用户需求和技术创新,创造更被用户喜欢的软解,并致力于推动手机应用软件产业持续健康发展。

    \n\n

    在此,本人郑重申明,该应用没有获取任何诸如“浏览历史记录,短信,语音邮件密码等”这种高敏感度的信息,并和国外的原作者取得联系,让其修正自己的言论并发布公开道歉,同时对于这种不负责任的言论和评价观点,对我及与我相关的应用进行不负责任的报道造成的影响给予补偿,我将保留追究其法律责任的权利。

    \n\n

    ps:

    \n\n

    如果您有其他的疑问或者问题,欢迎你在我sina微博客(http://t.sina.com.cn/iceskysl)或者sohu微博(http://t.sohu.com/iceskysl)给我沟通!
    \nupdate:
    \n写完申明后,去看消息出处看到其竟然做了修改,我早料到其会做相关的行为,所有早些时候截了屏幕如下:

    \n\n\n

    而现在的文章被修改为:

    \n\n\n

    看我用鼠标标识的地方,对关键信息进行了修改,感兴趣的人可以去 http://mobile.venturebeat.com/2010/07/28/android-wallpaper-app-that-steals-your-data-was-downloaded-by-millions/ 查看原文,对于这种标题党用子虚乌有的事情炒作,等消息传播后再修改自己的内容算什么行为!而对国内部分媒体在传播时不但不对真实性进行验证,还添油加醋,歪曲意思的报道,我非常无奈(看到有人还说可以获取信用卡信息,还加密传输,我实在无语)。

    \n\n

    按照我个人的感觉,他们应该紧接着要开始拿这个事件来炒作自己的产品了,我个人懒得去关注,如果有人发现有人借此炒作自己的产品,请帮忙分析分析,看看到底是什么人用这样手法。

    \n\n

    再次update!!!

    \n\n

    通过email和mylookout的人取得联系,说明我取得诸如设备号,手机屏幕大小是为了更智能的给设备适配图片,而获取部分的sim卡号是后来用户反馈说自己换了手机还想使用之前的收藏记录才使用的,这些信息只在该应用中使用,并没提供给任何第三方!

    \n\n

    同时让其确认venturebeat上文章中说到的获取浏览器历史,短信息,密码等高敏感性信息是否是他们说的还是写文章的人自己写的(Lots of my users send me the email ask me why I collect their text message and voicemail passward, I just want to make sure whether you and your ceo said that  I collected browsing history,text message ,voicemail passward during the meeting.)。

    \n\n

    其cto给我回复说他们没有说过我的应用获取过诸如text messages or browsing history这些信息( We never stated that the wallpaper applications gathered users text messages or browsing history.),是媒体在撰写和传播的时候错误报道了(A member of the press misreported our research and he has since corrected it. )。

    \n\n

    我非常无语~

    \n\n

    2010年8月4日第二次次update!

    \n\n

    多谢这些天很多朋友的关心,我很好,谢谢!这些天和google android组,lookout公司和venturebeat的作者,以及国内外很多媒体,博客们,记者们都有很多的接触。

    \n\n

    1. google就前段时间将应用暂停和我一起分析了这个应用,今天发来调查的结果:

    \n\n

    Our investigation has concluded that there's no obvious malicious code in your apps, though the implementation accesses data that it doesn't need to.  We've restored your apps (and they'll be available on Market again once you publish them), and are looking forward to seeing them updated to use ANDROID_ID.  We are likely to make a statement about this issue this week--I'll let you know.

    \n\n

    我早就说过,我配合调查,我把代码提供给他们,google也做出了公正的评判,另外也给我提了一些建议(ANDROID_ID)。

    \n\n

    2. 当时写这篇报道的venturebeat记者Dean Takahashi发来了mail,为自己犯的错误道歉,并道歉该事带来的恶劣影响,会再写一篇文章澄清这个事情以消除影响。

    \n\n

    3. 那个安全公司lookout的人写邮件来要于我一起“ We wanted to coordinate with you to prevent further misunderstandings. ”。

    \n\n

    4.好几个不认识的国外记者很负责任,发邮件和gt和我交流询问事情的真相,并帮我喊冤,谢谢这些有职业精神的记者们。

    \n\n

    这个事情到这差不多就结束了,其中看到很多假丑恶,也看到很多真善美!谢谢所有帮助过我的人(很多很多,就不一一列举)。

    \n", "_id"=>556}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Munin", "netstat", "passive"], "comments_count"=>0, "category_id"=>7, "title"=>"Fix the passive netstat connections in Munin", "body"=>" \n\n\"MuninIf your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.\n\n \n\n\"Passive\n\nApparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below\n\nEdit the following file:\n/usr/share/munin/plugins/netstat\n\nand change the line\n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n
    to
    \n
    netstat -s | awk '/active connections/ { print \"active.value \" $1 } /passive connection openings/ { print \"passive.value \" $1 } /failed connection/ { print \"failed.value \" $1 } /connection resets/ { print \"resets.value \" $1 } /connections established/ { print \"established.value \" $1 }'
    \n ref:\nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/\nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin", "created_at"=>2010-08-18 20:04:28 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn't a problem with your server, its a Munin bug that can be easily fixed.

    \n\n\n\n

    Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below

    \n\n

    Edit the following file:
    \n/usr/share/munin/plugins/netstat

    \n\n

    and change the line
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \nto
    \nnetstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection openings/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
    \n ref:
    \nhttp://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
    \nhttp://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin

    \n", "_id"=>557}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Charts", "Highcharts", "rails"], "comments_count"=>0, "category_id"=>2, "title"=>"ChartsOnRails", "body"=>"这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:\n\nHighcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.\n\n有兴趣的可以参考如下连接去看看:\n\nhttp://highcharts.com/\n\nhttp://railscasts.com/episodes/223-charts\n\nhttp://www.spritle.com/blogs/?p=859", "created_at"=>2010-08-20 21:48:59 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    这几天需要找到漂亮的Charts类库,找了几个,发现一个很不粗的,mark下待使用,介绍如下:

    \n\n

    Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

    \n\n

    有兴趣的可以参考如下连接去看看:

    \n\n

    http://highcharts.com/

    \n\n

    http://railscasts.com/episodes/223-charts

    \n\n

    http://www.spritle.com/blogs/?p=859

    \n", "_id"=>558}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"malformed format string on rails~", "body"=>"在rails中使用find进行模糊查询时,出现了malformed format string输入为字符)或非法字符(输入为数字)的提示。\n(1) @vendors  = Vendor.find(:all,:conditions=>[@sql])\n(2) @vendors = Vendor.find_by_sql(\"select * from vendor where \"+@sql)\n错误发生在按(1)方式查询过程中,采用(2)方式可以避免这个错误,这间接说明了find_by_sql确实相当不安全。\n查阅了一下资料,对于这个问题的说法如下:Rails uses sprintf (%) on the inside. So, Escape your % with %,因此只要将模糊查询的地方一个百分号全部换成两个便可以解决问题。", "created_at"=>2010-09-03 16:39:58 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    在rails中使用find进行模糊查询时,出现了malformed format string(输入为字符)或非法字符(输入为数字)的提示。
    \n(1) @vendors  = Vendor.find(:all,:conditions=>[@sql])
    \n(2) @vendors = Vendor.find_by_sql("select * from vendor where "+@sql)
    \n错误发生在按(1)方式查询过程中,采用(2)方式可以避免这个错误,这间接说明了find_by_sql确实相当不安全。
    \n查阅了一下资料,对于这个问题的说法如下:Rails uses sprintf (%) on the inside. So, Escape your % with %,因此只要将模糊查询的地方一个百分号全部换成两个便可以解决问题。

    \n", "_id"=>559}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["rails3"], "comments_count"=>0, "category_id"=>2, "title"=>"Ruby on Rails 3 的相关资料", "body"=>"1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。\n\n2.RailsPlugins.org – 提供了很多 Rails 3的插件.\n\n3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装\n\n4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法\n\n5.Rails 3 I18n changes - I18n的改变.\n\n6.Ruby on Rails 3 Screencast series\n## ActionController / Rack\n7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。\n\n8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.\n\n9.Render Options in Rails 3 -  Rails 3的渲染的变化.\n\n10.Adding Routes for tests / specs with Rails 3\n\n11.32 Rack Resources to Get You Started -  rack相关资源的整合.\n## ActionMailer\n12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.\n\n13.A Whole New ActionMailer -  ActionMailer的特性.\n## ActiveRecord/ActiveModel\n14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.\n\n15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.\n\n16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.\n\n17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.\n## Bundler\n18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.\n\n19.Library Management Gets an Update in Rails 3 。\n\n20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.\n\n21.AdventuresInCoding.com screencast on Bundler 。\n## Railties\n22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.\n\n23.rails-templater - 如何生成一个 greenfield Rails 3 应用.\n\n24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.\n## Routes\n25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.\n\n26.Rails Routing from the Outside In - 新的 router介绍.\n## Plugins\n27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.\n\n28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.\n\n29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。\n## Books\n30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.\n\n31.The Rails 3 Way .\n\n32.Rails 3 In Action - BDD with Cucumber\n\n33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.\n\n34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.", "created_at"=>2010-09-03 18:12:11 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    1.Rails 3.0 Release Notes - Rails导册对所有Ruby on Rails开发者来说都是很宝贵的资源,这个发布文档介绍了很多API的改进和新特性。

    \n\n

    2.RailsPlugins.org – 提供了很多 Rails 3的插件.

    \n\n

    3.Having Ruby on Rails 3 My Way - Rails 3与Mongoid, Haml, jQuery等的安装

    \n\n

    4.The Rails Module (in Rails 3) -在Rails模块中一些有用的方法

    \n\n

    5.Rails 3 I18n changes - I18n的改变.

    \n\n

    6.Ruby on Rails 3 Screencast series

    \n\n

    ActionController / Rack

    \n\n

    7.Embracing REST with mind, body and soul - José Valim 介绍了 RESTful responders与Rails 3 controller的使用。

    \n\n

    8.Railscasts #224 Controllers in Rails 3 – Rails 3 controllers的新特性.

    \n\n

    9.Render Options in Rails 3 -  Rails 3的渲染的变化.

    \n\n

    10.Adding Routes for tests / specs with Rails 3

    \n\n

    11.32 Rack Resources to Get You Started -  rack相关资源的整合.

    \n\n

    ActionMailer

    \n\n

    12.New ActionMailer API in Rails 3.0 - 如何使用新的ActionMailer.

    \n\n

    13.A Whole New ActionMailer -  ActionMailer的特性.

    \n\n

    ActiveRecord/ActiveModel

    \n\n

    14.ActiveModel: Make Any Ruby Object Feel Like ActiveRecord – ActiveModel的模块化.

    \n\n

    15.Railscasts #219 Active Model - 如何正确的添加ActiveModel 模块到tableless模块.

    \n\n

    16.ActiveRelation: ActiveRecord Gets a Facelift -新的ActiveRecord finder API.

    \n\n

    17.Active Record Query Interface - 自Rails 2以来,ActiveRecord query接口的变化.

    \n\n

    Bundler

    \n\n

    18.Gembundler.com -官方的 Bundler文档,包含一些扩展的文档.

    \n\n

    19.Library Management Gets an Update in Rails 3 。

    \n\n

    20.Railscasts #201 Bundler - 在Rails 3中,如何使用bundler.

    \n\n

    21.AdventuresInCoding.com screencast on Bundler 。

    \n\n

    Railties

    \n\n

    22.Rails 3 Internals: Railtie & Creating Plugins -  Railties in Rails 3.

    \n\n

    23.rails-templater - 如何生成一个 greenfield Rails 3 应用.

    \n\n

    24.Making generators for Rails 3 with Thor – 如何使用新的generators ,以及在gem中如何去处理.

    \n\n

    Routes

    \n\n

    25.The Lowdown on Routes in Rails 3 -在 Rails 3创建routes的几个不同的方法.

    \n\n

    26.Rails Routing from the Outside In - 新的 router介绍.

    \n\n

    Plugins

    \n\n

    27.Plugin Authors: Toward a Better Future - Rails 3中创建插件的改变.

    \n\n

    28.Customizing Rails Apps with Plugins - 使用responders, form, devise以及mail form的插件.

    \n\n

    29.Devise 1.1 is out and ready to rock with Rails 3 - Devise 1.1的新特性。

    \n\n

    Books

    \n\n

    30.Beginning Rails 3 – Cloves Carneiro Jr 和 Rida Al Barazi 撰写的 Rails 3 入门书籍,其中有很多实例.

    \n\n

    31.The Rails 3 Way .

    \n\n

    32.Rails 3 In Action - BDD with Cucumber

    \n\n

    33.Rails 3 Upgrade Handbook - Jeremy McAnally的书籍,教你如何从Rails 2 应用升级到Rails 3.

    \n\n

    34.Ruby on Rails Tutorial: Learn Rails by Example – 一步一步的教学习 Rails.

    \n", "_id"=>560}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["file", "ruby"], "comments_count"=>0, "category_id"=>2, "title"=>"ruby文件操作大全", "body"=>"参考:\n\nhttp://pleac.sourceforge.net/pleac_ruby/filecontents.html\n\nruby文件操作大全 http://www.javaeye.com/topic/517410\n\n用ruby读写文本文件 http://www.albertsong.com/read-87.html\n\nRuby 读取目录(Diretories),文件(files), 网页的几个方法小结\n\nhttp://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/", "created_at"=>2010-09-03 18:14:21 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    参考:

    \n\n

    http://pleac.sourceforge.net/pleac_ruby/filecontents.html

    \n\n

    ruby文件操作大全 http://www.javaeye.com/topic/517410

    \n\n

    用ruby读写文本文件 http://www.albertsong.com/read-87.html

    \n\n

    Ruby 读取目录(Diretories),文件(files), 网页的几个方法小结

    \n\n

    http://weixuhong.com/rubyruby-on-rails/2008/10/06/ruby-%E8%AF%BB%E5%8F%96%E7%9B%AE%E5%BD%95%EF%BC%88diretories%EF%BC%8C%E6%96%87%E4%BB%B6files-%E7%BD%91%E9%A1%B5%E7%9A%84%E5%87%A0%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%8F%E7%BB%93/

    \n", "_id"=>561}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["ruby", "spreadsheet"], "comments_count"=>0, "category_id"=>2, "title"=>"spreadsheet, ruby生成Excel电子表格", "body"=>"安装gem:\n
    [root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \n
    Successfully installed ruby-ole-1.2.10.1
    \n
    Successfully installed spreadsheet-0.6.4.1
    \n
    2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed\n\n使用:\n\nrequire 'rubygems'\n\nrequire 'spreadsheet/excel'\n\nSUM_SPREADSHEET = 'test.xls'\n\nworkbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)\n\nworksheet = workbook.add_worksheet('Random numbers and their sum.')\n\n# sum = 0\n\n# random_numbers = (0..9).collect { rand(100) }\n\n#\n\n# puts \"random_numbers=\#{random_numbers.size}\"\n\n# worksheet.write_column(0, 0, random_numbers)\n\n# worksheet.write_column(0, 1, random_numbers)\n\nworksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'\n\nrow = worksheet.row(1)\n\nrow.push 'Creator of Ruby'\n\nrow.unshift 'Yukihiro Matsumoto'\n\n# format = workbook.add_format(:bold => true)\n\n# worksheet.write(10, 0, \"Sum:\", format)\n\n# worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })\n\nworkbook.close\n\n参考:\n\nhttp://sg552.javaeye.com/blog/701428\n\nhttp://sunfengcheng.javaeye.com/blog/240130", "created_at"=>2010-09-03 18:16:56 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    安装gem:
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdoc
    \nSuccessfully installed ruby-ole-1.2.10.1
    \nSuccessfully installed spreadsheet-0.6.4.1
    \n2 gems installed
    \n[root@iceskysl]# gem install spreadsheet --no-ri --no-rdocSuccessfully installed ruby-ole-1.2.10.1Successfully installed spreadsheet-0.6.4.12 gems installed

    \n\n

    使用:

    \n\n

    require 'rubygems'

    \n\n

    require 'spreadsheet/excel'

    \n\n

    SUM_SPREADSHEET = 'test.xls'

    \n\n

    workbook = Spreadsheet::Excel.new(SUM_SPREADSHEET)

    \n\n

    worksheet = workbook.add_worksheet('Random numbers and their sum.')

    \n\n

    sum = 0

    \n\n

    random_numbers = (0..9).collect { rand(100) }

    \n\n

    puts "random_numbers=\#{random_numbers.size}"

    \n\n

    worksheet.write_column(0, 0, random_numbers)

    \n\n

    worksheet.write_column(0, 1, random_numbers)

    \n\n

    worksheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

    \n\n

    row = worksheet.row(1)

    \n\n

    row.push 'Creator of Ruby'

    \n\n

    row.unshift 'Yukihiro Matsumoto'

    \n\n

    format = workbook.add_format(:bold => true)

    \n\n

    worksheet.write(10, 0, "Sum:", format)

    \n\n

    worksheet.write(10, 1, random_numbers.inject(0) { |sum, x| sum + x })

    \n\n

    workbook.close

    \n\n

    参考:

    \n\n

    http://sg552.javaeye.com/blog/701428

    \n\n

    http://sunfengcheng.javaeye.com/blog/240130

    \n", "_id"=>562}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google"], "comments_count"=>0, "category_id"=>5, "title"=>"google adsense合作伙伴日活动(上海站)", "body"=>"受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~\n\n昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~", "created_at"=>2010-09-08 10:31:18 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    受google邀请参加他们2010年得google adsense合作伙伴日活动,9月8日来到上海,第一站,上次来北京好像是7月得时候~活动控制规模,所以不是很多人,我有个topic,主要分享国内android开发者的现况和一些模式,见到很多老朋友,结识一些新朋友~活动之余,和同事拜访了好几个合作伙伴,去了龙旗,展讯,联想等公司,聊的都还挺好,还顺道去盛大创新院拜访了下~

    \n\n

    昨天夜里去新天地见了一个朋友,今天晚上吃完饭去外滩转了一圈,白天在浦东浦西跑,这次把上海给搞的比较熟了~明天下午飞机回北京~周五是北京场,接下去是广州场~

    \n", "_id"=>563}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Using the Rails logger outside of models and controllers", "body"=>"You can use the Rails logger outside of Rails models in at least version 2.3.X and up of Rails. You might be used to doing the following in your models or controllers:\n\nlogger.info \"Some debugging info I want to see in my development log.\"\n\nIf you make a regular model that doesn’t inherit from ActiveRecord, though, you may see the following error:\n\nundefined local variable or method `logger' for #<Class:0x42fd77c>\n\nThe solution is to call Rails.logger.info (or debug, or warn) as follows:\n\nRails.logger.info \"Some debugging info I want to see in my development log.\"\n\nI hope that helps someone.", "created_at"=>2010-09-17 01:50:49 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    <!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} -->You can use the Rails logger outside of Rails models in at least version 2.3.X and up of Rails. You might be used to doing the following in your models or controllers:

    \n\n

    logger.info "Some debugging info I want to see in my development log."

    \n\n

    If you make a regular model that doesn’t inherit from ActiveRecord, though, you may see the following error:

    \n\n

    undefined local variable or method `logger' for #<Class:0x42fd77c>

    \n\n

    The solution is to call Rails.logger.info (or debug, or warn) as follows:

    \n\n

    Rails.logger.info "Some debugging info I want to see in my development log."

    \n\n

    I hope that helps someone.

    \n", "_id"=>564}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"Creating Small Unique Tokens In Ruby", "body"=>"
    require \"rubygems\"
    \n
    require 'active_support'
    \n
    require 'digest'
    \n
    #http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby
    \n
    puts \"rand=> \" + rand(36**8).to_s(36)
    \n
    puts \"Digest::SHA1=> \"+Digest::SHA1.hexdigest(\"some-random-string\")[8..16]
    \n
    puts \"ActiveSupport::SecureRandom=>    \"+ ActiveSupport::SecureRandom.base64(8).gsub(\"/\",\"_\").gsub(/=+$/,\"\")
    \n
    puts ActiveSupport::SecureRandom::hex(8)
    \n
    puts Array.new(4) { rand(256) }.pack('C*').unpack('H*').first
    \nrequire \"rubygems\"require 'active_support'require 'digest'\n#http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-rubyputs \"rand=> \" + rand(36**8).to_s(36)\nputs \"Digest::SHA1=> \"+Digest::SHA1.hexdigest(\"some-random-string\")[8..16]puts \"ActiveSupport::SecureRandom=>    \"+ ActiveSupport::SecureRandom.base64(8).gsub(\"/\",\"_\").gsub(/=+$/,\"\")\nputs ActiveSupport::SecureRandom::hex(8)\nputs Array.new(4) { rand(256) }.pack('C*').unpack('H*').first", "created_at"=>2010-09-19 22:36:01 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    require "rubygems"
    \nrequire 'activesupport'
    \nrequire 'digest'
    \n#http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby
    \nputs "rand=> " + rand(36**8).to_s(36)
    \nputs "Digest::SHA1=> "+Digest::SHA1.hexdigest("some-random-string")[8..16]
    \nputs "ActiveSupport::SecureRandom=>    "+ ActiveSupport::SecureRandom.base64(8).gsub("/","
    ").gsub(/=+$/,"")
    \nputs ActiveSupport::SecureRandom::hex(8)
    \nputs Array.new(4) { rand(256) }.pack('C').unpack('H').first
    \nrequire "rubygems"require 'active_support'require 'digest'

    \n\n

    http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-rubyputs "rand=> " + rand(36**8).to_s(36)

    \n\n

    puts "Digest::SHA1=> "+Digest::SHA1.hexdigest("some-random-string")[8..16]puts "ActiveSupport::SecureRandom=>    "+ ActiveSupport::SecureRandom.base64(8).gsub("/","_").gsub(/=+$/,"")
    \nputs ActiveSupport::SecureRandom::hex(8)
    \nputs Array.new(4) { rand(256) }.pack('C').unpack('H').first

    \n", "_id"=>565}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Configure SVN for your rails app.", "body"=>"http://gist.github.com/609762\n\n#!/bin/sh\nsvn remove log/*\nsvn commit -m\"removing log files\"\nsvn propset svn:ignore \"*.log\" log/\nsvn update log/\nsvn commit -m 'Ignoring all files in /log/ ending in .log'\nsvn move config/database.yml config/database.example\nsvn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'\nsvn propset svn:ignore \"database.yml\" config/\nsvn update config/\nsvn commit -m 'Ignoring database.yml'\nsvn remove tmp/*\nsvn propset svn:ignore \"*\" tmp/\nsvn update tmp/\nsvn commit -m \"ignore tmp/ content from now\"\nsvn propset svn:ignore \".htaccess\" config/\nsvn update config/\nsvn commit -m 'Ignoring .htaccess'\nsvn propset svn:ignore \"dispatch.fcgi\" config/\nsvn update config/\nsvn commit -m 'Ignoring dispatch.fcgi'", "created_at"=>2010-10-04 06:24:06 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    http://gist.github.com/609762

    \n\n

    !/bin/sh

    \n\n

    svn remove log/*
    \nsvn commit -m"removing log files"
    \nsvn propset svn:ignore ".log" log/
    \nsvn update log/
    \nsvn commit -m 'Ignoring all files in /log/ ending in .log'
    \nsvn move config/database.yml config/database.example
    \nsvn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
    \nsvn propset svn:ignore "database.yml" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring database.yml'
    \nsvn remove tmp/

    \nsvn propset svn:ignore "*" tmp/
    \nsvn update tmp/
    \nsvn commit -m "ignore tmp/ content from now"
    \nsvn propset svn:ignore ".htaccess" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring .htaccess'
    \nsvn propset svn:ignore "dispatch.fcgi" config/
    \nsvn update config/
    \nsvn commit -m 'Ignoring dispatch.fcgi'

    \n", "_id"=>566}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>3, "title"=>"delete & not exists in Mysql", "body"=>"This works\n\nselect * from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);\n\nHowever, this does NOT work\n\ndelete from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);\n\nwhy? Because of the alias p!!! Table alias is not allowed in not exists subquery!! Instead, you have to use the full table name~~~~ faint!\n\nCorrect code\n delete from tb_patient where not exists (select col_patient_id from tb_payment where col_patient_id = tb_patient.col_unid);", "created_at"=>2010-10-04 06:49:42 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    This works

    \n\n

    select * from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);

    \n\n

    However, this does NOT work

    \n\n

    delete from tb_patient p where not exists (select col_patient_id from tb_payment where col_patient_id = p.col_unid);

    \n\n

    why? Because of the alias p!!! Table alias is not allowed in not exists subquery!! Instead, you have to use the full table name~~~~ faint!

    \n\n

    Correct code
    \n delete from tb_patient where not exists (select col_patient_id from tb_payment where col_patient_id = tb_patient.col_unid);

    \n", "_id"=>567}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"解决ssh_exchange_identification: Connection closed by remote host,", "body"=>"用的好好的ssh突然链不上去了,查到说修改/etc/hosts.deny 和 /etc/hosts.allow\n\n然后发现/etc/ssh下的文件不能设为777的权限,要将权限设为600。\n\n于是偶chmod 600 /etc/ssh/*,然后再次重启了ssh。\n
    root@e:/home/iceskysl# /etc/init.d/ssh restart
    \n
    /var/run/sshd must be owned by root and not group or world-writable.
    \n
    root@e:/home/iceskysl#  chmod 600  /var/run/sshd
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart/var/run/sshd must be owned by root and not group or world-writable.root@li84-64:/home/iceskysl#  chmod 600  /var/run/sshd", "created_at"=>2010-10-18 18:45:27 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    用的好好的ssh突然链不上去了,查到说修改/etc/hosts.deny 和 /etc/hosts.allow

    \n\n

    然后发现/etc/ssh下的文件不能设为777的权限,要将权限设为600。

    \n\n

    于是偶chmod 600 /etc/ssh/*,然后再次重启了ssh。
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart
    \n/var/run/sshd must be owned by root and not group or world-writable.
    \nroot@e:/home/iceskysl#  chmod 600  /var/run/sshd
    \nroot@e:/home/iceskysl# /etc/init.d/ssh restart/var/run/sshd must be owned by root and not group or world-writable.root@li84-64:/home/iceskysl#  chmod 600  /var/run/sshd

    \n", "_id"=>568}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Android & Java"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["certificate"], "comments_count"=>0, "category_id"=>12, "title"=>"“Debug certificate expired” error in eclipse android plugins", "body"=>"I am using eclipse android plugins to build a project, But i am getting this error in the console window:\n\n[2010-02-03 10:31:14 - androidVNC]Error generating final archive:\nDebug certificate expired on 1/30/10 2:35 PM!\n\nIceskYsl@eoe ~/.android $ pwd\n/Users/IceskYsl/.android\nIceskYsl@eoe ~/.android $ ll\ntotal 48\ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .\ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..\n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini\n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg\ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd\n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg\n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore\n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset\n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg\n\nDelete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.\n\nThe Eclipse plugin should then generate a new certificate when you next try to build a debug package.", "created_at"=>2010-11-30 09:10:04 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    I am using eclipse android plugins to build a project, But i am getting this error in the console window:

    \n\n

    [2010-02-03 10:31:14 - androidVNC]Error generating final archive:
    \nDebug certificate expired on 1/30/10 2:35 PM!

    \n\n

    IceskYsl@eoe ~/.android $ pwd
    \n/Users/IceskYsl/.android
    \nIceskYsl@eoe ~/.android $ ll
    \ntotal 48
    \ndrwxr-xr-x 9 IceskYsl staff 306 Nov 17 2009 .
    \ndrwxr-xr-x+ 62 IceskYsl staff 2108 Nov 30 13:51 ..
    \n-rw-r--r-- 1 IceskYsl staff 123 Sep 30 15:42 adb_usb.ini
    \n-rw-r--r-- 1 IceskYsl staff 204 Dec 1 00:52 androidtool.cfg
    \ndrwxr-xr-x 6 IceskYsl staff 204 Oct 16 16:17 avd
    \n-rw-r--r-- 1 IceskYsl staff 1393 Dec 1 00:37 ddms.cfg
    \n-rw-r--r-- 1 IceskYsl staff 1267 Nov 17 2009 debug.keystore
    \n-rw-r--r-- 1 IceskYsl staff 759 Nov 17 2009 default.keyset
    \n-rw-r--r-- 1 IceskYsl staff 78 Dec 1 00:52 repositories.cfg

    \n\n

    Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

    \n\n

    The Eclipse plugin should then generate a new certificate when you next try to build a debug package.

    \n", "_id"=>569}]) +MONGODB iceylog_development['categories'].find({:_id=>12}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>12}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"2010年总结,2011年展望", "body"=>"时间飞快,2010年悄然流逝,该坐下来总结下刚刚过去的2010年,也有必要想想2011年的目标和期待了~刚刚过去的2010年是改变最大的一年,不光是我,我身边的人也是,谢谢那些帮助过,支持过,关注过我们的人,谢谢你们;\n\n1. 工作方面\n\n今年一整年都贡献了了eoe,eoe从2008年10月开始撰写第一本android的书《google android开发入门和实战》开始,2009年7月份注册公司,2010年整整一年的发展,我们度过了几个关键的时间点,曾经的挣扎和迷茫都已经过去了,我清晰的记得2009年年尾的时候,和一起奋斗的几个哥们在吃火锅的时候定下的目标,如今想想还非常的清晰。\n\n2010年,和大家伙们闷头奋斗的一年,我们的第一本书《google android开发入门和实战》重印了8次,销量突破15000册,出版了第二本android技术书籍《it's android time:Google android创赢路线和产品开发实战》发布并迅速加印;eoe从当初的6人发展到30+的团队,从全部技术人员到有产品,有运营,有市场和商务区域完善的团队;我们拿到了投资,有了自己的顾问,和国内大多数的投资商们建立了良好的关系;从当初的吃住,工作一起的小黑屋搬到了明亮的办公室,从之前的迷茫到找到我们的方向;我们拥有了众多且知名的合作伙伴,我们的产品一步一步的完善,从当初的拿不出手到现在由衷的自豪。\n\n2010年,我参加了上海paypal的开发者日做了主题演讲;参加了北京csdn第一期TUP活动做了主题演讲;参加了成都天翼空间的“能力开发”活动做了主题演讲;给台湾的开发者做了一次主题topic;和google 一到在全国7个城市路演(上海,北京,广州,深圳,成都,重庆,杭州);和联想合办了联想开发者大会;也举办了我们自己的eoe首届移动开发者峰会,与会400+多人,非常成功!\n\n我们推出eoemarket的新版本优亿市场,得到市场和用户的认可;eoeadnroid转型为开发者门户,推出了开发者服务平台(eoeSDK);还有一些正在开发中的产品!\n\n个人在2010年是非常忙碌的一年:技术,商务,活动,演讲,战略,团队很多的事情,也有了长足的提升。认识了很多人,有些是新朋友,有些则是老朋友。\n\n2. 生活方面\n\n2010年是生活较为稳定的一年,太太tina辞了不错的工作,从深圳来到北京和我一起生活了,虽然每日工作在一起的时间比较有限,但确实也体会了家的温馨;买了一套90+平的房子算是一个圆了去年许下的一个目标,虽然何时才能住进去还是个未知数,但那确实有一个属于自己的空间;哥哥结婚了,了却了父母的一番心事,最近听说要生小孩了,真是速度的很,爸妈应该要高兴了,希望别来催我生小孩啦,呵呵。奶奶,姥姥姥爷,父母亲人都很健康,无病无灾!tina的奶奶去了天堂,在那边享受快乐的生活.\n\n2010年过的很忙碌,也有一些尚未完成的心愿,也错过了一些事情,留下了些许遗憾,那些由于种种原因没能一路走下来的兄弟们,希望我们还有机会并肩作战!那些没能经常联系的朋友们,我时刻想念大家,希望大家都好!\n\n希望2011年能完成,列举一二,权当自勉!\n\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\n\n2. 能做一个有可能改变世界的产品;\n\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\n\n4. 在技术,英语,管理,交际方面有着长足的提高;\n\n5. 能找到一个合适的定居的地方为安定下来做些准备;\n\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\n\n7.能拿到驾照,顺便也有个属于自己的交通工具;\n\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\n\n9. 亲戚,朋友包括我和tina都健康快乐!\n\n10. 世界太平,和谐迎接2012!", "created_at"=>2011-01-02 23:46:24 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    时间飞快,2010年悄然流逝,该坐下来总结下刚刚过去的2010年,也有必要想想2011年的目标和期待了~刚刚过去的2010年是改变最大的一年,不光是我,我身边的人也是,谢谢那些帮助过,支持过,关注过我们的人,谢谢你们;

    \n\n

    1. 工作方面

    \n\n

    今年一整年都贡献了了eoe,eoe从2008年10月开始撰写第一本android的书《google android开发入门和实战》开始,2009年7月份注册公司,2010年整整一年的发展,我们度过了几个关键的时间点,曾经的挣扎和迷茫都已经过去了,我清晰的记得2009年年尾的时候,和一起奋斗的几个哥们在吃火锅的时候定下的目标,如今想想还非常的清晰。

    \n\n

    2010年,和大家伙们闷头奋斗的一年,我们的第一本书《google android开发入门和实战》重印了8次,销量突破15000册,出版了第二本android技术书籍《it's android time:Google android创赢路线和产品开发实战》发布并迅速加印;eoe从当初的6人发展到30+的团队,从全部技术人员到有产品,有运营,有市场和商务区域完善的团队;我们拿到了投资,有了自己的顾问,和国内大多数的投资商们建立了良好的关系;从当初的吃住,工作一起的小黑屋搬到了明亮的办公室,从之前的迷茫到找到我们的方向;我们拥有了众多且知名的合作伙伴,我们的产品一步一步的完善,从当初的拿不出手到现在由衷的自豪。

    \n\n

    2010年,我参加了上海paypal的开发者日做了主题演讲;参加了北京csdn第一期TUP活动做了主题演讲;参加了成都天翼空间的“能力开发”活动做了主题演讲;给台湾的开发者做了一次主题topic;和google 一到在全国7个城市路演(上海,北京,广州,深圳,成都,重庆,杭州);和联想合办了联想开发者大会;也举办了我们自己的eoe首届移动开发者峰会,与会400+多人,非常成功!

    \n\n

    我们推出eoemarket的新版本优亿市场,得到市场和用户的认可;eoeadnroid转型为开发者门户,推出了开发者服务平台(eoeSDK);还有一些正在开发中的产品!

    \n\n

    个人在2010年是非常忙碌的一年:技术,商务,活动,演讲,战略,团队很多的事情,也有了长足的提升。认识了很多人,有些是新朋友,有些则是老朋友。

    \n\n

    2. 生活方面

    \n\n

    2010年是生活较为稳定的一年,太太tina辞了不错的工作,从深圳来到北京和我一起生活了,虽然每日工作在一起的时间比较有限,但确实也体会了家的温馨;买了一套90+平的房子算是一个圆了去年许下的一个目标,虽然何时才能住进去还是个未知数,但那确实有一个属于自己的空间;哥哥结婚了,了却了父母的一番心事,最近听说要生小孩了,真是速度的很,爸妈应该要高兴了,希望别来催我生小孩啦,呵呵。奶奶,姥姥姥爷,父母亲人都很健康,无病无灾!tina的奶奶去了天堂,在那边享受快乐的生活.

    \n\n

    2010年过的很忙碌,也有一些尚未完成的心愿,也错过了一些事情,留下了些许遗憾,那些由于种种原因没能一路走下来的兄弟们,希望我们还有机会并肩作战!那些没能经常联系的朋友们,我时刻想念大家,希望大家都好!

    \n\n

    希望2011年能完成,列举一二,权当自勉!

    \n\n
      \n
    1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!

    2. \n
    3. 能做一个有可能改变世界的产品;

    4. \n
    5. tina能找到自己真正喜欢的工作,做自己喜欢的事情;

    6. \n
    7. 在技术,英语,管理,交际方面有着长足的提高;

    8. \n
    9. 能找到一个合适的定居的地方为安定下来做些准备;

    10. \n
    11. 能和tina一起去一次远途旅行,欧洲?也许吧;

    12. \n
    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;

    \n\n
      \n
    1. 多些空闲,多看看书,多些思考,多些时间写写东西!

    2. \n
    3. 亲戚,朋友包括我和tina都健康快乐!

    4. \n
    5. 世界太平,和谐迎接2012!

    6. \n
    \n", "_id"=>570}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"03. 技术归总 | Technic"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>11, "title"=>"mtr命令使用", "body"=>"这里说的mtr是一个网络工具,结合了\"traceroute\"和\"ping\"功能于一身,非常好用的一个工具,别和我说\"traceroute\"和\"ping\"这两个命令不知道哟!~~\n\ndebian的apt中,只需要安装“mtr-tiny ”即可使用mtr命令。\n\nlinux下面的mtr输出大概如下面所列:\n\n~$ mtr -r -n -c 100 www.163.com\nHOST: hz**-** Loss% Snt Last Avg Best Wrst StDev\n1. **.**.**.** 0.0% 100 1.9 3.6 1.8 23.0 3.3\n2. 61.164.42.69 0.0% 100 0.6 0.8 0.5 7.1 0.6\n3. 61.153.8.230 0.0% 100 0.6 0.6 0.4 2.2 0.2\n4. 220.191.129.129 0.0% 100 0.5 0.5 0.4 4.3 0.5\n5. 202.97.41.245 0.0% 100 7.8 16.7 7.7 182.6 30.0\n6. 202.97.34.65 0.0% 100 33.7 43.3 33.7 228.4 34.7\n7. 220.181.16.149 0.0% 100 31.6 32.2 31.4 44.1 2.4\n8. 220.181.16.10 0.0% 100 46.5 42.9 32.7 55.6 5.8\n9. 220.181.17.54 0.0% 100 42.4 41.5 36.1 49.7 3.0\n10. 220.181.28.50 0.0% 100 30.4 30.3 30.2 30.5 0.1\n\n输出各项的意思如下:\n\nLoss% --很明显是丢包率,单位是\"%\";\nSnt -- sent包的数量,如果是winmtr的话,还有一个\"recv\"表示收到回复包的数量,不过既然有\"Loss\"和\"Snt\",其实\"recv\"也很容易算出来,个人感觉winmtr有点画蛇添足了;\nLast -- 最后一个包的延时;\nAvg -- 所有包的平均延时,同\"ping\"的\"Avg\";\nBest -- 延时最小的包,同\"ping\"的\"Min\";\nWrst -- Worst,延时最大的包,同\"ping\"的\"Max\";\nStDev -- Standard Deviation,标准差,winmtr无该项。\nStDev的概念和计算方法参见这里(请自备爬墙工具)\n\n个人认为,如果StDev很大,表示各个包的延时的差别很大,网络不太稳定。不过由于中间点是路由器,一般路由器可能会对icmp包做限制或者优先丢弃,所以中间节点的StDev可以忽略不看。", "created_at"=>2011-01-14 00:04:42 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    这里说的mtr是一个网络工具,结合了"traceroute"和"ping"功能于一身,非常好用的一个工具,别和我说"traceroute"和"ping"这两个命令不知道哟!~~

    \n\n

    debian的apt中,只需要安装“mtr-tiny ”即可使用mtr命令。

    \n\n

    linux下面的mtr输出大概如下面所列:

    \n\n

    ~$ mtr -r -n -c 100 www.163.com
    \nHOST: hz- Loss% Snt Last Avg Best Wrst StDev
    \n1. ... 0.0% 100 1.9 3.6 1.8 23.0 3.3
    \n2. 61.164.42.69 0.0% 100 0.6 0.8 0.5 7.1 0.6
    \n3. 61.153.8.230 0.0% 100 0.6 0.6 0.4 2.2 0.2
    \n4. 220.191.129.129 0.0% 100 0.5 0.5 0.4 4.3 0.5
    \n5. 202.97.41.245 0.0% 100 7.8 16.7 7.7 182.6 30.0
    \n6. 202.97.34.65 0.0% 100 33.7 43.3 33.7 228.4 34.7
    \n7. 220.181.16.149 0.0% 100 31.6 32.2 31.4 44.1 2.4
    \n8. 220.181.16.10 0.0% 100 46.5 42.9 32.7 55.6 5.8
    \n9. 220.181.17.54 0.0% 100 42.4 41.5 36.1 49.7 3.0
    \n10. 220.181.28.50 0.0% 100 30.4 30.3 30.2 30.5 0.1

    \n\n

    输出各项的意思如下:

    \n\n

    Loss% --很明显是丢包率,单位是"%";
    \nSnt -- sent包的数量,如果是winmtr的话,还有一个"recv"表示收到回复包的数量,不过既然有"Loss"和"Snt",其实"recv"也很容易算出来,个人感觉winmtr有点画蛇添足了;
    \nLast -- 最后一个包的延时;
    \nAvg -- 所有包的平均延时,同"ping"的"Avg";
    \nBest -- 延时最小的包,同"ping"的"Min";
    \nWrst -- Worst,延时最大的包,同"ping"的"Max";
    \nStDev -- Standard Deviation,标准差,winmtr无该项。
    \nStDev的概念和计算方法参见这里(请自备爬墙工具)

    \n\n

    个人认为,如果StDev很大,表示各个包的延时的差别很大,网络不太稳定。不过由于中间点是路由器,一般路由器可能会对icmp包做限制或者优先丢弃,所以中间节点的StDev可以忽略不看。

    \n", "_id"=>571}]) +MONGODB iceylog_development['categories'].find({:_id=>11}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>11}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"那些时间点们", "body"=>"
    \n\n2002.9 武汉,开始大学\n\n2003.5  武汉,第二学位\n\n2006.7 深圳,大学毕业开始工作\n\n2008.10 北京,离开深圳,来到北京,参与别人创业\n\n2009.5 北京,开始和朋友一起自主创业\n\n2009.10 合肥,和tina步入婚姻殿堂\n\n2010.4 北京,创业走过第一个阶段,有了真正的办公室\n\n2010.7 北京,tina来到北京,终于不分居两地\n\n2011.4 北京,创业走过第二个阶段\n\n精彩还将继续...\n\n
    ", "created_at"=>2011-03-25 21:29:19 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    2002.9 武汉,开始大学

    \n\n

    2003.5  武汉,第二学位

    \n\n

    2006.7 深圳,大学毕业开始工作

    \n\n

    2008.10 北京,离开深圳,来到北京,参与别人创业

    \n\n

    2009.5 北京,开始和朋友一起自主创业

    \n\n

    2009.10 合肥,和tina步入婚姻殿堂

    \n\n

    2010.4 北京,创业走过第一个阶段,有了真正的办公室

    \n\n

    2010.7 北京,tina来到北京,终于不分居两地

    \n\n

    2011.4 北京,创业走过第二个阶段

    \n\n

    精彩还将继续...

    \n\n", "_id"=>572}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"Mac OS X(lion)软件推荐", "body"=>"Mac OS X(lion)软件推荐\n\nIceskysl@gmail.com At 2011.09.03\n\nhttp://iceskysl.1sters.com/?p=841\n\n最近身边好多朋友都加入Mac阵营,对Mac OS X 的软件不是太熟悉,要我写个推荐软件清单,原本觉得网上类似的推荐应该很多,大致查了下,发现好多都比较陈旧了。\n\n我08年开始使Mac,经过这三年多的使用,这里大致列出了一些自己使用过并且感觉比较不错的软件,供大家参考;需要说明的是每个人接触的软件有限,我的选择未必就是最好的,如果您有更好的软件推荐,还请告诉我;这个清单我会不定期更新,希望对大家有用。\n\n这个清单被我分成上篇(大众用户篇)和下篇(技术人员篇),有的软件连接我就不加了,大家自己Google下应该不难找,实在找不到的可以给我留言,我找给你。\n\n \n\n上篇:大众用户篇\n\n \n
      \n\t
    • 网页浏览器 \n
        \n\t
      • Chrome(推荐):自从用了chrome,就没有其他浏览器再能吸引我了,强烈推荐这个(我更喜欢dev版的)
      • \n\t
      • Safari: 系统自带的浏览器,我会留着,但是使用的次数和时间都不长;
      • \n\t
      • Firefox:没有Chrome前的首选,但是有了Chrome,就越发觉得FF好臃肿,现基本不用;
      • \n
      \n
    • \n\t
    • 即时通讯\n
        \n\t
      • Adium :兼容多种聊天账户,我用来开MSN,Google Talk 和 Google App Talk;
      • \n\t
      • QQ for Mac:随着QQ的不断升级,现在的已经很棒了,算一款合格的mac软件了;
      • \n\t
      • Skype:视屏聊天,需求不是很大,但是个不错的软件,需要skype的人肯定需要;
      • \n
      \n
    • \n\t
    • 视频播放\n
        \n\t
      • MPlayerX: 之前用的比较多的是VLC,后来发现了Mplayerx就几本不使VLC了,非常强大的视屏播放器;
      • \n\t
      • VLC:这个其实也不错,估计有人会喜欢
      • \n
      \n
    • \n\t
    • 音频播放\n
        \n\t
      • iTunes:没啥好介绍的,功能强大,但是我不习惯听本地的歌,基本都是听在线的;
      • \n
      \n
    • \n\t
    • 图片处理\n
        \n\t
      • Xee: 图片浏览用的,还不错的说;
      • \n\t
      • Picasa:google picasa用来整理照片;
      • \n\t
      • Pixelmator:是个画图工具
      • \n
      \n
    • \n\t
    • 压缩软件\n
        \n\t
      • 7zX:非常强大的压缩软件,压缩出来的中文兼容windows
      • \n\t
      • BetterZip:解压缩软件,支持zip、rar、7z等常见格式。
      • \n
      \n
    • \n\t
    • 上传下载软件\n
        \n\t
      • FileZilla: FTP工具,在使windows的时候就使的FTP软件,尤其喜欢其支持sftp方式的连接和传输
      • \n\t
      • uTorrent:BT工具,用的不多,但是一直装着了,还有个Xtorrent
      • \n
      \n
    • \n\t
    • 办公软件\n
        \n\t
      • Adobe Reader 9:看PDF还是需要这个的,效果还不错
      • \n\t
      • Evernote :文字纪录,非常强大可以同步的记事本软件,比记事本强大好多倍,有了这个其他的文字纪录类的软件就不需要了(配合ios或者android客户端使用更棒),这个文章就是在Evernote里写的;
      • \n\t
      • dropbox:资料同步软件,也非常强大,把自己的文件同步一份,走到哪里都是主场,非常好用(国内部分区域被墙,自己想办法);
      • \n\t
      • iWork '09: 文档处理工具
      • \n
      \n
    • \n\t
    • 输入法\n
        \n\t
      • IMKQIM:比较老牌的输入法,很不错,FIT就用的比较少了;
      • \n\t
      • 搜狗拼音:出了不久,还不怎么稳定,如果持续改进,应该是个很不错的输入法;
      • \n
      \n
    • \n\t
    • 系统软件\n
        \n\t
      • Quicksilver:非常棒的软件,快速启动,不用苦哈哈手工去找;
      • \n\t
      • CleanApp:清洁系统的,基本不用;
      • \n\t
      • Mobile Partner:无线上网用的,连3g网卡的
      • \n\t
      • VMware Fusion:虚拟机
      • \n
      \n
    • \n
    \n \n\n下篇:技术人员篇\n\n这列举了一些技术人员估计会感兴趣的工具,供参考!\n
      \n\t
    • 编程工具\n
        \n\t
      • TextMate:号称是编程人员的神器,其实无论哪个工具用熟了都很好,TextMate确实很优秀,优秀到尽管其中文字体支持的不好,还是必须的装;
      • \n\t
      • MacVim:这个也是神器,把Vim用好到走到哪里都不怕;
      • \n\t
      • iTerm:必备软件,管理SSH链接
      • \n\t
      • MongoHub:管理MongoDB的工具
      • \n\t
      • Sequel Pro:mysql管理工具,很强大;
      • \n\t
      • MySQLWorkbench:mysql管理,用来做表结构设计的;
      • \n
      \n
    • \n\t
    • 专业工具\n
        \n\t
      • GitHub:用github的同学必备,很好用
      • \n\t
      • GitX:可视化的git工具,你没有理由不用他
      • \n\t
      • Balsamiq Mockups:原型图工具,非常棒
      • \n\t
      • OmniGraffle Professional: 专业画图工具,其他的都不需要了;
      • \n\t
      • OmniPlan:做计划的工具,也是Omni出的;
      • \n\t
      • Mindjet MindManager:脑图工具
      • \n
      \n
    • \n\t
    • 其他\n
        \n\t
      • RESTClient:REST测试工具
      • \n\t
      • JD-GUI:反编译工具
      • \n\t
      • KeyCastr:显示快捷键工具
      • \n\t
      • iShowU:录制视频用的
      • \n\t
      • keycue:显示软件的快捷键
      • \n
      \n
    • \n
    \n ", "created_at"=>2011-09-02 20:31:57 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    Mac OS X(lion)软件推荐

    \n\n

    Iceskysl@gmail.com At 2011.09.03

    \n\n

    http://iceskysl.1sters.com/?p=841

    \n\n

    最近身边好多朋友都加入Mac阵营,对Mac OS X 的软件不是太熟悉,要我写个推荐软件清单,原本觉得网上类似的推荐应该很多,大致查了下,发现好多都比较陈旧了。

    \n\n

    我08年开始使Mac,经过这三年多的使用,这里大致列出了一些自己使用过并且感觉比较不错的软件,供大家参考;需要说明的是每个人接触的软件有限,我的选择未必就是最好的,如果您有更好的软件推荐,还请告诉我;这个清单我会不定期更新,希望对大家有用。

    \n\n

    这个清单被我分成上篇(大众用户篇)和下篇(技术人员篇),有的软件连接我就不加了,大家自己Google下应该不难找,实在找不到的可以给我留言,我找给你。

    \n\n\n

    上篇:大众用户篇

    \n\n

    网页浏览器
    \n
    \n Chrome(推荐):自从用了chrome,就没有其他浏览器再能吸引我了,强烈推荐这个(我更喜欢dev版的)
    \n Safari: 系统自带的浏览器,我会留着,但是使用的次数和时间都不长;
    \n Firefox:没有Chrome前的首选,但是有了Chrome,就越发觉得FF好臃肿,现基本不用;
    \n
    \n
    \n 即时通讯
    \n
    \n Adium :兼容多种聊天账户,我用来开MSN,Google Talk 和 Google App Talk;
    \n QQ for Mac:随着QQ的不断升级,现在的已经很棒了,算一款合格的mac软件了;
    \n Skype:视屏聊天,需求不是很大,但是个不错的软件,需要skype的人肯定需要;
    \n
    \n
    \n 视频播放
    \n
    \n MPlayerX: 之前用的比较多的是VLC,后来发现了Mplayerx就几本不使VLC了,非常强大的视屏播放器;
    \n VLC:这个其实也不错,估计有人会喜欢
    \n
    \n
    \n 音频播放
    \n
    \n iTunes:没啥好介绍的,功能强大,但是我不习惯听本地的歌,基本都是听在线的;
    \n
    \n
    \n 图片处理
    \n
    \n Xee: 图片浏览用的,还不错的说;
    \n Picasa:google picasa用来整理照片;
    \n Pixelmator:是个画图工具
    \n
    \n
    \n 压缩软件
    \n
    \n 7zX:非常强大的压缩软件,压缩出来的中文兼容windows
    \n BetterZip:解压缩软件,支持zip、rar、7z等常见格式。
    \n
    \n
    \n 上传下载软件
    \n
    \n FileZilla: FTP工具,在使windows的时候就使的FTP软件,尤其喜欢其支持sftp方式的连接和传输
    \n uTorrent:BT工具,用的不多,但是一直装着了,还有个Xtorrent
    \n
    \n
    \n 办公软件
    \n
    \n Adobe Reader 9:看PDF还是需要这个的,效果还不错
    \n Evernote :文字纪录,非常强大可以同步的记事本软件,比记事本强大好多倍,有了这个其他的文字纪录类的软件就不需要了(配合ios或者android客户端使用更棒),这个文章就是在Evernote里写的;
    \n dropbox:资料同步软件,也非常强大,把自己的文件同步一份,走到哪里都是主场,非常好用(国内部分区域被墙,自己想办法);
    \n iWork '09: 文档处理工具
    \n
    \n
    \n 输入法
    \n
    \n IMKQIM:比较老牌的输入法,很不错,FIT就用的比较少了;
    \n 搜狗拼音:出了不久,还不怎么稳定,如果持续改进,应该是个很不错的输入法;
    \n
    \n
    \n 系统软件
    \n
    \n Quicksilver:非常棒的软件,快速启动,不用苦哈哈手工去找;
    \n CleanApp:清洁系统的,基本不用;
    \n Mobile Partner:无线上网用的,连3g网卡的
    \n VMware Fusion:虚拟机
    \n
    \n
    \n
    \n

    \n\n

    下篇:技术人员篇

    \n\n

    这列举了一些技术人员估计会感兴趣的工具,供参考!
    \n
    \n 编程工具
    \n
    \n TextMate:号称是编程人员的神器,其实无论哪个工具用熟了都很好,TextMate确实很优秀,优秀到尽管其中文字体支持的不好,还是必须的装;
    \n MacVim:这个也是神器,把Vim用好到走到哪里都不怕;
    \n iTerm:必备软件,管理SSH链接
    \n MongoHub:管理MongoDB的工具
    \n Sequel Pro:mysql管理工具,很强大;
    \n MySQLWorkbench:mysql管理,用来做表结构设计的;
    \n
    \n
    \n 专业工具
    \n
    \n GitHub:用github的同学必备,很好用
    \n GitX:可视化的git工具,你没有理由不用他
    \n Balsamiq Mockups:原型图工具,非常棒
    \n OmniGraffle Professional: 专业画图工具,其他的都不需要了;
    \n OmniPlan:做计划的工具,也是Omni出的;
    \n Mindjet MindManager:脑图工具
    \n
    \n
    \n 其他
    \n
    \n RESTClient:REST测试工具
    \n JD-GUI:反编译工具
    \n KeyCastr:显示快捷键工具
    \n iShowU:录制视频用的
    \n keycue:显示软件的快捷键
    \n
    \n
    \n
    \n

    \n", "_id"=>573}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"Nginx开启 stub_status 模块", "body"=>"Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.\n本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定:\n./configure –with-http_stub_status_module\n\n一、查看已安装的 Nginx 是否包含 stub_status 模块\n#/usr/local/nginx/sbin/nginx -V\n\n [root@ice ~]# /opt/nginx/sbin/nginx -V\nnginx version: nginx/0.8.53\nbuilt by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)\nTLS SNI support disabled\nconfigure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-pcre=/tmp/root-passenger-1719/pcre-8.10 --add-module=/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx\n\n如果包含 stub_status 模块,那么就可以进行下面的步骤了:\n\n二、修改 Nginx 配置文件\n``location /nginx_status {\n # copied from http://iceskysl.1sters.com\n stub_status on;\n access_log off;\n allow SOME.IP.ADD.RESS;\n deny all;\n}```\n``三、重启 Nginx\n#/usr/local/nginx/sbin/nginx -s reload\n\n四、相关数据说明\nActive connections: 对后端发起的活动连接数.\nServer accepts handled requests: Nginx总共处理了38810620个连接,成功创建38810620次握手(证明中间没有失败的),总共处理了298655730个请求.\nReading: Nginx 读取到客户端的Header信息数.\nWriting: Nginx 返回给客户端的Header信息数.\nWaiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是Nginx已经处理完成,正在等候下一次请求指令的驻留连接.\n所以,在访问效率高,请求很快被处理完毕的情况下,Waiting数比较多是正常的.如果reading +writing数较多,则说明并发访问量非常大,正在处理过程中.```", "created_at"=>2011-09-03 08:05:33 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.
    \n本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定:
    \n./configure –with-http_stub_status_module

    \n\n

    一、查看已安装的 Nginx 是否包含 stub_status 模块

    \n\n

    /usr/local/nginx/sbin/nginx -V

    \n\n

    [root@ice ~]# /opt/nginx/sbin/nginx -V
    \nnginx version: nginx/0.8.53
    \nbuilt by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
    \nTLS SNI support disabled
    \nconfigure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-pcre=/tmp/root-passenger-1719/pcre-8.10 --add-module=/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx

    \n\n

    如果包含 stub_status 模块,那么就可以进行下面的步骤了:

    \n\n

    二、修改 Nginx 配置文件
    \nlocation /nginx_status {
    \n # copied from http://iceskysl.1sters.com
    \n stub_status on;
    \n access_log off;
    \n allow SOME.IP.ADD.RESS;
    \n deny all;
    \n}

    \n
    `三、重启 Nginx

    \n\n

    /usr/local/nginx/sbin/nginx -s reload

    \n\n

    四、相关数据说明
    \nActive connections: 对后端发起的活动连接数.
    \nServer accepts handled requests: Nginx总共处理了38810620个连接,成功创建38810620次握手(证明中间没有失败的),总共处理了298655730个请求.
    \nReading: Nginx 读取到客户端的Header信息数.
    \nWriting: Nginx 返回给客户端的Header信息数.
    \nWaiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是Nginx已经处理完成,正在等候下一次请求指令的驻留连接.
    \n所以,在访问效率高,请求很快被处理完毕的情况下,Waiting数比较多是正常的.如果reading +writing数较多,则说明并发访问量非常大,正在处理过程中.```

    \n", "_id"=>574}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["brew"], "comments_count"=>0, "category_id"=>7, "title"=>"Installs Homebrew to /usr/local so you don't need sudo to `brew install`", "body"=>"$ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346\n\n $ ruby /tmp/install_homebrew.rb\n==> This script will install:\n/usr/local/bin/brew\n/usr/local/Library/Formula/...\n/usr/local/Library/Homebrew/...\n==> The following directories will be made group writable:\n/usr/local/.\n/usr/local/bin\n==> The following directories will have their group set to admin:\n/usr/local/.\n/usr/local/bin\n\nPress enter to continue\n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin\n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin\n==> Downloading and Installing Homebrew...\nWarning: The following *evil* dylibs exist in /usr/local/lib\nThey may break builds or worse. You should consider deleting them:\n/usr/local/lib/libevent-1.4.2.1.3.dylib\n/usr/local/lib/libevent_core-1.4.2.1.3.dylib\n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib\n/usr/local/lib/libkyotocabinet.4.8.0.dylib\n/usr/local/lib/libprotobuf-lite.6.dylib\n/usr/local/lib/libprotobuf.6.dylib\n/usr/local/lib/libprotoc.6.dylib\n==> Installation successful!\nNow type: brew help\n\n参考:https://gist.github.com/323731", "created_at"=>2011-09-03 08:29:42 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    $ curl https://raw.github.com/gist/323731/install_homebrew.rb -o /tmp/install_homebrew.rb
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 4569 100 4569 0 0 1605 0 0:00:02 0:00:02 --:--:-- 2346

    \n\n

    $ ruby /tmp/install_homebrew.rb
    \n==> This script will install:
    \n/usr/local/bin/brew
    \n/usr/local/Library/Formula/...
    \n/usr/local/Library/Homebrew/...
    \n==> The following directories will be made group writable:
    \n/usr/local/.
    \n/usr/local/bin
    \n==> The following directories will have their group set to admin:
    \n/usr/local/.
    \n/usr/local/bin

    \n\n

    Press enter to continue
    \n==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin
    \n==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin
    \n==> Downloading and Installing Homebrew...
    \nWarning: The following evil dylibs exist in /usr/local/lib
    \nThey may break builds or worse. You should consider deleting them:
    \n/usr/local/lib/libevent-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_core-1.4.2.1.3.dylib
    \n/usr/local/lib/libevent_extra-1.4.2.1.3.dylib
    \n/usr/local/lib/libkyotocabinet.4.8.0.dylib
    \n/usr/local/lib/libprotobuf-lite.6.dylib
    \n/usr/local/lib/libprotobuf.6.dylib
    \n/usr/local/lib/libprotoc.6.dylib
    \n==> Installation successful!
    \nNow type: brew help

    \n\n

    参考:https://gist.github.com/323731

    \n", "_id"=>575}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"手机发的文章", "body"=>"好久没写文章了,装了个客户端,没事的时候可以写点随笔,时间好快,不记录以后全部都会忘记的..", "created_at"=>2011-11-22 06:02:19 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    好久没写文章了,装了个客户端,没事的时候可以写点随笔,时间好快,不记录以后全部都会忘记的..

    \n", "_id"=>576}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["perl", "Twig", "xml"], "comments_count"=>0, "category_id"=>7, "title"=>"install perl module for XML-Twig in RHEL-Red Hat/Fedora Linux?", "body"=>"This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)\r\n\r\nLet’s first search for the package\r\n$ yum search perl-XML-Twig\r\nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree\r\n\r\nNote that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.\r\n$ yum install perl-XML-Twig.noarch\r\n\r\nYou can check the details of this package perl-XML-Twig\r\n$ yum info perl-XML-Twig.noarch\r\n\r\n或者:\r\nperl -MCPAN -e 'install XML::Twig'", "created_at"=>2011-12-10 10:53:02 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    This module provides a way to process XML documents. It is build on top of XML::Parser. XML::Twig offers a tree interface to the document, while allowing you to output the parts of it that have been completely processed. It allows minimal resource (CPU and memory) usage by building the tree only for the parts of the documents that need actual processing, through the use of the twig_roots and twig_print_outside_roots options.(as pointed by yum info)

    \n\n

    Let’s first search for the package
    \n$ yum search perl-XML-Twig
    \nperl-XML-Twig.noarch : A perl module for processing huge XML documents in tree

    \n\n

    Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
    \n$ yum install perl-XML-Twig.noarch

    \n\n

    You can check the details of this package perl-XML-Twig
    \n$ yum info perl-XML-Twig.noarch

    \n\n

    或者:
    \nperl -MCPAN -e 'install XML::Twig'

    \n", "_id"=>577}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"防范垃圾利器Akismet使用体验和原理分析", "body"=>"博客不经常更新的原因是垃圾太猛烈,每次来要删除一批垃圾评论,而且wp后台的那个未审核评论变成垃圾评论还真是麻烦,每次都直接跑去查数据库\r\n````\r\nselect count(*),comment_approved from ice_comments group by comment_approved;\r\n+----------+------------------+\r\n| count(*) | comment_approved |\r\n+----------+------------------+\r\n| 5709 | 0 | \r\n| 579 | 1 | \r\n| 71 | spam | \r\n+----------+------------------+\r\n```\r\n\r\n看到那个comment_approved是0 的就是还没审核的,一个一个审核实在是麻烦的不行~~\r\n找到一个很多人不错的插件 Akismet(Automattic Kismet)是应用广泛的一个垃圾留言过滤系统,其作者是大名鼎鼎的WordPress创始人Matt Mullenweg,Akismet也是WordPress默认安装的插件,其使用非常广泛,设计目标便是帮助博客网站来过滤留言spam。\r\n开启后回自动把comment_approved是0的检查一遍,看看我的\r\n```` \r\nmysql> select count(*),comment_approved from ice_comments group by comment_approved;\r\n+----------+------------------+\r\n| count(*) | comment_approved |\r\n+----------+------------------+\r\n| 5214 | 0 | \r\n| 579 | 1 | \r\n| 566 | spam | \r\n+----------+------------------+\r\n3 rows in set (0.00 sec)\r\n```\r\n慢慢自动检查去吧,希望这个能把垃圾评论都找出来~~~\r\n\r\n说到这里,对Akismet的工作原理有了更多兴趣,顺手查了下:当一名用户把一条评论列为垃圾评论时,该数据会自动上传到Akismet的服务器上,以方便其他用户的Akismet自动拦截垃圾评论,因此Akismet可以说是广大Akismet用户共同维护的评论防火墙。\r\n大概的流程估计是这样的:\r\n\r\n
    1、所有评论首先都会传送一份到akismet服务器进行判断。\r\n2、akismet收集到了名字,网址,邮箱,和内容,ip,5个数据,其中名字应该不可能用作判断依据。\r\n3、akismet有一个信任名单,中立名单,黑名单几个级别。\r\n4、每当博主对评论手动通过一次,该评论的网址,邮箱,ip就获得一次加权。当积累到一定量之后进入信任白名单,所发评论能自动通过。\r\n5、当博主对评论进行一次垃圾标记,该评论的网址,邮箱,和内容,ip就获得一次负加权,当积累到一定量之后进入黑名单。
    \r\n\r\n\r\n如上过程应该有个机器学习的过程~加上一些算法和挖掘的原理,应该是可以实现的,其压力应该在服务器负载上,想全球那么多的wp程序(还有些其他网站接入Akismet的),每次评论的时候一个请求,这个量不得了呀~ 所以我估计Akismet的处理逻辑应该也是分层级的,比如说一个ip已经进入黑名单了,那么他的处理应该很简单了,如果不是黑名单,估计还回根据内容等其他信息判断~~\r\n\r\n于是乎,我想到eoeandroid的管理员和版主每天和spam抗争的惨烈情景,不晓得Discuz论坛是否有Akismet插件,如果没有,谁有兴趣可以开发一个,大体思路如下:\r\n
    \r\n1.使用Akismet提供的API对信息进行检测,地址 http://akismet.com/development/api/;\r\n2.对信息的检测只针对特定的用户组,比如“新手上路”、分低于200或者发贴量少于50个帖子的用户,做此限制主要是为了不影响论坛的忠实支持者的操作;\r\n3.用户提交的内容检测为Span时,阻止发贴、回复的操作,并提示用户,并记录用户提交垃圾信息的数次,当达到一定程序时将此用户禁言一定时间;\r\n4.相关参数在后台实现设置接口。\r\n5.在Discuz管理后台设置API Key,并检测API Key的有效性。\r\n
    \r\n查了下,好像没看到Discuz有这个插件,谁有兴趣开发一个~~", "created_at"=>2012-01-01 18:32:52 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    博客不经常更新的原因是垃圾太猛烈,每次来要删除一批垃圾评论,而且wp后台的那个未审核评论变成垃圾评论还真是麻烦,每次都直接跑去查数据库
    \n`
    \nselect count(*),comment_approved from ice_comments group by comment_approved;
    \n+----------+------------------+
    \n| count(*) | comment_approved |
    \n+----------+------------------+
    \n| 5709 | 0 |
    \n| 579 | 1 |
    \n| 71 | spam |
    \n+----------+------------------+
    \n

    \n\n

    看到那个comment_approved是0 的就是还没审核的,一个一个审核实在是麻烦的不行~~
    \n找到一个很多人不错的插件 Akismet(Automattic Kismet)是应用广泛的一个垃圾留言过滤系统,其作者是大名鼎鼎的WordPress创始人Matt Mullenweg,Akismet也是WordPress默认安装的插件,其使用非常广泛,设计目标便是帮助博客网站来过滤留言spam。
    \n开启后回自动把comment_approved是0的检查一遍,看看我的
    \n`
    \nmysql> select count(*),comment_approved from ice_comments group by comment_approved;
    \n+----------+------------------+
    \n| count(*) | comment_approved |
    \n+----------+------------------+
    \n| 5214 | 0 |
    \n| 579 | 1 |
    \n| 566 | spam |
    \n+----------+------------------+
    \n3 rows in set (0.00 sec)
    \n

    \n慢慢自动检查去吧,希望这个能把垃圾评论都找出来~~~

    \n\n

    说到这里,对Akismet的工作原理有了更多兴趣,顺手查了下:当一名用户把一条评论列为垃圾评论时,该数据会自动上传到Akismet的服务器上,以方便其他用户的Akismet自动拦截垃圾评论,因此Akismet可以说是广大Akismet用户共同维护的评论防火墙。
    \n大概的流程估计是这样的:

    \n\n

    1、所有评论首先都会传送一份到akismet服务器进行判断。
    \n2、akismet收集到了名字,网址,邮箱,和内容,ip,5个数据,其中名字应该不可能用作判断依据。
    \n3、akismet有一个信任名单,中立名单,黑名单几个级别。
    \n4、每当博主对评论手动通过一次,该评论的网址,邮箱,ip就获得一次加权。当积累到一定量之后进入信任白名单,所发评论能自动通过。
    \n5、当博主对评论进行一次垃圾标记,该评论的网址,邮箱,和内容,ip就获得一次负加权,当积累到一定量之后进入黑名单。

    \n\n

    如上过程应该有个机器学习的过程~加上一些算法和挖掘的原理,应该是可以实现的,其压力应该在服务器负载上,想全球那么多的wp程序(还有些其他网站接入Akismet的),每次评论的时候一个请求,这个量不得了呀~ 所以我估计Akismet的处理逻辑应该也是分层级的,比如说一个ip已经进入黑名单了,那么他的处理应该很简单了,如果不是黑名单,估计还回根据内容等其他信息判断~~

    \n\n

    于是乎,我想到eoeandroid的管理员和版主每天和spam抗争的惨烈情景,不晓得Discuz论坛是否有Akismet插件,如果没有,谁有兴趣可以开发一个,大体思路如下:
    \n
    \n1.使用Akismet提供的API对信息进行检测,地址 http://akismet.com/development/api/
    \n2.对信息的检测只针对特定的用户组,比如“新手上路”、分低于200或者发贴量少于50个帖子的用户,做此限制主要是为了不影响论坛的忠实支持者的操作;
    \n3.用户提交的内容检测为Span时,阻止发贴、回复的操作,并提示用户,并记录用户提交垃圾信息的数次,当达到一定程序时将此用户禁言一定时间;
    \n4.相关参数在后台实现设置接口。
    \n5.在Discuz管理后台设置API Key,并检测API Key的有效性。
    \n
    \n查了下,好像没看到Discuz有这个插件,谁有兴趣开发一个~~

    \n", "_id"=>578}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"在rails项目android-group中集成Akismet", "body"=>"前面一篇文章《防范垃圾利器Akismet使用体验和原理分析》讲到Akismet的原理,其中说到看谁有兴趣给dz加个类似的功能,我是懒得写php的code,写写rails的还有点兴趣,于是在android-group这个项目里添加了下,android-group是直接fork的ruby-china,把大概过程说下:\r\n\r\n1. 加插件ruby-akismet\r\n已经有人写了akismet的ruby插件https://github.com/joshfrench/rakismet,有有人封装了一次https://github.com/ysbaddaden/ruby-akismet,就很好使用了。\r\n
    \r\n#Add this gem to your Gemfile:\r\ngem 'ruby-akismet', :require => 'akismet'\r\n```\r\n\r\n\r\n#Create an initializer file like config/initializers/akismet.rb with your configuration:\r\n
    \r\nAkismet.key = '123456789'\r\nAkismet.blog = 'http://example.com'\r\nAkismet.logger = Rails.logger\r\n```\r\n\r\n2. 修改代码\r\n#修改Reply.rb,添加\r\n
    \r\nfield :spam, :type => Boolean, :default => false\r\n```\r\n#修改RepliesController\r\n
    \r\n# coding: utf-8\r\nclass RepliesController < ApplicationController```\r\n\r\nload_and_authorize_resource :reply\r\n\r\nbefore_filter :find_topic\r\ndef create\r\n\r\n@reply = @topic.replies.build(params[:reply])\r\n\r\n@reply.user_id = current_user.id\r\n@reply.spam = Akismet.spam?(akismet_attributes, request)\r\nlogger.info(\"akismet_attributes:\#{akismet_attributes}\")\r\nlogger.info(\"@reply.spam:\#{@reply.spam}\")\r\nif @reply.save\r\ncurrent_user.read_topic(@topic)\r\n@msg = t(\"topics.reply_success\")\r\nelse\r\n@msg = @reply.errors.full_messages.join(\"\r\n\")\r\nend\r\nend\r\n\r\ndef edit\r\n@reply = current_user.replies.find(params[:id])\r\ndrop_breadcrumb(t(\"menu.topics\"), topics_path)\r\ndrop_breadcrumb t(\"reply.edit_reply\")\r\nend\r\n\r\ndef update\r\n@reply = current_user.replies.find(params[:id])\r\n\r\nif @reply.update_attributes(params[:reply])\r\nredirect_to(topic_path(@reply.topic_id), :notice => '回帖更新成功.')\r\nelse\r\nrender :action => \"edit\"\r\nend\r\nend\r\n\r\nprotected\r\n\r\ndef akismet_attributes\r\n{\r\n:comment_author => @reply.user.login,\r\n:comment_author_url => user_url(@reply.user.login),\r\n:comment_author_email => @reply.user.email,\r\n:comment_content => @reply.body,\r\n:permalink => topic_url(@reply.topic_id)\r\n}\r\nend\r\n\r\ndef find_topic\r\n@topic = Topic.find(params[:topic_id])\r\nend\r\n\r\nend\r\n\r\n```\r\n\r\n#修改Cpanel::RepliesController,增加如下两个方法\r\n
    \r\ndef spam\r\n@reply = Reply.find(params[:id])\r\n@reply.update_attribute(:spam, true)\r\nAkismet.submit_spam(akismet_attributes)\r\nredirect_to(cpanel_replies_path)\r\nend\r\n\r\ndef ham\r\n@reply = Reply.find(params[:id])\r\n@reply.update_attribute(:spam, true)\r\nAkismet.submit_ham(akismet_attributes)\r\nredirect_to(cpanel_replies_path)\r\nend\r\n```\r\n\r\n#修改routes文件\r\n
    \r\nresources :replies do\r\nmember do\r\npost :spam\r\npost :ham\r\nend\r\nend\r\n```\r\n\r\n#再修改下view和locales文件就可以了,具体的就不贴了,可以在github上看到\r\nhttps://github.com/IceskYsl/android-group/commit/79fabb06b12fd776b301fed2c7c10aee744c5974\r\n\r\n也可以参考:\r\nhttp://rubydoc.info/github/ysbaddaden/ruby-akismet/master/frames\r\n\r\n项目地址:\r\nhttps://github.com/huacnlee/ruby-china\r\nhttps://github.com/IceskYsl/android-group", "created_at"=>2012-01-01 20:42:41 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    前面一篇文章《防范垃圾利器Akismet使用体验和原理分析》讲到Akismet的原理,其中说到看谁有兴趣给dz加个类似的功能,我是懒得写php的code,写写rails的还有点兴趣,于是在android-group这个项目里添加了下,android-group是直接fork的ruby-china,把大概过程说下:

    \n\n

    1. 加插件ruby-akismet
    \n已经有人写了akismet的ruby插件https://github.com/joshfrench/rakismet,有有人封装了一次https://github.com/ysbaddaden/ruby-akismet,就很好使用了。
    \n
    \n#Add this gem to your Gemfile:
    \ngem 'ruby-akismet', :require => 'akismet'
    \n```

    \n\n

    #Create an initializer file like config/initializers/akismet.rb with your configuration:
    \n
    \nAkismet.key = '123456789'
    \nAkismet.blog = 'http://example.com'
    \nAkismet.logger = Rails.logger
    \n
    \n<!--more-->
    \n<strong>2. 修改代码</strong>
    \n<strong>#修改Reply.rb,添加</strong>
    \n<pre lang="ruby" line="1">
    \nfield :spam, :type =&gt; Boolean, :default =&gt; false
    \n

    \n#修改RepliesController

    \n\n

    coding: utf-8

    \n\n

    class RepliesController < ApplicationController```

    \n\n

    load_and_authorize_resource :reply

    \n\n

    before_filter :find_topic
    \ndef create

    \n\n

    @reply = @topic.replies.build(params[:reply])

    \n\n

    @reply.user_id = current_user.id
    \n@reply.spam = Akismet.spam?(akismet_attributes, request)
    \nlogger.info("akismet_attributes:\#{akismet_attributes}")
    \nlogger.info("@reply.spam:\#{@reply.spam}")
    \nif @reply.save
    \ncurrent_user.read_topic(@topic)
    \n@msg = t("topics.reply_success")
    \nelse
    \n@msg = @reply.errors.full_messages.join("
    \n")
    \nend
    \nend

    \n\n

    def edit
    \n@reply = current_user.replies.find(params[:id])
    \ndrop_breadcrumb(t("menu.topics"), topics_path)
    \ndrop_breadcrumb t("reply.edit_reply")
    \nend

    \n\n

    def update
    \n@reply = current_user.replies.find(params[:id])

    \n\n

    if @reply.update_attributes(params[:reply])
    \nredirect_to(topic_path(@reply.topic_id), :notice => '回帖更新成功.')
    \nelse
    \nrender :action => "edit"
    \nend
    \nend

    \n\n

    protected

    \n\n

    def akismet_attributes
    \n{
    \n:comment_author => @reply.user.login,
    \n:comment_author_url => user_url(@reply.user.login),
    \n:comment_author_email => @reply.user.email,
    \n:comment_content => @reply.body,
    \n:permalink => topic_url(@reply.topic_id)
    \n}
    \nend

    \n\n

    def find_topic
    \n@topic = Topic.find(params[:topic_id])
    \nend

    \n\n

    end

    \n
    #修改Cpanel::RepliesController,增加如下两个方法\n<pre lang="ruby" line="1">\ndef spam\n@reply = Reply.find(params[:id])\n@reply.update_attribute(:spam, true)\nAkismet.submit_spam(akismet_attributes)\nredirect_to(cpanel_replies_path)\nend\n\ndef ham\n@reply = Reply.find(params[:id])\n@reply.update_attribute(:spam, true)\nAkismet.submit_ham(akismet_attributes)\nredirect_to(cpanel_replies_path)\nend\n
    \n
    \n\n

    #修改routes文件
    \n
    \nresources :replies do
    \nmember do
    \npost :spam
    \npost :ham
    \nend
    \nend
    \n```

    \n\n

    再修改下view和locales文件就可以了,具体的就不贴了,可以在github上看到

    \n\n

    https://github.com/IceskYsl/android-group/commit/79fabb06b12fd776b301fed2c7c10aee744c5974

    \n\n

    也可以参考:
    \nhttp://rubydoc.info/github/ysbaddaden/ruby-akismet/master/frames

    \n\n

    项目地址:
    \nhttps://github.com/huacnlee/ruby-china
    \nhttps://github.com/IceskYsl/android-group

    \n", "_id"=>579}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"nginx upstream的5种配置方式", "body"=>"nginx的upstream目前支持5种方式的分配\r\n\r\n1、轮询(默认)\r\n每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。\r\n\r\n2、weight\r\n指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。\r\n例如:\r\n````upstream bakend {\r\nserver 192.168.0.14 weight=10;\r\nserver 192.168.0.15 weight=10;\r\n}```\r\n\r\n3、ip_hash \r\n每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。\r\n例如:\r\nupstream bakend {\r\nip_hash;\r\nserver 192.168.0.14:88;\r\nserver 192.168.0.15:80;\r\n}\r\n\r\n4、fair(第三方)\r\n按后端服务器的响应时间来分配请求,响应时间短的优先分配。\r\n````upstream backend {\r\nserver server1;\r\nserver server2;\r\nfair;\r\n}```\r\n\r\n5、url_hash(第三方)\r\n按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。\r\n例:在upstream中加入hash语句,server语句中不能写入weight等其他的参数,hash_method是使用的hash算法\r\n\r\n````upstream backend {\r\nserver squid1:3128;\r\nserver squid2:3128;\r\nhash $request_uri;\r\nhash_method crc32;\r\n}```\r\n\r\ntips:\r\n````upstream bakend{#定义负载均衡设备的Ip及设备状态\r\nip_hash;\r\nserver 127.0.0.1:9090 down;\r\nserver 127.0.0.1:8080 weight=2;\r\nserver 127.0.0.1:6060;\r\nserver 127.0.0.1:7070 backup;\r\n}```\r\n在需要使用负载均衡的server中增加\r\nproxy_pass http://bakend/;\r\n\r\n每个设备的状态设置为:\r\n
    1.down 表示单前的server暂时不参与负载\r\n2.weight 默认为1.weight越大,负载的权重就越大。\r\n3.max_fails :允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream 模块定义的错误\r\n4.fail_timeout:max_fails次失败后,暂停的时间。\r\n5.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
    \r\nnginx支持同时设置多组的负载均衡,用来给不用的server来使用。\r\n\r\nclient_body_in_file_only 设置为On 可以讲client post过来的数据记录到文件中用来做debug\r\nclient_body_temp_path 设置记录文件的目录 可以设置最多3层目录\r\nlocation 对URL进行匹配.可以进行重定向或者进行新的代理 负载均衡\r\n\r\n参考:\r\nhttp://wiki.nginx.org/HttpUpstreamModule\r\nhttp://www.pagefault.info/?p=251", "created_at"=>2012-01-03 04:00:53 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    nginx的upstream目前支持5种方式的分配

    \n\n

    1、轮询(默认)
    \n每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。

    \n\n

    2、weight
    \n指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。
    \n例如:
    \n`upstream bakend {
    \nserver 192.168.0.14 weight=10;
    \nserver 192.168.0.15 weight=10;
    \n}

    \n\n

    3、ip_hash
    \n每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。
    \n例如:
    \nupstream bakend {
    \nip_hash;
    \nserver 192.168.0.14:88;
    \nserver 192.168.0.15:80;
    \n}

    \n\n

    4、fair(第三方)
    \n按后端服务器的响应时间来分配请求,响应时间短的优先分配。
    \n`upstream backend {
    \nserver server1;
    \nserver server2;
    \nfair;
    \n}

    \n\n

    5、url_hash(第三方)
    \n按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。
    \n例:在upstream中加入hash语句,server语句中不能写入weight等其他的参数,hash_method是使用的hash算法<!--more-->

    \n\n

    `upstream backend {
    \nserver squid1:3128;
    \nserver squid2:3128;
    \nhash $request_uri;
    \nhash_method crc32;
    \n}

    \n\n

    tips:
    \n`upstream bakend{#定义负载均衡设备的Ip及设备状态
    \nip_hash;
    \nserver 127.0.0.1:9090 down;
    \nserver 127.0.0.1:8080 weight=2;
    \nserver 127.0.0.1:6060;
    \nserver 127.0.0.1:7070 backup;
    \n}

    \n在需要使用负载均衡的server中增加
    \nproxy_pass http://bakend/;

    \n\n

    每个设备的状态设置为:
    \n1.down 表示单前的server暂时不参与负载
    \n2.weight 默认为1.weight越大,负载的权重就越大。
    \n3.max_fails :允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream 模块定义的错误
    \n4.fail_timeout:max_fails次失败后,暂停的时间。
    \n5.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
    \nnginx支持同时设置多组的负载均衡,用来给不用的server来使用。

    \n\n

    client_body_in_file_only 设置为On 可以讲client post过来的数据记录到文件中用来做debug
    \nclient_body_temp_path 设置记录文件的目录 可以设置最多3层目录
    \nlocation 对URL进行匹配.可以进行重定向或者进行新的代理 负载均衡

    \n\n

    参考:
    \nhttp://wiki.nginx.org/HttpUpstreamModule
    \nhttp://www.pagefault.info/?p=251

    \n", "_id"=>580}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["nginx", "statistics", "upstream"], "comments_count"=>0, "category_id"=>9, "title"=>"NGINX upstream statistics", "body"=>"使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置\r\n\r\n#create by ice 2011.12.22\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\nserver {\r\nlisten 80;\r\nserver_name www.iceskysl.com;\r\nerror_log /opt/nginx/logs/error/error_v2_www.log;\r\naccess_log /opt/nginx/logs/access/access_v2_www.log main;\r\n\r\nroot /var/www/v2/public/;\r\nindex index.html index.htm;\r\n\r\nlocation / {\r\nproxy_redirect off;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header Host $host;\r\nproxy_set_header Content-Length $content_length;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nclient_max_body_size 10m;\r\nclient_body_buffer_size 128k;\r\nproxy_connect_timeout 90;\r\nproxy_send_timeout 90;\r\nproxy_read_timeout 90;\r\nproxy_buffer_size 4k;\r\nproxy_buffers 4 32k;\r\nproxy_busy_buffers_size 64k;\r\nproxy_temp_file_write_size 64k;\r\nchunked_transfer_encoding off;\r\nproxy_pass http://unicon_v2_www/;\r\n}\r\n}\r\n\r\n其中upstream的这段配置:\r\nupstream unicon_v2_www {\r\n# This is the socket we configured in unicorn.rb\r\nserver unix:/var/www/v2/tmp/sockets/unicorn.sock backup;\r\nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;\r\nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;\r\n}\r\n\r\n我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。\r\n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:\r\n
    USTATS module provides basic statistics for each backend in nginx upstreams:\r\n\r\nNumber of requests\r\nHttp 499/500/503 errors count\r\nTcp errors\r\nHttp read/write timeouts\r\nFail timeout\r\nMax fails count\r\nLast failed access time\r\nTotal fails count\r\nBlacklisted backend highlighting\r\nDown backends highlighting\r\nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending \"?json\" to the end of location on which the module was set to work on (see configuration instructions below).
    \r\n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)\r\n详细使用指南:http://code.google.com/p/ustats/\r\n\r\n\"\"", "created_at"=>2012-01-03 05:59:10 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    使用过nginx的应该都都晓得upstream,前面一篇文章说到《nginx upstream的5种配置方式》,例如如下是很常见的一段配置

    \n\n

    create by ice 2011.12.22

    \n\n

    upstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}
    \nserver {
    \nlisten 80;
    \nserver_name www.iceskysl.com;
    \nerror_log /opt/nginx/logs/error/error_v2_www.log;
    \naccess_log /opt/nginx/logs/access/access_v2_www.log main;

    \n\n

    root /var/www/v2/public/;
    \nindex index.html index.htm;

    \n\n

    location / {
    \nproxy_redirect off;
    \nproxy_set_header X-Real-IP $remote_addr;
    \nproxy_set_header Host $host;
    \nproxy_set_header Content-Length $content_length;
    \nproxy_set_header X-Forwarded-For $remote_addr;
    \nclient_max_body_size 10m;
    \nclient_body_buffer_size 128k;
    \nproxy_connect_timeout 90;
    \nproxy_send_timeout 90;
    \nproxy_read_timeout 90;
    \nproxy_buffer_size 4k;
    \nproxy_buffers 4 32k;
    \nproxy_busy_buffers_size 64k;
    \nproxy_temp_file_write_size 64k;
    \nchunked_transfer_encoding off;
    \nproxy_pass http://unicon_v2_www/;
    \n}
    \n}

    \n\n

    其中upstream的这段配置:
    \nupstream unicon_v2_www {

    \n\n

    This is the socket we configured in unicorn.rb

    \n\n

    server unix:/var/www/v2/tmp/sockets/unicorn.sock backup;
    \nserver 192.168.0.1:5000 weight=9 max_fails=2 fail_timeout=30s;
    \nserver 192.168.0.2:5000 weight=3 max_fails=2 fail_timeout=30s;
    \n}

    \n\n

    我们了解到socket模式的这个是backup,其他两个机器分别weight=3和weight=9,于是我们想监控下upstream每个后端具体处理了多少请求,有没有问题等,这个好像就不好监控了,nginx自带的status模块只能监控总的请求数,无法区分每个upstream的具体情况。
    \n找到一个ustats(http://code.google.com/p/ustats/),其介绍是:NGINX basic upstream statistics module,具体的如下:<!--more-->
    \nUSTATS module provides basic statistics for each backend in nginx upstreams:

    \n\n

    Number of requests
    \nHttp 499/500/503 errors count
    \nTcp errors
    \nHttp read/write timeouts
    \nFail timeout
    \nMax fails count
    \nLast failed access time
    \nTotal fails count
    \nBlacklisted backend highlighting
    \nDown backends highlighting
    \nThe module allows you to sort values in some columns for each separate upstream. The data can be retrieved as JSON by appending "?json" to the end of location on which the module was set to work on (see configuration instructions below).
    \n看上去正是我需要的,有时间试试看~(为啥nginx不学haproxy官方自带一个详细statistics的页面呢~haproxy那个statistics很详细很好用~)
    \n详细使用指南:http://code.google.com/p/ustats/

    \n\n", "_id"=>581}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客记忆:2007年-2011年的博客汇总", "body"=>"晚上心血来潮整理起自己的博客,从2007年开始到现在,快900篇文章,慢慢的整理,记忆一点点的浮现(工作,深圳,北京,创业,成长),发现博客的记忆是片段的有思想的,微博则是零碎的不成体系的废话,为了记忆,以后还是多写点博客~\r\n\r\n1.文章分类汇总\r\n\r\n\"\" \"\"\r\n\r\n从分类上看,过去几年更多的积累还是在技术上,ruby,mac,android和security还是比较多(杂七杂八的分类是中间迁移的时候分类信息丢了的缘故,里面也基本上技术的文字),产品分类是才加上的,现在技术做的比较少了,产品关注的多一些,以后会有更多关于产品相关的~\r\n\r\n2. 按月归档\r\n\r\n\"\"\r\n\r\n看看之前写的纪录,2007到2010年都还算蛮规律的,基本上每个月都会有数量不等的文章~而2011年开始看到写的急剧减少,一个是因为weibo的出现,平日的只言片语都丢weibo上了;二是懒了,写不出大段的文字~\r\n\r\n\r\n\r\n\r\n今天晚上仔细把模板修葺了一下,以后会多三个方面的内容,一个是前面说到的产品,产品是现在看的比较多的;另外一个是和创业相关的文字,创业两年来,我想是有些东西可以分享的;第三个是旅行相关的,本来这个博客是定位技术的,生活会少一些的,后面会写一些和自己的旅行,成长相关的内容~", "created_at"=>2012-01-03 08:56:18 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    晚上心血来潮整理起自己的博客,从2007年开始到现在,快900篇文章,慢慢的整理,记忆一点点的浮现(工作,深圳,北京,创业,成长),发现博客的记忆是片段的有思想的,微博则是零碎的不成体系的废话,为了记忆,以后还是多写点博客~

    \n\n

    1.文章分类汇总

    \n\n

     

    \n\n

    从分类上看,过去几年更多的积累还是在技术上,ruby,mac,android和security还是比较多(杂七杂八的分类是中间迁移的时候分类信息丢了的缘故,里面也基本上技术的文字),产品分类是才加上的,现在技术做的比较少了,产品关注的多一些,以后会有更多关于产品相关的~<!--more-->

    \n\n

    2. 按月归档

    \n\n\n

    看看之前写的纪录,2007到2010年都还算蛮规律的,基本上每个月都会有数量不等的文章~而2011年开始看到写的急剧减少,一个是因为weibo的出现,平日的只言片语都丢weibo上了;二是懒了,写不出大段的文字~

    \n\n\n

    今天晚上仔细把模板修葺了一下,以后会多三个方面的内容,一个是前面说到的产品,产品是现在看的比较多的;另外一个是和创业相关的文字,创业两年来,我想是有些东西可以分享的;第三个是旅行相关的,本来这个博客是定位技术的,生活会少一些的,后面会写一些和自己的旅行,成长相关的内容~

    \n", "_id"=>582}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"奶奶离开了我们,永远的", "body"=>"时间很快,转眼间走完了2011年,正在感谢2011年亲戚朋友都健康的时候,奶奶即将迎来90高寿。\n然前天晚上家里电话说奶奶住院,有点不舒服,应该无大碍。夜里睡觉不能安心,几次惊醒,就觉得不对劲了。\n果不其然,昨天早上家里来电,奶奶病危,出院回家了,让我们准备回来,准备归的时候又接电话说奶奶回到家了,状况好转。昨天是奶奶90岁生日,我们都觉得挺过这个坎应该就好了,默默祈祷,快到夜里12点的时候,我们都觉得应该过去了。\n但是,最后10多分钟还是没能走完,奶奶离开了我们,在她90岁生日的时候,奶奶没有受苦,是安详的离去的,千里奔袭,一路走一路默默流泪,回去送奶奶最后一程。", "created_at"=>2012-01-06 15:06:33 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    时间很快,转眼间走完了2011年,正在感谢2011年亲戚朋友都健康的时候,奶奶即将迎来90高寿。
    \n然前天晚上家里电话说奶奶住院,有点不舒服,应该无大碍。夜里睡觉不能安心,几次惊醒,就觉得不对劲了。
    \n果不其然,昨天早上家里来电,奶奶病危,出院回家了,让我们准备回来,准备归的时候又接电话说奶奶回到家了,状况好转。昨天是奶奶90岁生日,我们都觉得挺过这个坎应该就好了,默默祈祷,快到夜里12点的时候,我们都觉得应该过去了。
    \n但是,最后10多分钟还是没能走完,奶奶离开了我们,在她90岁生日的时候,奶奶没有受苦,是安详的离去的,千里奔袭,一路走一路默默流泪,回去送奶奶最后一程。

    \n", "_id"=>583}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"小心ruby中Array的include?方法", "body"=>"前几天遇到一个很诡异的情况,昨天终于找到根本原因并解决了,我觉得有必要把这个过程纪录下,应该会有人遇到类似的问题。\r\n\r\n前几天在一个坛子里问“每天500w条log如何入mysql库比较靠谱”,需求是\r\n
    我们有个产品,每天差不多500w的业务量,需要对500w做相关的分析,就需要入库~\r\n目前用的是mysql 按月切表定期老化数据,但是导入数据情况比较糟糕~每天导入数据差不多需要20个小时,和MySQL 5000 records/second差距巨大~\r\n尝试过三个方案:\r\n1. 定期解析日志,直接入库;\r\n2. 定期解析日志,生成sql,再直接sql入库;\r\n3. 生成data文件,load到库里\r\n但是效果都不理想~ 没什么大数据处理的经验,大家支招~~~
    \r\n其中第一种方案基本上被抛弃了,采用第二种方案,但是还是很糟糕,500w的数据差不多需要10来个小时,还是无法接受,于是仔细剖析了下过程:\r\n
    1. 准备sql文件\r\nsqlFileName = RAILS_ROOT + \"/log/insert.sql.\" + LOG_POSTFIX_FOR_YESTERDAY\r\nsqlfile = File.open(sqlFileName, \"w\")\r\n2. 打开日志文件\r\nFile.open(\"../log/apps.log.\#{LOG_POSTFIX_FOR_YESTERDAY}\").each do |line|\r\n3.提取需要的数据\r\nid, apk_id, ip, client_id, channel_id, uniquely_code ,track = line.split(\" : \")[1].split(\",\")\r\n4. 生成sql串\r\nsqlInsert = \"INSERT logs_downloads.....balalaalala\r\n5. 写到sql文件里\r\nsqlfile.puts( sqlInsert )\r\n6. 调mysql直接导入sql\r\n里面还有一些数据的清洗和排重工作~\r\n每天的日志文件差不多500w行,解析生成sql的过程不理想(其中没用数据库操作)~ 难道是我磁盘性能很糟糕~~
    \r\n过程看到基本上都没问题,无外乎解析文件,写文件的操作,不应该慢成这样的,最后把目光放在了数据的清洗和排重工作种,这个过程是想在入库的时候就把一些虚假的量排除掉,于是我们自己设计了一个算法来过滤,算法的逻辑很简单,根据一些参赛md5出一个key,然后把这个key丢在Array中,然后用include?来判断这个key是否已经存在,问题就出在这里!\r\n\r\nruby的Array中的include?是需要很小心的,我之前想当然的认为这个方法应该很快,也没仔细看就用了,结果发现问题就在这个方法上,直接上下源码看看:\r\n\"\"\r\n当看到:\r\n````\r\nfor (i=0; i #blalalal\r\n}\r\n```\r\n\r\n这个的时候我就明白了,果然,这个方法直接遍历Array,然后你可以想想当我有个500w大小的Array的时候,再用include?是何等的情景啦~\r\n修改方案很容易了,改用hash就好了,不多说~~", "created_at"=>2012-01-17 07:18:18 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    前几天遇到一个很诡异的情况,昨天终于找到根本原因并解决了,我觉得有必要把这个过程纪录下,应该会有人遇到类似的问题。

    \n\n

    前几天在一个坛子里问“每天500w条log如何入mysql库比较靠谱”,需求是
    \n我们有个产品,每天差不多500w的业务量,需要对500w做相关的分析,就需要入库~
    \n目前用的是mysql 按月切表定期老化数据,但是导入数据情况比较糟糕~每天导入数据差不多需要20个小时,和MySQL 5000 records/second差距巨大~
    \n尝试过三个方案:
    \n1. 定期解析日志,直接入库;
    \n2. 定期解析日志,生成sql,再直接sql入库;
    \n3. 生成data文件,load到库里
    \n但是效果都不理想~ 没什么大数据处理的经验,大家支招~~~
    \n其中第一种方案基本上被抛弃了,采用第二种方案,但是还是很糟糕,500w的数据差不多需要10来个小时,还是无法接受,于是仔细剖析了下过程:<!--more-->
    \n1. 准备sql文件
    \nsqlFileName = RAILS_ROOT + "/log/insert.sql." + LOG_POSTFIX_FOR_YESTERDAY
    \nsqlfile = File.open(sqlFileName, "w")
    \n2. 打开日志文件
    \nFile.open("../log/apps.log.\#{LOG_POSTFIX_FOR_YESTERDAY}").each do |line|
    \n3.提取需要的数据
    \nid, apk_id, ip, client_id, channel_id, uniquely_code ,track = line.split(" : ")[1].split(",")
    \n4. 生成sql串
    \nsqlInsert = "INSERT logs_downloads.....balalaalala
    \n5. 写到sql文件里
    \nsqlfile.puts( sqlInsert )
    \n6. 调mysql直接导入sql
    \n里面还有一些数据的清洗和排重工作~
    \n每天的日志文件差不多500w行,解析生成sql的过程不理想(其中没用数据库操作)~ 难道是我磁盘性能很糟糕~~
    \n过程看到基本上都没问题,无外乎解析文件,写文件的操作,不应该慢成这样的,最后把目光放在了数据的清洗和排重工作种,这个过程是想在入库的时候就把一些虚假的量排除掉,于是我们自己设计了一个算法来过滤,算法的逻辑很简单,根据一些参赛md5出一个key,然后把这个key丢在Array中,然后用include?来判断这个key是否已经存在,问题就出在这里!

    \n\n

    ruby的Array中的include?是需要很小心的,我之前想当然的认为这个方法应该很快,也没仔细看就用了,结果发现问题就在这个方法上,直接上下源码看看:
    \n
    \n当看到:
    \n`
    \nfor (i=0; i #blalalal
    \n}
    \n

    \n\n

    这个的时候我就明白了,果然,这个方法直接遍历Array,然后你可以想想当我有个500w大小的Array的时候,再用include?是何等的情景啦~
    \n修改方案很容易了,改用hash就好了,不多说~~

    \n", "_id"=>584}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>7, "title"=>"不常用但很有用的linux命令", "body"=>"这里纪录一些不常用但很有用的linux命令\r\n\r\n#通过端口号找到进程(13543这个就是进程号)\r\n[root@ lab]# netstat -lnp | grep 9000\r\ntcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 13543/unicorn.rb -D ", "created_at"=>2012-01-18 00:18:12 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    这里纪录一些不常用但很有用的linux命令

    \n\n

    通过端口号找到进程(13543这个就是进程号)

    \n\n

    [root@ lab]# netstat -lnp | grep 9000
    \ntcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 13543/unicorn.rb -D

    \n", "_id"=>585}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["2011", "2012", "计划"], "comments_count"=>0, "category_id"=>5, "title"=>"2011计划年度总结回顾,2012年预期", "body"=>"时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:\r\n\r\n2010年总结的时候曾写到:《2010年总结,2011年展望》\r\n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!\r\n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~\r\n\r\n2. 能做一个有可能改变世界的产品;\r\n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~\r\n\r\n3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;\r\n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~\r\n\r\n4. 在技术,英语,管理,交际方面有着长足的提高;\r\n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?\r\n\r\n5. 能找到一个合适的定居的地方为安定下来做些准备;\r\n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~\r\n\r\n6. 能和tina一起去一次远途旅行,欧洲?也许吧;\r\n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~\r\n\r\n7.能拿到驾照,顺便也有个属于自己的交通工具;\r\n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~\r\n\r\n8. 多些空闲,多看看书,多些思考,多些时间写写东西!\r\n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;\r\n\r\n9. 亲戚,朋友包括我和tina都健康快乐!\r\n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。\r\n\r\n10. 世界太平,和谐迎接2012!\r\n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!\r\n\r\n2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~\r\n\r\n2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~\r\n\r\n2012年的预期如下:\r\n工作\r\n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;\r\n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;\r\n3. 规划布局和管理能力可以有沉淀,有积累;\r\n4. 外语能有长足的进步,可以听说流畅;\r\n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;\r\n\r\n兴趣爱好\r\n1. 系统学习摄影,有一台单反;\r\n2. 主导或者贡献一个开源产品或项目;\r\n3. 在一个计算机技能的新领域有所突破;\r\n4. 策划并出版至少一本新书;\r\n5. 多看好书和电影,多些分享和总结,多写blog;\r\n\r\n生活\r\n1. 拿到驾照,有自己的交通工具;\r\n2. 感情甜蜜,并开始实施定居和下一代计划;\r\n3. 和tina一起去至少两个地方旅行,草原和欧洲;\r\n4. 常回家看看,多些时间陪陪他们\r\n5. 自己,tina,家人,朋友都健康快乐度过2012;\r\n\r\n希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~", "created_at"=>2012-01-24 19:30:37 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    时间飞快,清晰的记得2010年末写总结的情形,转眼间,一年的时间又过去,我需要坐下来回顾下2010年写给2011年的计划的完成情况,顺便给我的2012年列些预期了:

    \n\n

    2010年总结的时候曾写到:《2010年总结,2011年展望》
    \n1. eoe能健康发展,成为这次移动互联网浪潮的android方面的赢家!
    \n回顾:2011年是eoe的发展年,我们从小到大,逐步成长,2011年初的时候我们还在西二旗的辉煌国际,20来个人,没什么品牌,没多少收入。2011年的eoe成长了不少,我们从20多人扩展到60多人,我们从商住两用的200平的办公室搬到了凯旋中心正规的400多平的办公室,我们自己的产品按照自己的规划和节奏逐步完善;我们有了自己的线下沙龙,扩展到上海,广州等地,初步形成我们自己的品牌和口碑。我们有了一些收入,我们有了发展壮大的资源,我们的团队更爱自己的工作,更爱eoe的氛围。现在说输赢都还为时尚早,我们正在前进的路上~

    \n\n

    2. 能做一个有可能改变世界的产品;
    \n回顾:主导了一个产品,按照既定的计划和方向,这个产品还在完善中,何时能腾飞成为明星还不得而知,但是我们磨练了团队,摸索前进了大半年,我们对这个方向坚定不移,我们还在等待机会,我们需要一些时间,2012将是看到我们成果的时间~

    \n\n

    3. tina能找到自己真正喜欢的工作,做自己喜欢的事情;
    \n回顾:tina在2011年的上半年是折腾的,尝试了好几家公司和工作,在下半年找到适合自己的工作,也是个很不错的德国企业,这个算是达成了~

    \n\n

    4. 在技术,英语,管理,交际方面有着长足的提高;
    \n回顾:这个目标不符合swot规则,无法鉴定完成的怎么样了,大概说说感受。2011年的技术只在架构方面有所长进,英语还是不过关,管理学会了系统化看问题和分解问题,懂得了一点点的管理,交际好像改观不大,客串了几次活动主持人,现在上台完全不紧张了,算是进步不?

    \n\n

    <!--more-->5. 能找到一个合适的定居的地方为安定下来做些准备;
    \n回顾:这个不及格,虽然有了一个自己的小窝,但是依然还在北京漂着,还是没有找到理想的定居地点,还是不喜欢北京的天气和氛围,还是希望能找一个南边的地方定居,我喜欢温暖的,开放的,年轻的城市,哪个才是我理想的定居城市,继续寻找中~

    \n\n

    6. 能和tina一起去一次远途旅行,欧洲?也许吧;
    \n回顾:2011年和tina出去转了两次,10.1日去了宁夏的银川和中卫,第一次去了祖国的大西北,看到了戈壁和沙漠,体验了大西北的风土人情。然后在2011年圣诞节前夕去了新加坡,没能去成欧洲,就选择去了新加坡,很喜欢新加坡这个城市,干净整齐,气候温暖清新~

    \n\n

    7.能拿到驾照,顺便也有个属于自己的交通工具;
    \n回顾:开始学驾照了,交规考了100分,但是还没来得及练车,也就没能拿到驾照,更没有自己的交通工具,看来还的抓紧了~

    \n\n

    8. 多些空闲,多看看书,多些思考,多些时间写写东西!
    \n回顾:2011年的下半年时间多了一些,不用天天救火和打杂了,看了一些感兴趣的书,比如《怪诞行为学》,《异类》,《暗时间》,《裂变》,《未来是湿的》,《jobs传》以及一堆技术,产品和交互设计的书籍,看的多,但是写的不多,在weibo上絮叨了3000多条,但是不系统,都是零碎散落的,2012年会多写读后感,多些文字纪录的;

    \n\n

    9. 亲戚,朋友包括我和tina都健康快乐!
    \n回顾:2011年是平安的,自己,家人,亲戚,朋友都健康无恙,谢谢上苍;2012年1月的适合,90岁的奶奶在她生日的那天安详的离去了,天堂更加美好,我们会想念您的。

    \n\n

    10. 世界太平,和谐迎接2012!
    \n回顾:2011年世界不太平静,地震,火山,核泄漏,战争,饥荒,瘟疫,空气污染还是遍布世界,这是个伤痕累累的地球,能否挺过2012,深表担忧!

    \n\n

    2011年已经成为过去时,过去的2011年波澜不惊,虽有过压力,也有过迷茫,但是始终没摇摆的是一颗勇敢的心,有家庭的支持和朋友的鼓励,我们顺利的上岸了,归总一句话:2011年没有浪费,是满负荷的,每天也都是新的,每天都有新收获~

    \n\n

    2012年来的有点突然,有点匆忙,还有点蛮横,一不留神,2012已经来到面前,2012年最终会是怎样还不得而知,现在的我至少可以列举一些预期,权当自勉~

    \n\n

    2012年的预期如下:
    \n工作
    \n1. eoe再上一个大台阶,产品和品牌在业界都能排在第一梯队,公司和团队能健康发展;
    \n2. 主导的x产品的推出和扩大影响力,达到预期水平,可以在一个领域成为领头羊;
    \n3. 规划布局和管理能力可以有沉淀,有积累;
    \n4. 外语能有长足的进步,可以听说流畅;
    \n5. 理解产品和流量运营,新媒体等社会化营销的相关理论和操作方法;

    \n\n

    兴趣爱好
    \n1. 系统学习摄影,有一台单反;
    \n2. 主导或者贡献一个开源产品或项目;
    \n3. 在一个计算机技能的新领域有所突破;
    \n4. 策划并出版至少一本新书;
    \n5. 多看好书和电影,多些分享和总结,多写blog;

    \n\n

    生活
    \n1. 拿到驾照,有自己的交通工具;
    \n2. 感情甜蜜,并开始实施定居和下一代计划;
    \n3. 和tina一起去至少两个地方旅行,草原和欧洲;
    \n4. 常回家看看,多些时间陪陪他们
    \n5. 自己,tina,家人,朋友都健康快乐度过2012;

    \n\n

    希望2012不是世界末日,希望我还有机会写2012年的年度回顾和2013年预期~

    \n", "_id"=>586}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"博客功能修葺完毕,多写文字", "body"=>"年后回到北京,趁着还有一天稍微宽裕的时间,把博客又修葺了下,现在的结构是我很满意的,大致罗列下~\r\n\r\n1.导航区\r\n\"\"\r\n\r\n导航上是我的主要分类,目前有博客文章,旅行,书,音乐,电影,工具箱,团队以及我个人的信息,以后还会添加的有“我的订阅”,“我的项目”,“我的应用”等~\r\n\r\n2. 旅行\r\n\"\"\r\n我爱旅行,喜欢背着包到处跑,这个页面纪录我曾到过的地方,以后会把照片整理放上来的~\r\n\r\n3. 书\r\n\"\"\r\n“要么旅行要么读书,身体或者是心灵,总有一个需要在路上.”\r\n\r\n4. 音乐\r\n\"\"\r\n\r\n5. 电影\r\n\"\"\r\n\r\n另外,把n年前注册的个人域名启用了,大家以后可以通过: http://www.iceskysl.com/ 访问到这个网站~", "created_at"=>2012-01-27 22:47:29 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    年后回到北京,趁着还有一天稍微宽裕的时间,把博客又修葺了下,现在的结构是我很满意的,大致罗列下~

    \n\n

    1.导航区

    \n\n

    导航上是我的主要分类,目前有博客文章,旅行,书,音乐,电影,工具箱,团队以及我个人的信息,以后还会添加的有“我的订阅”,“我的项目”,“我的应用”等~<!--more-->

    \n\n
      \n
    1. 旅行
      \n
      \n我爱旅行,喜欢背着包到处跑,这个页面纪录我曾到过的地方,以后会把照片整理放上来的~

    2. \n

    3. \n
      \n“要么旅行要么读书,身体或者是心灵,总有一个需要在路上.”

    4. \n
    5. 音乐

    6. \n
    7. 电影

    8. \n
    \n\n

    另外,把n年前注册的个人域名启用了,大家以后可以通过: http://www.iceskysl.com/ 访问到这个网站~

    \n", "_id"=>587}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"排斥WYSIWYG编辑器", "body"=>"这个blog从2007年开始写,到现在差不多有4-5年了,最开始是用的php的Sablog-X,后来用了自己写的一套rails的1stlog,后来用转到wordpress上一直至今~\r\n\r\n做为大众博客引擎,wordpress是合适的,但是做为技术人员,wordpress太傻瓜了,最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~\r\n\r\n别哪天手痒,又写一套blog引擎吧~ balala~", "created_at"=>2012-01-28 00:45:52 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    这个blog从2007年开始写,到现在差不多有4-5年了,最开始是用的php的Sablog-X,后来用了自己写的一套rails的1stlog,后来用转到wordpress上一直至今~

    \n\n

    做为大众博客引擎,wordpress是合适的,但是做为技术人员,wordpress太傻瓜了,最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~

    \n\n

    别哪天手痒,又写一套blog引擎吧~ balala~

    \n", "_id"=>588}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["chrome"], "comments_count"=>0, "category_id"=>10, "title"=>".NFClass red links chrome问题排查和解决", "body"=>"不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~ \r\n\r\n\"\"\r\n\r\n仔细检查,发现如下的css\r\n\"\"\r\n\r\n\r\n\r\n经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:\r\n
    \r\nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.\r\n\r\nThis attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)\r\n
    \r\n\r\n修复的方法很简单,去掉“Show no follo”的勾选就好了~\r\n", "created_at"=>2012-01-28 01:48:36 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    不知道从什么时间开始,我在chrome中看网页的时候经常能看到红色背景的链接文字,开始以为是网站的样式除了问题,后来觉得应该是chrome浏览器出了什么问题~

    \n\n\n

    仔细检查,发现如下的css

    \n\n

    经过检查(Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css),发现不是本地的css配置,最后找到是一个叫“SEO Site Tools”导致的,具体原因是:
    \n
    \nThe reason is simple. I installed an extension called SEO Site Tools which installs an icon on the right of the address bar. When you click the button, on the window displayed there is the option “Show no follo” which is an option for displaying links that have the value nofollow for the attribute rel of an HTML element.

    \n\n

    This attribute instructs some search engines that a hyperlink should not influence the link target’s ranking in the search engine’s index. (Source: wikipedia.org)

    \n\n

    修复的方法很简单,去掉“Show no follo”的勾选就好了~

    \n", "_id"=>589}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Html/css/js"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["CoffeeScript", "Connect", "Express", "jade", "JavaScript", "Node.js", "npm"], "comments_count"=>0, "category_id"=>10, "title"=>"CoffeeScript解决JavaScript不美,Node.js潜力巨大", "body"=>"如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。\r\n\r\n如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~\r\n\r\n#装npm\r\nice@mac:~ > curl http://npmjs.org/install.sh | sh\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584\r\ntar=/usr/bin/tar\r\nversion:\r\nbsdtar 2.8.3 - libarchive 2.8.3\r\ninstall npm@1.1\r\nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz\r\n0.6.2\r\n1.1.0-3\r\ncleanup prefix=/usr/local\r\n\r\nAll clean!\r\n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\nIt worked\r\n\r\n#看看怎么用\r\nice@mac:~ > npm help\r\n\r\nUsage: npm \r\n\r\nwhere is one of:\r\n adduser, apihelp, author, bin, bugs, c, cache, completion,\r\n config, deprecate, docs, edit, explore, faq, find, get,\r\n help, help-search, home, i, info, init, install, la, link,\r\n list, ll, ln, login, ls, outdated, owner, pack, prefix,\r\n prune, publish, r, rb, rebuild, remove, restart, rm, root,\r\n run-script, s, se, search, set, show, star, start, stop,\r\n submodule, tag, test, un, uninstall, unlink, unpublish,\r\n unstar, up, update, version, view, whoami\r\n\r\nnpm -h quick help on \r\nnpm -l display full usage info\r\nnpm faq commonly asked questions\r\nnpm help search for help on \r\nnpm help npm involved overview\r\n\r\nSpecify configs in the ini-formatted file:\r\n /Users/ice/.npmrc\r\nor on the command line via: npm --key value\r\nConfig info can be viewed via: npm help config\r\n\r\nnpm@1.1.0-3 /usr/local/lib/node_modules/npm\r\n\r\n#用npm装connect\r\nice@mac:~ > npm install connect\r\nnpm http GET https://registry.npmjs.org/connect\r\nnpm http 200 https://registry.npmjs.org/connect\r\nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/formidable\r\nnpm http 200 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz\r\nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz\r\nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz\r\nconnect@1.8.5 ./node_modules/connect \r\n├── mime@1.2.4\r\n├── qs@0.4.1\r\n└── formidable@1.0.8\r\n\r\n#用npm装express\r\nice@mac:~ > npm install express\r\nnpm http GET https://registry.npmjs.org/express\r\nnpm http 200 https://registry.npmjs.org/express\r\nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz\r\nnpm http GET https://registry.npmjs.org/mime\r\nnpm http GET https://registry.npmjs.org/qs\r\nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http 304 https://registry.npmjs.org/qs\r\nnpm http 304 https://registry.npmjs.org/mime\r\nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz\r\nexpress@2.5.6 ./node_modules/express \r\n├── mkdirp@0.0.7\r\n├── mime@1.2.4\r\n└── qs@0.4.1\r\n\r\n#用npm装jade\r\nice@mac:~ > npm install jade\r\nnpm http GET https://registry.npmjs.org/jade\r\nnpm http 200 https://registry.npmjs.org/jade\r\nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz\r\nnpm http GET https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/mkdirp\r\nnpm http 200 https://registry.npmjs.org/mkdirp\r\nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander\r\nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz\r\nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz\r\njade@0.20.0 ./node_modules/jade \r\n├── commander@0.2.1\r\n└── mkdirp@0.3.0\r\n\r\n好了,你入门了,更多资料,请自行查看如下链接的资料吧~\r\n\r\n相关资料\r\n\r\nCoffeeScript: CoffeeScript is a little language that compiles into JavaScript\r\nhttp://coffeescript.org/\r\n\r\n为什么CoffeeScript这么美?\r\nhttp://cnodejs.org/blog/?p=1584\r\n\r\nCoffeeScript: The beautiful way to write JavaScript\r\nhttp://amix.dk/blog/post/19612\r\n\r\n10个让朋友对你刮目相看的CoffeeScript单行代码绝技\r\nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/\r\n\r\nnpm: a package manager for node\r\nhttps://github.com/isaacs/npm\r\n\r\nExpress:http://expressjs.com/\r\nHigh performance, high class web development for Node.js\r\n\r\nConnect: Connect is a middleware layer for Node.js\r\nhttp://www.senchalabs.org/connect/\r\n\r\njade: http://jade-lang.com/\r\nNode Template Engine\r\n\r\ncoffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.\r\nhttps://github.com/qiao/coffee-box", "created_at"=>2012-01-28 14:57:06 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    如果你对JavaScript感兴趣,但是不喜欢写一大堆一大堆的JavaScript代码,那真的不是你的错,因为很多人都说JavaScript不美,究其原因,可以归纳为:JavaScript的诞生是个悲剧. 它是函数式+动态语言的优秀内核, 却硬被绑上了C/Java的语法。

    \n\n

    如果你真的喜欢JavaScript,那么你可以尝试了解更多~比如CoffeeScript,再比如Node.js,再比如Connect,再比如Express,再再比如jade,再再再比如npm等等,于是我们从安装npm(a package manager for node)开始~

    \n\n

    #装npm
    \nice@mac:~ > curl http://npmjs.org/install.sh | sh
    \n % Total % Received % Xferd Average Speed Time Time Time Current
    \n Dload Upload Total Spent Left Speed
    \n100 7881 100 7881 0 0 3664 0 0:00:02 0:00:02 --:--:-- 8584
    \ntar=/usr/bin/tar
    \nversion:
    \nbsdtar 2.8.3 - libarchive 2.8.3
    \ninstall npm@1.1
    \nfetching: http://registry.npmjs.org/npm/-/npm-1.1.0-3.tgz
    \n0.6.2
    \n1.1.0-3
    \ncleanup prefix=/usr/local

    \n\n

    All clean!
    \n/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    \nnpm@1.1.0-3 /usr/local/lib/node_modules/npm
    \nIt worked
    \n<!--more-->

    \n\n

    看看怎么用

    \n\n

    ice@mac:~ > npm help

    \n\n

    Usage: npm

    \n\n

    where is one of:
    \n adduser, apihelp, author, bin, bugs, c, cache, completion,
    \n config, deprecate, docs, edit, explore, faq, find, get,
    \n help, help-search, home, i, info, init, install, la, link,
    \n list, ll, ln, login, ls, outdated, owner, pack, prefix,
    \n prune, publish, r, rb, rebuild, remove, restart, rm, root,
    \n run-script, s, se, search, set, show, star, start, stop,
    \n submodule, tag, test, un, uninstall, unlink, unpublish,
    \n unstar, up, update, version, view, whoami

    \n\n

    npm -h quick help on
    \nnpm -l display full usage info
    \nnpm faq commonly asked questions
    \nnpm help search for help on
    \nnpm help npm involved overview

    \n\n

    Specify configs in the ini-formatted file:
    \n /Users/ice/.npmrc
    \nor on the command line via: npm --key value
    \nConfig info can be viewed via: npm help config

    \n\n

    npm@1.1.0-3 /usr/local/lib/node_modules/npm

    \n\n

    #用npm装connect
    \nice@mac:~ > npm install connect
    \nnpm http GET https://registry.npmjs.org/connect
    \nnpm http 200 https://registry.npmjs.org/connect
    \nnpm http GET https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http 200 https://registry.npmjs.org/connect/-/connect-1.8.5.tgz
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/formidable
    \nnpm http 200 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http GET https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
    \nnpm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.8.tgz
    \nnpm http 200 https://registry.npmjs.org/qs/-/qs-0.4.1.tgz
    \nconnect@1.8.5 ./node_modules/connect
    \n├── mime@1.2.4
    \n├── qs@0.4.1
    \n└── formidable@1.0.8

    \n\n

    #用npm装express
    \nice@mac:~ > npm install express
    \nnpm http GET https://registry.npmjs.org/express
    \nnpm http 200 https://registry.npmjs.org/express
    \nnpm http GET https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http 200 https://registry.npmjs.org/express/-/express-2.5.6.tgz
    \nnpm http GET https://registry.npmjs.org/mime
    \nnpm http GET https://registry.npmjs.org/qs
    \nnpm http GET https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http 304 https://registry.npmjs.org/qs
    \nnpm http 304 https://registry.npmjs.org/mime
    \nnpm http 200 https://registry.npmjs.org/mkdirp/0.0.7
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.0.7.tgz
    \nexpress@2.5.6 ./node_modules/express
    \n├── mkdirp@0.0.7
    \n├── mime@1.2.4
    \n└── qs@0.4.1

    \n\n

    #用npm装jade
    \nice@mac:~ > npm install jade
    \nnpm http GET https://registry.npmjs.org/jade
    \nnpm http 200 https://registry.npmjs.org/jade
    \nnpm http GET https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http 200 https://registry.npmjs.org/jade/-/jade-0.20.0.tgz
    \nnpm http GET https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/mkdirp
    \nnpm http 200 https://registry.npmjs.org/mkdirp
    \nnpm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander
    \nnpm http GET https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \nnpm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
    \nnpm http 200 https://registry.npmjs.org/commander/-/commander-0.2.1.tgz
    \njade@0.20.0 ./node_modules/jade
    \n├── commander@0.2.1
    \n└── mkdirp@0.3.0

    \n\n

    好了,你入门了,更多资料,请自行查看如下链接的资料吧~

    \n\n

    相关资料

    \n\n

    CoffeeScript: CoffeeScript is a little language that compiles into JavaScript
    \nhttp://coffeescript.org/

    \n\n

    为什么CoffeeScript这么美?
    \nhttp://cnodejs.org/blog/?p=1584

    \n\n

    CoffeeScript: The beautiful way to write JavaScript
    \nhttp://amix.dk/blog/post/19612

    \n\n

    10个让朋友对你刮目相看的CoffeeScript单行代码绝技
    \nhttp://heikezhi.com/2011/06/08/10-coffeescript-one-liners-to-impress-your-friends/

    \n\n

    npm: a package manager for node
    \nhttps://github.com/isaacs/npm

    \n\n

    Express:http://expressjs.com/
    \nHigh performance, high class web development for Node.js

    \n\n

    Connect: Connect is a middleware layer for Node.js
    \nhttp://www.senchalabs.org/connect/

    \n\n

    jade: http://jade-lang.com/
    \nNode Template Engine

    \n\n

    coffee-box: Blog engine for fashionable developers. Built upon Node.js, Express, MongoDB and CoffeeScript.
    \nhttps://github.com/qiao/coffee-box

    \n", "_id"=>590}]) +MONGODB iceylog_development['categories'].find({:_id=>10}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>10}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Database"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Graphviz", "rails-erd"], "comments_count"=>0, "category_id"=>3, "title"=>"rails-erd: 生成rails项目的实体关系图", "body"=>"写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:\r\n\r\n1. 首先安装Graphviz\r\n% brew install cairo pango graphviz # Homebrew on Mac OS X\r\n% sudo port install graphviz # Macports on Mac OS X\r\n% sudo aptitude install graphviz # Debian and Ubuntu \r\n\r\n2. 然后在开发环境中使用,在Gemfile添加\r\n``\r\ngroup :development do\r\n gem \"rails-erd\", :git => 'git://github.com/voormedia/rails-erd.git'\r\nend\r\n```\r\n\r\n3. 安装gem\r\n% bundle install \r\n\r\n4. 生成PDF\r\n% rake erd\r\n在项目根目录下就会生成ERD.pdf,效果类似:\r\n\"\"\r\n\r\n更多信息参考:http://rails-erd.rubyforge.org/\r\n\r\n附:常见错误处理:\r\nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.\r\n\r\n原因是rails-erd依赖choice这个gem,装下\r\nice@mac:/www/trunk > sudo gem install choice\r\nPassword:\r\nSuccessfully installed choice-0.1.4\r\n1 gem installed\r\nInstalling ri documentation for choice-0.1.4...\r\nInstalling RDoc documentation for choice-0.1.4...", "created_at"=>2012-01-28 18:47:49 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    写rails的好像很多人都没正儿八经的数据库设计文档(尽管这是不对的,但是还是很多人这么干了),随着项目越来越大,有时候我们需要搞明白实体间关系的时候就傻眼了,如何能形象的展示实体间的关系(Entity-Relationship Diagrams),rails-erd 这个gem 可以帮我们实现:

    \n\n
      \n
    1. 首先安装Graphviz
      \n% brew install cairo pango graphviz # Homebrew on Mac OS X
      \n% sudo port install graphviz # Macports on Mac OS X
      \n% sudo aptitude install graphviz # Debian and Ubuntu

    2. \n
    3. 然后在开发环境中使用,在Gemfile添加
      \n
      \ngroup :development do
      \ngem "rails-erd", :git => 'git://github.com/voormedia/rails-erd.git'
      \nend
      \n
      `

    4. \n
    5. 安装gem
      \n% bundle install

    6. \n
    7. 生成PDF
      \n% rake erd
      \n在项目根目录下就会生成ERD.pdf,效果类似:

    8. \n
    \n\n

    更多信息参考:http://rails-erd.rubyforge.org/
    \n<!--more-->
    \n附:常见错误处理:
    \nCould not find gem 'choice (~> 0.1.4) ruby', which is required by gem 'rails-erd (>= 0) ruby', in any of the sources.

    \n\n

    原因是rails-erd依赖choice这个gem,装下
    \nice@mac:/www/trunk > sudo gem install choice
    \nPassword:
    \nSuccessfully installed choice-0.1.4
    \n1 gem installed
    \nInstalling ri documentation for choice-0.1.4...
    \nInstalling RDoc documentation for choice-0.1.4...

    \n", "_id"=>591}]) +MONGODB iceylog_development['categories'].find({:_id=>3}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>3}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Google Task", "GTD"], "comments_count"=>0, "category_id"=>7, "title"=>"Google Task使用心得, 最合适的GTD工具", "body"=>"希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~\r\n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~\r\n\r\n其实我的需求蛮简单的,大概如下:\r\n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)\r\n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)\r\n3. 界面简洁,再简洁\r\n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用\r\n5. 可以打印或者email给朋友\r\n\r\n最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。\r\n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)\r\n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;\r\n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;\r\n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~\r\n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~\r\n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;\r\n\r\n此外,Google Task提供如下方式的使用,我个人觉得足够了\r\n1. gmail中集成/igoogle集成\r\n2. iphone客户端,android客户端(第三方开发的)\r\n3. chrome插件\r\n4. 桌面客户端(没找到,也不怎么用)\r\n5. api接口(或者自己写)\r\n\r\n如果硬说还可以有些期待的话,我的是这样的:\r\n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)\r\n2. 可以把一个list里没完成的复制到另外一个list中\r\n3. 真木了\r\n\r\n我的个人建议是:必须用好快捷键!\r\n\r\n希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助\r\n如果你有兴趣,可以看看它的官方帮助页面\r\nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237\r\n如果你针对Google Task有疑问,欢迎和我交流~", "created_at"=>2012-02-03 22:01:06 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    希望没有标题党,我属于半调子的GTD (Get Thing Done),我不会严格准收GTD的规则,只是寻找最合适的方法和工具来提高我的效率~
    \n尝试过很多GTD的工具,例如大名鼎鼎的things,37signals的Ta-Da List,doit.im,Remember the Milk(RTM)等等等~线上的,线下的,收费的,免费的,林林总总,好多好多~但是没一款是我用着非常顺手的~

    \n\n

    其实我的需求蛮简单的,大概如下:
    \n1. 需要支持快捷键(最好是手不离开键盘能完成全部操作,或者是纪录,整理list的主要工作)
    \n2. 需要支持子任务(最好是不限制级的,目前能用到3级别)
    \n3. 界面简洁,再简洁
    \n4. 支持多端访问,至少在电脑和手机(android&iphone)可以使用
    \n5. 可以打印或者email给朋友

    \n\n

    最终还是回到了Google Task,经过一段时间的使用,我现在已经非常喜欢Google Task,也给我的效率带来很大帮助,我可以把我的方式分享下。
    \n1. 每天开电脑的第一件事情就是开gmail,处理完邮件开始工作,顺手把gmail里把Google Task打开,并pop up出一个单独的窗口,拖拉到合适的大小;(我工作的时候是两个显示器,就把这个窗口一直放在外接显示器的边上,抬眼可见)
    \n2. 每周一个list,名字是时间范围,比如2012.02.06-2012.02.12;
    \n3. 周一的时候会尽量把本周要做的事情列进去(按照事情的类型或者项目,比如公司事务,eoemarket相关),再把要做的事情一个一个输入进去,Google Task的输入很方便,用好tab键和shift tab键来调整层级;用好Ctrl + Up和Ctrl + Down来调整顺序,用Shift + Enter进入到具体的事情中撰写详细,写完再Shift + Enter回到列表;
    \n4. 每次做事情的时候,可以用Tab再细分,一个一个执行掉;完成后回到Google Task,用Option + Enter 标识这个完成(Option + Enter这个快捷键在官方帮助文档和tips里都没,我自己找出来的,mac电脑);另外勾选上级条目可以把下级条目都标记完成~
    \n5. 每次遇到新的事情直接添加进去,经常review,如此反复就好了~
    \n6. 有的时候还通过打印和发送邮件通知其他人我都做了什么;

    \n\n

    此外,Google Task提供如下方式的使用,我个人觉得足够了
    \n1. gmail中集成/igoogle集成
    \n2. iphone客户端,android客户端(第三方开发的)
    \n3. chrome插件
    \n4. 桌面客户端(没找到,也不怎么用)
    \n5. api接口(或者自己写)

    \n\n

    如果硬说还可以有些期待的话,我的是这样的:
    \n1. 谁写个更好用的iphone客户端(现在app store上的质量一般,而且收费,哪天我心血来潮我来写一个去~)
    \n2. 可以把一个list里没完成的复制到另外一个list中
    \n3. 真木了

    \n\n

    我的个人建议是:必须用好快捷键!

    \n\n

    希望我的这篇介绍能让你喜欢Google Task,并对自己有所帮助
    \n如果你有兴趣,可以看看它的官方帮助页面
    \nhttp://support.google.com/mail/bin/answer.py?hl=en&ctx=mail&answer=106237
    \n如果你针对Google Task有疑问,欢迎和我交流~

    \n", "_id"=>592}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"入手kindle 4初体验", "body"=>"kindle刚出那会就想着能买一台读书,不知道什么原因没买成,年前又想起,在weibo上问过一次,大家反馈都还不错,过完年回来的一个周末突然想起,就跑到网上查,慢慢才搞明白kindle 4,kindle 3,还有kindle touch,kindle fire都啥区别,于是选了kindle 4,因为只用来读书,应该足够,于是就买了~\r\n\"\"\r\n\r\n在taobao上买的,发的顺风,第二天下午就送到,还是蛮速度的,拆箱子,开机,开始体验传说中的kindle 4~倒腾了一晚上,终于可以写点初体验,就不上图了,说几点我的体验。\r\n\r\n1. 价格真便宜,价格才79刀,taobao上也就600多块钱,应该不算贵吧,相比ipad之类的便宜的不是一点半点;\r\n2. 待机时间超长,重量很轻,加上一个皮套也很轻,轻的你可以躺在床上看也不觉得受累;\r\n3. 书籍蛮多,对中文支持不错,我的买回来的好像给我刷了多看系统,没搞明白啥玩意,直接被我恢复到原版了,对中文支持也很好,可以插上usb直接往里面拷书,也可以通过给username@free.kindle.com发邮件来推送;\r\n4. 推送到kindle的功能相当好用,虽然有所延迟,但是体验还是很好的,方便快捷;\r\n5. 显示效果真好,很柔和很自然(当然有的pdf排版不好的看着还是比较痛苦的)\r\n6. 打字很不方便,需要做读书笔记的要注意了,我连调出键盘输入wifi密码都觉得痛苦~\r\n\r\n如上是几点感受,我用了也还不久,如果你想了解更多,可以给我留言;如果你有更多好书,也可以分享给我,我不看小说,不要分享给我咯~", "created_at"=>2012-02-13 06:03:36 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    kindle刚出那会就想着能买一台读书,不知道什么原因没买成,年前又想起,在weibo上问过一次,大家反馈都还不错,过完年回来的一个周末突然想起,就跑到网上查,慢慢才搞明白kindle 4,kindle 3,还有kindle touch,kindle fire都啥区别,于是选了kindle 4,因为只用来读书,应该足够,于是就买了~

    \n\n

    在taobao上买的,发的顺风,第二天下午就送到,还是蛮速度的,拆箱子,开机,开始体验传说中的kindle 4~倒腾了一晚上,终于可以写点初体验,就不上图了,说几点我的体验。

    \n\n
      \n
    1. 价格真便宜,价格才79刀,taobao上也就600多块钱,应该不算贵吧,相比ipad之类的便宜的不是一点半点;
    2. \n
    3. 待机时间超长,重量很轻,加上一个皮套也很轻,轻的你可以躺在床上看也不觉得受累;
    4. \n
    5. 书籍蛮多,对中文支持不错,我的买回来的好像给我刷了多看系统,没搞明白啥玩意,直接被我恢复到原版了,对中文支持也很好,可以插上usb直接往里面拷书,也可以通过给username@free.kindle.com发邮件来推送;
    6. \n
    7. 推送到kindle的功能相当好用,虽然有所延迟,但是体验还是很好的,方便快捷;
    8. \n
    9. 显示效果真好,很柔和很自然(当然有的pdf排版不好的看着还是比较痛苦的)
    10. \n
    11. 打字很不方便,需要做读书笔记的要注意了,我连调出键盘输入wifi密码都觉得痛苦~
    12. \n
    \n\n

    如上是几点感受,我用了也还不久,如果你想了解更多,可以给我留言;如果你有更多好书,也可以分享给我,我不看小说,不要分享给我咯~

    \n", "_id"=>593}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>6, "title"=>"源于内心,回归更纯粹的技术 -记eoeAndroid社区新版上线", "body"=>"eoeAndroid社区是我于[b]2009年4月7日[/b]创办的,转眼间已经来到2012年的2月中旬,不知不觉过去快三个年头,三年来eoeAndroid一直在不停的探索前进,目的是力求让更多人在这能安家落户,学有所成。\r\n\r\n记忆中我们的eoeAndroid已经经过了这么几个阶段\r\n\r\n第一阶段:这是个大家庭(2009年)\r\n社区创建之初,android在国内还很不活跃,社区人数不多,仅有几个好朋友开始活跃,开始摸索android是个什么,可以做什么,社区人不多,但是大家都蛮熟悉,社区象一个大家庭,大家经常熬夜研究文档,代码,试验。\r\n\r\n第二阶段:曲折的发展之路(2010年)\r\n到了2010年前后,有了第二批做android的人,社区得到大家的认可和口碑相传,很快服务器就开始吃紧,开始不稳定,那会服务器还托管在上海一个机房,而后就遭受其他网站的牵连,机房被封,服务器被拔线,几经折腾,后来索性搬迁到国外,虽然一些地方速度慢一些,但是终于稳定了;这段时间很曲折,在国内换从上海换到成都,又换到北京,险些万劫不复,幸好那会备份转移做的比较勤,只丢了一点点数据,万幸!\r\n\r\n第三阶段:蓬勃发展,开拓思路(2011年)\r\n迁往国外后的一段日子,android终于爆发了,开发者数量也开始爆发了,越来越多的人加入android技术阵营,社区一次一次的加带宽,加内存,加磁盘,一次一次的升级,优化,最后我们再次迁回国内,有了自己的机房和专属服务器;社区也做过一次大的升级成开发者门户,想给大家提供更多的内容。\r\n\r\n第四阶段:新起点,新目标\r\n2011底,我们酝酿新的改版,我们一直在思考如何把eoeAndroid社区做好,让更多的人得到帮助,让更多的人踏入android行业的大门;我们设计和讨论过n多方案,最终我们选择的方向是“[color=Red]源于内心,回归更纯粹的技术[/color]”,或许是因为技术出身,对技术有着特殊的感情,我们觉得eoeAndroid一直都有这么一些精神:专业 专注 自由 开放 分享 。我们大家都专注android技术领域,都是专业的人才,我们会积累沉淀好的资源和文章,用心运营;我们也崇尚自由的氛围,开放的态度,乐于分享我们的经验和知识。\r\n新的2012年,我们重新启航,新版今天正式上线,详细的公告在这里 http://www.eoeandroid.com/thread-156623-1-1.html,如果您觉得改的不错,请告诉你的朋友回来瞅瞅,如果你觉得还有可以完善的地方,非常感谢您来这给我捉虫子 http://www.eoeandroid.com/thread-156622-1-1.html\r\n\r\n新的2012年里,我们将秉承:专业 专注 自由 开放 分享。寻觅更多的合作伙伴,为广大开发者解决实际问题,力求把eoeAndroid做成大家都喜欢的eoeAndroid。您如果有任何建议和意见,都非常欢迎得到您的反馈~\r\n\r\n-by iceskysl at 2012.02.16凌晨2点 北京", "created_at"=>2012-02-15 10:08:16 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    eoeAndroid社区是我于[b]2009年4月7日[/b]创办的,转眼间已经来到2012年的2月中旬,不知不觉过去快三个年头,三年来eoeAndroid一直在不停的探索前进,目的是力求让更多人在这能安家落户,学有所成。

    \n\n

    记忆中我们的eoeAndroid已经经过了这么几个阶段

    \n\n

    第一阶段:这是个大家庭(2009年)
    \n社区创建之初,android在国内还很不活跃,社区人数不多,仅有几个好朋友开始活跃,开始摸索android是个什么,可以做什么,社区人不多,但是大家都蛮熟悉,社区象一个大家庭,大家经常熬夜研究文档,代码,试验。

    \n\n

    第二阶段:曲折的发展之路(2010年)
    \n到了2010年前后,有了第二批做android的人,社区得到大家的认可和口碑相传,很快服务器就开始吃紧,开始不稳定,那会服务器还托管在上海一个机房,而后就遭受其他网站的牵连,机房被封,服务器被拔线,几经折腾,后来索性搬迁到国外,虽然一些地方速度慢一些,但是终于稳定了;这段时间很曲折,在国内换从上海换到成都,又换到北京,险些万劫不复,幸好那会备份转移做的比较勤,只丢了一点点数据,万幸!

    \n\n

    第三阶段:蓬勃发展,开拓思路(2011年)
    \n迁往国外后的一段日子,android终于爆发了,开发者数量也开始爆发了,越来越多的人加入android技术阵营,社区一次一次的加带宽,加内存,加磁盘,一次一次的升级,优化,最后我们再次迁回国内,有了自己的机房和专属服务器;社区也做过一次大的升级成开发者门户,想给大家提供更多的内容。

    \n\n

    第四阶段:新起点,新目标
    \n2011底,我们酝酿新的改版,我们一直在思考如何把eoeAndroid社区做好,让更多的人得到帮助,让更多的人踏入android行业的大门;我们设计和讨论过n多方案,最终我们选择的方向是“[color=Red]源于内心,回归更纯粹的技术[/color]”,或许是因为技术出身,对技术有着特殊的感情,我们觉得eoeAndroid一直都有这么一些精神:专业 专注 自由 开放 分享 。我们大家都专注android技术领域,都是专业的人才,我们会积累沉淀好的资源和文章,用心运营;我们也崇尚自由的氛围,开放的态度,乐于分享我们的经验和知识。
    \n新的2012年,我们重新启航,新版今天正式上线,详细的公告在这里 http://www.eoeandroid.com/thread-156623-1-1.html,如果您觉得改的不错,请告诉你的朋友回来瞅瞅,如果你觉得还有可以完善的地方,非常感谢您来这给我捉虫子 http://www.eoeandroid.com/thread-156622-1-1.html

    \n\n

    新的2012年里,我们将秉承:专业 专注 自由 开放 分享。寻觅更多的合作伙伴,为广大开发者解决实际问题,力求把eoeAndroid做成大家都喜欢的eoeAndroid。您如果有任何建议和意见,都非常欢迎得到您的反馈~

    \n\n

    -by iceskysl at 2012.02.16凌晨2点 北京

    \n", "_id"=>594}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Ruby & Rails"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>2, "title"=>"解决用ruby生成大xml文件的性能问题", "body"=>"近日遇到一个需求是定期生成一个很大的xml文件,可能会10多w个item,过程中需要查询数据库,需要一些运算,遇到了性能问题,开始使用nokogiri,但是很慢很慢,大概的代码如下:\r\n````\r\nrequire 'rubygems'\r\nrequire 'nokogiri'\r\na = Time.now\r\nbuilder = Nokogiri::XML::Builder.new do |xml|\r\n xml.root {\r\n (1..500000).each do |k|\r\n xml.products {\r\n xml.widget {\r\n xml.id_ k\r\n xml.name \"Awesome iceskysl widget\"\r\n }\r\n }\r\n end\r\n }\r\nend\r\no = File.new(\"test_noko.xml\", \"w\")\r\no.write(builder.to_xml)\r\no.close\r\nputs (Time.now-a).to_s\r\n```\r\n\r\n这个代码有2个主要的问题:\r\n1. 慢\r\n2. 耗内存\r\n\r\n于是我们有两个解决方案,分别是:\r\n\r\n\r\n1.用libxml-ruby替代nokogiri,因为nokogiri优势是读取的快,写的花一般,用libxml-ruby可以这样\r\n````\r\nrequire 'rubygems'\r\nrequire 'xml'\r\ndoc = XML::Document.new()\r\ndoc.root = XML::Node.new('root_node')\r\nroot = doc.root\r\n\r\n500000.times do |k|\r\n root << elem1 = XML::Node.new('products')\r\n elem1 << elem2 = XML::Node.new('widget')\r\n elem2['id'] = k.to_s\r\n elem2['name'] = 'Awesome widget'\r\nend\r\n\r\ndoc.save('foo.xml', :indent => false, :encoding => XML::Encoding::UTF_8)\r\n```\r\n执行的结构类似\r\nice@mac:/source/labs/xml > time ruby test_xml2.rb \r\nreal\t0m50.065s\r\nuser\t0m4.594s\r\nsys\t0m0.509s\r\n\r\n2. 直接写,示范代码如下\r\nf = File.open(\"foo.xml\", \"w\")\r\nf.puts(\"\")\r\nf.puts('')\r\n500000.times do |k|\r\n f.puts \"\"\r\nend\r\nf.puts('')\r\nf.close\r\n\r\n运行结构类似这样的:\r\nice@mac:/source/labs/xml > time ruby test_xml.rb \r\nreal\t0m0.974s\r\nuser\t0m0.813s\r\nsys\t0m0.063s\r\n\r\n从上面可以看到,效率差别还是蛮大的,回到我自己的case里来,原来需要6个小时的job现在不要30分钟就搞定了(自然还有一些其他的优化,就不细说了)~~", "created_at"=>2012-02-24 03:28:51 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    近日遇到一个需求是定期生成一个很大的xml文件,可能会10多w个item,过程中需要查询数据库,需要一些运算,遇到了性能问题,开始使用nokogiri,但是很慢很慢,大概的代码如下:
    \n`
    \nrequire 'rubygems'
    \nrequire 'nokogiri'
    \na = Time.now
    \nbuilder = Nokogiri::XML::Builder.new do |xml|
    \n xml.root {
    \n (1..500000).each do |k|
    \n xml.products {
    \n xml.widget {
    \n xml.id_ k
    \n xml.name "Awesome iceskysl widget"
    \n }
    \n }
    \n end
    \n }
    \nend
    \no = File.new("test_noko.xml", "w")
    \no.write(builder.to_xml)
    \no.close
    \nputs (Time.now-a).to_s
    \n

    \n\n

    这个代码有2个主要的问题:
    \n1. 慢
    \n2. 耗内存

    \n\n

    于是我们有两个解决方案,分别是:
    \n<!--more-->

    \n\n

    1.用libxml-ruby替代nokogiri,因为nokogiri优势是读取的快,写的花一般,用libxml-ruby可以这样
    \n````
    \nrequire 'rubygems'
    \nrequire 'xml'
    \ndoc = XML::Document.new()
    \ndoc.root = XML::Node.new('root_node')
    \nroot = doc.root

    \n\n

    500000.times do |k|
    \n root << elem1 = XML::Node.new('products')
    \n elem1 << elem2 = XML::Node.new('widget')
    \n elem2['id'] = k.to_s
    \n elem2['name'] = 'Awesome widget'
    \nend

    \n\n

    doc.save('foo.xml', :indent => false, :encoding => XML::Encoding::UTF_8)
    \n```
    \n执行的结构类似
    \nice@mac:/source/labs/xml > time ruby test_xml2.rb
    \nreal 0m50.065s
    \nuser 0m4.594s
    \nsys 0m0.509s

    \n\n

    2. 直接写,示范代码如下
    \nf = File.open("foo.xml", "w")
    \nf.puts("<?xml version=\\"1.0\\" encoding=\\"gbk\\"?>")
    \nf.puts('')
    \n500000.times do |k|
    \n f.puts ""
    \nend
    \nf.puts('')
    \nf.close

    \n\n

    运行结构类似这样的:
    \nice@mac:/source/labs/xml > time ruby test_xml.rb
    \nreal 0m0.974s
    \nuser 0m0.813s
    \nsys 0m0.063s

    \n\n

    从上面可以看到,效率差别还是蛮大的,回到我自己的case里来,原来需要6个小时的job现在不要30分钟就搞定了(自然还有一些其他的优化,就不细说了)~~

    \n", "_id"=>595}]) +MONGODB iceylog_development['categories'].find({:_id=>2}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>2}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Architecture"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["db-charmer", "mysql", "Octopus", "rails", "Sharding"], "comments_count"=>0, "category_id"=>9, "title"=>"在rails中mysql读写分离的方案", "body"=>"手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:\r\n\r\n之前晓得有两个方案可以使用\r\n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)\r\n2. 用类似master_slave_adaptermasochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~\r\n\r\n也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。\r\n\r\n于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章\r\nDB Charmer – ActiveRecord Connection Magic Plugin\r\n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/\r\n\r\nDbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads\r\n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/\r\n\r\ndb-charmer github\r\n https://github.com/kovyrin/db-charmer\r\n\r\ndb-charmer homepage\r\n http://kovyrin.github.com/db-charmer/index.html\r\n\r\n看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~", "created_at"=>2012-02-26 00:22:43 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    手上几个项目访问的压力越来越大,用合用的mysql转移到单独的msql服务器了,但还是压力还是很大,偶尔还会遇到lock问题,是想着需要做一下mysql的读写分离的方案,找了一些资料,汇总如下:

    \n\n

    之前晓得有两个方案可以使用
    \n1. 用类似use_db这样的插件,实现针对model的读写分离(其实这个不是真正意义上的读写分离,但是可以凑合用)
    \n2. 用类似master_slave_adapter和masochism插件实现真正意思上的读写分离,配置稍微麻烦点,有的可能还需要一些hard code~

    \n\n

    也在ruby_china发了帖子和大家讨论了下(http://ruby-china.org/topics/1397),在大家的回复了,看到 @kevinxu 提到了db-charmer (https://github.com/kovyrin/db-charmer),也看到 @ShiningRay 提到了data_fabric,还有 @bony 提到了可以自己来拦截“拦截一下activerecord的方法,在读操作和写操作时重新设置connection”。

    \n\n

    于是就去多查下资料,看到有如下ruby-toolbox上有个Active_Record_Sharding的页面(https://www.ruby-toolbox.com/categories/Active_Record_Sharding ),里面还提到了了Octopus这个gem(https://github.com/tchandy/octopus),于是仔细看了一下Db-charmer这个还是比较完善的,按照其描述是这样的:DbCharmer is a Rails plugin (and gem) that could be used to manage AR model connections, implement master/slave query schemes, sharding and other magic features many high-scale applications need. 然后找到几篇不错的介绍文章
    \nDB Charmer – ActiveRecord Connection Magic Plugin
    \n http://kovyrin.net/2009/11/03/db-charmer-activerecord-connection-magic-plugin/

    \n\n

    DbCharmer 1.7.0 Release: Rails 3.0 Support and Forced Slave Reads
    \n http://kovyrin.net/2011/09/01/dbcharmer-1-7-0/

    \n\n

    db-charmer github
    \n https://github.com/kovyrin/db-charmer

    \n\n

    db-charmer homepage
    \n http://kovyrin.github.com/db-charmer/index.html

    \n\n

    看到几经完善,现在也已经支持rails3了,没仔细测试,也还没来得及看源码,有空的可以看后分析下,我主要考虑稳定性和扩展性~

    \n", "_id"=>596}]) +MONGODB iceylog_development['categories'].find({:_id=>9}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>9}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Mac", "Messages"], "comments_count"=>0, "category_id"=>7, "title"=>"升级mac到10.7.3,体验mac Messages", "body"=>"很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~\r\n\r\n今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下\r\n\r\n\"\"\r\n\r\n装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~\r\n\r\n\"\"\r\n\r\n但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?", "created_at"=>2012-03-02 06:10:51 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    很早前就注意到mac官网放出了mac版得messages beta(http://www.apple.com/macosx/mountain-lion/messages-beta/),当时下载后安装得时候提示需要10.7.3,由于本机还是10.7.2版无法体验~

    \n\n

    今天下班得时候发现提示10.7.3下载完成可以安装了(mac好像把更新版本放在后台进行,下载完直接提示用户安装了),迫不及待更新,看到如下

    \n\n\n

    装完后就开始装上次下载得messages beta,下载完安装(需要重启,好像第一次遇到mac安装完软件需要重启),而后就可以用自己得apple id来登陆了,登陆完就可以给其他联系人发message信息啦~

    \n\n\n

    但是也发现一个问题,手机端收到得信息是按字分割得,还不晓得是什么原因,是中文得原因?

    \n", "_id"=>597}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"说说我招聘android技术人员的思路", "body"=>"事情源于在eoe android社区看到一个同学写了《android面试全跟踪——看到天涯失业7个月,有感而发写下此文》,文章中详细纪录了自己寻找android工作的过程,其中个中辛酸,我想只有体验过这个过程的人才有体会;我把那个帖子转到weibo上,很多人也反馈说看着心酸,我觉得我可以写点东西分享下企业怎么看android技术人员的招聘。\r\n\r\n有些人可能对我多少有些了解,应该算国内第一批开始搞android相关的人,09年创办的android开发社区(eoeandroid.com)现在也是国内android开发人员最活跃的社区,我写过一些代码,也写过一些技术的文章,也做过android应用,也见过很多android的技术,也给公司(eoe)招了不少android技术人员,也给不少朋友奇特推荐过android技术的人,我下面会分享我对android技术人员招聘的一些看法。\r\n\r\n1. 首先看为人:品性很重要\r\n\r\n或许是因为我们是创业公司,会严格选择每一个进来的人,特别是技术的人。技术很重要,但是在我这边不是第一位的,人品和性格是第一的,创业公司唯一不变的就是变化,如果人品不过关的人肯定待不住,如果性格合不来的人肯定待不久。有人说这个很虚,见一面怎么可能看出品性,其实不难,一举一动,言语措辞都很简单就可以看出一个人的内在(因为技术的人为人真的很简单),所以,如果你去面熟,表现真实的自己,对公司,对个人都是有好处的,合得来就是合得来,合不来强求也没用,这本是个双向选择的事情,不存在谁强势谁弱势。积极,主动,自信,阳光是比较好的品格~\r\n\r\n2. 接着看技术:基本功需要有体系,够扎实,思维要跳跃\r\n\r\n如果来eoe面试过的人应该知道,我们面android有一套笔试题,但是java的,很多人不理解可能会问我来面android的为啥让我做java的题?其实很简单,java是基础,我们的笔试题会涉及到基础的,算法的,开放性的试题,我们需要全面的了解一个人。每个题目都很重要,所以,如果去面试,如果对方是精心设计的题,请认真一点回答,记住认真不是死板,答题看的是基础和思维,细节无所谓,因为有真正干活的时候有google,有api~\r\n\r\n3. 然后看经验:经验很重要,你必须对你做过的项目了如指掌\r\n\r\n做完题目,我们一般就正式面试了,会问问笔试题目上你的感觉和具体一个问题的思路,然后才开始问之前的经验,我们的要求是必须真正做过项目,如果没项目,应用也行,其实需要的就是一个关键点:你真正操作过一个应用,对你做过的模块必须了如指掌,我们不会问太多项目,让你一个最熟悉的或者最喜欢的项目,问的很细节,细节到你证明这个项目自己之前是用心做的,或者证明你在这个项目就是个打酱油的。\r\n\r\n然后会问点和android相关的东西,一般容易的,中等的和比较刁钻的问题都会问一些,刁钻的比如会问你现场保护的机制,方式,为什么要现场保护等等问题,如果你是个做技术爱思考的人,这些问题应该不难,如果你虽然做过1-2年android,但是每个方面都很泛泛,那你肯定会被问的傻傻的。\r\n\r\n最后会问一些开放性的问题,都是很随机的题目,比如桌子上的一个杯子等等都可能会被问~~这个地方主要看整体的思维和分析问题的能力。\r\n\r\n4. 做决定:合适还是不合适,或者留题目,做个小测试\r\n\r\n如此过程,我们基本上就能判断一个人是否符合我们要求,如果不满足,我们基本会很直接告诉原因是什么,哪个地方我们觉得不合适,你以后应该注意什么?如果我们觉得满足预期,可能就收了;如果我们拿不准,但是觉得你潜力很好,可能会留个题目,做个小东西,不会很难,做的时候请注意自己的编码风格,整体项目结构等等,这些是关键因素~\r\n\r\n如上过程,就是我在招android技术人员的一些思路和过程,我们是创业公司,相对看的更全面的能力,但是我个人觉得企业的思维或许都差不多,如果你要找android相关的工作,请参考~\r\n\r\n另外,android开发社区 里有很多企业招聘android技术人员,大家可以多关注,希望大家能找到自己满意android工作~记得经常来android开发社区活动~\r\n\r\n再顺便提一下,我们(eoe)长期招合适的android技术,如果你有兴趣,可以联系我~", "created_at"=>2012-03-16 05:42:16 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    事情源于在eoe android社区看到一个同学写了《android面试全跟踪——看到天涯失业7个月,有感而发写下此文》,文章中详细纪录了自己寻找android工作的过程,其中个中辛酸,我想只有体验过这个过程的人才有体会;我把那个帖子转到weibo上,很多人也反馈说看着心酸,我觉得我可以写点东西分享下企业怎么看android技术人员的招聘。

    \n\n

    有些人可能对我多少有些了解,应该算国内第一批开始搞android相关的人,09年创办的android开发社区(eoeandroid.com)现在也是国内android开发人员最活跃的社区,我写过一些代码,也写过一些技术的文章,也做过android应用,也见过很多android的技术,也给公司(eoe)招了不少android技术人员,也给不少朋友奇特推荐过android技术的人,我下面会分享我对android技术人员招聘的一些看法。

    \n\n

    1. 首先看为人:品性很重要

    \n\n

    或许是因为我们是创业公司,会严格选择每一个进来的人,特别是技术的人。技术很重要,但是在我这边不是第一位的,人品和性格是第一的,创业公司唯一不变的就是变化,如果人品不过关的人肯定待不住,如果性格合不来的人肯定待不久。有人说这个很虚,见一面怎么可能看出品性,其实不难,一举一动,言语措辞都很简单就可以看出一个人的内在(因为技术的人为人真的很简单),所以,如果你去面熟,表现真实的自己,对公司,对个人都是有好处的,合得来就是合得来,合不来强求也没用,这本是个双向选择的事情,不存在谁强势谁弱势。积极,主动,自信,阳光是比较好的品格~

    \n\n

    2. 接着看技术:基本功需要有体系,够扎实,思维要跳跃

    \n\n

    如果来eoe面试过的人应该知道,我们面android有一套笔试题,但是java的,很多人不理解可能会问我来面android的为啥让我做java的题?其实很简单,java是基础,我们的笔试题会涉及到基础的,算法的,开放性的试题,我们需要全面的了解一个人。每个题目都很重要,所以,如果去面试,如果对方是精心设计的题,请认真一点回答,记住认真不是死板,答题看的是基础和思维,细节无所谓,因为有真正干活的时候有google,有api~

    \n\n

    3. 然后看经验:经验很重要,你必须对你做过的项目了如指掌

    \n\n

    做完题目,我们一般就正式面试了,会问问笔试题目上你的感觉和具体一个问题的思路,然后才开始问之前的经验,我们的要求是必须真正做过项目,如果没项目,应用也行,其实需要的就是一个关键点:你真正操作过一个应用,对你做过的模块必须了如指掌,我们不会问太多项目,让你一个最熟悉的或者最喜欢的项目,问的很细节,细节到你证明这个项目自己之前是用心做的,或者证明你在这个项目就是个打酱油的。

    \n\n

    然后会问点和android相关的东西,一般容易的,中等的和比较刁钻的问题都会问一些,刁钻的比如会问你现场保护的机制,方式,为什么要现场保护等等问题,如果你是个做技术爱思考的人,这些问题应该不难,如果你虽然做过1-2年android,但是每个方面都很泛泛,那你肯定会被问的傻傻的。

    \n\n

    最后会问一些开放性的问题,都是很随机的题目,比如桌子上的一个杯子等等都可能会被问~~这个地方主要看整体的思维和分析问题的能力。

    \n\n

    4. 做决定:合适还是不合适,或者留题目,做个小测试

    \n\n

    如此过程,我们基本上就能判断一个人是否符合我们要求,如果不满足,我们基本会很直接告诉原因是什么,哪个地方我们觉得不合适,你以后应该注意什么?如果我们觉得满足预期,可能就收了;如果我们拿不准,但是觉得你潜力很好,可能会留个题目,做个小东西,不会很难,做的时候请注意自己的编码风格,整体项目结构等等,这些是关键因素~

    \n\n

    如上过程,就是我在招android技术人员的一些思路和过程,我们是创业公司,相对看的更全面的能力,但是我个人觉得企业的思维或许都差不多,如果你要找android相关的工作,请参考~

    \n\n

    另外,android开发社区 里有很多企业招聘android技术人员,大家可以多关注,希望大家能找到自己满意android工作~记得经常来android开发社区活动~

    \n\n

    再顺便提一下,我们(eoe)长期招合适的android技术,如果你有兴趣,可以联系我~

    \n", "_id"=>598}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["D90", "Nikon"], "comments_count"=>0, "category_id"=>5, "title"=>"第一台单反 Nikon D90", "body"=>"2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。\r\n\r\n因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~\r\n\r\n搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~\r\n\r\n机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。\r\n\r\n第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~", "created_at"=>2012-04-06 08:38:20 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    2012刚开始的时候写过《2011计划年度总结回顾,2012年预期》中曾经写到“1. 系统学习摄影,有一台单反;”,时间走到4月份,终于入手了一台单反:Nikon D90。

    \n\n

    因为是第一台,所以一点经验没有,之前连傻瓜相机用的都少,只偶尔用iphone拍点图像,所以对快门,光圈,曝光,景深,白平衡记本上是没概念的,之前查过一次资料,在Nikon D90,Canon 600D,Nikon D7000等几个之间有过选择,之前在微博上问过达人们,C家和N家都有一大群的粉丝,每个人都能说出一大堆的理由~

    \n\n

    搁置了一段时间后,眼看着春天来了,外面光秃秃的树杈也渐渐的有了一点活力,想着也需要给自己找个借口出去走走了,于是再次选了单反,几经比较后,还是选择了Nikon D90。理由不多说,中间也考虑过Canon 600D,后来应该还是看中Nikon的专业性,D90的高性价比吧~

    \n\n

    机器手感不错,做工精良,虽然是08年的机器,但还是很气派的,晚上抱着D90说明书,又把前面买的《跟我学摄影》翻出来看了看,还真学了不少之前觉得很复杂的知识,再次体会到,如果你想学什么,就投入进去,尝试着喜欢上,然后你就应该能更有兴趣的学习了。

    \n\n

    第一台单反,完成《2011计划年度总结回顾,2012年预期》中的一个目标,此文仅为纪录。接下去会花下时间多多练习,争取能拍出一些不错的作品~

    \n", "_id"=>599}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"Mac & *UNIX"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["completion", "git"], "comments_count"=>0, "category_id"=>7, "title"=>"Git 命令行自动补全", "body"=>"在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行\r\n
    source ~/.git-completion.bash
    \r\n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到````/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 ````/etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。\r\n\r\n在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:\r\n``````$ git co<tab><tab> commit config``````\r\n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 ````m<tab>``` 会自动完成 ````git commit``` 命令的输入。\r\n\r\n命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 ````git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:\r\n``````$ git log --s<tab> --shortstat --since= --src-prefix= --stat --summary``````\r\n这个技巧不错吧,可以节省很多输入和查阅文档的时间。", "created_at"=>2012-04-06 14:57:40 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    在Pro Git上看到的技巧,git的源代码包里的contrib/completion目录下有个git-completion.bash,把这个文件保存到~/.git-completion.bash,然后在.bashrc或.bash_profile中加入一行
    \nsource ~/.git-completion.bash
    \n这样就能在bash下用tab自动补全git命令、branch等内容了。也可以为系统上所有用户都设置默认使用此脚本。Mac 上将此脚本复制到/opt/local/etc/bash_completion.d``` 目录中,Linux 上则复制到 /etc/bash_completion.d/``` 目录中。这两处目录中的脚本,都会在 Bash 启动时自动加载。

    \n\n

    在输入 Git 命令的时候可以敲两次跳格键(Tab),就会看到列出所有匹配的可用命令建议:
    \n$ git co&lt;tab&gt;&lt;tab&gt; commit config
    \n此例中,键入 git co 然后连按两次 Tab 键,会看到两个相关的建议(命令) commit 和 config。继而输入 m&lt;tab&gt;``` 会自动完成 git commit``` 命令的输入。

    \n\n

    命令的选项也可以用这种方式自动完成,其实这种情况更实用些。比如运行 git log``` 的时候忘了相关选项的名字,可以输入开头的几个字母,然后敲 Tab 键看看有哪些匹配的:
    \n
    $ git log --s&lt;tab&gt; --shortstat --since= --src-prefix= --stat --summary````
    \n这个技巧不错吧,可以节省很多输入和查阅文档的时间。

    \n", "_id"=>600}]) +MONGODB iceylog_development['categories'].find({:_id=>7}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>7}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>[], "comments_count"=>0, "category_id"=>5, "title"=>"关于Markdown和Mou", "body"=>"开年的时候写过一篇文章《排斥WYSIWYG编辑器》,其中说到:\r\n
    最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~
    \r\n其实比较成熟的标记语言还是有不少的,比如wiki format,又比如今天要讲的Markdown,甚至还有国内bbs喜欢用的bbcode都还是不错的标记语言,这里主要讲的是Markdown和Mou。\r\n\r\nhttp://apple4.us/上有篇文章写的不错《为什么作家应该用 Markdown 保存自己的文稿》,其中说了为什么作家需要用Markdown保存自己的文稿,其实对技术人员也一样有用,大家可以仔细看看~同时被介绍的还有Mou(Mou The missing Markdown editor for web developers)。\r\n\r\nMou真是个不错的东西,让不会编程的人也很快接收其用法,当你已经熟练掌握其语法后,其实也可以不用Mou,比如技术人员一般直接在textmate里写或者直接写都还蛮不错的。\r\n\r\n大概汇总下用 Markdown 有如下好处:\r\n
      \r\n\t
    1. 干净,只写你需要的文字和标记,没一堆乱七八糟的html
    2. \r\n\t
    3. 简单,真简单,就那么些标记,不需要10分钟你就学会了;
    4. \r\n\t
    5. 纯文本,占的空间小,打开块,记得空doc还有11k;
    6. \r\n\t
    7. 兼容性好,就是文本,文本编辑器都可以打开编辑,最不喜欢的就是.doc或者.gage,那个兼容性呀,简直是噩梦;
    8. \r\n\t
    9. 显示可控,无论是转html,还是又mou这样的工具,还是直接处理,都非常简便;
    10. \r\n\t
    11. 其他
    12. \r\n
    \r\n技术人员如果能坚持写技术blog都能用Markdown保存下来,其实是一个不错的宣传,wordpress会不会又被我废弃,直接写个轻量级的日志引擎,难说~\r\n\r\n \r\n\r\n参考:\r\n\r\nhttp://kramdown.rubyforge.org/documentation.html\r\n\r\nhttps://github.com/tanoku/redcarpet\r\n\r\nhttp://zh.wikipedia.org/wiki/Markdown", "created_at"=>2012-04-06 15:26:48 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    开年的时候写过一篇文章《排斥WYSIWYG编辑器》,其中说到:
    \n最不习惯的就是是文章的格式,一堆html代码,技术的人好像都有洁癖,我现在写的都是在html模式下至今写的,非常排斥WYSIWYG编辑器~一堆没用的格式代码~很不干净~
    \n其实比较成熟的标记语言还是有不少的,比如wiki format,又比如今天要讲的Markdown,甚至还有国内bbs喜欢用的bbcode都还是不错的标记语言,这里主要讲的是Markdown和Mou。

    \n\n

    http://apple4.us/上有篇文章写的不错《为什么作家应该用 Markdown 保存自己的文稿》,其中说了为什么作家需要用Markdown保存自己的文稿,其实对技术人员也一样有用,大家可以仔细看看~同时被介绍的还有Mou(Mou The missing Markdown editor for web developers)。

    \n\n

    Mou真是个不错的东西,让不会编程的人也很快接收其用法,当你已经熟练掌握其语法后,其实也可以不用Mou,比如技术人员一般直接在textmate里写或者直接写都还蛮不错的。

    \n\n

    大概汇总下用 Markdown 有如下好处:
    \n
    \n 干净,只写你需要的文字和标记,没一堆乱七八糟的html
    \n 简单,真简单,就那么些标记,不需要10分钟你就学会了;
    \n 纯文本,占的空间小,打开块,记得空doc还有11k;
    \n 兼容性好,就是文本,文本编辑器都可以打开编辑,最不喜欢的就是.doc或者.gage,那个兼容性呀,简直是噩梦;
    \n 显示可控,无论是转html,还是又mou这样的工具,还是直接处理,都非常简便;
    \n 其他
    \n
    \n技术人员如果能坚持写技术blog都能用Markdown保存下来,其实是一个不错的宣传,wordpress会不会又被我废弃,直接写个轻量级的日志引擎,难说~

    \n\n

     

    \n\n

    参考:

    \n\n

    http://kramdown.rubyforge.org/documentation.html

    \n\n

    https://github.com/tanoku/redcarpet

    \n\n

    http://zh.wikipedia.org/wiki/Markdown

    \n", "_id"=>601}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"04. 无心呢喃 | Buzz"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Android", "开发入门与实战"], "comments_count"=>0, "category_id"=>5, "title"=>"《Google Android开发入门与实战》第10次加印,真要改版了?", "body"=>"早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~\r\n\r\n问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~\r\n\r\n这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~\r\n\r\n这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?\r\n\r\n \r\n\r\n \r\n\r\n ", "created_at"=>2012-04-12 18:13:01 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    早上收到出版社消息,我2009 年6月出版的《Google Android开发入门与实战》再次加印,已经印了10次了,总的销量差不多2万本了,还记得10年7月还写过一篇《纪念我的第一本Android技术书籍销量过万》~

    \n\n

    问了下出版社的编辑,说是人邮里出版的android书里销量最好的,颇感意外,看到很多人加入android阵营,也有点欣慰~

    \n\n

    这本书当时写的还是比较匆忙的,主要是针对android入门开发者的,很多地方也写的不仔细,比如代码有点多,代码没有很好的格式化,内容偏简单,系统化不够等等~ 书中的例子也有点比较老了,例如yobo的api已经不能使用了,豆瓣的api也有了更新等等~每次读者在社区问书上一些问题的时候,我都觉得蛮愧疚的,毕竟内容比较老,会误导一些读者~

    \n\n

    这本书是国内第一本android的技术的书,当时的android sdk还是1.5版,上市快3年了,内容相对偏老的,出版社一再催我能更新到最新的sdk版本,再把之前用户反馈比较多的问题完善下~是不是真的需要抽点时间来出第二版了呢?

    \n\n

     

    \n\n

     

    \n\n

     

    \n", "_id"=>602}]) +MONGODB iceylog_development['categories'].find({:_id=>5}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>5}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Experts-Exchange", "Quora", "StackOverflow"], "comments_count"=>0, "category_id"=>6, "title"=>"StackOverflow初探,模式和遴选机制最出色", "body"=>"其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。\r\n\r\nFenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。\r\n\r\nStackOverflow给我最大印象的有两个:\r\n\r\n1. 模式\r\n\r\n系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。\r\n\r\n \r\n\r\n\"\"\r\n\r\n2. 遴选机制\r\n\r\nstackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉\r\n\r\n \r\n\r\n有人感叹说:\r\n
    在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \r\n很有意思,值得研究一下~\r\n\r\n ", "created_at"=>2012-04-20 06:58:43 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    其实很早前就晓得StackOverflow和Experts-Exchange,当然还有Quora,做技术的应该都晓得StackOverflow,很多人应该是经常搜问题的时候会被带到StackOverflow,很多问题的满意答案应该都是在StackOverflow找到的。

    \n\n

    Fenng曾写过一篇《为什么 Stack Overflow 会如此成功?》,对,很多人都会问为什么StackOverflow如此成功,而且还仅仅只是开始,以后会成长成啥样的还不不晓得,但是从大家全部的赞叹中还是说明StackOverflow是非常成功的。

    \n\n

    StackOverflow给我最大印象的有两个:

    \n\n

    1. 模式

    \n\n

    系统自身是wiki+digg/reddit+blog+forum的结合(下图),通过威望值(Reputation Point) 与徽章(Badge) 建立起信任评价体系,并且做到对参与者的有效激励。

    \n\n

     

    \n\n\n

    2. 遴选机制

    \n\n

    stackoverflow的评价机制非常有意思,和百度贴吧这样的问答系统正好相反,他的最佳答案是由网友dig出来了,而且如果有人的回答不好,还会被修改掉或者直接删掉

    \n\n

     

    \n\n

    有人感叹说:
    \n在国内是做不出这种网站的, 国人素质问题, 我使用stackoverflow深感其用, 关键是开放, 不并单单指奖励机制,我有好几次发的帖和答案(在stackoverflow上)不太好, 都被别人删掉了, 真刺激我的神经, 但忍了, 因为他的高质量就这样来的,但在国内出现这样的情况, 那个网站肯定被人骂得狗血淋头了,例如我经常看到有人骂javaeye的论坛不让发帖等等之类。
    \n很有意思,值得研究一下~

    \n\n

     

    \n", "_id"=>603}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) +MONGODB iceylog_development['categories'].find({:name=>"01. 视觉观察 | Observe"}).limit(-1).sort([[:_id, :asc]]) +WARNING: Can't mass-assign protected attributes: state +MONGODB iceylog_development['$cmd'].find({:findandmodify=>"mongoid.auto_increment_ids", :query=>{:_id=>"posts"}, :update=>{:$inc=>{:c=>1}}, :new=>true, :upsert=>true}).limit(-1) +MONGODB iceylog_development['posts'].insert([{"state"=>1, "tags"=>["Drive", "dropbox", "evernote"], "comments_count"=>0, "category_id"=>6, "title"=>"Google Drive试用初体验", "body"=>"已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。\r\n\r\n毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。\r\n\r\n最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。\r\n\r\n整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{\"url\": \"https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\", \"resource_id\": \"document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI\"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。\r\n\r\n最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~\r\n\r\n如果您对Google Drive感兴趣,推荐快捷键:\r\n\r\nhttp://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts", "created_at"=>2012-04-25 16:32:13 UTC, "updated_at"=>2012-06-24 15:53:15 UTC, "body_html"=>"

    已经不记得第一次听说google要出自己的云端存储,也不记得已经听说了几次这样的传闻了,这几天终于剪刀庐山真面目,也就是Google Drive,中文翻译为“google云端硬盘”。

    \n\n

    毫不掩抑的说我的google重度使用者,几乎尝试过所有的google服务,其中gmail和gdoc应该最重度的用户了。另外,同步之前尝试过n多种,最终选择的是dropbox,而且是重度用户,虽然用着还不错,但是总希望google能出一个类似的服务,或者收购dropbox;所以当Google Drive发布后第一天就翻山越岭的过去瞧瞧,提交申请等待,今天早上收到激活通知,迫不及待的体验了一把,过程网上一大堆,不多说。

    \n\n

    最纠结的自然还是被墙,虽然早就麻木,但每次都修改hosts,proxy还是让人心生厌烦,心想着何时我们才能真正的网络自由。

    \n\n

    整个体验过程还算顺利,和dropbox真的差不多(skyDrive好像也差不多),逻辑基本一致,本地创建一个文件夹和云端保持一致,还可以同步到android等移动设备;但是Google Drive不同的是和google doc做了整合,会把线上的google doc全部同步下来,这个真心很好(其实我觉得他应该创建一个docs目录放文档~),我差不多好几千份文档,很快就同步完了(后来查了下,是因为他只同步了文档索引,每个文件才153 bytes,例如{"url": "https://docs.google.com/Doc?docid=0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI", "resource_id": "document:0AQSsdoBxI0TDZGhmODZrcjlfMzUsswaHZtaGI"});。更有价值的是装个google离线可以离线编辑,于是在想有没有可能谁出一个离线撰写google doc的软件,真心喜欢google doc的快捷键,真心不喜欢ms word和mac下的pages,希望有人能写一个google doc格式的文档撰写软件。

    \n\n

    最后说一说Google Drive对dropbox的影响,个人觉得会有部分影响,尤其是国外网络自由的情况下,google的这个服务真心不错,而且加上gmail的帐号系统,在线编辑,共享和协作都很方便;但是影响不会致命,dropbox毕竟把这个服务做到了极致,一般做到极致的服务都是有前途的,或许哪一天就被哪个大佬诏安了,或者和我另外一个重度使用的服务evernote合并吧,哇卡~

    \n\n

    如果您对Google Drive感兴趣,推荐快捷键:

    \n\n

    http://support.google.com/docs/bin/answer.py?hl=en&answer=1295935&p=docslist_shortcuts;

    \n", "_id"=>604}]) +MONGODB iceylog_development['categories'].find({:_id=>6}).limit(-1).sort([[:_id, :asc]]) +MONGODB iceylog_development['categories'].update({"_id"=>6}, {"$inc"=>{"posts_count"=>1}}) + + +Started GET "/cpanel/posts" for 127.0.0.1 at 2012-06-24 23:53:17 +0800 +Processing by Cpanel::PostsController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB [DEBUG] Cursor#close 201019790124545625 +MONGODB iceylog_development['posts'].find({}).limit(30).sort([[:_id, :desc]]) + Rendered cpanel/posts/index.html.erb within layouts/cpanel (26.5ms) +Completed 200 OK in 36ms (Views: 31.0ms | Mongo: 2.0ms) + + +Started GET "/cpanel/posts/604/edit" for 127.0.0.1 at 2012-06-24 23:53:22 +0800 +Processing by Cpanel::PostsController#edit as HTML + Parameters: {"id"=>"604"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:_id=>604}).limit(-1).sort([[:_id, :asc]]) + Rendered shared/_error_messages.html.erb (0.1ms) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['categories'].find({}) + Rendered cpanel/posts/_form.html.erb (41.3ms) + Rendered cpanel/posts/edit.html.erb within layouts/cpanel (55.8ms) +Completed 200 OK in 79ms (Views: 74.8ms | Mongo: 1.5ms) + + +Started GET "/cpanel/posts/597/edit" for 127.0.0.1 at 2012-06-24 23:53:26 +0800 +Processing by Cpanel::PostsController#edit as HTML + Parameters: {"id"=>"597"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:_id=>597}).limit(-1).sort([[:_id, :asc]]) + Rendered shared/_error_messages.html.erb (0.0ms) +MONGODB iceylog_development['categories'].find({}) + Rendered cpanel/posts/_form.html.erb (4.8ms) + Rendered cpanel/posts/edit.html.erb within layouts/cpanel (5.4ms) +Completed 200 OK in 11ms (Views: 8.5ms | Mongo: 0.8ms) + + +Started GET "/cpanel/posts/576/edit" for 127.0.0.1 at 2012-06-24 23:53:31 +0800 +Processing by Cpanel::PostsController#edit as HTML + Parameters: {"id"=>"576"} +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:_id=>576}).limit(-1).sort([[:_id, :asc]]) + Rendered shared/_error_messages.html.erb (0.0ms) +MONGODB iceylog_development['categories'].find({}) + Rendered cpanel/posts/_form.html.erb (4.6ms) + Rendered cpanel/posts/edit.html.erb within layouts/cpanel (5.3ms) +Completed 200 OK in 11ms (Views: 8.5ms | Mongo: 0.8ms) + + +Started GET "/cpanel" for 127.0.0.1 at 2012-06-24 23:54:07 +0800 +Processing by Cpanel::HomeController#index as HTML +SiteConfig.site_author_username.to_s:true +SiteConfig.site_author_password.to_s:true +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}, {:_id=>1}).limit(-1) +MONGODB [DEBUG] Cursor#close 2802187946066918545 +MONGODB iceylog_development['posts'].find({:deleted_at=>nil}).limit(5).sort([[:_id, :desc]]) +MONGODB iceylog_development['$cmd'].find({"count"=>"categories", "query"=>{}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['$cmd'].find({"count"=>"posts", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"pages", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) +MONGODB iceylog_development['system.namespaces'].find({}) +MONGODB iceylog_development['$cmd'].find({"count"=>"sites", "query"=>{:deleted_at=>nil}, "fields"=>nil}).limit(-1) + Rendered cpanel/home/index.html.erb within layouts/cpanel (54.1ms) +Completed 200 OK in 79ms (Views: 74.0ms | Mongo: 3.2ms) diff --git a/tmp/cache/8ED/600/site_config%3Amenu_html b/tmp/cache/8ED/600/site_config%3Amenu_html index 4d2b96ffca6262a83402b383b8b655e384212790..e5b0d122a227d7ebacc3592f0486659db9806f4c 100644 GIT binary patch delta 26 hcmaFF{D^r%5WlgZxrLsYiJ7IDg&{-w+l`5hi~w#-2ps?b delta 26 hcmaFF{D^r%5Wj(`xv`#!rKypjnIXf*`5O}(83Ap{2nhfH diff --git a/tmp/cache/95A/F70/site_config%3Asite_title b/tmp/cache/95A/F70/site_config%3Asite_title index dd1d3fc47df6bbf610e9b5ab7dc1a18345e715d2..447f2fb62d70390a5f478c7717d23ae3d7554487 100644 GIT binary patch delta 23 ecmb=anGnQpY-nzwXJ%k(U}R*;uw&E2L}>s}K?ceI delta 23 ecmb=anGnQpU}|oxXJTSzVQOH=Fw<~iqBHJE2 delta 30 lcmXS~oZu}cWoT?-U}|b$YHqA&Vqs!#W^Bp87C$jw0swS~2N3`O diff --git a/tmp/cache/A84/740/site_config%3Aabout_me_html b/tmp/cache/A84/740/site_config%3Aabout_me_html index 42473b8ba6272a97754d1138a3dc43f0e6694385..c83c8837dd7d718cb35fbf59ea73be709b8c367c 100644 GIT binary patch delta 32 ncmZ3^vW#Vdx2U9{v5A4Hsj;ECg`Sy-iMfFpgVWuOiN_cLhnxt- delta 33 ocmZ3+vYcgtx0sZnv5A4Hse!4vv7U*gk(s5jB}0eL#)M;x0FE#Swg3PC diff --git a/tmp/cache/D8A/8E0/site_config%3Asite_author_username b/tmp/cache/D8A/8E0/site_config%3Asite_author_username index 983d7f06a2d62a690c4aa87e349cf8bdabb10596..bc1bf20d8bedd0a9b939baaea4fe249217274406 100644 GIT binary patch delta 23 ecmb=anGnQpY-nzwXJ%|^Ze(G|@X>E#qBHU}|b?Xl|irW@2P&V8I}FYht1d0C2qrbpQYW delta 30 lcmb=ao!~7dWoT?-U}|b$YHqA&Vqs}%Zehp}eRg7k3;=mO2j>6) diff --git a/tmp/pids/server.pid b/tmp/pids/server.pid index bc9e9e9..2f619d0 100644 --- a/tmp/pids/server.pid +++ b/tmp/pids/server.pid @@ -1 +1 @@ -14684 \ No newline at end of file +14979 \ No newline at end of file