What have you found for these years?

2011-12-05

有這麼敏銳?

前幾天睡醒躺在床上,就是上篇提到的醒醒睡睡中的一段,覺得隱隱約約聽到
有隻鳥叫很熟悉似的... 聲音其實很小,我都懷疑我是不是幻聽,而且合理推測,
要聽到應該是不太可能。可是我又覺得那好像是真的。

雖然還是很想睡,但好奇心作祟,還是決定趕快衝下去把廁所的兩個門打開,
聽聽看是不是真的。結果兩門一開後,果然很明顯真的是那隻鳥的叫聲 XD

之前住隔壁四樓,現在住七樓,兩邊雖然互看是看得到,但那距離我並不覺得
是大喊可以溝通的。一開始覺得會在廁所聽到就已經覺得很扯了。打電話去
確認後,才肯定真的是因為該鳥覺得飼料不足了,所以一直在叫。畢竟加完
飼料後,我就沒有聽到叫聲了 XD

而關上兩道廁所的門後,基本上大部份外界的噪音就已經聽不太到了。只有
那種特別吵的引擎聲,或是哪裡又有死小孩在鬼吼鬼叫才聽得到。主要的噪音
會變成來自樓上或是隔壁。

在這種情況下居然還能聽到鳥叫聲,實在很誇張 XD
或是說,那時候其實夠安靜,所以才聽得到..?

以前住十樓時,在一樓也聽得到他在叫,而且還滿大聲的...。

鸚鵡的叫聲是不是都很誇張啊?

2011-12-04

睡太久

昨天比較累,因為前一天睡得比較少,晚上又出門,所以三點就睡了,
理論上來說是比最近的平均要來得早不少.. 結果一睡卻又睡到下午五點,
將近十四個小時了,實在是...

不過要不是睡太多會頭痛的話,可能我還會一直睡下去吧..

我記得我十點時醒來過,接下來可能是十二點,再接著大概則是持續著
半小時到一小時間,不斷醒來一次。每次醒來覺得嗯,差不多可以起來了,
只要再混一下就好了,然後沒兩分鐘就又睡著了。

嗯,說不定最重要的不是調整作息,而是要如何在醒來後不要再繼續睡著。
不過醒來後要做什麼?這件事總是讓人困擾著。做要做的事情,實在沒力;
但好像也沒什麼真的可以讓人覺得很休息的事..

2011-12-01

[ANN] rest-more 0.8.0 released

rest-more

by Cardinal Blue http://cardinalblue.com

DESCRIPTION:

Various REST clients such as Facebook and Twitter built with rest-core

CHANGES:

rest-more 0.8.0 – 2011-11-29

Incompatible changes

  • [Facebook::RailsUtil] Some methods are renamed. For example, rc_facebook_write_rg_fbs is renamed to rc_facebook_write_fbs. All renamed methods are considered private, so we’re not listing them here.

  • [Facebook::RailsUtil] rc_facebook_storage_key is changed to: "rc_facebook_#{rc_facebook.app_id}", your users might need to login again in order to save the access_token into the new place.

Bugs fixes

  • [Github] Fixed usage of Oauth2Query.

  • [Facebook] Now we’re using POST in authorize! to exchange the access_token with the code instead of GET. If we’re using GET, we would run into a risk where a user might use the code to get other people’s access_token via the cache. Using POST would prevent this because POSTs are not cached.

  • [Facebook::RailsUtil] Fixed a serious bug. The bug would jump up if you’re using :write_session or :write_cookies or :write_handler along with :auto_authorize, for example: rc_facebook_setup(:auto_authorize => true, :write_session => true) The problem is that Facebook::RailsUtil is not removing the invalid access_token stored in session or cookie, and yet it is considered authorized, making redirecting to Facebook and redirecting back doesn’t update the access_token. rc_facebook_cleanup is introduced to remove all invalid access_tokens, which would get called once the user is redirected to Facebook, fixing this bug.

