Research Fellowships

I’ve just received an email from the careers service about places available on a 10-year Canon research fellowship. Application is open to any European or Japanese national. The thought hit me that this is actually a very good idea and a good way of spending money. Sponsoring young talented academics by giving them an opportunity to grow their research projects.

So, I thought that this is a much better use of money than what our government is presently doing. I would think that Malaysia would benefit if we had a similarly open programme, which encouraged young academics of all nationalities to set up shop in the country. But then, I realised that there was only one snag. I’m not sure if there are many non-Malaysians who would apply for such a research fellowship.

I can definitely imagine Malaysians applying for such a fellowship because it would give us an opportunity to go home. However, I’m not too sure who else would be interested. Unlike Japan, we do not have an established research environment and culture at home. So, as much as such a programme might help us to nurture young talent and promote research, the young talent may not want to go to Malaysia. This ends up as a catch-22 situation.

Regardless of this big problem, I still think that having such a programme, is a good idea. We need to break out off the loop at some point. This is what we need.

  1. A non-politician, in charge of such a programme. He/She does not need to be an academic as the role is a strategic one. Give this person a suitably sized budget, say RM 100 million which will be doled out as a number of 10-year research fellowships. Administrative staff should be kept to a minimum, under 6.
  2. Unlike A* that goes around fishing for top professors, we can go after the latent talent – young academics who need an opportunity to shine. Seed their research with some funding, say RM 100k and set them off. Toss them all into an incubator like facility, with the necessary shared infrastructure to support their research. Then, sit back and wait for the results.

If we are unable to capture the top researchers and professors of the world, maybe we can capture some of the young ones. If correctly nurtured, these young ones may be able to produce world class research as well. If we are really lucky, one or two of them may discover something ground breaking. Then, the job of this programme would be to nurture them and graduate them into positions of leadership. Don’t dead end these people, which is a huge problem in the local universities.

All this hangs on the person in charge. He/She needs to have broad authority and political backing, without having to succumb to political shenanigans. Hence, the funding for the programme should not be sourced from public funding. Public funds must never form more than 30% of it. The private sector must take the lead and fund most of it, with the premise that any IP generated, will be co-owned by all the companies involved.

There is now another snag. All the major industries in Malaysia are state controlled in one way or another. Think palm oil (Sime Darby), oil & gas (PETRONAS), automotive (PROTON) and others. The only industry that’s relatively free of government thumbs is electronics. However, the major players are all foreign owned companies who already have research centres set up all over the world.

Anyway, just a “back of the napkin” kind of idea. Highly flawed and in need of more thought.

Archival Media

I’ve always wanted to write about this as I’ve noticed that few people have encountered the phenomenon before. The topic has to do with the choice of archival media for long term storage. With the amounts of data that we generate today, whether it be videos, images or text, we need some form of method to store the data safely. This applies as much to research and work as well as personal data.

A very common way of archiving data today, is the blank CD or DVD. It’s cheap to obtain, small enough to not take up much space, and holds a large amount of data on it. Many people are under the impression that it is safe and reliable. I’ve always known that the chemicals used for the burning layer, have a lifespan. Some research would reveal the manufacturer’s quoted lifespan as about 75 years or so. More than sufficient for personal data.

But something happened to me once, to change that perception. It all happened quite by accident.

I was working on my computer at home, one lonely afternoon. As the day was quite hot, I bought myself a big packet of cendol, which is a popular Malaysian beverage, which is made of crushed ice, gula melaka – a form of brown sugar made from coconut, red beans and some green gelatinous thing made of starch. So, it’s sweet and cool, perfect for a hot sunny day.

I poured the beverage into a big 12cm zebra brand steel mug, which should be fairly familiar to any Malaysian, and sat it down on a coaster. The coaster was basically a spent CD-R that didn’t quite burn properly. As they were usually termed as coasters, I used them literally as such. This was when I noticed something interesting. A ring of clear plastic would appear under the base of the big steel mug. It would seem that the CD-R coating had dissolved in the water that condensed on the outside of the mug and collected at the bottom.

So, I did a few more experiments, and ran the CD-R under tap. I even drowned it in a basin of water. However, the chemical layer only dissolves under the steel mug of cendol. So, I bought a few more mugs of it, over the next few days and ended up with a crystal clear piece of CD-R plastic. The entire top layer had dissolved off, including the metalic coating.

