Automated backup

September 30th, 2009 at 12:48 · Filed Under Blogging, Call Me a Geek, Computing, Linux, Mac OS X, Software Development, Solaris · Comment 

Since August 18, my software development work has been picking up its pace and I have checked in more works more often, at least five times on single productive day. Ever since, I have been manually backing up Subversion directory using tar. My project server is fornax.

Fornax is a 6-year old PC running Ubuntu. It wasn’t working properly due to the cooling fan in its power supply unit. Until about two weeks ago, I replaced the old fan. I am not very confident about the replacement because it is a third party part and the replacement isn’t as good as expected, but it works. I have to shut it down every night before going to bed.

So, the last thing before I go to bed is to backup the svn directory and then shutdown the server. I am quite fed up with this extra manual works. Last night, before going to bed, I decided to automate this process. And I did it this morning.

I wrote a simple bash shell script to do the backup. I cron it so that the process will start automatically at 2300 hours and then shutdown.


#!/bin/bash

BACKUPFILE=/tmp/backups/svn-$(date +%Y%m%d).tar.gz

rm /tmp/backups/svn-*.gz
tar -cj /svn > $BACKUPFILE
for COMPUTER in host1 host2
do
   scp $BACKUPFILE user@$COMPUTER:Desktop/
done
/sbin/shutdown -h +5

UPDATE (05/10/2009): I setup a password-less ssh login so that no password is required for scp (secured copy). Now, after the backup, the backup file will be copied automatically to two other computers for safe keeping.

iPhone 3.0 Software Update

June 28th, 2009 at 0:26 · Filed Under At Home, Call Me a Geek, Computing, Days in My Life, Gadgets, Mac OS X, Technology · 4 Comments 

A couple of weeks ago, the iPhone 3.0 software update was official launched. I connected my iPod Touch to iTunes 8.2 and clicked Update. Unfortunately, iTunes said that the update wasn’t available at iTunes Malaysia store. I wasn’t very happy with the service Apple has provided. The update was supposed to be free but it would cost me US$9.95 to upgrade my iPod Touch to iPhone 3.0.

Here’s the screenshots (click to enlarge): Read more

Backup your Mac with AppleScript

All programmers are lazy. They want to automate tasks as much as they can. Because of this uniquely great habit, they have developed countless of useful software.

Ok. I am lazy. I have been using rsync to sync folders I am working on between my Macs. I have been using command line scripts in Terminal for almost two years and finally I have gotten lazy over the task.

The thing is, I need to execute the scripts in Terminal every time I want to synch my folders. Of course, I could simply use cron to automate the tasks at specific time but I ran the risk to cause havoc between the folders on different Macs. It is best not to cron the task.

So, I learned up AppleScript and after a ten-minute hack, I wrote a nice AppleScripts to do the job. It is quick and dirty.

set debug to false

with timeout of (30 * 60) seconds
	tell application "Terminal"
		set Window_Title to "Sync Documents"
		set Rsync_Cmd to "rsync -acrtv --delete
			/Users/username/Documents/
			username@xxx:Documents"
		set output_doc to do shell script Rsync_Cmd
		choose from list paragraphs of output_doc with prompt
			"Result:" with title Window_Title with empty
			selection allowed
	end tell
end timeout

Copy the script to ~/Library/Scripts/Applications/Finder and save it as “sync documents.scpt”. Then launch Script Editor to edit username to your login name and xxx to your Mac IP address or computer name. This script will sync your Documents folder under your user home directory. To execute this AppleScript, at Finder, click on the script icon on the menu bar and select the script to launch.

rsync uses ssh. If you have not setup a password-less ssh login, you will need ssh-askpass in /usr/libexec. Unfortunately, it does not ship with Mac OS X. You can get it at Joe Mocker’s weblog.

The new WordPress

March 5th, 2009 at 11:55 · Filed Under Blogging, Hacking, Web · Comment 

Just finished upgrading WordPress to 2.7.1 with a totally new user interface. I still prefer the one in 2.6.x so I guess I need a little time to get use to the new UI.

The upgrade is inevitable because some of my sites were affected by Yahoo! Counter  malicious malware. It is a nasty injection of script. I could not locate where it was injected and my web host wasn’t very helpful. I decided to upgrade, hopefully, to wipe out the code injection.

