【美國加州 Yosemite National Park】優勝美地國家公園健行之一.迷人的秋日美景。飽覽山谷與Vernal Falls、Nevada Falls兩大瀑布

「一生必去」這4個字的最高等級用語,絕對可以用來形容美國加州的「優勝美地國家公園」(Yosemite National Park),相信沒有人會反對。因為它在世界上的地位,彷彿就是「大自然的大教堂」。
優勝美地國家公園(Yosemite National Park),是美國國家公園內極為閃耀的一顆明珠,地處加州東北部,內華達山脈的西麓,曾是印第安原住民阿瓦尼奇人(Ahwahneechee)的故鄉。公園的範圍橫跨加州中西部圖奧勒米縣(Tuolumne)、馬里波薩縣(Mariposa)和馬德拉縣(Madera)。優勝美地國家公園於於1984年被納入聯合國教科文組織(UNESCO)世界遺產,每年吸引4百萬來自世界各地的遊客前來觀光。
優勝美地國家公園內,有超過95%的土地被指定為原生地域(wilderness),為了要保護公園的原貌,美國總統林肯於1864年6月30日,將優勝美地谷蝴蝶林(Mariposa)內的美洲衫巨木林,設為美國的第一座州立公園。並且在「國家公園之父」約翰•繆爾(John Muir,1838~1914)這位作家、科學家、保育先知的倡議之下,於1890年成為第二座國家公園。它幾乎是全美甚至全球最受歡迎的國家公園。
公園內除了有四面絕壁的優勝美地山谷,還有充滿高山美景的圖奧勒米牧場,自然風光令人歎為觀止。而它的美和大遠遠超過一般人所暸解,公園的佔地面積超過1,169平方英哩/284,899 公頃,而其中最多遊客造訪的的優勝美地谷(Yosemite Valley),只佔了整個公園不到1%的面積。優勝美地國家公園主要有四大景區,呈F型分佈,分別是優勝美地谷(Yosemite Valley)、山頂的冰川點(Gracier Point)、北側的第奧嘉(Tioga Pass)以及南端的瓦沃納(Wawona)景區。這次的優勝美地之旅,只有北側的第奧嘉景區沒有造訪,那裡就留待下次不同季節再去造訪吧!

優勝美地山谷在上一次冰河時期被冰川覆蓋,山谷呈U字型,兩旁峭壁上到處可見由冰川切削過的痕跡,其中最有名的就是半圓頂(Half Dome),這顆巨岩是冰河時期所形成的,峰頂海拔2,693公尺,歷時8,700萬年,在地質與歷史上他就是個不折不扣的巨人。只要你在優勝美地國家公園內,走到比較高的地點,幾乎從任何地方,都可以看到它的身影,據說 North Face 品牌 logo 的…

Connect to the Foursquare API via OAuth in your Rails application

OAuth is an open authentication protocol that allows secure API communication without the necessity of continually passing a username and password with each request. The idea for OAuth was conceived in 2006 by a group of individuals working on the Twitter implementation of OpenID. 

After reviewing both OpenID and other existing industry practices, such as Amazon Web Services API and Flickr API, it was decided that a proposal should be written for a new open protocol for application authentication.

OAuth has been widely adopted among major web services. Twitter, not only implementing OAuth as its primary API authentication method, but using it as the basis for its “Sign in with Twitter” service. Today, you’ll also find the protocol used by Facebook, Google, Yahoo, LinkedIn, and many others.

Foursquare is a new and rapidly growing social utility whose potential for mash-ups with other applications is limited only by one’s own imagination. The Foursquare platform implements the OAuth 2.0 standard, so users can authorize applications to access Foursquare resources on their behalf without revealing their passwords or other credentials to those applications. The foursquare API gives you access to all of the data used by the foursquare mobile applications, and, in some cases, even more.

I have been experimenting with the Foursquare API for a few days now, and I wanted to show you how you can implement use Foursquare in your Rails application using OAuth 2.0 (This is a very simple Rails application that connects to the Foursquare API using Quimby [http://github.com/groupme/quimby]). It is working fine as I'm using Rails 2.3.8 on ruby 1.8.7 and it also work with Rails 3!

I'm going to just give you the concept for this post. If you have no prior experience with Ruby or you are new to Rails, as you read this post, don't get use these code directly, it will not work for your blank Rails application.

Below is a general overview for an OAuth connection: 
1.Send request to target website for token, with the server's client_id & secret_id 
2.Redirect user to authorize page with token (and callback url)
3.After user confirm, user will be redirect to the callback page with a access_token
4.Save the access_token, and free to call target server for user data.

You will need a Foursquare account to obtain your key and secret in the first place. Visit https://foursquare.com/oauth to register your Rails application and obtaining your API credentials, where you need to provide an app name (ex: Railscode), a website url (ex: http://localhost:3000) and a callback URL (ex: http://localhost:3000/fsq_callback).  It’s a free signup, and if you wish to work on the API I’m sure you’ve already had an interest in the application! After registration, you should see something like this:

Copy your Foursquare App Client ID & Client Secret and paste it into your environment.rb or maybe config_foursquare.yml. The callback URL is the location your users will be sent after they authenticate on Foursquare’s site.

Next run rails script to generate a migration file:
$ script/generate migration add_foursquare_to_users

And we have to install the following ruby gems:

We need to be able to intercept this redirect, capture the token, and store it so we can begin interacting with Foursquare. Add the following method to the application controller:

Next we need to write a callback method in the fsq_oauth_controller.rb. Once we’ve retrieved the code from the Foursquare server, we can exchange it for an access token.

Add the following line in the routes.rb:

In order to retrieve an access token, we need to redirect the user to the Foursquare authorization URL (More info can be found on https://developer.foursquare.com/docs/oauth.html). we can add the foursquare connect button in the view page:

When pressing the login button, you can login with your Foursquare credentials!

Now that the app has an access token, we can launch our main activity and start interacting with Foursquare.

This has been a basic look into getting started with Foursquare’s API. OAuth is a very powerful open protocol for connecting into larger social communities. It offers the most secure solutions for both users and web masters. The Foursquare Developers center is an amazing tool for newbies.Scour the resources and look up and function calls you may be interested in working with. Similarly the official OAuth website has some terrific readings outlining the purpose and practical solutions for the protocol.


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



【台灣百岳】2017, Sep 23~25 大壩群峰(大霸尖山、小霸尖山、加利山、伊澤山)3泊3日輕鬆行♪

【美國加州 Yosemite National Park】優勝美地國家公園健行之一.迷人的秋日美景。飽覽山谷與Vernal Falls、Nevada Falls兩大瀑布


2D & 3D Mobile Game Engines for iOS and Android Platform




以電子郵件傳送 *

訊息 *