Ruby URL safe base62 string like youtube
http://ronny.haryan.to/archives/2009/04/07/build-your-own-url-shortening-service/#more-191
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
class BaseCodec def self.base_n_decode(s, alphabets) n = alphabets.length rv = pos = 0 charlist = s.split("").reverse charlist.each do |char| rv += alphabets.index(char) * n ** pos pos += 1 end return rv end def self.base_n_encode(num, alphabets) n = alphabets.length rv = "" while num != 0 rv = alphabets[num % n, 1] + rv num /= n end return rv end end class Base62 < BaseCodec ALPHABETS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" def self.decode(s) base_n_decode(s, ALPHABETS) end def self.encode(s) base_n_encode(s, ALPHABETS) end end |
Cloud Computing Presentation- Hong Kong Institute of Vocational Education
Hello Everyone,
My name is YinPeng, and I have been with the Ankoder/RoRCraft team since February this year. It has been a few months since arriving here, and already I have a taste of how a start-up company really works, instead of studying books and listening to University Professors.
Let me update you on what has been happening in the last few weeks. Besides the fact that I am learning many new things, like branch related terms, we are working hard to improve the functions and the website in order to be able to meet the needs of our customers. Since the competition in the video encoding world is growing with the popularity of online video, more and more new competitors arise in this industry each day.
Last week, Rex Chung- founder of RoRCraft and Ankoder, went to the Hong Kong Institute of Vocational Education in TsingYi to talk about Cloud Computing and Online Video to the computing students present. The students were very enthusiastic about this subject, and asked a lot questions regarding the presentation. Given the nature of the students that attended, it is safe to say that there are going to be very skilled and motivated Internet skilled workers in the coming future. On behalf of Rex and all of us here at RoRCraft, we would like to thank the Hong Kong Institute of Vocational Education for allowing the privelidge of presenting on such a new and upcoming topic.
The slide content of the presentation is posted below.

<br />
Port install FFmpeg updated.
cd /opt/local/var/macports/sources/rsync.macports.org/release/ports/multimedia/ffmpeg
vi PortFile
7 configure.cflags-append DHAVE_LRINTF ${configure.cppflags}-disable-mmx \
78 configure.args \
79 —disable-vhook \
80 —enable-gpl \
81 —enable-postproc \
82 —enable-swscale —enable-avfilter —enable-avfilter-lavf \
83 —enable-libmp3lame \
84 —enable-libvorbis \
85 —enable-libtheora \
86 —enable-libdirac —enable-libschroedinger \
87 —enable-libfaac \
88 —enable-libfaad \
89 —enable-libxvid \
90 —enable-libx264 \
91 —mandir=${prefix}/share/man \
92 —enable-pthreads \
93 —enable-nonfree \
94 —enable-libamr-nb —enable-libamr-wb \
95 —cc=gcc-4.0
96 #
http://www.penguin.cz/~utx/amr
get libamrnb and libamrwb
downgrading lame to 3.97
Quick Update Rorcraft Hong Kong Office in Science Park
We’ve been quiet here for a while, which means we’ve been very busy.
We moved into our new HK office at the Science Park late 08.
We’ve been working on some large projects since then, and we’re also working hard on Ankoder.
Here’s some photos from our new office.