Now, I have to file a request to Google to clear the malware listing of my sites.

Discover your iPod touch

February 4th, 2009 at 2:30 · Filed Under Blogging, Call Me a Geek, Computing, Gadgets, Mac OS X, Technology · Comment 

One of my most desired applications on iPod touch is to be able to take PDF and source code anywhere I go for discussion without taking a MacBook with me. The good thing about iPod touch is its ability to sneak into my shirt pocket or in a carrying pouch on my belt. Sometimes taking a MacBook along just for the purpose of viewing a PDF or some source code is deemed to be cumbersome. One obvious problem is that I have to carry my MacBook in the bag anywhere I go, for example, shopping. It is risky to leave the MacBook in the trunk. Many theft cases have been reported.

Discover is the best application that allows me to wirelessly transfer my files to iPod touch and view it. It is free and secured. Unlike other free applications of the same class, Discover is only limited to physical storage available on your iPod touch. It supports many file formats such as PDF, Office document formats (which I don’t use), and Unicode support (C/C++, Objective-C and more). Unfortunately, it does not recognize Ada source files. I hope BBase will support Ada in coming release.

Download Discover from iTunes store and install into iPod touch. Just launch Discover and connect (using any WebDAV enabled browser) to iPod touch with the IP address provided on the iPod screen. You can setup secured access with passwords to protect your iPod touch from unauthorized access.

iPod Touch

January 29th, 2009 at 22:57 · Filed Under Blogging, Call Me a Geek, Computing, Mac OS X · Comment 

I received my 2nd generation iPod Touch 16GB today. I tried to make unboxing video but the result was not as good as I expected. Sorry guys. May be next time.

After I took it out from the box, I put it on screen protector film and soft silicon skin right away. I have heard and read about scratching screen, drops and oily finger marks on iPod Touch and iPhone. I think it is good to protect my investment.

I have an iPod nano which my sister gave me more than a year ago. I seldom use it but most often I use it to listen to podcasts and some music. The reason for me to acquire an iPod Touch is to explore some ideas and to develop some useful software for it.

iPod Touch is a very powerful device besides music and video playing. It is in fact a powerful PDA for many applications in my opinion.

A good head start

January 1st, 2009 at 23:46 · Filed Under At Home, At Work, Call Me a Geek, Computing, Days in My Life, Hacking, Holidays, Mac OS X · Comment 

Happy New Year 2009 buddies!

It seems like a good head start for me. Everything I planned for today seems to be smooth sailing although I am having one problem which I do not know why it happens. I guess I will need to toy with it and/or hack it to learn why it isn’t behaving as it supposed to be. If everything is running perfect before end of this month, I will acquire an iPod Touch to proceed further. This will be my first wish on this very first day of 2009.

Finder hang in Leopard

October 23rd, 2008 at 21:49 · Filed Under Call Me a Geek, Hacking, Mac OS X · Comment 

When I returned home this evening, LA told me her applications had hung. I checked and found not only that, the Finder was not responsive too. I had no choice but to power off and to restart the Mac Mini again. This had also affected my user account. The Finder had failed to launch after login and the Dock did not appear as well. But fortunately root user account was not badly affected.

I Googled and found some articles and solutions here, here and here. I exhausted all the methods and I did not have DivXNetworks and ApplicationEnhancer.bundle in the directories mentioned in these links. I decided to go my own way.

What I did was to delete everything that was related to DivX. Since I did not have DivXNetworks, so I removed DivX folders in “/Library/Application Support” and “~/Library/Application Support” and also the DivX programs in Applications.

After the deletion, Finder still could not launch properly. I launched Console.app to examine system logs and found some errors in cache files com.apple.LaunchedServices*. I removed everything with com.apple.LaunchedServices in /Library/Caches.

Viola! Everything is back to normal again. DivX is a third party enhancement software and is not very stable. It seems like DivX has messed up with the system caches and somehow prevented Finder to launch.

I have spent two and half hours mingling with this problem. I hope my experience will save some of your time if you have the same problem as mine. I am going to take my supper.

Good luck!

Butterworth low-pass filters

September 4th, 2008 at 0:14 · Filed Under At Work, Call Me a Geek, Days in My Life, Mathematics, Software Development · Comment 

