Archive for the ‘Uncategorized’ Category

Working with Windows XP Mode in MS Virtual PC in my Windows 7

Thursday, September 23rd, 2010

Recently a great idea came to myself.

Windows 7 Professional comes with the ability to install Windows XP Mode. Its basically an image of virtual Windows XP that you can run with virtualization technology such as (of course) Microsoft Virtual PC or Virtual Server. The purpose of Microsoft providing this image is to “debug”, “test” legacy applications. But I found a very sweet use of the image though: as the main workspace instead of the Windows 7 host itself.

Basically what I did is, I assign 50% of the available physical RAM to the Windows XP Mode. My laptop has 2 GB of RAM, so I assign 1024 MB of RAM for Windows XP. Why I did this, is because 2 GB of RAM for Windows 7 is just  barely enough, and when I’m running heavy applications (Eclipse, WinSCP, etc), Win 7 becomes lag and it takes quite long to hibernate/resume the computer.

But the Windows XP Mode, having 1 GB RAM, is particularly fast and very responsive to work with. So I end up installing and running those programs in the Windows XP Mode, while I leave the Windows 7 just for some personal stuffs, such as browsing, MSN, Torrents/downloading, that do not require much of resources. The result is I end up having both fast and responsive personal and workspace environments.

Other than perceived better performance, its also very easy to hibernate the workspace (Virtual machine). Just close the Virtual PC and all the files and settings will be kept “frozen” until I resume it by activating the Virtual PC. It also offers better maintenance scenario, in case the workspace is corrupted I just need to reinstall Windows XP Mode, and not the entire host OS (Windows 7).

It also enables me to start/shutdown/hibernate/resume the Windows 7 very quickly, below 1 minute each. As long as they are done without having the Windows XP Mode still running.

Its a so-sweeeet configuration..

Now I wonder… Will that violate the EULA of the Windows XP Mode ?

Into the Cloud

Sunday, August 29th, 2010

These few days I’ve been reading articles about Cloud Computing. I have to say its actually simpler that what I’ve been expecting.

Basically Cloud Computing is what its about, literally, “computing that is done by a computer that is a part of a shared resources called cloud”.

The main purpose of utilizing cloud computing is to reduce cost and increasing application scalability. This is done by utilizing a shared resources that we can commit on-demand, thus enables us to pay only what we’ve been utilizing (resources, bandwidth, and service). Since the cloud may serve a lot of customers and systems/applications, usually the server is a uber, super, ultra high-spec computer/server system (like, several Opteron/Xeon processors with Terra-bytes of RAM and Gigabits of bandwidth).

Imagine the possibility. This is one of the best example of a cloud-computing use case that I’ve found in the internet:

Your organization has 1,000 boxes of documents to scan and OCR and you need to get the work done in one week. By hosting your application on the cloud, you could have as much processing power as you need. Hundreds of servers could be deployed to your project at once. When the work is done, your hosting obligations go to zero.

Wow! That’s awesome!

Other implementations:

A few big players of this Cloud Computing are Amazon and Microsoft. There are also smaller players that offers lesser services and sometimes for free. Dropbox (yeah, the application that one of our clients use) is an example of cloud-based service.

A weakness of the Cloud Computing is that you need to allocate some time to make your application live. Especially if your application requires a lot of data to function. In above example, you need to allocate some time to upload the scan images of the 1000-box documents to the cloud first, before the application can begin. A way to solve this is to have the application to process the OCR together with the upload. So the application might be activated every minute, finding new files in the upload directory, and process whatever images inside there that have not been processed. It depends on how we design our application to better utilize the time and resources.

Now I start to think of how we can use Cloud-based computing in our project…

1. Replace IMS servers with AMI from AWS.

2. Host some of the IMS reporting process in AWS.

3. Host some of the website projects that requires alot of processing and bandwidth to AWS.

Anyone keen to talk to me about this ?

How to make Thinkpad scroll button work in Linux/Ubuntu

Friday, August 27th, 2010
Edit this file using superuser privileges:
sudo gedit /usr/lib/X11/xorg.conf.d/20-thinkpad.conf
Add or type in:
———– BEGIN LISTING ———–
Section “InputClass”
Identifier “Trackpoint Wheel Emulation”
MatchProduct “TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint”
MatchDevicePath “/dev/input/event*”
Option “EmulateWheel” “true”
Option “EmulateWheelButton” “2″
Option “Emulate3Buttons” “false”
Option “XAxisMapping” “6 7″
Option “YAxisMapping” “4 5″
EndSection
———– END LISTING ———–
Reboot your computer

WinSCP synchronization replacement for Linux

Friday, August 27th, 2010

There are a few GUIs programs that I’ve tried, for example Unison and Conduit, but apparently none of them provide the functionality perfectly and none of them are stable.

So I decided to try this simple Shell script. What it does is, it accept two parameters, which is supposed to be source directory and target directories. It checks for directory modification every 1 second by checking directory’s stat (some kind of hashcodes), and if there’s modification detected the script will run rsync. The –exclude parameter in the rsync make sure we skip all hidden files (begin with fullstop), including .svn directories.

