How to compile C in Linux

To compile C in Linux/Unix:

gcc filename.c

This will give a.out program to run

To run:


Wanna change the program name to something else? Use -o option:

gcc filename.c -o myprogram

To run:


As easy as that

Auto Shutdown for Windows XP

There is a shutdown command in Microsoft Windows. To use the command go to Start > Run and start typing.

For example:

shutdown -s -f -m \\myComName -t 10800 -c “I will shutdown by myself”

-t take time in seconds as parameter.

Please replace myComName with the actual computer name.

To find out the computer name,

1. Right click at My Computer

2. Properties

To cancel type:

shutdown -a

This is a link to a full documentation on Microsoft’s website:

Plain text editor for Mac OS X

On Windows, I love using notepad. However, in Mac OS X Leopard, they came up with rich text editor for TextEdit. It looks really cool when being able to see the color, HTML, etc. Sadly, in practical, it is very annoying for me for coding. For example, <html> tag becomes &lt;html&gt;, etc.

So, I decided to disable the rich text format function in TextEdit.

This is how I did it:

1. Open TextEdit > Preferences

2. Under “New Document” I selected Plain Text as format.

3. Under “Open and Save” I select first 2 boxes, to ignore rich text commands in both HTML and RTF files.

Note that “GOD [see comment below]” pressing cmd + shift + t switches between paintext and richtext mode. Thank you 🙂

Rename Java Package in Eclipse

Today, I attempted to change a java package name. I did a right click at the package name and there’s no “Rename.”

What I did is creating a new package, say Then I go to, right click > refactor> move and select

I then edited web.xml file, do a search replace from to and it works.

However, later I found that there’s a function “rename” under refactor. but I have not tried it. I will check it out next time.

Installing Fez on Ubuntu 8.10

This is a record of my attempt to install Fez: on Ubuntu 8.10:

Fez has couple of dependencies and requirements:

  • Apache, MySQL and PHP. (I’m using LAMP for this)
  • Fedora repository 2:
  • Java:
  • Couple of extensions: Tidy, LDAP, GD, MySQL, CURL, ImageMagick, Graphviz and JHOVE.

Installing various Extensions:

apt-get install sun-java6-jdk
apt-get install php5-tidy
apt-get install php5-ldap
apt-get install php5-gd
apt-get install php5-curl
apt-get install php5-imagick
apt-get install graphviz
apt-get install jhove

A few tweaks to PHP ini:

1. Edit /etc/php/apache/php.ini

allow_call_time_pass_reference = On
date.timezone = Australia/Perth
post_max_size = 10MB
upload_max_filesize = 10M
memory_limit = 50M

Installing Fedora:

1. Download Fedora 2 from the above website.

2. Go to fedora directory and run: java -jar fedora-jar-file.jar

3. This is a basic value that I used:

  • Type: Custom
  • Authentication for API-A: False
  • SSL: False
  • Servlet Engine: Included
  • Fedora Home: Fedora directory
  • Tomcat Home: Default
  • Tomcat HTTP Port: 8080
  • Tomcat Shutdown Port: 8005
  • Database Included
  • Policy Enforcement enabled: False
  • Resource Index: True
  • REST-API: False
  • Enable Messaging: False
  • Deploy local services/demo: True

4. After that I set couple of enviroment variables: FEDORA_HOME, JAVA_HOME, CATALINA_HOME

5. Then to go to CATALINA_HOME/bin and run: ./ to start Fedora.

Installing Fez:

1. Download Fez code from the above link.

2. Untared it and copied files across to webroot, say /var/www/fez/

3. Change the owner to www-data (for apache)

4. Go to http://myhostname/fez/ and followed the installtion process.

SVN Commit Failed

Today when I tried to commit from Terminal, I have got this message:

“svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no ‘editor-cmd’ run-time configuration option was found”

But svn checkout, status and update are working. I did some research and found that I can get around this by using -m parameter

svn ci -m “message”

And again, it works.

Installing Ubuntu on Eee PC

Almost forget to blog about this…

Eee PC is a tiny laptop from ASUS, check out the details from this link:

Note, let me stick with ‘tiny laptop’ than a proper term until every legal thing is sorted.

Eee PC is small, light weight and it comes with no CD ROM. I can spend extra money to buy an external CD ROM but I couldn’t be bothered with it.

My first attemped is to get Ubuntu Live CD running on a flash drive. But after, I spent a few hours trying to get Ubuntu on a stick, I gave up. So, I went and pulled my IDE external HDD case apart as well as pulled the CD ROM Drive from my PC and connected everything together. It worked great. I’m glad that pulling a few things together can save a lot of money and yes, most of my IT equipments are pretty out-of date (IDE/SATA).

I put Ubuntu CD in (can be downloaded from, connected the external CD ROM to USB, pressed F2 (Changed to boot from CD ROM) and my Ubuntu was slowly running. Please note the word ‘slow.’ Everything went smoothly, the installation process went really well, except the screen is too small (not-so-high). It was not enough to display the whole configuration page, with a help of ALT key, everything was ok.

After, I have my Ubuntu running there are a few issues that I have to solve. I refered to and now I have Ubuntu running happily on my Eee PC, of course with wifi.