I was reading about Butterworth low-pass filters since two weeks ago. Signal processing was not my favorite but this particular linear analog electronic filter had somehow captured my attention. I have interns working on some projects. One project uses Butterworth low-pass filters to process signal acquired from some sensors.

I have to verify their works using Mathematica on Mac OS X for data modeling. But there is a problem with this software. It does not have a built-in function of Butterworth low-pass filter so I need to build one.

The gain G(ω) of an n-order Butterworth low pass filter is given in terms of transfer function H(s) as:

where ωc is break frequency.

The Mathematica code with break frequency normalized at 1 rad/s:


butterworth[w1_, w2_, o_] = 1/(1 + (w1/w2)^(2*o));

LogLinearPlot[
 Evaluate[Table[
   10*Log[10, butterworth[w1, 1, order]], {order, 5}]], {w1, 0.01, 100},
  PlotRange -> {-100, 0}, PlotPoints -> 100, ImageSize -> 400]
Export["butterworth.jpg", %]
Plot of the gain of Butterworth low-pass filters of the n-order 1 through 5.

Plot of the gain of Butterworth low-pass filters of the n-order 1 through 5.

Ada Obsession

June 17th, 2008 at 21:25 · Filed Under Ada, At Work, Blogging, Call Me a Geek, Software Development, Web · Comment 

Well, well, well. Kazeserver alpha RC1 has to be delayed due to some design issues and I am rewriting most part of the software so that the source can be understood easily. For the past two weeks, I was troubled by the old design but I have got a new picture now.

Isn’t Ada code easy to understand? Well, yes. But I was using a lot of Unbounded_String in records which made my code hard to read and understood. While Unbounded_String is compatible with database operation, it lacks the understandability and readability if compared to String (1 .. 10) for example.

Today, I am totally obsessed in Ada and am feeling the strongest Ada obsession after a couple of years. The feeling is still burning. If my Ada obsession keep burning, I believe I can release KazeServer for alpha testing before of June. Hopefully.

Subversion client hangs after post-commit

June 9th, 2008 at 16:29 · Filed Under Call Me a Geek, Hacking, Linux, SCM · 1 Comment 

I had been hit by this problem since I setup Subversion on Ubuntu in January. The svnserve was properly invoked on Ubuntu server but whenever any svn client was trying to commit something back to the server, the client would hang for hours before it prompted an error: “Connection reset by peers.”

I searched all the Subversion and Ubuntu forums but could not find any solution to my problem. In the past months, I tried to identify the source of the problem and even tried many solutions suggested by people on these forums but the problem persisted. I had been committing to svn server with post commit email notification turned off and lost quite a number of post commit message. I used to keep track of changes by these email notification.

Yesterdat, I was trying my luck again and I accidentally noticed sendmail and sendmail-mta were called after commit. A look into syslog confirmed that sendmail process was put into sleep by some unknown reason. Failing to identify the cause, I removed sendmail and related packages from my Ubuntu server and installed Exim4. It is claimed to be easier to installed and configured than sendmail. The problem diminished after I got exim4 up and running. Now I am able to receive post commit email notification after every svn commit. Every commit takes a few seconds to complete after this. Problem resolved.

HOWTO – Clone your Mac OS X hard drive

May 22nd, 2008 at 12:16 · Filed Under Call Me a Geek, Computing, HOWTO, Mac OS X · 18 Comments 

First of all, why do I need to clone the hard drive? Good question though. Here are a few possible answers:

  1. I have too much money to spend for a spare hard drive to clone my Mac hard drive.
  2. I want to have a bootable external hard drive, installing on an external USB hard drive is not possible.
  3. I want to upgrade my Mac’s hard drive, and I don’t want to do the installations and setup all over again

Obviously number 3 is my answer. I acquired a bigger capacity hard drive to upgrade my current 120GB hard drive in my MacBook. After some Googling around, I found an answer.

There is an Apple utility program called Apple restore or asr located in /usr/sbin. Connect your external USB hard drive and format it using Disk Utility. Open the Terminal in Applications -> Utilities. Type the following command line into the Terminal to copy your hard drive over your external drive.

% sudo asr -source /Volumes/OSX BOOT VOLUME NAME/ -target /Volumes/TARGET VOLUME NAME/