Enhancement

  • [Facebook] Now we use default_data to get the default data, instead of relying Defaults middleware.

  • [Facebook] Protected methods are changed to private.

  • [Flurry] app_info now accepts opts.
  • [Flurry] event_metrics is renamed to event_summary
  • [Flurry] event_metrics is now the API for accessing ‘eventMetrics/Event’
  • [Flurry] If you didn’t pass dates, now default to for 7 days.
  • [Flurry] Instead of overriding query, defining default_query

  • [Linkedin+Twitter] Removed Defaults middleware because now we’re using the data from Oauth1Client instead.

  • [Linkedin+Twitter] Removed oauth_token, oauth_token=, oauth_token_secret, and oauth_token_secret= because we’re using them from Oauth1Client instead.

  • [Linkedin+Twitter] Removed set_token because it’s handled in Oauth1Client now.

  • [Twitter::RailsUtil] Now rc_twitter_setup accepts options like rc_facebook_setup: auto_authorize, ensure_authorized, write_session, write_cookies, write_handler, and check_handler.

  • [Mixi] Removed Defaults middleware in favor of default_data.

  • [Facebook+Github+Mixi+Twitter] Added a me method for accessing current user information.

INSTALLATION:

gem install rest-more

Or if you want development version, put this in Gemfile:

gem 'rest-more', :git => 'git://github.com/cardinalblue/rest-more.git',
                 :submodules => true

SYNOPSIS:

require 'rest-more'

RestCore::Twitter.new.statuses('_cardinalblue') # get user tweets
RestCore::Github.new.get('users/cardinalblue')  # get user info

linkedin = RestCore::Linkedin.new(:consumer_key    => '...',
                                  :consumer_secret => '...')
linkedin.authorize_url!   # copy and paste the URL in browser to authorize
linkedin.authorize!('..') # paste your code from browser
linkedin.me               # get current user info

RestCore::Facebook.new.get('4') # get user info

See example for more complex examples.

[ANN] rest-core 0.8.0 released

rest-core

by Cardinal Blue http://cardinalblue.com

DESCRIPTION:

Modular Ruby clients interface for REST APIs

CHANGES:

rest-core 0.8.0 – 2011-11-29

Changes are mostly related to OAuth.

Incompatible changes

  • [OAuth1Header] callback is renamed to oauth_callback
  • [OAuth1Header] verifier is renamed to oauth_verifier

  • [Oauth2Header] The first argument is changed from access_token to access_token_type. Previously, the access_token_type is “OAuth” which is used in Mixi. But mostly, we might want to use “Bearer” (according to OAuth 2.0 spec) Argument for the access_token is changed to the second argument.

  • [Defaults] Now we’re no longer call call for any default values. That is, if you’re using this: use s::Defaults, :data => lambda{{}} that would break. Previously, this middleware would call call on the lambda so that data is default to a newly created hash. Now, it would merely be default to the lambda. To make it work as before, please define def default_data; {}; end in the client directly. Please see OAuth1Client as an example.

Enhancement

  • [AuthBasic] Added a new middleware which could do basic authentication.

  • [OAuth1Header] Introduced data which is a hash and is used to store tokens and other information sent from authorization servers.

  • [ClientOauth1] Now authorize_url! accepts opts which you can pass authorize_url!(:oauth_callback => 'http://localhost/callback').

  • [ClientOauth1] Introduced authorize_url which would not try to ask for a request token, instead, it would use the current token as the request token. If you don’t understand what does this mean, then keep using authorize_url!, which would call this underneath.

  • [ClientOauth1] Introduced authorized?
  • [ClientOauth1] Now it would set data['authorized'] = 'true' when authorize! is called, and it is also used to check if we’re authorized or not in authorized?

  • [ClientOauth1] Introduced data_json and data_json= which allow you to serialize and deserialize data with JSON along with a sig to check if it hasn’t been changed. You can put this into browser cookie. Because of the sig, you would know if the user changed something in data without using consumer_secret to generate a correct sig corresponded to the data.

  • [ClientOauth1] Introduced oauth_token, oauth_token=, oauth_token_secret, oauth_token_secret=, oauth_callback, and oauth_callback= which take the advantage of data.

  • [ClientOauth1] Introduced default_data which is a hash.

INSTALLATION:

gem install rest-core

Or if you want development version, put this in Gemfile:

gem 'rest-core', :git => 'git://github.com/cardinalblue/rest-core.git',
                 :submodules => true

If you just want to use Facebook or Twitter clients, please take a look at rest-more which has a lot of clients built with rest-core.

All texts are licensed under CC Attribution 3.0