Things that I find interesting, mostly about nature, science, mathematics, programming, and Thailand's fight against corruption.
Wednesday, May 11, 2011
I've Just Learned About Bloom Filter
Friday, January 21, 2011
A Few Webpages For Math Teachers And Learners
Monday, August 24, 2009
Useful Unicode Information For Thai Language

I needed to convert a bunch of files saved in a few Unicode encodings and I found the Unicode table for you, Unicode HOWTO (for Python), and Ascii Table MS-DOS Codepage 874 (Thai) pages very useful. I'm writing this down in case someone needs to do similar things for Thai files.
Saturday, July 11, 2009
Useful Python Notes
Wednesday, December 17, 2008
If Programming Languages Were Religions...
Saturday, January 19, 2008
Applied Probability: How To Write A Spelling Corrector In 21 Lines Of Python
If you have children, they should have some basic math and probability skills. Rational thoughts need those skills. Otherwise, they won't be able to make quantitative comparisons.
Sunday, December 16, 2007
Solving Sudoku Puzzles
I was thinking about writing a program to solve Sudoku puzzles for fun. Before I started writing, I did a quick Google search to see what programs are available. The search turned up many results, the most impressive of which is this essay by Peter Norvig (who co-wrote a famous AI book and is currently the Director of Research at Google)Tuesday, December 11, 2007
Python: Programming Is Fun Again!
My thought exactly.
Any programmer can learn it in an afternoon and be productive in a day. As a bonus, the code is naturally easier to read, so after half a year, I can pick up my own old code again in 10 seconds. And I'm just an average amateur programmer. (Amateur = doing it for love; Professional = doing it for money. Look at the etymology here and here.)
All CS students should at least know about it. I don't understand why introductory programming classes in Thailand are being taught with C, C++, C#, or Java while half the class would copy the other half's homework. No learning happens in half of the brains!
My posts about Python in the past are here.
Saturday, December 01, 2007
Thursday, February 22, 2007
My Wife Discovered Flickr and Tabblo

Click here to go to our pictures at Flickr.
Click here to go to our pictures at Tabblo.