Pros:
- It works
- No installation, dependencies, special software etc
- Not affected by SVN update/traffic

Cons:
- Can only work directory against directory
- No GUI

————————BEGIN LISTING————————
#!/bin/bash

echo “Synchronizing $1 ==> $2″
rsync -zr –exclude=”.*” –progress $1 $2
echo “Synchronizing $1 ==> $2″

OLD=`stat -t $1`

while true
do
NEW=`stat -t $1`
if [ "$NEW" != "$OLD" ]
then
rsync -zr –exclude=”.*” –progress $1 $2
OLD=`stat -t $1`
echo “Synchronizing $1 ==> $2″
fi
sleep 1
done
————————END LISTING————————

Setting Up Ubuntu Workstation for TAC Web Engineer

Monday, August 2nd, 2010

I created this document for any TAC web engineer in the future who wants to set up his own workstation with Ubuntu Linux. This document assumes we will be using Ubuntu 9.10 or above, and I will create this document style in Migrating-from-Windows style.

Connectivity

We’ve got Wifi, assuming we’re able to make it work. Most of us use Thinkpads, which should be highly compatible with Linux kernel 2.6.x. Broadband on mobile modems (those Huawei junks) are working just nice, so we can just go onsite or presentation without much worry. Worst case, just subscribe to M1’s Novatel Mifi plan so we have Wifi on the go, powered by battery.

Email

There is Evolution email client. But I would recommend Zimbra instead.

Web Browser

Chrome and Firefox are available for Linux. IE, however, is not. So you have to bug somebody else just to borrow his IE. This is ironic, but fortunate. Yes, its not typo, “FORTUNATE”. It means nobody would expect you to use and test in IE. Anyway IE/FF/Chrome compatibility is no longer Web Engineer’s issue. Its now become Front-end’s issue.

PHP Editor

Eclipse is available for Linux. Zend too, and PHPEd too.

Source Control

There is RabbitVCS for Ubuntu with support for Subversion. I’m still figuring out how it works actually. People say it works almost exactly like TortoiseSVN, which is an extension of Nautilus (the ‘Windows Explorer’ for GNOME). Command-line SVN also available.

sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-get update
sudo apt-get install rabbitvcs-cli rabbitvcs-gedit rabbitvcs-core rabbitvcs-nautilus rabbitvcs-thunar

WinSCP

Here comes the best part. Take a look at Conduit and SSHFS. You will LOVE it. Its way better than WinSCP.

sudo add-apt-repository ppa:conduit/ppa
sudo apt-get update
sudo apt-get install conduit
sudo apt-get install sshfs
sudo mkdir /media/tleilax_projects
sudo sshfs -p 2221 tony@tleilax.theadventus.com:/home/projects /media/tleilax_projects
sudo conduit &

Text editor

This is abundant in Linux. I should not need to list all the possibilities. But generally, gEdit is a nice graphical one.

Remote Desktop Connection

There is a command-line called rdesktop. Perhaps its the same with the one under “Internet | Remote Desktop Viewer”.

MS Office

OpenOffice is available for Linux. If you die-die need MICROSOFT OFFICE, you will need to purchase CrossOver, a Windows application emulator for Linux. But usually people would forgive you for not having MS Office installed :)
Visio, however, is still an unsolved puzzle.

FTP/SFTP Client

FileZilla is available for Linux.

sudo apt-get install filezilla

How to make Excel loads UTF-8 CSV files correctly

Saturday, June 12th, 2010

How to make MS Excel load UTF-8 CSV files correctly:

1. Your CSV file must have the correct byte-order mark. According to wikipedia, the correct BOM for UTF-8 is 239 187 191. So you need to do fputs($f, chr(239).chr(187).chr(191)); first before echoing the rest of the data.

http://en.wikipedia.org/wiki/Byte_order_mark

2. Echo the UTF-8 data as per usual. If your data comes from ANSI or other encoding, do an mb_convert_encoding or iconv first.

Example code:

$fname = $dir.’01_summary.csv’;
$f = fopen($fname, ‘w’);

fputs($f, chr(239).chr(187).chr(191));

fputcsv($f, array(
‘Edm Subject’,
$edm_job['cmpg_subject']
), ‘,’, ‘”‘);

How to force user to logout on browser close

Friday, June 11th, 2010

Beware of the drawbacks :

- Browser “Refresh”, typing URL manually, and closing one of the multiple tabs will get the user logged out due to Ajax call triggered.

<script>

var sendajax = true;

