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...

Monday, November 28, 2011

Run internet required commands behind a proxy server in Linux

Most of the time I need to run a terminal behind a proxy server at my office to run a batch job, and I failed to run it because I don't know how to add proxy server in the terminal. But, now, I just found the command to add a proxy server in Linux. It's very simple just only one line :)

Open terminl and type this command
# Changing username, password, proxyname, and port to be yours.
export http_proxy="http://username:password@proxyname:port"
# After that you can test to run behind your proxy server
# , simply as following.
wget http://www.google.com
# If the connection is successful, then you will get the 
# file from this Google page.

To remove the proxy server from your network run the following command:
# Just delete a proxy sever variable using unset 
unset http_proxy
# Or set http_proxy to blank
export http_proxy=""

The example above is how bind a proxy server in HTTP protocol.
For the other protocols, e.g. FTP, ... so on. Try to find its variable for binding with a proxy server.
Another protocol that I know is FTP.
FTP => ftp_proxy
If you want to remove it, do the same as the example above.

Good luck ^^.

How to restart Linux network service

Sometime you may need to update your network immediately, e.g. DHCP and IP under a virtualization software, ... so on. The fastest way is to restart the network service.

You need to login as root user before using the following commands!!!

RedHat Linux command to reload or restart network:
# To restart Linux network service:
$ service network restart
or
$ /etc/init.d/network restart

# To start Linux network service:
$ service network start

# To stop Linux network service:
$ service network stop
Debian Linux command to reload or restart network:
# To restart Linux network service:
$ /etc/init.d/networking restart

# To start Linux network service:
$ /etc/init.d/networking start

# To stop Linux network service:
$ /etc/init.d/networking stop
Ubuntu Linux user use sudo command with above Debian Linux command:
# To restart Linux network service:
$ sudo /etc/init.d/networking restart

# To start Linux network service:
$ sudo /etc/init.d/networking start

# To stop Linux network service:
$ sudo /etc/init.d/networking stop

Credit: http://theos.in/desktop-linux/tip-that-matters/how-do-i-restart-linux-network-service/

Tuesday, November 22, 2011

Adding Facebook Like Button to your Blogger posts

According to Blogger default don't provide essential social plugins like "Like-Button" in a post. We, however, can includes it into each of your post easily as the following steps:
  1. You needs to create an App in Facebook at: https://developers.facebook.com.
  2. So, you will get the App API key.
  3. Go to https://developers.facebook.com/docs/reference/plugins/like/ page to customize your Like-Button as your preferred style. After finish, click at get code, then copy that code (HTML5) to somewhere. You will get 2 portions of code, first and second.
  4. Go to your Blogger template, select edit HTML manually then click at expand the widget because post customization is in the widget portion.
  5. Go deep to the above widget code zone (almost at the end), or if you can't find you can put it on the top, but this code will be loaded first before loading Blogger data.
  6. Paste your first half of Facebook code above widget code.
  7. Next, you need to find the template for each post, then append the second half to that template. For me, I want to append Like-Button  followed the default share buttons. So, I will search for "shareButtons". It may have many shareButtons words in your template, but to know the one you want is that it has a code to describe its components e.g. Twitter, Gmail, Facebook, Google+ buttons.
  8. Finally, append the second half of Facebook code here, but it need to change a "data-href" attribute to be "expr:href" as a Blogger data, and put its value equals to "data:post.url".
    For example: 
  9. <div class="fb-like" data-send="true" data-show-faces="true" data-width="450" expr:href="data:post.url"> </div>
  10. Done, save the your code and view your post!!!
Like This Post!!!

Friday, November 18, 2011

Stanford Online Courses in Q1 2012

The following Stanford Online Classes will be opened in Q1 next year!!!
1. CS 101 by Nick Parlante
2. Natural Language Processing by Dan Jurafsky and Chris Manning
3. Software Engineering for SAAS by Armando Fox and David Patterson
4. Human-Computer Interfaces by Scott Klemmer
5. Game Theory by Matthew Jackson and Yoav Shoham
6. Probabilistic Graphical Models by Daphne Koller
7. Machine Learning by Andrew Ng (Same class as current ml-class.org)

Moreoever, Stanford Entrepreneurship Online Classes will be opened in Q1 next year too.

1. The Lean Launchpad - http://www.launchpad-class.org/
2. Technology Entrepreneurship - http://www.entrepreneur-class.org/

Don't wait until the last moment :)

Tuesday, November 1, 2011

The Lemur Project - SEO Tools

Lemur is an opensource toolkit for Information Retrieval and language modeling, It also provides API in C++, JAVA, C#, etc. I used it to check ranking among my website pages and competitor pages.
To use this tool, you have to download it first from http://www.lemurproject.org/.
Then, to allow Lemur indexing your pages you need to put Lemur' headers for all of your indexed pages as the following code:

<doc>
<docno>FULL PATH TO THIS FILE<⁄docno>
<dochdr><⁄dochdr>
.
.
.
YOUR HTML CONTENT
.
.
.
<⁄doc>

Next, let's see urllist.txt, you need to put all of full path of your indexed files one line per one file path.
C:\seo\competitors\aol\1.html
C:\seo\competitors\bbc\1.html
C:\seo\competitors\bbc\2.html
.
.
.

After that, edit queries.txt, insert keywords with one keyword per line.
carbon dioxide
cfc
fuel
.
.
.

Assume that my Lemur' folder is named seo. Do as follows:
1. Open a command window.
2. Go to seo directory by type in the following commnad.
cd C:\seo
3. To index the web pages (both competitors and cfs), type this
C:\seo\lemur\bin\BuildIndex.exe buildparam.txt
4. To run a query, type this
C:\seo\lemur\bin\RunQueriesHTML.exe queryparam.txt
5. Open the result file located in C:\seo\results.html with you web browser

Finally, you will see the result similar to the following picture:










Enjoy using it xD.