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

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

Connect LinkedIn Account into your Rails Application with Authlogic and OAuth

LinkedIn launched its new API in November 2009, allowing any developer brave enough to implement OAuth to integrate with one of the largest social networks around. Seeking an opportunity to really understand OAuth more fully and play around with the LinkedIn API at the same time, I created the LinkedIn connect sample code.

This is a sample Ruby on Rails tutorial to demonstrate how you can use the LinkedIn API to authenticate users and pull their profile data into your own website.


GETTING STARTED


Before you can use the LinkedIn API, you'll need to set up your API keys.

Getting Started with the LinkedIn API


1. Where do I begin? Start by navigating to http://developer.linkedin.com. This is Linkedin developer portal where you can read API documentation, collaborate with other developers, and keep abreast of changes to the LinkedIn API. From here, click on “LinkedIn APIs.”

2. Now click on “Request an API Key”

3. After logging in, you’re now presented with an opportunity. You can create as many API keys as you like, one for each application that you create. Let’s get started.


4. This isn’t as complicated as it looks. Let’s look closely.
Application Developers: This is a list of your LinkedIn Connections that will receive network updates published by your application and is used only while it is in development mode. You need to be connected to any LinkedIn member that you want to put on this whitelist. Interface Language: Your application is provided in one or more languages to end users. Let us know what those languages are so we can better support you in the future. Programming Tools: Knowing what kind of programming languages and tools you use to develop your application lets us know what languages and environments are most important for us to support. Just a few more fields to go over!

5. Ready to get your API keys? When you’re done, click “Add Application”
Contact Info: Tell us how to get in contact with you should we have a question about or there is a problem with your application.
OAuth Redirect URL: If you have a static location that should always be used for your OAuth callbacks, you can specify it here. It is recommended that you use the oauth_callback parameter in the appropriate requests instead.
Agreement Language: If you’d like to force the login screen to appear in one of the languages LinkedIn supports, you can set that here. It is recommended to leave the setting at “Browser Locale Setting.”
Terms of Service/CAPTCHA: Please do read our API Terms of Use. You cannot create an API key without agreeing to our terms. You’ve likely seen a CAPTCHA before, and it needs little explanation.



6. You’ve got your API keys. What’s next?
The LinkedIn Developer Network is where you’ll find guidelines, documentation, and growing community of developers.


RUBY GEM INSTALLATION


First you need to upgrade your Rails VERSION to 2.3.x, and install the required Ruby Gems below:

1. Setup and use Authlogic

$ sudo gem install authlogic

2. Install OAuth and Authlogic_Oauth

$ sudo gem install oauth
$ sudo gem install authlogic-oauth

3. Install other required Ruby gems

$ sudo gem install json
$ sudo gem install crack

Or for older version of Rails, you can install it as a plugin:

$ script/plugin install git://github.com/binarylogic/authlogic.git
$ script/plugin install git://github.com/jrallison/authlogic_oauth.git

* Authlogic at Github:http://github.com/binarylogic/authlogic
* Authlogic Example: http://github.com/binarylogic/authlogic_example


SETUP API KEY IN YOUR APP


Create load_linkedin_config.rb in #{RAILS_ROOT}/config/initializers directory

Create linkedin_config.yml in #{RAILS_ROOT}/config directory



DATABASE MIGRATION


1. Make some changes to user table in your database:

$ script/generate migration AddLinkedinConnectToUsers

2. Create Position,Education and Connection model:

$ script/generate model position

$ script/generate model education

$ script/generate model connection


3. Modify the User model, add the content below to the #{RAILS_ROOT}/app/models/user.rb:

The private method "populate_oauth_user", which is called before user record created, and is used to fetch profile info (name, headline, industry, profile pic, public url, summary, specialties, web urls) in LinkedIn.com, and save these info to your user record. The other private method "populate_child_models", which is called after user record created, and which will save past position info (companies, job titles, durations, descriptions), education info (schools, degrees, field of study, dates, etc) and connections info (names, industries, headlines, profile pics) for user.

4. Modify the Connection model, add the contents below to the #{RAILS_ROOT}/app/models/connection.rb:

5. Modify the Education model, add the content below to the #{RAILS_ROOT}/app/models/education.rb:

6. Modify the Position model, add the content below to the #{RAILS_ROOT}/app/models/position.rb:

7. Create UserSession model, and define the oauth_consumer class method on your UserSession model:


CONTROLLER METHOD


You only need to save your objects this way if you want the user to authenticate with their OAuth provider.

That being said, you probably want to do this in your controllers. You should do this for BOTH your User objects and UserSession objects (assuming you are authenticating users). It should look something like this:

You should save your @user objects this way as well, because you also want the user to authenticate with OAuth.

In my case, I have to integrating the LinkedIn OAuth Sign in feature to my current Rails project, so I changed the "Create" method in my UsersController like this way:

When the user click on the LinkedIn Login button and we can't find the oauth_token and oauth_secret in the database, the user will be redirect to signup page with "linkedin_user" parameter. After fill in the fields, they will be redirect to LinkedIn authentication page, then user record will be created. If we can find the oauth_token and oauth_secret in the database, the user will be login to the site.



ADD REGISTER BUTTON


You can simply use the "oauth_register_button" helper method to add LinkedIn register buttons to your views, like this:

Now add some style in your CSS file for LinkedIn button:



NEXT STEPS


Now we have user's LinkedIn data saved in the database, so you can write some codes to show the user's LinkedIn profile data (such as Username, Headline, Location, Education, Position, Websites, Skills, Experience, Connections) in the website.

You may want to add methods to update profile info on each login or update request. Or pull status updates, specialties, and current position for connection.

If you're interested in learning more about LinkedIn and OAuth, I encourage you to checkout Taylor Singletary's presentation LinkedIn OAuth: Zero to Hero.

熱門文章

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

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

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

Mar, 2024【桃園龍潭】石門山景春步道、小粗坑古道隨意走走|順遊石門水庫、黃大目豆干

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

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

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

【美國加州】加州一號公路自駕遊~Half Moon Bay、17 Mile Drive、Bixby Greek Bridge、Big Sur、McWay Falls、Elephant Seal Rookery

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

Apr 24, 2022【桃園蘆竹】桃園四月雪|輕鬆好走的羊稠森林步道油桐花盛開

文章列表

Contact

名稱

以電子郵件傳送 *

訊息 *