2018, Feb 21【北アルプス 乗鞍岳 厳冬期】Mt.乗鞍スノーリゾート ピストン☆日帰り雪山登山♨

圖片
2018年的農曆過年期間,和山友Bryan兄前往日本乗鞍岳和八ヶ岳山域進行雪季登山訓練。
2月19日晚上抵達羽田機場,乘坐高速巴士到新宿,晚上住宿在去年住宿過的旅館“新宿ビジネスホテル”,隔天早上9點出門,到中央東口附近的一蘭拉麵吃早餐,然後前往バスタ新宿(巴士總站),搭乘10點50分的高速巴士前往松本bus terminal。先去便利商店買些行動糧,然後乘坐上高地線電車前往“新島々駅”,然後再轉搭公車前往“乗鞍スキー場前”,晚上住在Ski Resort旅館街的天然溫泉旅館“なごみ湯 白樺”。
隔天早上吃完早餐,早上9點步行到滑雪場的リフト乗り場,乘坐3次リフト抵達かもしかリフト最上部(標高約1,970m的ツアーコース開始点)。夏季時,觀光客可以搭乘巴士直接抵達標高2,702m的畳平(乗鞍 bus terminal),但冬季公路早已被積雪覆蓋,這裡是冬季前往乗鞍岳最便利的登山口。
稍微整理一下登山裝備,早上9點50分啟程出發,稍早查看天氣預報,今天的天氣是多雲午後轉陰的天氣,因此從一開始就不抱持任何期待可以看見美麗的山景。從ツアーコース開始点出發後,雖然沿途足跡都很明顯,但沿路都是鬆雪,沒有買スノーシュー穿,每個步伐都走的相對費力,當下突然有點懊惱,但雖然如此,還是不影響行進的步調。
在沒有スノーシュー的狀態下,持續和鬆雪奮鬥了一個多小時,上午11點30分到達“ツアーコース終点 ”,這裡是分別前往“肩ノ小屋”和“位ヶ原山荘”的岔路口,位ヶ原山荘冬季有營業,如果安排2天1夜的行程,可以在那裡住宿一晚,但住宿必須事前預約。我們取直行繼續朝向肩ノ小屋前進。從岔路口開始,雪地上已經沒有明顯的足跡,天候也隨著時間逐漸變差,視野完全被濃霧所遮蔽,眼前只剩下一片白色,能見度大約只有10公尺,因此不時需要依賴GPS裝置來確認方向。
中午12點50分經過“大雪溪避難小屋”(當下以為這就是肩ノ小屋,後來回家查看地圖才知道並不是),小屋的入口處已經被封死,無法進去小屋取暖,只能站在小屋外吃點糧食補充水份。這時的溫度差不多有零下10幾度,加上風寒效應,手套一拿下來,手指頭瞬間失去知覺,後來發現小拇指有輕微凍傷。在這邊小休息10分鐘左右,繼續靠著GPS往山頂方向前進。
Bryan選了一條捷徑,走沒多久我就覺得奇怪,按常識來判斷,這種深雪和極陡的坡度,直覺就不是正常的登頂路線,後來回家查看…

FbGraph + OmniAuth + Facebook Graph API on Rails application

OAuth is often described as a 'valet key for the web'. In the same way as a valet key gives restricted access to a car, allowing the valet to drive it but not open the trunk or glovebox, OAuth allows a client application restricted access to your data at a resource server via tokens issued by an authorization server in response to your access grant.

Facebook Platform uses the OAuth 2.0 protocol for authentication and authorization. Suppose your Rails application allows users to share content with their Facebook friends. To support this, a connection needs to be established between a user's local account and her Facebook account. Once established, a Facebook instance can be obtained and used to post content to the user's wall. The basic idea is to store the access_token during an OAuth2 login process and later on use the token to fetch more data.

The last days I was working on letting user sign-up/sign-in using Facebook account. I'm planning to integrate some social features into my ongoing Rails project. Previously I was working with Facebooker, an awesome Rails plugin that did a great job for my previous project, however it seemed not support the latest Facebook Graph API. Thought I found a new solution.