It would seem, that the chemicals used are actually water soluble, under the correct temperature conditions. I have no idea what the threshold temperature was, but it is definitely above freezing. So, it may not be a good idea to put archived data into “cold storage”, so to speak.

HTPC Board

D945GCLFI think that I have finalised on the main computer board that I’ll be using for my HTPC. The standard PC boards are a little too power hungry for a HTPC while the VIA boards are a little under-powered. Furthermore, the VIA EPIA platform is not easily available in Malaysia. I know because I have tried getting them before, directly from the local VIA distributor. They are certainly not cheap.

Yesterday, I checked my price list and found that Intel are now directly selling their new Atom based mini-ITX boards through the channel. So, I can buy it directly. Furthermore, they are selling it for a very cheap price. This seems like the best bet to me, for the moment. The D945GCLF board comes in a mini-ITX form factor (17cmx17cm) and has a 1.6GHz Atom processor and GMA950 graphics based chipset on it.

Although it’s not an ideal board, it is certainly usable for regular applications, including a HTPC front-end. The graphics are more than sufficient for 2D (i.e video) acceleration. The main processor, has an average power dissipation of about 2W. So, if you look at the picture, you may be wondering why there’s a big heat sink and fan on it. The big heat sink and fan is not on the processor, but on the northbridge chipset! Sneaky bastards!

Regardless, the Atom processor comes with hyper-threading technology and scores a 153 on a Cinebench benchmark, which makes it about the same performance as a Core 2 Duo running at 500MHz. I was able to playback standard-definition (720×400) H264 on my old laptop with a AthlonXP 500MHz. So, the Atom platform should be more than sufficient.

In fact, I am quite enamoured by this board. I have always been a fan of small form factor PCs running on low powered devices. I used to source some of my boards from Taiwan, in the past. I’m actually thinking of buying a bunch of these boards and using them for various other purposes, including building a Eee Monitor like desktop for myself.

HTPC Display

An integral part of any HTPC is definitely the video display. It wouldn’t be called a HTPC otherwise. Assuming that the motherboard chosen is capable of sending video output in VGA, DVI and HDMI, there are several alternatives to choose from, when building a HTPC: Computer monitor, LCD TV, projector. The trade-off here would be size versus price.

But then, something dawned on me recently. There is no real point in building a HD capable HTPC when there are no HD sources for me to watch. Digital Video Broadcast (DVB) TV is only presently in trials and isn’t supposed to go into service until after 2010. Even Astro does not yet broadcast in HDTV although it does have the capability to do so in the future. So, my main source of media will probably be DVD quality video, which is meant for SDTV (720×480/720×576).

In other words, there is no need for me to set up a HDTV quality rig yet, at least not for another few years. By that time, the prices of HD capable devices should have dropped. So, for the moemnt, I will focus on building a SDTV capable display system:

  • Monitor: 22″ 1680×1050@RM800. Viewing distance: 2.5m
  • Plasma TV: 32″ 1366×768@RM2,100. Viewing distance: 3.7m
  • LCD TV: 32″ 1366×768@RM2,400. Viewing distance: 3.7m
  • Projector: >32″ 800×600@RM2,500. Viewing distance: >3.7m

So, a monitor isn’t really useful in a living room unless I plan to only watch thing alone. The moment that I have a few friends over, it isn’t going to cut it. This leaves the LCD TV and projector as the only viable options. Since they are both priced equally, you would think that the projector is the way to go. But there are plenty of drawbacks to the projector idea.

A projector would require a darkened room to work well. This means that the living room lights need to be off and the curtains drawn. This may or may not be suitable for everyday viewing. Also, a projector is a fairly noisy device as it needs a cooling fan to cool down the light bulb. Furthermore, the bulb itself has a limited lifespan. The cost to replace a bulb can be in the range of RM 1,500 per bulb.

So, the best option would still be a TV. Considering that there are no HDTV sources, I might just get a regular SDTV instead. A good 29″ colour TV can be had for under RM 1,000. But a much more power efficient and sexier alternative would be a 32″ plasma, which can be had for RM 2,000. There is just too much choice to be had.