Quick guide to Amazon EBS
We’ve switched to use Amazon EBS for a few months now. Therefore, we have been able to have a good night’s sleep without worrying our database disappearing. Here’s a quick guide.
It’s very easy to use EBS for EC2. First make sure you downloaded the latest ec2-api-tools (you can’t find EBS related tools in its old version). Here’s my ec2-api-tools info (yours don’t need to be exactly same with me):
—- ruby $ ec2ver
1.3-24159 2008-05-05
—-
EC2 instance can only use EBS in the same avaliablity zone with it, so we need to check the availability zone in which your ec2 instances are. You can do this by
$ ec2din
…
INSTANCE i-abc12345 ami-abc12345 ec2-…compute-1.amazonaws.com ip-….ec2.internal running 0 m1.small 2008-06-23T23:12:26+0000 us-east-1b
So the instance is in us-east-1b. Now create a 200G storage block in this zone:
—- ruby$ ec2-create-volume —size 200 -z us-east-1b
VOLUME vol-4d826724 200 creating 2008-10-14T00:00:00+0000
1 2 3 4 5 6 |
You can check the block by<br /> <br /> --- ruby$ ec2-describe-volumes vol-4d826724 VOLUME vol-4d826724 200 available 2008-10-14T00:00:00+0000 |
The block now is created. It’s like we have bought a 200G harddisk from amazon, now let’s install it on our ec2 instance:
—- ruby$ ec2-attach-volume vol-4d826724 -i i-6058a509 -d /dev/sdh
ATTACHMENT vol-4d826724 i-6058a509 /dev/sdh attaching 2008-10-14T00:15:00+0000
1 2 3 4 5 6 7 8 |
This will let the system on ec2 instance recognize our new block storage on /dev/sdh (you can specify any device name that not the same with currently used, like /dev/sdz). Now you can use this device (/dev/sdh) as a normal block device like other real disk partitions(such as /dev/sda). For example,<br /> <br /> --- ruby$ mkreiserfs /dev/sdh #this will format it with reiserfs $ mkdir /mnt/data $ mount /dev/sdh /mnt/data #mount the block to /mnt/data, now all data write to /mnt/data dir will be # persistent on the block storage vol-4d826724. it won't lost after you reboot the machine |
Some other useful tools are:
ec2-describe-volumes: used to find the relationships between your blocks and instances
ec2-detach-volume: detach a block from instance
Here’s a full manual of EBS.
Download youtube videos with ruby
As you might know, we’ve released Ankoder.net for while now. It lets anyone to download videos into their iPods and various other formats. Scraping the flv url from Youtube HTML isnt exactly easy.
This is how we do it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
def parse_youtube(url) youtube = "http://www.youtube.com/" # url =~ /(?:http\:\/\/.*youtube.com\/(?:watch\?v=|v\/))?(.*)$/ url =~ /watch\?v=(.*)/ video_id = $1 video_id = video_id.split("&")[0] flv_url = nil open("#{youtube}watch\?v=#{video_id}") do |f| f.each_line do |line| if line =~ /watch_fullscreen\?(.*?)video_id=([\w-]+)&(.*?)&t=([\w-]+)&/ # p line flv_url = "#{youtube}get_video?video_id=#{$2}&t=#{$4};auto" break end end end flv_url end USER_AGENT = %{Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071231 Firefox/2.0.0.11 Flock/1.0.5} IO.popen("curl -o \"#{file_name}\" -L -A \"#{USER_AGENT}\" \"#{parse_youtube(url)}\" 2>&1") |
Uploading large files to Rails with Merb
As you know Rails does bad on handling file upload, a large file will block your Rails app a long while, make it busy on receiving the file and can’t give response to other visitors, make them upset and leave you alone.
One solution is using merb to handle file upload for rails. The latest Merb that build on Rack(a cool framework who help you dealing with all kinds of http servers) does a really good job on uploading.
First, install merb:
—- rubysudo gem install merb
1 2 3 4 5 6 7 |
Second, create a merb app in your rails dir:
--- ruby
merb-gen app uploader
cd uploader
|
You can ignore all other files except config/rack.rb, this is the only file we need to modify.
Currently there’s only one line in the file:
1 |
run Merb::Rack::Application.new |
It will ask merb to handle the http request come from rack.
Let us change this file to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
require 'cgi' class File def to_s path end end # build a new handler to handler rack's request class Uploader def call(env) # leverage merb's utility to parse the request. # Merb will save the file to a tempfile and save the tempfile's path in request's param request = Merb::Request.new(env) params = request.params # pass the params directly to the real (rails) app result = post("http://someplace.com/api", hash_to_params(params)).split("\n")[-1] # processing result or just ignore it ... end private def post(url, params="") curl_cmd = "curl -H \"Content-type: application/x-www-form-urlencoded\" #{url} -d \"#{params}\"" puts "curl_cmd = #{curl_cmd}" f = IO.popen(curl_cmd +" 2>&1") result = f.read f.close result end def hash_to_params(hash) hash.map do |k, v| if v.kind_of? Hash h = {} v.each { |kk, vv| h["#{k}[#{kk}]"] = vv } hash_to_params h else "#{k}=#{CGI.escape v.to_s}" end end.join("&") end end run Uploader.new |
Run merb by
merb p 1234 -c 1 -e production -d-
-
Remember to config your apache or your favorite webserver to redirect all request from /uploader to port 1234 (Your merb uploader is listening here!).
Pretty easy, isn’t it?
Ankoder.net - download youtube videos straight to your ipods
We released http://free.ankoder.com a couple of months ago, there’s been a steady growth. Many users wanted to download the videos straight to their ipods, and now we’ve done it. We’ve relaunched the site as htt://www.ankoder.net and we’ve given a it a long dued face lift as well.