OmniAuth is an open source project which provides support for many of the main providers out there: twitter, facebook, foursquare, and many more. In addition, OmniAuth is designed in such a way that it is very easy to implement custom strategies---interchangable logic which encapsulates the steps required to successfully authenticate with an Oauth2 provider.

OmniAuth relies on the request and callback sequence as defined in OAuth2 specification. OmniAuth extracts away a lot of the complexity of working with OAuth, so we can skip all of that information and focus on just what we need to. The diagram below depicts how OmniAuth handles the request and callback sequence:


The request phase of the OAuth dance typically redirects to a providers website which prompts the user to enter their credentials with the provider calling back to Omniauth with a success or failure message.

There is a couple of great screencasts on how to integrate Omniauth to Devise using Rails 3 and allow Facebook, Twitter, etc. authentications. In this post, I'm going to show you how to connect to the Facebook platform using FbGraph along with Omniauth to retrieve a list of records and post message to the facebook wall via its Graph API. For this example, I'm using Rails 2.3.8 on my Mac. But I strongly encourage you to start with Rails 3.

First, we would need a migration to store a permanent Facebook token for offline access:
$ script/generate migration AddFacebookTokenToUsers


Add the following to your config/environment.rb

Next, in your initializer, usually config/initializer/omniauth.rb, request additional permissions, we need to tell Omniauth to retrieve more Facebook permissions in order to have offline access, Wall, etc. You can define the ones you need from Facebook permissions API pages, but here is my setting:

If you get this error message when you're trying to run your Rails server: 
WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.8
The problem was most likely bad library management, if you don't have libxml2 in the Cellar directory on OSX, you can install it to this using homebrew:


Now, lets get to the application code changes. In the application controller we define the facebook_user like this:


In the routes.rb we add following routes:


Next, edit your fb_oauth_controller.rb add the callback method:


Callback is the action that is called after the authorization. The access_token is not restricted with time unless Facebook changes their policy and make them expire after a particular period of time, and is used later for interacting with Facebook.. To understand how it all works, read about Facebook permissions, the Graph API. The /auth/facebook url is invoked first. This redirects the user to Facebook where the user gets the permission prompt, to allow your application to access the users information. If everything works you should have the full authentication workflow going!



You can also use this URL to get a permanent access_token:


Facebook uses the OAuth 2.0 protocol for user authentication and application authorization. Following are the steps required to obtain an access token:

(a) Redirect the user to https://graph.facebook.com/oauth/authorize and pass the application id and post authorize callback URL as parameters to this API.
(b) User enters their credential in the above Facebook URL and after successfully authorizing the application, Facebook would redirect the user to the authorize callback url along with a verification string in the argument code, which can be exchanged for an OAuth access token.
(c) Generate an access token using the above verification code by fetching https://graph.facebook.com/oauth/access_token

Once the access token is obtained, all further communications to Facebook will only require this token instead of the user’s credentials. 


You can modify the callback method to integrate Facebook connect with your authentication system (Allow your users to sign up/sign in with their Facebook account). See the example below:


Now the application retrieves email and also you have an access to Facebook Graph API. For instance, to post something on Facebook wall you can:




Enjoy! hope this helps you :)


熱門文章

[轉載] 洛克菲勒寫給兒子的38封信(全文)

September, 2012 白姑大山二天一夜~其實沒那麼累,只是路途遙遠

2013.5.25~26【新阿溪縱走】眠月線鐵道線探勘。順登松山、萬歲山、小笠原山、對高岳

[平成28年9月11~16日]生命の息吹と太古の大自然に魅せられる、世界遺産屋久島2泊3日テント担いで縦走♪(淀川登山口~白谷雲水峡)

[平成28年11月24~29日]秘湯・絶景の家族旅行🍁🍁 奈良・和歌山2016秋/吉野山・洞川温泉・みたらい渓谷・瀞峡・湯の峰温泉・熊野古道

2017, Oct 29【桃園大溪】週末輕鬆走~打鐵寮古道&白石山

Jan 1, 2012 東北雪の鄉&北海道 跨年自由行~卷五。札幌&小樽・藻岩山、円山動物園、北海道神宮、拉麵横丁、小樽運河

文章列表