Now, going back down to a lower resolution opens up a whole other can of worms with regards to the processor and graphics chip. It is perfectly possible to watch standard definition content, even when encoded with H264, on a low powered PC. I’ve tried it on my 500MHz Athlon with RS100 graphics and it works perfectly at <50% cpu utilisation. So, I would imagine it to work on an entirely passively cooled EPIA platform with a 1GHz VIA processor and Unichrome graphics.

So, we're back to square one.

HTPC Rig

htpcI’ve been investigating different combinations of devices for building a Home Theatre PC (HTPC). This will be one of the first things that I build when I get home. My main considerations when building a HTPC is the WAF (Woman Acceptance Factor) factor and future proofing the machine.

The WAF factor can be broken down into:

  • Silent machine so that it doesn’t make a din while it runs.
  • Aesthetically pleasing so that it doesn’t stick out like a sore thumb in the living room.

Future proofing the machine would mean:

  • HDTV capable display (1920×1080)
  • Digital outputs either with DVI or HDMI
  • Capable of BlueRay playback

As usual, the problem is: fast, silent, cheap (pick any two).

To have a high WAF factor, requires using a low power machine so that it can be passively cooled in a small case. For this, the logical combination would involve a ultra-low power VIA processor with Unichrome graphics. However, its ability to playback high-def content is suspect because of the lower processing capabilities. Another alternative is to use an Intel/AMD processor coupled with an ATI/NVidia graphics chipset, which should provide enough power to playback any future video content, but would also dissipate quite a lot of heat in the process.

Furthermore, I am limited by the actual parts that can be purchased off-the-shelf. I would not want to import anything if I don’t absolutely have to. So far, the best option that I’ve come up with is this:

  1. CPU: AMD 4050E (45W)
  2. GPU: AMD780G (ATI3200) or NF8200 (Geforce 8200)
  3. RAM: 1Gb

The different motherboards that support the graphics chipsets cost about RM 320 and come with all the necessary video outputs (DVI + HDMI). The ATI chip has UVD (AVIVO HD) technology while the Geforce chip has PureVideo HD technology. Both of which allow the processor to offload the HDTV decoding pipeline to the graphics processor. However, there is one catch. At present, none of these technologies are supported in Linux.

Seeing that I’ll be building a MythTV based HTPC, Linux acceleration is important. Of the two vendors, ATI is more likely to have acceleration support in Linux than NVidia. AMD has done a lot in recent months to provide cross-platform parity for its drivers and has caught up to NVidia in terms of driver quality. But on top of this, AMD has released documentation for the ATI graphics processors, which makes it possible for third party drivers to support it better.

The CPU was chosen as it is a low-power desktop processor. With a maximum TDP of 45W, it is the second coolest desktop AMD processor and almost cool enough to be a laptop processor. So, it may actually be possible to cool it passively with a suitably large heat sink. An alternative to being aesthetically pleasing would just be to hide it out of sight, except for the IR receiver.

LCD TVs

As I’ll be going home soon, I’ve been thinking about toys that I’d like to buy and keep in my living room. One of the very first things that I’m likely to get, is an LCD TV. This is because I’ll be building my own little media centre machine in the living room. I do not plan to subscribe to satellite TV (Arsetro) but will instead rely on the Internet and for all my entertainment needs.

So, just comparing the price of LCD TVs in the UK and Malaysia, I find a slight difference in the price. The present sweet spot for LCD TVs seems to be the 32″ HDTV models. If I’m going to splurge on a TV, I might as well splurge on a HD1080 one. So, I quickly googled up the prices. In Malaysia, I can buy one for just slightly under RM 2,500. In the UK, I can get one for slightly under £300 (RM 2,000) or about £250 (RM 1,600) ex VAT. If I choose to forego warranty, I might get it even cheaper!

It seems that it is actually significantly cheaper in the UK than Malaysia. You know what? This does not surprise me one bit because a HDTV is a “luxury” item. Over here in the UK, there is economies of scale because a majority of the people are able to afford a HDTV unlike in Malaysia, where most people still survive on standard TVs. So, the retailers are able to move more units here in the UK, resulting in more competition and lower prices.

The potential price difference of almost RM 1,000 is important as I can construct a high WAF media centre for around that price. The motherboard, CPU and RAM would cost just under RM 500. A 250Gb harddisk would cost less than RM 200, leaving another RM 300 to buy a chasis and accessories. Things are just so darn expensive in Malaysia!

