arimbun

  • Author: arimbun
  • Published: Jul 25th, 2010
  • Category: Mac
  • Comments: None

Apache/MySQL/PHP config on Snow Leopard

Tags: , , , , ,

By default, Mac OS X 10.6 (Snow Leopard) bundles with Apache/MySQL/PHP. However, they do not quite work out of the box. Follow these extra steps and you’ll get your web server up and running in no time.

  • Author: arimbun
  • Published: Jul 21st, 2010
  • Category: Uncategorized
  • Comments: 3

Weird MSN chatbot

Tags: , ,

If you have enough friends in MSN, it is quite normal to see one or two that send you malicious links. This time I encountered a bot of a more intelligent breed: it actually talked to me and acted like a human. Well, close enough anyway. And this was repeated twice.

PHP: echo and print

Tags: , , ,

Both commands are used to display some output, so what’s the difference? I chanced upon an interesting article that covers the differences between the two. I’ll put up the summary here:

  • echo is (marginally) faster than print. Providing that the statement is in a large enough loop, one will notice a slight performance gain by using echo. It’s probably advisable in the long run, unless you’re already used to print.
  • passing mutiple string parameters is faster than concatenating multiple echo calls. See example below:
  • // "." signals concatenation and is slower
    echo "hello" . "world"
    
    // "," signals multiple arguments and is faster
    echo "hello", "world"

The Pathfinder

Tags: ,

Artificial Intelligence (AI) has always been one of my interests. I was lucky enough to enrol in possibly one of the best courses offered at The University of Sydney, namely COMP3308 Introduction to Artificial Intelligence. My first assignment touched on path search algorithms which form the basis of “smart robots”. The problem in a nutshell is to write a program that, given a start node and a finish node, finds a path through a given maze (8×8 or 16×16) in the most efficient way. Five different algorithms were used: breadth-first search, depth-first search, greedy best-first search, A* search and hill-climbing search.

You can download the Python source code and documentation on my GitHub.

I am planning a version 2 which will incorporate a GUI for visual aid of the simulation, but first I’ll need to get my Python GUI programming up to speed…

Jobs admits antennagate on iPhone 4

Tags: , , ,

It took a while, but Steve Jobs finally admitted in a press conference that poor signal calculation algorithm was to blame for the wireless signal problem. I find this one particularly interesting; I would have thought that the built-in antenna design was responsible, but algorithm? Is the problem really inherent to the software?

Update: It appears that the software update was only meant to improve the phone’s calculation of signal strength and did not actually solve the problem it had with signal loss.

  • Author: arimbun
  • Published: Jul 16th, 2010
  • Category: Linux
  • Comments: 2

Introduction to rsync — quick file synchronisation

Tags: , ,

rsync is a very good utility for synchronising files over a network. It works based on the delta-transfer algorithm—only data in the source that do not exist on the destination are copied over. This method saves plenty of time and bandwidth compared to the standard cp command.

Example: rsync $SRC $DST

On your local machine, you can use this to:
1. Copy files in a directory into another. Below code will match all files in the home directory that have the .txt extension and copy them all into /path/to/heaven.

rsync -v /home/login_name/*.txt /path/to/heaven

2. Copy directories (recursively) from a directory into another. The command below is similar to the previous, except that all directories (and their contents) are copied as well.

rsync -vr /home/login_name/* /path/to/heaven

  • Author: arimbun
  • Published: Jul 12th, 2010
  • Category: Uncategorized
  • Comments: None

Rework by David Hansson

Tags: , ,

David Hansson—the creator of Ruby on Rails and partner at 37signals— co-wrote Rework, a book designed to target bad business practices and how they could change. There is a free excerpt available if anyone is interested. Its succinct language is a common trait today and should come across as easy to understand.

The book’s key mottos—as seen on the back cover—sum it up quite nicely.

The Friends problem

Tags: ,

This is a good programming practice of creating a recursive descent parser besides the calculator itself. The Friends problem calculates the set union(s) or set difference(s) between a given number of sets.

Sample input

{ABC}
{ABC}+{DEFG}+{Z}+{}
{ABE}*{ABCD}
{ABCD}-{CZ}
{ABC}+{CDE}*{CEZ}
({ABC}+{CDE})*{CEZ}

Sample output

{ABC}
{ABCDEFGZ}
{AB}
{ABD}
{ABCE}
{CE}

Source code is available on my GitHub.

© 2010 arimbun

Powered by Wordpress and Magatheme