Codenone

Programming Language and Martial Art

หลังจากคราวที่แล้วว่ากันเรื่อง ภาษาสำหรับเขียนโปรแกรมกับอาวุธ คราวนี้เรามาว่ากันเรื่อง ภาษาสำหรับเขียนโปรแกรมกับวิทยายุทธ์ ก็อย่างที่เคยบอก เรื่องนี้เป็นเรื่องละเอียดอ่อนอันดับต้นๆ ของโลก ผมแค่นึกขึ้นมาได้ตอนขับรถกลับบ้านเท่านั้น เท่านั้นจริงๆ ช่วงนี้คงจะอ่านนิยายกำลังภายในมากเกินไป มีทั้งจอมคนแผ่นดินเดือดและฟงอวิ๋น สนุกจนไม่ต้องหลับต้องนอน แต่นิยายสมัยนี้ไม่ค่อยมีกระบวนท่าโดดเด่น ผมเลือกมาเฉพาะที่คนส่วนใหญ่จะรู้จักเท่านั้นพอ

Turtle Interpreter in Python

The second computer science homework at Codenone is to develop a turtle interpreter. In fact, I don't like to write this kind of code. It has been so long since I wrote ultra mini assembler and compiler both manual and using lex and yacc. However, the ruby version inspired me. The ruby code looks very pretty and the author also convinces about how easy in Python. So I would like to try to solve this homework in Python.

Comparison of Java, Python and Ruby

What is the best programming language? This is one of the most popular question for anyone who are going to study new language. I also used to ask myself the same question. As a consequence, it is a kind of a war. The latest thread regarding this question was the hard fight and its copy at Blognone. The truth behind the scene is that you must not expect to get any fairness out of any comparison. There are so many criteria and assumptions which might help some languages. However, it is still worth to try.

Lindenmayer System Translator in Python

According to the third question of a computer science homework, it is about Lindenmayer System Translator. Lindenmayer system aka L-system is a formal grammar for modeling the growth process of plant development. In fact, it is very easy to implement L-system as long as we understand the grammar. In Python, implementing L-system is very very easy.

How to measure memory consumption of a program on Linux

According to the hard fight which is a comparison of Java, Python and Ruby side by side, the performance is very impressive because Python is faster than the rest. A java guru immediately identified flaws of this test in Java codes. In addition, he also improved the codes for getting faster program. However, he was too busy to perform the benchmarks again himself. I volunteered to do this task on my laptop. After preparing all codes in Java, Python and Ruby, I have to measure how long it takes to execute each code. The tool I used was "time". Everything went well until I was asked to also measure memory consumption in each case. time always gave me zero without any error message. It seems this is a bug in Linux kernel that getrusage() will return zero in all memory related values. Fortunately, I found a workaround using Python!

How to calculate MD5 in C#

Not only wget but also MD5SUM, I have been asked how to implement this functionality in C#. Again and again, I wrote below code in Mono on Ubuntu Feisty.