I personally like Tabblo better because it is very easy for us to arrange pictures on the pages. It is also made with my favorite programming language, Python. (Well, Python and a lot of Javascript, I suppose.)
Wednesday, November 29, 2006
Web Browsing Automation
For example, I use PAMIE which is a library for Python like this:
import cPAMIE
ie = cPAMIE.PAMIE('www.website-to-visit.com')
ie.imageClick('intro.jpg')
ie.textBoxSet('loginName','my_username')
ie.textBoxSet('password', 'my_password')
ie.imageClick('login.jpg')
ie.linkClick('Reports for Today')
ie.linkClick('My Report')
I saved the above commands into a file called 'myreport.py' and whenever I needs to see the report, I just doublick the file and see Internet Explorer do the logging in and clicking for me.
The password is stored in plain text, so this is not very secure if you are sharing your computer with untrusted people. However, if you are not serious about this, it can save you time, especially when your Internet is not fast and you have to wait if you visit the site manually. This way, all the waiting is done by the script, freeing you to do other better things.
Monday, August 21, 2006
If You Need To Teach Programming To Physics Students In Two Days, ...
Python is my favorite programming language now.* A programmer should be able to learn (and start to be productive in) Python in an afternoon using the tutorial that comes with the installation. For a more detailed introduction, Dive Into Python by Mark Pilgrim is very hard to beat. I bought his book even though he lets us see all the contents on the web, just to show my appreciation.
If you use Linux/Unix or Mac, you should already have Python installed. If you use Windows, you can download the Python installer at www.python.org or use ActiveState's package (which I use.)
There are useful collections of Python recipes at Python Cookbook and Python Grimoire. You can see and learn from example programs there.
If you are hungry for even more tutorials, you can come to this page where you will find 300+ tutorials about using Python in all kinds of things.
As for the editor and development environment, you can use the included IDLE or PythonWin editor, but I prefer SPE and PyScripter. PyScripter runs only on Windows but SPE runs everywhere that Python runs.
--- - ---- - ----- ---------
*My preferred programming languages in the decreasing order are: Python, Mathematica, C++ (which I use like C with STL), C, Perl, Delphi, and VBA. I only read Java, but do not write programs in it. I hope to learn about Haskell, Erlang, and Lisp in the coming years.
Wednesday, March 22, 2006
"สูตรสู่ความสำเร็จ"
หวัดดีคับ ....
มีข้อความดีๆ มาฝาก .... เรื่องอะไรลองอ่านเอาเองนะ
...
สูตรสู่ความสำเร็จ
ถ้า A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
มีค่าเท่ากับ 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
แล้วจะพบว่า......
1) H+A+R+D+W+O+R+K = 8+1+18+4+23+15+18+11 = 98%
HARD WORK หรือ ทำงานหนัก มีค่าเท่ากับ 98 %
2) K+N+O+W+L+E+D+G+E = 11+14+15+23+12+5+4+7+5 = 96%
KNOWLEDGE หรือ ความรู้ มีค่าเท่ากับ 96 %
3) L+O+V+E=12+15+22+5 = 54%
LOVE หรือ ความรัก มีค่าเท่ากับ 54 %
4) L+U+C+K = 12+21+3+11 = 47%
LUCK หรือ โชค มีค่าเท่ากับ 47 %ไม่มีสิ่งใดที่มีค่า 100 % เลยหรือ !!!
แล้วสิ่งใดที่มีค่าเท่ากับ 100 %
- ใช่เงินหรือเปล่า ?……… .... .....ไม่ใช่ !!!!!
(M+O+N+E+Y = 13+15+14+5+25 = 72)- ความเป็นผู้นำหรือเปล่า ?………ไม่ใช่ !!!!!
(L+E+A+D+E+R+S+H+I+P = 12+5+1+4+5+18+19+8+9+16 = 97)แล้วอะไรล่ะ ?
A+T+T+I+T+U+D+E = 1+20+20+9+20+21+4+5 = 100%
ATTITUDE หรือ ทัศนคติ นั่นเอง ที่มีค่าเท่ากับ 100 %
ท่านคิดเช่นนั้นหรือไม่ ทุกปัญหามีทางออก . .
บางทีแค่เพียงแต่เราเปลี่ยน "ทัศนคติ "
ของเราเสียใหม่เท่านั้นเอง มีเพียงแต่ “ทัศนคติ” ของเราเท่านั้น
ที่จะเป็นตัวนำทาง ไปสู่ความสำเร็จในชีวิต และงานที่ทำความคิด & ทัศนคติ
สุดท้าย .... ลงมือทำ
ผมเลยหาคำอื่นๆที่มีค่า 100% อีก ปรากฏว่า คำว่า APOPLECTIC, DUMBFOUND, EMASCULATE, FLUORINE, HEMOGLOBIN, HOSPITAL, IMPOTENCE, INEFFICIENT, LEADERLESS, MUMMIFY, NIHILIST, PUSSY, SALACIOUS, SAVORY, SHIBBOLETH, SHRIEKING, SIMULATE, SLEEPYHEAD, SOCIALISM, SODOMITE, STARFISH, SUFFOCATED, TELEPHONE, TELESCOPE, THIRTY, WHENEVER, WHOLESALE, และWHORISH ก็มีค่า 100% เหมือนกัน (คุณสามารถดูคำอื่นๆอีกหลายร้อยคำโดยดาวน์โหลดไฟล์นี้)
อย่าซีเรียสครับ อย่าซีเรียส :-)
(I found these words by using the list of words from here and wrote a small Python program to process the words. Everything (the word list, the program, and the output) can be downloaded from here.)
Sunday, May 08, 2005
Python & Java Programming Links
Another excellent article about using Unicode is "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)" by Joel Spolsky.
If you want to develop Java applications that support the Thai language, IBM has a useful article here.
I'm checking out CherryPy which claims to be "a pythonic, object-oriented web development framework." It seems simple enough for me to work with. We'll see.