Replace “OSX BOOT VOLUME NAME” and “TARGET VOLUME NAME” with actual volume names. asr will take quite some time to copy the contents of hard drive to external hard drive. Get a cuppa, pop in your iPod earphone and relax.

When asr completes the execution, it will print a message:

asr: did not copy blessed information to target, which may have missing or out-of-date blessed folder information.

Then, bless your target drive with this:

% sudo bless -folder /Volumes/TARGET VOLUME NAME/System/Library/CoreServices

Now, the hard drive is bootable. Restart your Mac and hold down “option” key. A screen will appear allowing to choose which volume to boot from.

Hacker and Cracker

May 21st, 2008 at 16:57 · Filed Under Blogging, Call Me a Geek, Computing, Hacking, Security · 12 Comments 

I received an email from my sister, M. In her email, she pointed out I should not label myself as “hacker”. Well, I could not agree to her opinion so I decided to write this post entry to clear the name for all hackers.

Many people have watched too much Hollywood movies and have developed a perception that hackers are bad guys. They do not understand, nor can distinguish the difference between Hacker and Cracker.

Very well, Hacker and Cracker are like Good Sorcerer and Bad Sorcerer. Hackers are generally referring to a group of programmers or software engineers who dwell into codes of a computer system to find faults or loop holes so that the functionality, usually, security of the computer system can be improved. Hackers are also contributing to many open source device drivers to be used in open source software such as Linux. They study how a device communicates with a computer system without any documentation from the manufacturer (sometimes, some device manufacturers are reluctant to release technical information fearing their competitors may steal their secrets) and write codes to allow the device to communicate with the operating system.

Some hackers visit websites to look for security loop holes and put a file there to indicate their successful hack. Usually, they cause no disruption or damage but to alert system administrator of such security vulnerabilities. One of my website was hacked by hacker from Turkey last week. No damage or disruption caused but simply alerted me of security vulnerability. I quickly corrected the security flaw.

Hackers also study computer codes (binary or source) to learn about a computer software system so to rebuild another similar computer software system for the interest of know-how or to improve the software system. Instead of hacking, reverse engineering best described this type of activity.

Crackers, on the other hand, have the intention to harm or steal. They look for security vulnerabilities to get access into your computer system to cause disruption or steal your information for illicit purposes. Their ultimate goal is to cause damage or to gain something from you to be used for illicit activities, such as stealing your financial accounts or credit cards data for their financial gain.

There are many hacker organizations, for instance, BlackHat. It holds many international technical conferences and training around the world to improve information security.

Laypersons who do not understand the meaning of hacker generally think hacker is a bad guy. Being a hacker myself (sometimes), I just want to clear the name for hackers. And to show the good nature of a hacker, please read here and here.

Mathematics – The Systematic Reasoning

May 21st, 2008 at 1:50 · Filed Under Ada, Call Me a Geek, Computing, Mathematics, Pascal, Software Development · 4 Comments 

I remembered the way my mathematic teachers taught maths in class. Although none of them explained why we must learn maths, as it was the way supposed to be, they taught me systematic problem solving. I began to appreciate the beauty of mathematics when I started immersing myself in programming. The algorithm development and language constructs which are based on mathematics fascinate me with its beauty.

A good programming language teaches us systematic discipline and systematic reasoning. The first programming language which I learned was Commodore BASIC. I hated that. I learned half way (as the matter of fact, 2 days) and I switched to Apple Basic. In the mid 1980s, Apple II was the most popular home computer after Commodore VIC 20. Apple II that ran Apple DOS caught on the wagon very fast. The most common programming tool on Apple II was of course Apple BASIC. That was my first programming language and I had written many programs with it.

Then I was exposed to FORTRAN 77. The language construct was pretty much like Apple BASIC. I caught on with FORTRAN pretty fast. Then under some influences from friends whom I met at the computer center, I learned Apple Pascal. We challenged one another to increase the boot speed of Apple DOS. We rewrote Apple DOS with Apple Pascal and evidently increased the booting speed of Apple DOS.

Pascal is a very structured language (compared to Apple BASIC and FORTRAN 77) invented by Professor Niklaus Wirth to teach students programming and systematic reasoning. The structural construct of the language enable the programmer to think of the problem in a structural approach. Pascal cultivates structural discipline in solving programming problems. Pascal has provided me most of the necessary training in systematic discipline and systematic reasoning in solving problems.

