In Lisp or Scheme language, the anonymous function (which is called lambda-style function) is common used. These functions are special because it doesn’t have a name. So it can be only used once. Usually, these functions are very small and simple. (more…)
Archive for the ‘Programming’ Category
Anonymous Function in PHP
Saturday, October 25th, 2008What is JAVA_HOME in Ubuntu?
Tuesday, October 21st, 2008Some Java programs need the environment variable JAVA_HOME, such as Tomcat. In Windows operating system, JAVA_HOME is the directory that the JDK is located. However, in Ubuntu if you install JDK with “sudo apt-get install sun-java6-jdk”, the JDK’s files are extracted to many directories like /usr/bin, /usr/lib, etc. What is JAVA_HOME?
Some people thought it should be /usr because in Windows the Java compiler “javac” is in JAVA_HOMEbinjavac. So in Linux it should be JAVA_HOMEbinjavac and JAVA_HOME=/usr. I don’t think it is the best sulotion. Because I found /usr/bin/javac is not the real Java compiler, it is just a link. I used “ls -l /usr/bin/javac” to see what it links to:
/usr/bin/javac -> /etc/alternatives/javac
And /etc/alternatives/javac is also a link. It links to /usr/lib/jvm/java-6-sun/bin/javac. This is the real Java compiler. And the path is similar to that in Windows. So I think JAVA_HOME should be /usr/lib/jvm/java-6-sun in Ubuntu Linux.
Sending AJAX Requests with Prototype
Saturday, October 11th, 2008Several days ago I tried to learn a little about Javascript language and AJAX. Implementing AJAX with pure Javascript is not an easy work. It is not cross-browser so that I have to detect which browser sent the AJAX request. I think some frameworks can solve the problem in a better way and finally I found a Javascript framework — Prototype. (more…)
Function Overloading in PHP 5
Tuesday, September 23rd, 2008Function overloading means using one function to do more than one kinds of work. For example, there is a class whose name is “Container”. The container class maintains an array. It has a function called “add”. You can use “add” function to add some items to the class. The argument may be a single object or an array. i.e. $c->add(35) and $c->(add(array(35)) are the same. How to do it in PHP? (more…)
Adding Python CGI support to Apache
Tuesday, September 23rd, 2008The reason I start to learn Python is to play with Google App Engine. So I think I should learn Python web programming. I need to add Python support to my Apache server. Someone recommanded me to use “mod_python”. But unfortunately I can’t install the mod_python correctly. Therefore, I have to use Python CGI. (more…)
I am Going to Learn Python
Tuesday, September 23rd, 2008A few days ago I knew Google App Engine. A free service for hosting your own web application. App Engine uses the server farm of Google. So I think it is very stable and safe. However, up to now App Engine only support Python language. I knew a little about Python several years ago, but at that time I am not very interested in it. Last month I made a survey, most of people think that Python is the most interesting programming language. I believe it is true.
Although it is said that Google App Engine may support PHP and other languages. I don’t want to wait until the day comes. If I start to learn Python, after some days I can play with App Engine. I wish Python would give me more nice feelings.
GChart 0.1 Released
Tuesday, September 23rd, 2008GChart is my first open source project. It took me about two weeks. GChart is a PHP library for data charts using Google Chart APIs. What is Google Chart API? According to the Google official document: (more…)
How to Use SimpleTest
Tuesday, September 23rd, 2008SimpleTest is a unit test framework for PHP. As its name, it is simple, easy to use. You can create many test cases with its help. Since I planned to develop a PHP library for Google Chart API. I decide to use SimpleTest to test my program. (more…)
Resizing an Image Using PHP
Tuesday, September 23rd, 2008Many web applications need lots of pictures. For example, an online shop. Every item may need a small image for showing on the font page and a large image. Uploading two images for one item is a dirty work. So why not upload one image and use a program to resize it? (more…)
Servlet: Hello World
Tuesday, September 23rd, 2008Servlet is a Java programme running on the server side. It is used to provide dynamic contents. Like CGI, servlet can receive requests from a client and do some word, send the result to the client. To run servlets you need to install JDK and a web container. The most popular web container is Tomcat. I use Tomcat 5.5 now. (more…)