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, March 21, 2011

Problem Solving using creative thinking

There are 3 general steps:
1. Target the goal: you must have the concrete and attainable target in order to asking questions that straight to the point.
2. Find the ways to solve the problem: think, think, and think. Don't think about possibility and reality yet.
3. Analysis and select good ideas: adjust ideas, re-think, possibility, logicality, or blend ideas together.
But ideas are not creative if not better, can't solve a problem, and not attainable.
Ref: Creative Thinking - Dr.Kriengsak Chareonwongsak
Web: http://www.kriengsak.com/

Sunday, March 20, 2011

How to show hidden files in Mac

It's very easy by do as following:
1. Open "Terminal"
2. type "defaults write com.apple.finder AppleShowAllFies TRUE"
3. Then type "killall Finder" to restart Finder

Note: If you want to change back to hidden files, just change TRUE into FALSE

Wednesday, March 16, 2011

How to calculate precision and recall

Basically, we can calculate precision and recall easily. For example, we have total 1000 cases. We know that there are 100 cases which are positive. Then, you want system to predict the positive. For example, you get 200 positive cases in testing and then you record the ids of our predictions. After that, sum up how many times to get right and wrong. There are 4 ways to determine right of wrong:

1. True Negative (TN): case negative and system can predict as negative.
2. False Negative (FN): case positive but system predicted as negative.
3. False Positive (FP): case negative but system predicted as positive.
4. True Positive (TP): case positive and system can predict as positive.

Then, we found that got 80 true positives of 200 cases. Total cases (N) = 1000
TP = 80
FN = 20 -> (100-80)
FP = 120 -> (200-80)
TN = 780 -> ((1000-100)-(200-80)) -> (900-120)
Note that: TP + FN + FP + TN = N,
TP + FN = Number of positive labels,
TN + FP = Number of negative labels

Finally, we can do calculation.
Accuracy = (TP + TN) / N = (80 + 780) / 1000 = 0.86 => 86%
Recall = TP / (TP + FN) = 80 / (80 + 20) = 0.8 => 80%
Precision = TP / (TP + FP) = 80 / (80 + 120) = 0.4 => 40%

Monday, February 28, 2011

Barcamp Bangkok #4 2010 - My experience (Part3)

So far, this is the last part of my Barcamp Bangkok experience ^^.

My second day:
11:00 - 11:30 - Room 905 - Getting things done with "Getting Things Done" Part 2 by @KnightBaron
Nothing much about this room, most of contents he said are in the book of Getting Things Done by David Allen.
It's a framework for life/self management.

11:30 - 12.00 - Room 1005 - The real truth about IT careers in Thailand
Expert know what not to do and failed many times. You have 2 choice 1. Find a company 2. Create your company. Proficiency in one language and do it for a long time. Do interesting or exciting jobs. Love to code and doing it for fun. Participate in project and share experience, open mind, spread to other. GEEK! really want.

Part 1: http://darkkung-blog.blogspot.com/2010/11/barcamp-bangkok-4-2010-my-experience.html
Part 2: http://darkkung-blog.blogspot.com/2010/11/barcamp-bangkok-4-2010-my-experience_13.html

LaTex Editor and Compiler

For Windows, we can use TeXnicCenter from http://www.texniccenter.org/ and use MikTex as a LaTex compiler from http://miktex.org/.

For Mac, you can just install MacTex package from  http://www.tug.org/mactex/ easily.

Friday, February 25, 2011

How to fix Boot Camp time offset

I have a problem with the time in Boot Camp. Everytime I use Windows and then comeback to use OSX, the current time will be changed all the time. It's very annoying. Now, I just found the solution from this blog: http://grupenet.com/2007/12/04/fix-boot-camp-time-offset/. It's very useful.

There are 3 steps:
1. Open your notepad.
2. Copy and paste the following:
@echo off
net time /setsntp:tick.usno.navy.mil
net stop w32time
net start w32time
3. Copy it into "Startup" folder in Startup menu

Now every time you start up Windows, it will fix the time offset automatically.
p.s. If it doesn't work, try to use automate sync time. If you can access internet, the time will be synchronized automatically.

Friday, February 18, 2011

How to save objects in Python

Python provide module for us to save an object by using "pickle" module. You can save an object into a file for loading it in later use.

For example:

file1.py
import pickle

class Test:
    A = ''
    B = ''

f = open('pickle','w+')
ob = Test()
ob.A = 'A'
ob.B = 'B'
pickle.dump(ob, f)

file2.py
import pickle

class Test:
    pass

f = open('pickle','r+')
ob = ''
# If we don't have class template for loading object, 
# the error will occur.
ob = pickle.load(f)

print ob.A     # output: A

It's very simple in python to save state of the object ^^.
More detail at: http://docs.python.org/library/pickle.html

Simple way to export files from iPods

There are many to export files from iPods but I just found this solution is very simple. After you install the program and then open it. It will show the contents from your iPods. Finally, you just drag and drop files into your location. This application is called DeTune.

Wednesday, February 16, 2011

How to copy fonts in Mac

There are 2 ways to do that.
1. Copy directly by copy fonts into /Library/Fonts/
2. Go to application -> open Font Book -> import fonts

p.s. If want to export text to other computer, can use .pdf. It can be read in any machine without fonts installation problem.

Thursday, February 10, 2011

Quick open terminal in Mac by using one click

In the past, I post about quick open terminal in Windows and Ubuntu. Now, it's a time for Mac.
You can do it by download one of them (they're very similar).
1. http://code.google.com/p/cdto/
2. http://homepage.mac.com/thomasw/OpenTerminal/

After download, you have to drag it icon into finder bar.


It's very easy to use by click at an icon or drag folder to an icon. Then, it will open terminal at the current or selected directory.

^^

For Windows: http://darkkung-blog.blogspot.com/2010/10/open-command-window-at-current-path-in.html
For Linux-Ubuntu: http://darkkung-blog.blogspot.com/2010/10/quick-open-teminal-in-ubuntu-by-using.html

p.s. You can create it by yourself by using "Automator" by looking at http://www.macworld.com/article/47793/2005/11/folderinterm.html for more details.