Posts filed under 'Programming'
ผมจำเป็นต้องใช้ function นี้เพื่อเขียนโปรแกรมให้สำหรับบริษัทบ้านผม (Easy Insure) พอไปหาก็หาไม่เจอ ก็เลยเขียนเองดีกว่า อันที่ผมเขียนนี้เป็นแบบ tail recursion นะครับ ไม่มี limit จะกี่หลักก็ได้ (recusre จนเครื่องคุณพังก่อน ผมลอง 100-200 หลักแล้วก็ยังสบายมาก)(เพื่อกันคน แกล้งเครื่อง server นี้ผมจำกัดให้ เล่นได้ 30 หลักเท่านั้นนะครับ)
ลองไปเล่น + download ได้ที่นี่ครับ http://www.growlichat.com/bahtText/bahtTextTest.php
*code นี้ผมเขียนให้อ่านง่ายไว้ก่อน เพื่อให้คนศึกษา ไม่ได้เขียนให้เร็วนะครับ
*ถ้าใครจะเอาไปให้คนเขียนให้ office TLE ดูก็ได้นะครับ ว่าแบบไม่มี limit เค้า implement กันอย่างไร
January 15th, 2006
It’s always annoying when I have to convert a tab-deliminated file to a html table so that I can post it on my project website. I usually did it by hands. Yes, it was dumb. I was trying to find a freeware to do this for me but I couldn’t find one. I was trying to use excel. It put too much junk in my html table. So, I decided to write a little program that read from standard input the tab deliminated file and write html table to stdoutput. Ex: java HtmlTable < input.txt > output.txt.
Note that you need to compile it first: to compile just type javac HtmlTable.java.
Click to Download
December 14th, 2005

This is a neat trick to get your compiler(not your program) run faster. I haven’t tried this but it seems very logical to do so
To understand this toungue twister trick, First we need to understand what a comiler is. A compiler is basically a program that translate your programming language in to binary code that your machine can understand. But, it’d be bland if that’s the only thing compiler does to your program. A smart compiler, gcc for example, optimize you code as well. How does it optimize you code? Take this bad code for example…
Continue Reading July 7th, 2005

It’s quite a chore to make a histogram. It comes to me many time that I have to make a histogram for a list of numbers. I had to rewrite the program everytime. But, this time I’ll just write a good one and publish it so that other people(including me) won’t have to do this chore again. Without saying much…
Continue Reading July 4th, 2005

Imagine, you are working on a program that will manipulate an unknown length file. Printing the output to tell user is necessary for telling the user that the program is not halting.
Continue Reading July 3rd, 2005