Strace to the Rescue!

For some unfathomable reason, a mailing list that I was running, decided to stop working last week. Whenever anyone sent an email to the mailing list, they would get a bounced error and fail. I was forced to reboot the server two weeks ago, but I had not changed any settings since. So, I was rather puzzled as to what was going on.

The first thing I did was to check the mail server logs and the error surprised me:

Jul 2 15:41:23 localhost postfix/pipe[10572]: 70CB7401A4: to=, orig_to=, relay=mlmmj, delay=1.5, delays=0.96/0.02/0/0.49, dsn=5.3.0, status=bounced (Command died with signal 11: "/usr/bin/mlmmj-recieve")

This did not make any sense to me. MLMMJ was segfaulting without any reason. I tried googling around for a solution but there was none. MLMMJ is not a very well documented mailing list manager either. So, I was left to find my own solution to the problem.

The usual causes for a segfault are usually memory related. So, I thought that the server might be running out of RAM. To test this, I stopped running some other services to free up RAM. Then, I sent a test email to the list to see the same segfault error. So, it’s not a case of “lack of memory”. Then, I thought that it might be a file permissions problem so I set the test mailing list to be world read-write-able. This didn’t work either.

So, time to dig deeper into the “mlmmj-receive” programme. Reading up on the man pages, I realised that it was only a front-end software that calls two other back-end programmes to do the dirty work. It calls “mlmmj-process” to process the email and “mlmmj-send” to send the email. So, it was possible that any one of these three things were failing.

The next thing that I tried was to create a blank mailing list with no subscribers and sent a test email to it. Surprisingly, the “mlmmj-receive” completed without much ado. So, this indicated to me that the problem was likely with the “send” stage. But, it got me no closer to an answer as I couldn’t think of any reason why this stage was failing at all as the main SMTP server was running perfectly.

So, it was time to roll up the sleeves and engage STRACE. I have only used it once for debugging purposes and now it was time for me to see what was going on behind the scenes. But to deploy this, I would first need to intercept all the messages being sent to and returned from MLMMJ. So, I wrote a wrapper script “/usr/bin/mlmmj-receive” to wrap around “/usr/bin/mlmmj-recieve” (note the spelling difference).

#!/bin/sh
cat - > /tmp/mlmmj.in
cat /tmp/mlmmj.in | strace -f -o /tmp/mlmmj.log /usr/bin/mlmmj-recieve $@ 1>/tmp/mlmmj.out
cat /tmp/mlmmj.out

This simple script first intercepts all the data piped to MLMMJ and saves it in “/tmp/mlmmj.in”. The next line is the magic that uses strace to trace the actual operations, which dumps all the system calls to “/tmp/mlmmj.log”. Studying this log revealed, the interesting inner workings of MLMMJ and also provided a clue as to what was going wrong.

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("xx.xx.xxx.xxx")}, 28) = 0
fcntl64(5, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1215041316, 932534}, NULL) = 0
poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 0) = 1
send(5, "\v\352\1\1\nlocalhost\t\1\1", 28, 0) = 28
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(5, FIONREAD, [28]) = 0
recvfrom(5, "\v\352\205\203\1\nlocalhost\t\1\1", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("xx.xx.xxx.xxx")}, [16]) = 28
close(5) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

This bit showed that just before segfaulting, the programme (in this case, mlmmj-send) was polling the DNS server for the IP address of “localhost”. This did not make sense as a computer should not be polling a DNS server for “localhost”, which is defined in “/etc/hosts”. In fact, at an earlier part of the programme, it actually opens up “/etc/hosts” and tries to find “localhost” in it.

Seems like there was a formatting problem with the file which I didn’t realise. But none of the other programmes seemed to have any problems connecting to localhost except MLMMJ. So, I fixed the problem and voila, the mailing list was working again.

Anyway, I now think that STRACE is a god-like tool. It gives me great insight into the inner workings of any software application. This would be very useful for reverse engineering purposes as well as debugging and optimisation tasks. It has an option to output timestamps, including how long each system call takes. I will look into this application more, and learn how to exploit it thoroughly. This tool is one to keep in the tool bag.