Profile

Click to view full profile
Hi, I'm Veerapat Sriarunrungrueang, an expert in technology field, especially full stack web development and performance testing.This is my coding diary. I usually develop and keep code snippets or some tricks, and update to this diary when I have time. Nowadays, I've been giving counsel to many well-known firms in Thailand.
view more...

Wednesday, June 22, 2011

Did you meant to say/did you mean to say

It must be "Did you mean to say" because meant is a past participle form of mean and did shows that this sentence is in the past.
Credit: http://www.englishforums.com/English/DidMeantMeanSay/ddkbn/post.htm

Sunday, June 19, 2011

Lets vs let's

To let means to "allow".

Let him in. = Allow him to come in.

The word "let's" means "let us"

The first comes with the pronoun "us".
The second does not come with the pronoun "us".


She lets [allows] him to paint. = She allows him to paint.

So the rule is that when you mean let us, or allow us, or permits us, you use let's.

The following examples do not have the plural pronoun [us] contraction so no apostrophy is used.

She lets me paint. = She allows me to paint.
She lets them paint. = She allows them to paint.
She lets him or her paint. She allows him or her to paint.

Credit: http://www.englishforums.com/English/LetsVsLets/gnbh/post.htm from 
Radrook

Saturday, May 28, 2011

Fetch Web Pages in Python using urllib2

urllib2 is an extensible library for opening URLs. Mostly, we will use fetch data from URLs via HTTP. We can use it to access normal Website, HTTP Authentication, Web Proxy, and etc. urllib2 is included in python standard library.

Example:

import urllib2
# Normal usage
f = urllib2.urlopen('http://wwww.google.com')
print f.read()

# Use under Proxy
auth_handler = urllib2.ProxyBasicAuthHandler(urllib2.HTTPPasswordMgrWithDefaultRealm())
auth_handler.add_password(realm=None,uri='proxy-name',user='username',passwd='password')
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
f = urllib2.urlopen('http://wwww.bing.com')
print f.read()

In the example, It use GET to fetch data. If you want to change it to POST, you have to put data attribute in the method.

The basic usage is "urllib2.urlopen(url[, data][, timeout])".

More details at: http://docs.python.org/library/urllib2.html

Sunday, May 22, 2011

So You Think You Can Dance Online

So You Think You Can Dance is an American Dance reality show. It is broadcast on the Fox Channel. It's marvelous. I began to watch it since March via AXN Channel during vacation. Each competitor has a high standard in dancing, so it make me feel excited when I'm watching it.

Watch at: http://www.sidereel.com/So_You_Think_You_Can_Dance

Or you may download it directly using KeepVid, or Keep-Tube without any limitation from MegaUploadVideo. Enjoy watching ><!

Wednesday, May 18, 2011

The differences between get and post method in HTTP

Sometimes, I confuse which method should be used in HTTP. Now, I have found the answer from http://wiki.answers.com.

The answer is here:
GET Method:
  1. All the name value pairs are submitted as a query string in URL.
  2. It's not secured as it is visible in plain text format in the Lacation bar of the web browser.
  3. As the data transfers through address bar (URL) there are some restrictions in using space, some characters like ampersand (&) etc in the GET method of posting data. We have to take special care for encoding data if such special characters are present.
  4. Length of the string is restricted.
  5. If method is not mentioned in the Form tag, this is the default method used.
  6. If get method is used and if the page is refreshed it would not prompt before the request is submitted again.
  7. One can store the name value pairs as bookmark and directly be used while sharing with others - example search results.
  8. Data is always submitted in the form of text
  9. If the response of the page is always same for the posted query then use GET example database searches
POST Method:
  1. All the name value pairs are submitted in the Message Body of the request.
  2. Length of the string (amount of data submitted) is not restricted.
  3. Post Method is secured because Name-Value pairs cannot be seen in location bar of the web browser.
  4. If post method is used and if the page is refreshed it would prompt before the request is resubmitted.
  5. If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.
  6. Data is submitted in the form as specified in enctype attribute of form tag and thus files can be used in FileUpload input box.

Read more: http://wiki.answers.com/Q/What_is_the_difference_between_get_and_post_method_in_HTTP