2014/02/18

AWS VPC 設定教學

在 AWS VPC(Virtual Private Cloud) 介紹中列了四種 scenario,在此以 Scenario 2: VPC with Public and Private Subnets 為例來說明操作過程。
整個過程會建立 public, private 兩個 subnet,public subnet 用來放置對外服務的 instance 具有 public IP,如 web server。而 private subnet,只允許 VPC 內部存取,如 database。


Create VPC

1. 建立 VPC,指定 CIDR block 爲 10.0.0.0/16
Local IP 位址從 10.0.0.0 - 10.0.255.255 共 256*256 個 IP


2. 切兩個 subnet
Public subnet CIDR: 10.0.0.0/16,IP 從 10.0.0.0 - 10.0.0.255
Private subnet CIDR: 10.0.1.0/16,IP 從 10.0.1.0 - 10.0.1.255
預設所有在 VPC 底下任何 subnet 的 IP 都可以互通

2014/02/12

Install YouTube plugin in PhoneGap

I develop app with PhoneGap 3.3.1, and import the YouTube plugin from YTPhoneGapPlugin.

Integrate steps:
1. Use command to install plugin
$ cordova local plugin add https://github.com/matiasmolinas/YTPhoneGapPlugin.git

2. Download YouTube api to project libs folder

3. Register the YouTube API Key from here, and fill the key in
android project/src/gdg/youtube/YouTube.java

4. Implementation
var videoId = "YSxYCMlkLsw";
var success = function() { console.log("Success"); };
var error = function(message) { console.log("Oopsie! " + message); };
window.youtube.playVideo(videoId, success, error);

If you met error message as following:
I/Web Console( 1614): Oopsie! No Activity found to handle Intent { act=com.google.android.youtube.api.StandalonePlayerActivity.START (has extras) } at file:///android_asset/www/app.js:1
Try to install YouTube app in your Android system, if you use emulator, try to download from google play and use command line to install it.
adb install com.google.android.youtube.apk
Reference