How to enable ephemeral storage on Amazon Beanstalk instance.

Amazon’s Beanstalk is a great deployment environment for startup like us. Occasionally, we see issue on the beanstalk but lucky beanstalk allow us to use custom AMI for the beanstalk instances.

One of the issue we seen is that beanstalk only comes with 8GB ESB storage. But in fact, each EC2 instance comes with ephemeral(local) storages.(the size varies based on the instance type).

Our goal is to enable these missing ephemeral storage for the tomcat application. To do create a custom AMI with ephemeral storage.

I. Disable Auto Mount

Due to the default setting in CloudInit, it always mounts the first ephemeral drive on /media/ephemeral. To make the mountpoint customizable, we have to disable automount ephemeral0 first.

To do so, you have to launch a new instance with the beanstalk AMI first.

ec2-run-instances ami-b8c539d1 -t m1.large

Log in to the server
Edit /etc/sysconfig/cloudinit, and set CONFIG_MOUNTS=no.
Edit the /etc/fstab

/dev/sdb /var/cache/tomcat6 auto defaults 0 2
  /dev/sdc /tmp auto defaults 0 2

And then delete everything in /var/cache/tomcat6.

rm -rf /var/cache/tomcat6/*

II. Create a Temporary AMI

Log in to http://aws-portal.amazon.com and create a new AMI based on the instance we just used.

III. Create the Cloud Init Script

Open your text editor and create a tomcat.init script on your local machine

#!/bin/sh

chown root:root /var/cache/tomcat6
chmod 755 /var/cache/tomcat6
chmod 1777 /tmp

if [ ! -d  /var/cache/tomcat6/temp ]
then 
  mkdir /var/cache/tomcat6/temp
  chmod 775 /var/cache/tomcat6/temp
  chown tomcat:root /var/cache/tomcat6/temp
fi
if [ ! -d  /var/cache/tomcat6/work ]
then 
  mkdir /var/cache/tomcat6/work
  chmod 775 /var/cache/tomcat6/work
  chown tomcat:root /var/cache/tomcat6/work
fi

IV. Create a New Instance with Ephemeral Storage

ec2-run-instances ami-xxxxxxx --user-data-file tomcat.init -b /dev/sdb=ephemeral0 -b /dev/sdc=ephemeral1 -t m1.large 

V. Create Beanstalk AMI

Log in to http://aws-portal.amazon.com and create a new AMI based on the instance we just initiated. This AMI is the AMI you can use in your beanstalk environment.

Why google.map don’t work well in Taiwan

This is part of my posting on telnet://ptt.cc

Google街景不準,跟台灣門牌號碼制度的落後比較有關。

先說美國的門牌號碼作法,以紐約市為例 http://tinyurl.com/44arddr

直的是 Ave(大道),橫的是St(街),門牌號碼的排法是每一個路口就是重新算 100號做起始。所以算 3712 號,就是在該路第三十七跟三十八個路口間,用內差法來做排列。若是一個大樓占據了整個區間,下一個路口仍是從 xx00 開始排

至於台灣的排法,則是從路口來數大樓數,要是碰上一個大樓佔了整個區塊,下一個建物還是的門牌還是 N+1

http://tinyurl.com/4yhjwz7
所以就碰上了從市貿到NY Bagles 這邊,整排都是大型大樓,就只有幾個門牌號碼。在這一區,Google就吃鱉吃的很慘,我有次要去鴻喜花園的店,Google.Map給我的地址跑到三百公尺外的牡丹園去。

美國的門牌號碼編法,讓Google.Map等要存的資料較少,要定位時用內插法來估,也不會歪太遠;台灣的門牌編法,除了一個一個點的去存資料,不然變成沒有辦法精確的定位。

ps: 台灣門牌,原地改建時會變得更好玩,一棟變三棟就變 -1 -2 -3 ,我上禮拜有碰過 -47 的 Orz..

Monthly Review: March 2011.

It was quit busy three months for me and thing has changed a lot during the last three month.

First, we had a new hire, a full-time SDET, Ace Chen. He will be responsible for load testing and performance estimating on our platform product.

On the frontend side, Even and Michael are working hard to bring the frontend UI to market. We are approaching the final stage of design and implementation. You could expect to see the beta release in the coming two months.

A pricing and billing system is under-way too, we have surveyed few billing platform including Paypal WebPro, Recurly, Braintree, etc… and chose Chargify as our solution.

On the platform side, a lot of thing has changed. First, we switched our choice of cloud provider from Rackspace to Amazon beanstalk. The decision is based on our experience with operational support and reliability of Rackspace.

Also, the platform has written to adopt to the benefit of the Amazon offering. The cassandra cluster has been replaced by S3 and SimpleDb. Asynchronized event processing is brought to our platform with the help from Akka, Camel, and Amazon SQS.

During the load test, we already got some good numbers from the platform. We will start to build demo client applications soon.

Monthly Review: December 2010.

December is a quite interesting month for bluetangstudio.

We have hired our 1st (part-time) employer as a SDET. Also, we may have a new hire who will join bluetangstudio early next year.

Also, we have finalized the software architecture design and the customer facing API for our platform produce. At the mean time, we also finalized the web design. This is quit going well this year.

Being an entrepreneur is always an exciting thing on both good and bad side of life. One just can not expect what will happen in the next second. No matter what kind of difficulty is standing in front of you, you have to laugh at it and solve the situation.

Early this month, we lost one web designer contractor before of his tight schedule. In just few days, I met another excellent web designer, Even Wu. Even has designed few major websites in Taiwan, I can’t wait to see what kind of product we will create together.

Blue Tang Studio is Hiring…

Blue Tang Studio is a newly founded startup focusing on location base service. We are building a search platform for mobile applications and web-applications. Currently, We are looking for experienced developers to create our framework product.

Required Qualifications:
* At least 4 years experience in Java and web development.
* Familiarity with JavaScript, jQuery and/or prototype.
* Experience with agile development methodologies.
* Good understanding of RESTful web-service, JSON, XML, JAXB,and JAX-RS.
* Prior experience with dependency injection frameworks, such as Spring or Guice.
* Proficient with Linux/Unix and open source tools/platforms
* Proficient in English

Bonus:
* Experience with search, using Lucene and/or SOLR.
* Experience with Tapestry 5.
* Familiarity with dynamic languages such as Ruby, Python, and Scala.
* Familiarity with web application architecture and deployment.
* Experience with Google App Engine or Amazon EC2 is beneficial.

Programming Challenge:
Without using any built in date or time functions, write a function or method that accepts two mandatory arguments. The first argument is a string of the format “[H]H:MM {AM|PM}” and the second argument is an integer. Assume the integer is the number of minutes to add to the string. The return value of the function should be a string of the same format as the first argument. For example AddMinutes(“9:13 AM”, 10) would return “9:23 AM”.

Work Condition:
* Office location: 臺北市大安區敦化南路1段245號11樓(敦南誠品樓上)
* Flexible work hour: You have to attend to 11am daily meeting and provide 8 hours of service.
* Labor and Health insurance.

Please send you resume, the source code, and your desired pay rate to jobs@bluetangstudio.com to apply for this position.

About Us

原點科技(Blue Tang Studio) is a newly founded start-up focusing on location based service. We are building a search platform for mobile applications and web-applications.

The platform is our strategic product and will enable the internal and external customers to build new location based service within few weeks.

The are looking for talented and self-motivated people to join our team.

原點科技為一新創公司,公司的主力方向是在Location Based Service,目前正在開發搜尋平台中。

軟體產品(Product)與軟體專案(Project)的不同在於,假設一個Project需要五個人,再開一個專案需要再五個人;而產品,一個客戶跟一千個客戶,開發成本是相同的,獲利高但是全球競爭,只有前兩名能夠生存。

敝公司的目標正在於,建立一個雲端資料庫,提供SDK及Cloud Solution給各國的軟體公司,希望有志於軟體產品開發的人材加入。

美國運通AMEX卡介紹,及如何比較點數回饋

在第一篇介紹完第一銀行的幾張現金回饋卡後,接著我要介紹美國運通卡;AMEX發行的卡片,曾是筆者在美國時期的最愛,AMEX的目標客戶群是人口結構中收入較高的一群,提供的服務自然不在話下,如30天只要USD 29塊的租車保險,購物自動延長一倍保固(買電器最好用,買Apple MacBook,刷AMEX的卡,一年保固變兩年保固),與COSTCO發的聯名卡在餐廳刷有3%的現金回饋,是外食族的最愛,刷機票旅館也有2%;為了與現金回饋的卡競爭,所以也推出有1.5%的Blue Cash。

然而以上這些好處,在台灣發行的美國運通卡,通通都沒有

美國運通在台灣發行的卡別,主要是國際共通的綠卡金卡白金卡,以及數張航空公司聯名卡。

在台發行的美國運通卡,通通沒有提供現金回饋,只可累積點數兌換贈品;雖然這幾張卡沒有提供現金回饋的方式,可是接下來筆者仍要透過幾個計算,來把這些點數回饋方式與現金回饋方式來做個比較。

以綠卡來說,每年有年費1,800,加入累積點數還有額外1,000元的費用,點數的累積則是每30元一點。

若是想要用點數抵掉年費,要14,400點,約是要刷432,000元,才可以抵掉1,800元的年費,換算起來,現金回饋的比率是0.42%。

點數除了可以抵年費外,還可以用來直接抵刷卡金額,規則是每1,000點可以抵新台幣100元,換算起來是100 / 1000 / 30 = 0.33%。

或者,你可以拿點數換一客晶華酒店下午茶(5,200點抵590元消費),折算起來是0.38%的回報率。

不論怎麼說,若是你的目標是拿現金回饋的話,美國運通的綠卡、金卡、白金卡,你都可以略過了,不只回饋的比率低,還要先繳納1000元才可以加入現金回饋的方案;這樣不管你怎麼刷,回報率永遠是追不上0.5%的現金回饋卡的。

至於與航空公司所發行的聯名卡,未來會有專文比較。

三種現金回饋方式介紹

function update() {
s1 = parseInt($(‘#general’).attr(‘value’));
s2 = parseInt($(‘#grocery’).attr(‘value’));
s3 = parseInt($(‘#dpstore’).attr(‘value’));

total = s1 + s2 + s3;

cb1 = total * 0.005;
cb2 = total * 0.001;
if (total > 10000) {
   cb2 = 10;
   cb2 += (total-10000) * 0.007;
}

cb3 = s1 * 0.002;
sp = s2 + s3;
if (sp < 20000) {
  cb3 += sp * 0.002;
}
else {
  sp -= 20000;
  cb3 += 20000 * 0.002;

  if (sp < 30000) {
    cb3 += sp * 0.005;
  }
  else{
    sp -= 30000;
    cb3 += 30000 * 0.005;
    cb3 += sp * 0.008;
  }
}

$('#cb_one').text(Math.round(cb1));
$('#cb_two').text(Math.round(cb2));
$('#cb_three').text(Math.round(cb3));

}

格主在放洋期間,日常的娛樂之一,就是收集與申請信用卡,最多時,曾經同時擁有11張卡,每張卡的背後,都有不同的回饋,大多數的卡片,多是為了來店禮而申請的。在那個信用浮爛的年代,申請信用卡,美國的銀行,多會給予約100元的現金做申請時的獎金,靠這樣,我就賺進了約一千美金的現金,算是對日常生活的小補貼。

雖然說我有十多張卡,但是帶在身上的只有三張

  1. 不限商店別,一率2%現金回饋的現金回饋卡
  2. 在超市及加油站專用,5%現金回饋的卡
  3. 一張高額度的1.5%現金回饋卡,當做備用卡。

由於我是信用卡狂人,什麼消費能刷卡,絕不付現,因此,一年大約刷卡消費五十萬元,然後另外還有二十萬是花在超市及加油上;算起來,一年我都收到約兩萬元的現金回饋(500,000 * 2% + 200,000 * 5%)

接下來,就是要先用第一銀行的三張卡,來試算一下現金回饋的金額,這三張卡是:

卡名 第一銀行穩賺金融卡
年費 未知
循還利率 未知
現金紅利 每筆簽帳回饋0.5%
卡名 第一銀行媚儷鈦金卡【簽萬名媛】
年費 首年正卡年費1,200元,附卡年費600元(核卡即收無減免),第二年起,正(附)卡合計每滿1萬元,可扣抵年費100元,至年費扣底完為止。
循還利率 未知
現金紅利 當月累積簽帳達1萬,現金回饋0.7%;1萬以下回饋0.1%,刷的越多,回饋越高。
於24家大型百貨公司或東森、MOMO、VIVA電視購物單筆簽帳滿1萬元再享每日1次加碼60~100元現金回饋
卡名 第一銀行I First生活卡
年費 未知
循還利率 未知
現金紅利 一般消費:現金回饋0.2%
特定商店消費:
20000元以下現金回饋0.2%(1倍)
20,001~50,000元現金回饋0.5%(2.5倍)
50,001元以上現金回饋0.8%(4倍)

現金回饋試算表(可點選輸入不同數值)

一般消費金額
超市、賣場消費金額
百貨消費金額
穩賺金融卡 現金回饋:100
媚儷鈦金卡 現金回饋:80
I First生活卡 現金回饋:40

乍看之下,好像穩賺金融卡的福利最遭,可是細算之下好像又不是這樣。用上面的試算表,算一下,若是消費金額少、且不在超市及百貨消費的話,給與5%現金回饋的穩賺金融卡,比另外兩者可能幫你賺的更多的錢。至於I First生活卡,只有在百貨每月消費超過七萬元時,回饋才會比穩賺金融卡多。

至於這之間要怎麼拿捏,這一點先擱著,未來,我會再專文探討詳細的操作手法的