When CP/M was introduced on Apple II, I was able to use UCSD Pascal on CP/M enabled Apple II machines. It won’t be long before IBM and IBM compatibles (8086) stirred up a turmoil with MS-DOS. Then, Turbo Pascal (by Borland) emerged. Turbo Pascal was the lightest and fastest compiler at that time. I became addicted in writing computer programs with Turbo Pascal.

Then I caught on with C and C++ and began to develop software with Borland’s Turbo C/C++ compiler. When MS Windows became a de-facto standard on every desktop computers, I dwelled into Borland’s Delphi (based on Object Pascal) to develop GUI applications.

During Apple CP/M era, I was exposed to Ada. I discovered Ada compiler by accident in another computer shop. I bought the program without thinking twice. Of course, it was a pirated copy. There was no copyright law then. But thanks to the pirated Ada compiler, otherwise I would not know such beautiful programming language has ever existed!

In 1995, I started to learn Ada when books were available. In no time, I fell in love with Ada until today. Whenever I was told or perhaps requested to look at computer programs written in any other languages, e.g. PHP, Visual Basic, C/C++ and etc., I feel that represent an insult to mind trained in systematic reasoning as in Pascal papers which Professor Wirth wrote.

Ada and Pascal are very alike because Ada developers had adopted Pascal’s structural language construct. Both Ada and Pascal clearly represent logical expression without any difficulties. Both languages are constructed heavily based on mathematic concepts and thus enforce systematic discipline and systematic reasoning.

Virtualization – Installing Ubuntu Linux with VMware on MacBook

May 14th, 2008 at 13:40 · Filed Under Call Me a Geek, Computing, Linux, Mac OS X, Solaris · 3 Comments 

I have successfully installed 64-bit Ubuntu 8.04 (Hardy Heron) Linux on my Mac Book. Out of my expectation, the installation was rather quick and easy compared to installing Solaris 10. I had tried installing Solaris 10 on my Mac Book. Solaris installation was successful but I couldn’t boot into it. I wondered why.

My Mac Book sports an Intel Core 2 Duo 2.16GHz with 2GB RAM and 160GB hard drive. I am too skeptical to have 2 physical partitions on my hard drive. Thanks to VMWare Fusion, I can create virtual partition with it. After I have installed VMware Fusion 1.1.1, I created a Ubuntu-64-bit virtual partition and installed Ubuntu from the ISO disk image. With VMware Fusion, I can install directly from the disk image without having to burn a CD or DVD.

Since my Mac Book is codenamed Uranus, I called my Ubuntu on Mac Book, Uranus-Zeta. The idea is from the ζ-ring of Uranus

Like Linux, Mac OS X is a UNIX like operating system. Why do I need Linux? Well, there are a number of reasons. One being you can and another to learn new things. But these are not the reasons to motivate me. Being a software developer developing cross-platform software, I do tests on multiple platforms. Having Linux to run on my MacBook means I can develop and test my software on both Mac OS X and Linux environment without switching to my Linux/Solaris boxes. Another important reason is that I see the needs to support my clients on Linux arise and soon Solaris. Having the ability to run three different operating systems on one machine can be productive and versatile for me.

The other obvious reason is that I have a Core 2 Duo. Meaning I am having two 64-bit CPUs in one processor. It will be a waste of resources if I don’t utilize the computing power I already have. Assigning each CPU to run different operating systems and tasks is called virtualization.

With VMware Fusion, I can run Linux and Solaris side-by-side with Mac OS X without the need to boot into anyone of them at one time. This is a great feature when supporting clients in Mac OS X, Linux and Solaris.

Here are some screen shots (click to enlarge) of Uranus-Zeta:

Shoulder bursitis

April 21st, 2008 at 10:15 · Filed Under Call Me a Geek, Injuries, Karate, Software Development, Sports · 2 Comments 

I had shoulder pain since March. Initially, it began at my left shoulder after waking up one morning. The pain was not too serious until recently (for the past two weeks), I had lousy sleep. Both of my shoulders were aching and often woke me up in the middle of the night. I thought it was some kind of spraining and it would go away after good rest with less training. But it seems to self-exacerbate. The pain was getting more intense every night.