$(’a').click(function(e){sendajax = false});

$(’form’).submit(function(e){sendajax = false});

function windowonbeforeunload()

{

if(sendajax)

{

$.ajax({

async: false,

type: ‘GET’,

url: ‘<?=site_url(’users/ping’)?>’,

success: function(msg) {

alert(’Ajax called - you just clicked refresh, typed URL, or close window’);

}

});

}

}

window.onbeforeunload = windowonbeforeunload;

</script>

Sleep

Friday, May 21st, 2010

Has been quite a while since I’ve last posted a blog. I was mainly busy juggling with 3 projects in Feb - Apr. And quite sad, I think I failed one of them terribly (I bet you know which project it is).

Recently I was doing some experiment with myself, after receiving numerous (and repeated) advices from mom and an uncle (he’s a doc, so I have little doubt on what he says). In short, their advice is to go to bed earlier, sleep enough, and wake up earlier. He said that human body is designed to :

1. Sleep between 6 - 10 hours a day
2. Sleep at 9pm
3. And thus, wake up at about 6am

Reason being:

1. According to Human Circadian rhythm,  human body produces melatonin (the chemical that induces sleep) at about 9pm
2.  REM, the phase of sleep that helps with restoring brain functions after full-day exertion, can only happen during the first and last phase of sleep — how can this happen with a sleep that shifted out of Circadian rhythm, and forced to end with a waker alarm ?
3. Human body begins detoxifying itself around 11pm and finished 4pm (liver, lungs). That’s why you feel unwell if you sleep too late and wake up too early. Not to mention that you can catch cold/flu easier too.  Also that’s part of the reason we cough in early morning, its normal.

I have no issue with sleeping enough, but going to bed earlier ? And even worse, waking up earlier ? Those have been kind of “impossible” for me, especially in a period when work commitment needs to be high, and especially there’s no house maid  to do things that I only able to do after work.

So this week, I’ve been trying to fit my sleep schedule along the recommended line (11pm - 7am), and try not to wake up because of my phone alarm asked me to. Here’s what I’ve significantly felt:

1. Improvement in my memory function.

I’m able to remember what I need to do better, faster, and sometimes without the need to write down notes. I’m also able to remember things in the past that I usually cannot remember, for example conversations with people, song titles, people names, etc.

2. Improvement in thinking power.

Sometimes I feel like I’m able to anticipate things better, able to plan actions need to be done until 2-3 steps ahead (example when doing programming). Its like, when I’m typing some codes, several seconds before I finish typing, my mind already moves somewhere else like how to upload, how to test, and what to expect.

3. Improvement in cognitive and communication ability.

Usually I cannot comprehend things that is spoken in MRT-rush manner (like a thing described in 1,234,156,790,000 sentences spoken verbally). Until now I still cannot, but if usually I’m lost within 5-6 sentences, now I’m lost after 7-8 sentences. Something like that. Sometimes I also feel that I speak better and in a more organized way (if only you will realize how difficult it is to speak in foreign language after some 27 years of speaking only mother-tongue).

So looking at the benefit (assuming those improvements are actually because I sleep better), I wish to continue this sleeping pattern. But how about those things that I sacrificed in order to follow the pattern ?

1. Refreshing time

I usually play games after work, and I realized that this is actually not really a requirement to me. I can play games when in transit, and also during weekend. I’d rather use this time for other things.

2. Family time

I have no solution for this right now. But anyway there’s little quality family time you can achieve during the time when you’re totally worn out after work, when your emotion level is bad, and you just want to end the day sooner than later. And no, I’m not gonna comment on night-sport here.

3. House chores

The extra little time left after work and before you sleep. That’s the only time window I have in a day. So must finish all of them and during that time, I try to give more quality time to family. Example: doing the house chores together while discussing on our future plans, and some little chat before going to bed.

4. Work commitment

One thing I realize is, its difficult to think and do work-related tasks during evening/night after work because of only little time left before bed-time and considering how tired I am during the time. But if you realize, by right actually I have little extra time that can be utilized in the morning before going to work =)

jQuery Ajax Manager (Queue/Cache/Abort/Block)

Monday, February 22nd, 2010

I use this for SmartRoam, but actually have not verified whether it works well. But it looks quite promising. This is how Ajax calls should be done!

http://www.protofunc.com/scripts/jquery/ajaxManager/

I recommend Evernote for everyone

Monday, January 18th, 2010

Evernote is good for you, if:

One. You need more than just a notepad, which is able to organize your notes into categories, give tagging, and summarize a to-do list. Oh, a rich editor is also a must-have. Plain text is so 1980.

Two. You need an easy, automated, secure way to backup your notes to a separate computer (internet). So that if you change your computer, or simply just using another computer, you can get your notes easily.

Three. You want a notebook that can be synchronized across your myriad number of gadgets you have. Evernote is available on desktop (Windows and Mac), as well as mobile devices (Windows Mobile, Apple, Android, Palm, Blackberry). So that you can type your note in your phone, but later at home you can just sync the notes to your computer. No clumsy cables or sophisticated bluetooth needed.

Lastly, and most importantly. You are cheap and looking for a freeware. Evernote is free for 40 MB. More than that, you can go premium for $5 a month (or $45 a year). Which dollar ? USD of course.

And here’s the link. I suppose you do not want a link to the homepage :)

http://www.evernote.com/about/download/