First, sign up for an account on Ankoder.net.
Once logged in, goto “My Videos” and copy the podcast link.

Now goto iTunes > Advanced > Subscribe to podcast. Paste that podcast link and click ‘OK’.


Now you can start downloading by inputting the youtube link and select “ipod”.
Then click “Download”.
The videos will be downloaded to your iTune and sync with your ipod or iphones automatically.


The Facebook autocomplete address to: field.
We’ve extended the Autocomplete.Local from Scriptaculous to implement the autocomplete to: field mimicing the Facebook’s features. This was a little challenging at the start, but prototype.js and scriptaculous have just made it so much easier.

Concepts
- json – array of contacts with names and email address and any other fields you wish to search
- The input box changes size dynamically and reposition itself according to the keystrokes
- Each ‘token’ created is an input field, submitting the id of the user or an email address
Straight to the source
Syntax
1 |
new Autocompleter.LocalAdvanced(id_of_text_field, id_of_div_to_populate, json_array, options)
|
The constructor takes four parameters. The first two are, as usual, the id of the monitored textbox, and id of the autocompletion menu. The third is an array of strings that you want to autocomplete from, and the fourth is the options block.
Extra local autocompletion options
| Option | Default Value | Description |
|---|---|---|
search_field |
“name” | Which attribute to search in the json array. |
choices |
10 | How many autocompletion choices to offer |
partialSearch |
off | If false, the autocompleter will match entered text only at the beginning of strings in the autocomplete array. Defaults to true, which will match text at the beginning of any word in the strings in the autocomplete array. If you want to search anywhere in the string, additionally set the option fullSearch to true |
fullSearch |
false | Search anywhere in autocomplete array strings. |
partialChars |
2 | How many characters to enter before triggering a partial match (unlike minChars, which defines how many characters are required to do any match at all). |
ignoreCase |
true | Whether to ignore case when autocompleting |
Example
HTML
1 2 3 4 5 6 7 8 9 10 |
<div tabindex="-1" id="ids" class="clearfix tokenizer" onclick="$('autocomplete_input').focus()"> <span class="tokenizer_stretcher">^_^</span><span class="tab_stop"><input type="text" id="hidden_input" tabindex="-1"></span> <div id="autocomplete_display" class="tokenizer_input"> <input type="text" size="1" tabindex="" id="autocomplete_input" /> </div> </div> <div id="autocomplete_populate" class="clearfix autocomplete typeahead_list" style="width: 358px; height: auto; overflow-y: hidden;display:none"> <div class="typeahead_message">Type the name of a friend, friend list, or email address</div> </div> |
Javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
(new Image()).src='/inbox/images/token.gif'; (new Image()).src='/inbox/images/token_selected.gif'; (new Image()).src='/inbox/images/token_hover.gif'; (new Image()).src='/inbox/images/token_x.gif'; var contacts = [ {name:"phoenix zhuang",email:"phoenix@rorcraft.com"}, {name:"jian xie",email:"jan.xie@rorcraft.com"}, {name:"isaiah peng",email:"isaiah.peng@rorcraft.com"}, {name:"chris chan",email:"chris.chan@rorcraft.com"}, {name:"rex chung",email:"rex@rorcraft.com"}, {name:"chung rex",email:"chung@rorcraft.com"}, {name:"chan chris",email:"chan@rorcraft.com"}, {name:"peng isaiah",email:"peng@rorcraft.com"} ]; var typeahead = new Autocompleter.LocalAdvanced('autocomplete_input', 'autocomplete_populate', contacts, { frequency: 0.1, updateElement: addContactToList, search_field: "name" }); var hidden_input = new HiddenInput('hidden_input',typeahead); |
CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
/* autcompleter.advancedlocal css */ .tokenizer{min-height:5px;padding:0px 0px 3px 3px;width:100%;background:#fff;font-size:11px;} .tokenizer_locked{background:#f4f4f4;} .tokenizer, .tokenizer *{cursor:text} .tokenizer input{width:100%;} .tokenizer .tokenizer_input, .tokenizer .token{float:left;margin-right:3px;margin-top:3px;} .tokenizer .tab_stop, .tokenizer .tokenizer_stretcher{display:block;float:left;overflow:hidden;width:0px;} .tokenizer .tab_stop{height:0px;} .tokenizer .tokenizer_stretcher{padding-top:7px;} #autocomplete_input{width:20px;} #facebook .tokenizer .tab_stop input{border:0px solid black;display:inline;position:relative;left:-500px;} #facebook .tokenizer .tokenizer_input_borderless {left:4px;margin-left:-1px;overflow:hidden;position:relative;} #facebook .tokenizer_input_borderless #autocomplete_input{border:3px solid white!important;border-left:none;display:block;margin:-3px 3px -4px -2px;padding:0px!important;} /*IE6-/Win only*/ /*\*/ * html#facebook .tokenizer_input_borderless #autocomplete_input { border:3px solid black;margin: -3px 3px -4px 14px:padding-left:10px; } /**/ .tokenizer div:-moz-first-node{padding-top:1px!important;} .tokenizer_input{max-width:450px;overflow:hidden;padding:1px 0px;} #facebook .tokenizer_input input, .tokenizer_input_shadow{border:0px solid black;outline:0;font-family:'lucida grande', tahoma, verdana, arial, sans-serif;font-size:11px;padding:0px 5px;margin:0 0 -1px 0;white-space:pre;} .tokenizer_input_shadow{display:inline;left:-10000px;position:absolute;top:-10000px;} .tokenizer .tokenizer_input_shadow{height:0px;display:block;left:0px;overflow:hidden;position:relative;top:0px;} div.tokenizer .token{background-image:url('/inbox/images/token.gif');background-repeat:no-repeat;color:black;white-space:nowrap;} div.tokenizer .token span{background-image:url('/inbox/images/token.gif');background-position:top right;background-repeat:no-repeat;display:block;} div.tokenizer .token span span{background-position:bottom right;} div.tokenizer .token span span span{background-position:bottom left;} div.tokenizer .token span span span span{background-image:none;padding:2px 3px 2px 5px;} div.tokenizer.tokenizer_locked .token span span span span{padding-right:5px;} html div.tokenizer_locked .token:hover, html div.tokenizer_locked .token:hover span{background-image:url('/inbox/images/token.gif');} div.tokenizer .token:hover, div.tokenizer .token:hover span{background-image:url('/inbox/images/token_hover.gif');text-decoration:none;} div.tokenizer .token_selected, div.tokenizer .token_selected span, div.tokenizer .token_selected:hover, div.tokenizer .token_selected:hover span{background-image:url('/inbox/images/token_selected.gif');color:white;text-decoration:none;} div.tokenizer .token span.x, div.tokenizer .token span.x_hover, div.tokenizer .token:hover span.x, div.tokenizer .token:hover span.x_hover{background-image:url('/inbox/images/token_x.gif');background-position:4px 2px;cursor:pointer;display:inline;padding:0px 6px 0px 5px;} div.tokenizer.tokenizer_locked .token span.x, div.tokenizer.tokenizer_locked .token span.x_hover{display:none;} div.autocomplete { position:absolute; width:355px; background-color:white; border:1px solid #888; margin-top:-2px; padding:0px;} div.autocomplete ul { list-style-type:none;margin:0px; padding:0px;} div.autocomplete ul li.selected { background-color: #ffb;} div.autocomplete ul li { list-style-type:none; display:block; margin:0; padding:2px; height:32px;cursor:pointer;} /* end of autcompleter.advancedlocal css */ |
Download the full source
Autocomplete_AdvancedLocal.zip
[update] We’ve forked a version of the control.js and changed all reference to element.style to setStyle(). It was causing script errors in IE.
http://github.com/rorcraft/scriptaculous/tree/master/src/controls.js
RoRCraft 中文 and Zendesk 中文 庆祝北京奥运
为了庆祝今天08北京奥运会开幕,我们非常兴奋地宣布我们将与Zendesk的合作开发helpdesk 2.0并在chinese.zendesk.com推出中文版的禅宗服务台。禅宗服务台(Zendesk)是一个web2.0风格的在线桌面帮助方案。我 们之前曾帮助他们发行iphone接口,现在我们已经实现了禅宗服务台中文市场的本地化。如须协助建立汉化版禅宗客户服务台,请电邮致 rex@rorcraft.com 与我們联络。
同时我们非常高兴地宣布我们终于建立了自己的中文站点 – http://www.rorcraft.com/zh
We are very excited to announce our cooperation with Zendesk – helpdesk 2.0 and the launch of a Chinese version of Zendesk at chinese.zendesk.com to celebrate the start of Beijing Olympics 08. Zendesk is a online helpdesk solution in web2.0 style. We’ve previously helped them release their iphone interface and now we have localized it for the Chinese speaking market.
For assistance in setting up your own chinese localized version of Zendesk please contact us at rex@rorcraft.com.
We are also very happy to announce that we’ve finally localized our own site – http://www.rorcraft.com/zh/

熱烈慶祝2008北京奧運
Patching paperclip to create thumbnails only for images
Paperclip has some good features over attachment_fu that “attached files don’t need to have a seperare model (thank god). Your attachments are treated just like any other atribute. Images aren’t saved until your model is saved” ( by Jim Neath ).
The fall back of paperclip is that it tries to create a thumbnail for any type of file, including pdf. It won’t cause much problem if it cannot create a thumbnail to a certain file. But when it comes to pdf file, paperclip tries to generate a thumbnail for every page of the file, it becomes very slow when uploading the pdf file if the file has hundreds of pages. Sometimes it even times out! At the same time, attachment_fu does not have this problem.
attachment_fu.rb includes a class method #images? to distinguish if the file is an image.
—- ruby129 # Returns true or false if the given content type is recognized as an image.
130 def image?(content_type)
131 content_types.include?(content_type)
132 end
1 2 |
<p>Content types of images are initialized at the begin of the file:</p> --- ruby5 @@content_types = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg'] |
Then the #image? method is called in a instantial method #thumbnailable:
1 2 3 4 5 6 7 8 9 10 |
216 # Checks whether the attachment's content type is an image content type
217 def image?
218 self.class.image?(content_type)
219 end
220
221 # Returns true/false if an attachment is thumbnailable.
# A thumbnailable attachment has an image content type and the parent_id attribute.
222 def thumbnailable?
223 image? && respond_to?(:parent_id) && parent_id.nil?
224 end
|
In the #create_or_update_thumbnail it test if the content is thumbnailable? to determine going or not.
—- ruby243 # Creates or updates the thumbnail for the current attachment.
244 def create_or_update_thumbnail(temp_file, file_name_suffix, *size)
245 thumbnailable? || raise(ThumbnailError.new(“Can’t create a thumbnail if the content \
type is not an image or there is no parent_id column”))
246 returning find_or_initialize_thumbnail(file_name_suffix) do |thumb|
247 thumb.attributes = {
248 :content_type => content_type,
249 :filename => thumbnail_name_for(file_name_suffix),
250 :temp_path => temp_file,
251 :thumbnail_resize_options => size
252 }
253 callback_with_args :before_thumbnail_saved, thumb
254 thumb.save!
255 end
256 end
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<p>Paperclip has a similar structure like this, it makes it easier to make this patch.</p>
--- rubyFrom line #217
def post_process #:nodoc:
return if @queued_for_write[:original].nil?
logger.info("[paperclip] Post-processing #{name}")
@styles.each do |name, args|
begin
dimensions, format = args
dimensions = dimensions.call(instance) if dimensions.respond_to? :call
@queued_for_write[name] = Thumbnail.make(@queued_for_write[:original],
dimensions,
format,
@whiny_thumnails)
rescue PaperclipError => e
@errors << e.message if @whiny_thumbnails
end
end
end
|
The trick here is to add the #thumbnailable? method in right after the #begin keyword and raise a PaperclipError if it fails:
—- ruby213 def post_process #:nodoc:
214 return if queued_for_write[:original].nil?
215 @styles.each do |name, args|
216 begin
# Test here
217 thumbnailable? || raise(PaperclipError.new("Can not create thumbnails \
if the content type is not an image."))
218 dimensions, format = args
219 dimensions = dimensions.call(instance) if dimensions.respond_to? :call
220 @queued_for_write[name] = Thumbnail.make(queued_for_write[:original],-
221 dimensions,
222 format,-
223 @whiny_thumnails)
224 rescue PaperclipError => e
225 @errors << e.message if @whiny_thumbnails
226 end
227 end
228 end
—-
Add the #image? and #thumbnailable? method to attachment.rb of paperclip, and initialize the thumbnailable content types at the beginning. That’s all, now you can upload pdf files very fast.
About how to use paperclip, Jim Neath has a great tutorial Paperclip: Attaching Files in Rails. Enjoy it!
Using XSendFile to prevent memory leak in mongrel
When we working on the lastest project which allow user to download video that may be upto a few hundred MB, we see that the memory usage of mongrel start from 5MB in the beginning , and jump to to 300MB in a single night. After trace for a while, we found that the source of the leaking pointing to sendfile function that we currently use. So we looking for a solution to fix the memory leak , and that is the XSendFile which we are going to talk about.
Most of the people would use mongrel as the application server to deploy the rails , while using apache as the load balance proxy to forward the traffic to the servers that running mongrel. By using XSendFile, instead of mongrel load the file , and pass the file stream to apache,
Amazon EC2 finally support static IP addresses
To enable the static IP addresses function , you need to download the latest Amazon EC2 Command-Line Tools,
the download link of it is http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&categoryID=88
after download, I recommend to unzip it to a folder call ec2 under your home path
—- htmlmkdir /ec2
cd ~/ec2
unzip ec2-api-tools.zip—-
you can now see a folder call ec2-api-tools-1.3-19403 under the ec2 folder.
now it is time to update the .profile , so that EC2 tool can find the library that it use.
you have to download the private and public cert from amazon
—- htmlnano ~/.profile
export PATH=/ec2/ec2-api-tools-1.3-19403/bin:$PATH
export EC2_HOME=~/ec2/ec2-api-tools-1.3-19403
export EC2_CERT=~/.ec2/cert-xxxxxxxxx.pem
export EC2_PRIVATE_KEY=~/.ec2/pk-yyyyyy.pem—-
then you can start a new console so that the profile update will be effective.
you can now allocate a new IP address for your account.
—- htmlChris:~ chrischan$ ec2-allocate-address
ADDRESS 75.101.139.212—-
This new IP 75.101.140.212 is not bundle to any AMI instance yet.
You have to manually assign this IP address to a instance
First, you need to know the instance that you have already started. you can use the following command
—- htmlChris:~ chrischan$ ec2-describe-instances
RESERVATION r-3c1bea55 073126868754 default
INSTANCE i-7124dd30 ami-5035d079 ec2-67-202-34-115.compute-1.amazonaws.com
domU-12-31-38-00-6D-98.compute-1.internal running 0m1.small 2008-03-05T15:51:36+0000
us-east-1a—-
you can see that the instance id is i-7124dd30, we can then assign the IP to that instance
—- htmlChris:~ chrischan$ ec2-associate-address 75.101.140.212 i i-7124dd30—
ADDRESS 75.101.140.212 i-7124dd30
If you want to check the address allocation status, you can use the follow command
—- htmlChris:~ chrischan$ ec2-describe-addresses
ADDRESS 75.101.140.212 i-7124dd30—-
for any time if you want to free the IP , you can use
—- htmlec2-release-address IP-address—-
If you want to assign the existing IP address to a new instance , you can use ec2-associate-address,
but this time , you assign the new instance IP, and the existing IP address bundling will remove,
so the single IP address will always only bundle to one instance.
Also, a instance can only have one IP address assocate to it , so when you assign a new IP address to a instance,
all the existing IP bundling will be removed. And all the IP address in this status will start to charge you account.
So whenever any IP allocate has finished , please make to use ec2-describe-addresses to check the IP address bundling status.
Ankoder Architecture presentation
In March, we had a ruby on rails user group meetup in Hangzhou, China. It was exciting to meet more rails developers in China and shares some experience on our projects. Hangzhou is famous for it’s West Lake, it is just 1.5 hrs south of Shanghai. It is turning into the Silicon Valley of China, because several large internet companies are based in Hangzhou, such as Alibaba. They are also experimenting with Rails, because of its amazing productivity gains.
<img src=“http://devblog.rorcraft.com/assets/2008/3/28/IMG_1903.JPG”/ width="400">
We did a presentation on our architecture and how we host a fault tolerant system on Amazon’s EC2. We will already need to change this a little since Amazon has just released the long been waited feature Static IP. Now you don’t need to rely on DNS to failover to your new server, you can at least start a new instance and point your IP to the new host.
Contact
We love to hear about your web projects.
Email:
Sydney: +61 421 591 943
Hong Kong:+852 6901 2682



