【南投信義】丹大林道與消失的省道台16線|可徒步深入中央山脈的經典長程林道

圖片
布農族人有這麼一句話:「濁水溪的上游,不是終點,是我們布農文化的起源」,這句話揭開 丹大林道 的旅行序幕。下面是幾年前,丹大林道還沒被媒體大肆報導前,我曾在某個冬季前往安靜的丹大林道徒步健行和野營,以及在工寮過夜的三天兩夜重裝健行紀錄。 2024.01.31更新:合流坪的鋼便橋已於今日被台電撤除了 連結: 台電施工後丹大林道「恢復」通行! 拆橋挖巨溝「車輛恐無法通過」 丹大地區 位於臺灣本島中部之濁水溪上游,行政區隸屬於南投縣信義鄉,為全國面積第二大的鄉鎮。丹大地區也是濁水溪的發源處。東側翻過中央山脈可達花蓮,南鄰玉山國家公園,西接日月潭國家風景區,北側則與仁愛鄉相接。 潭南、雙龍、地利及人和四村等區域皆位於信義鄉,著名的 丹大(孫海)林道 便位於地利村中,沿著步道往東至花蓮邊界處可與七彩湖相接。其中地利村及雙龍村面積最大,合佔本區約七成面積,人和村次之,面積最小者為潭南村 。 丹大林道周邊地圖 丹大林道路徑示意圖 日治時期西元1943年,原本預計將東部花蓮木瓜溪流域附近的水力發電廠所生產的剩餘電力運輸到西部,但因為日本在1945年戰敗後,計畫就宣告中止,1948年台灣工業急速發展,用電量大增,直到1950年獲得美國援助執行了能高路線全長45公里的69kV東西向輸電計畫。 之後為了解決花東地區電力供應問題,台電於1985年開始研究新東西輸電之路線,最後決定自南投明潭發電廠與大觀第二發電廠輸送電力至花蓮鳳林超高壓變電所,此新東西輸電線於1990年開始辦理路線中心測量,1998年完工,全長72.4公里。 沿線共有196座電塔,線路橫跨中央山脈海拔2925公尺的崇山峻嶺,並在「 七彩湖 」附近的越嶺處設有「 光華復旦 」紀念碑,西以 丹大林道 、東以 萬榮林道 為維修保線道路。 丹大林道是深入丹大地區的重要通道,1958年(民國47年),出生於現今雲林縣口湖鄉的孫海,標得林務局巒丹大事業區第八林班地檜木原始林採伐權及伐木後的重新造林權,為了進入深林,孫海沿著原本的山徑開闢出可以卡車通行的丹大林道,因此丹大林道也被稱為「 孫海林道 」。 當年為了闢築林道與運輸需要,孫海建造了一座木橋於合流坪橫跨濁水溪,之後改為水泥橋,這座橋就是著名的「 孫海橋 」。 為了伐木業而開闢的丹大林道,其終點一開始並不是在七彩湖,後半段到光華復旦碑約12公里路段,是台電為了興建東西線輸電工程,才於

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封信(全文)

May 2023【台中南屯】地雷店食記|森鐵板燒|用餐體驗差,價格超貴卻豪無價值。小心別踩雷!!!

May, 2024【新北瑞芳】四腳亭步道|漫步油桐花步道,踏訪時光痕跡:四腳亭砲台歷史尋幽之旅

Sep, 2021【苗栗南庄】蓬萊林道Off Road小試|雨後很爛很濕滑|二傳低底盤車勿輕易嘗試

May, 2024【台北南港】更寮古道親山步道|土庫岳、山豬淚湖、山豬窟尖西南峰環狀型健行

Jun 24~25, 2022【南橫三星】庫哈諾辛山+【南臺首嶽】關山(進涇橋登山口)|2天1夜野營登山

【南投信義】丹大林道與消失的省道台16線|可徒步深入中央山脈的經典長程林道

April, 2023【彰化芬園】步道平坦好走!彰化八卦山「挑水古道」+十八觀音步道、碧山古道O形環走

【秋季清邁遊 Part 2|Hiking the Mae Sa Waterfalls and Mok Fah Waterfalls】The 6 Day Itinerary To Explore Chiang Mai And Northern Thailand's Mountains

Aug, 2023【桃園大溪】桃園小百岳編號23-溪洲山步道|適合訓練腳力、還能觀賞石門水庫的山水景色

文章列表

Contact

名稱

以電子郵件傳送 *

訊息 *