Last night, I read articles about shoulder bursitis or rotator cuff injuries and treatment. After reading these articles, I decided to give it a try. I applied Fastum gel (Ketoprofen) on both shoulders. Guess what? I had the best sleep ever since March. I woke up early this morning without any pain.

Fastum is used to relief localized pain of arthritis, rheumatism or sports injury. I should have acted earlier.

On and off, I had been doing some wauke spontaneously while I was thinking or working on some programming problems. Some kind of off-my-mind of physical activities after sitting in front of computer for too long. I guess it was the effect of banging my head on the keyboard and I lost sense of safety. Without doing proper stretching, I performed wauke with speed and force as in a counter attack situation. That could have torn my muscles or tendons on the bursa and I overlook the seriousness of the pain. How insanely I was!

Alright, now I am on Ketoprofen and I am going to apply it for the second time. Hope my shoulders will recover in a month or two.

GPS Guided Delivery

January 30th, 2008 at 23:23 · Filed Under Business, Call Me a Geek, GPS, Technology · 3 Comments 

Delivery all done! A dozen hampers at 4 locations in Selangor/Kuala Lumpur. 3 out of 4 locations were alien places to me because I had never been there. Drop #1 in Sungai Long, Drop #2 was in Sungai Besi, Drop #3 in PJ and Drop #4 in Selayang. 1, 2 and 4 were places I was not familiar with and had never been there.

I arrived at Kajang toll at 1130 hours and started to use my GPS device to guide me. Found the place easily by following the GPS guidance. It took some times to navigate through some messy traffics and finding the block and the unit. But I managed to drop off and proceed to Drop #2 at 1215 hours.

Drop #2 and #4 needed some communication with the clients as their address were without street name. They used lot number as they were in industrial park. That complicated the process a little. By 1507 hours, all goods delivered.

On the night before, I researched on the GPS map and found Drop #1 and marked it. Easy job. I had to defer Drop #2 and #4 until morning so that I could call up the clients for some direction. I called them this morning and could roughly know the locations and marked them.

What made this mission interesting was an ironic demarcation which a traditional delivery versus technology-assisted delivery. While heading to Sungai Long after exiting Kajang toll, I saw a cab driver with a full load of hampers in his cab. He was on a hamper delivery mission too. The difference was that he was looking at his hand drawn map on the steering wheel. In great contrast, I was guided by GPS.

The mission had helped me to build a Clientele GIS.

IP Flooding

January 22nd, 2008 at 14:17 · Filed Under At Home, At Work, Call Me a Geek, Days in My Life, Hacking · Comment 

I am experiencing IP flooding on my router. It notifies me by email about this attack. Right now, I have identified the source and hopefully I can nail this attacker soon. This is not the first time I experience IP flooding. I have received quite many email notifications in the past 3 weeks but I was out. It is coincident that I am still at my computers solving some server problems.

SVN setup

January 22nd, 2008 at 11:53 · Filed Under At Home, At Work, Call Me a Geek, Computing, Days in My Life, Hacking, Linux, SCM · 4 Comments 

I’ve finally found time to setup svn at my home net after so many months. My svn server was down when my previous Linux box was down with a dead hard disk last year. The setup was quite a brisk. I had everything installed and configured last night. The test for remote access using a url was successful. I could import, checkout and check in. Because it was already late, about 1AM, I felt rather tire and went to bed.

This morning, I hacked some codes to provide a rather informative post commit email notification. All are done except the check in will stall. It takes a long time (and possibly hang!). I have yet to fully test before I begin my development project again.

Is your connection secured?

January 19th, 2008 at 10:33 · Filed Under Business, Call Me a Geek, Computing, Marketing, Security · Comment 

Internet has become a common tool to connect your mobile computer back to the computers in your office while you are on the go. When you are out there negotiating business with your client, you need to extract a file from your computer in your office but you are hundred or maybe thousands miles away, how can you retrieve your file?

The answer is by using FTP or File Transfer Protocol. You can make connection from your mobile computer to your office computer via an Internet connection. It is very convenient to use. But there is a security concern. All communications between your mobile and office computers can be read like an open book by anyone lurking in the Internet. You need a secured way to transfer your sensitive business data.

Pragma Systems SFTP client provides you a secured FTP connection by encrypting all data before they leave your computers. You can be rest assured of the confidentiality of your data during transmission. Don’t leave your office without it. You never know who is watching.

Next Page »