I just found out about OverAPI.com, a website that collects cheat sheets for various topics in computing, including programming languages, software, and concepts.
I think a site like this is useful and handy, and will definitely keep a bookmark on it.
Wednesday, April 17, 2013
Collections of cheat sheet
Thursday, October 18, 2012
Compiling VirtualBox guest addition with Ubuntu mainline kernel
When compiling the guest addition of VirtualBox 4.2.0 on my system which runs Ubuntu 12.04 and mainline kernel (kernel-ppa/mainline), I encountered lots of error: unknown type name ‘uint64_t’. This happens even when all the linux-headers-* packages are already installed.
To fix these errors, the kernel headers from Ubuntu's linux-headers-* needs to be merged with the kernel source from http://kernel.org. Here're the steps.
[DISCLAIMER: please do not hold me responsible if your machine becomes unusable due to the following steps]
First, ensure that the kernel headers from kernel-ppa/mainline are installed, and they match with the running kernel.
cincai@cincai-VirtualBox:~$ uname -r 3.6.0-030600-generic cincai@cincai-VirtualBox:~$ ls -1d /usr/src/linux-headers-* #Note: dash one d /usr/src/linux-headers-3.6.0-030600 /usr/src/linux-headers-3.6.0-030600-genericBefore proceeding, backup those linux-headers sub-directories so that they can be restored in case bad things happen.
The next step is to download the matching kernel source. In our example, it is http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.tar.bz2.
Now we need to merge the Ubuntu's and kernel.org's files. Please copy the following script and saved into a file called, let's say, merge.sh.
#!/bin/bash
kversion=$(uname -r)
find /usr/src/linux-headers-$kversion -type l | xargs rm
cp -a /usr/src/linux-headers-$kversion/* /usr/src/linux-headers-${kversion%-*}
rm -fr /usr/src/linux-headers-$kversion
mv /usr/src/linux-headers-${kversion%-*} /usr/src/linux-headers-$kversion
topdir=$(tar -tjf $1 | head -1)
topdir=${topdir%/*}
tar --strip-components=1 -C /usr/src/linux-headers-$kversion -xjf $1 $topdir/arch $topdir/include
#Fix kernel version
kver=${kversion%%-*}
cat > /usr/src/linux-headers-$kversion/include/linux/version.h <<EOF
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define LINUX_VERSION_CODE KERNEL_VERSION(${kver//\./,})
EOF
Flag merge.sh as executable, then then run it.
cincai@cincai-VirtualBox:~$ chmod u+x merge.sh cincai@cincai-VirtualBox:~$ sudo ./merge linux-3.6.tar.bz2
If everything works, then the VirtualBox guest edition should compile cleanly.
Wednesday, March 31, 2010
A Messy Mess
The latest KMess (v2.0.3), a 3rd-party MSN client, is supposed to properly set-and-retain the friendly name.
However, I still encountered a situation where the friendly name is always reset to the MSN ID (e.g., abc@def.com) which is an email address. Guess that's the price to pay for messing around with different 3rd-party clients.
Luckily the situation could be salvaged, somehow. This was after a series of trials-and-errors (coupled with frantic login/logout sequences). Talking about having too much time with nothing to do!
Anyway, enough with the babbling. Here's how to sort out that messy mess:
- First, change the friendly name from abc@def.com to another (random, meaningless) email address such as xxx@yyy.com.
- Logout and re-login.
If the friendly name is still the new email address xxx@yyy.com, then this is a good sign. - Now, change the friendly name to whatever wished.
- Logout and re-login, and hopefully the name stays intact.
Thursday, October 15, 2009
GPUSVM-0.1 and invalid memory accesses
GPUSVM is a CUDA implementation of SVM which uses the SMO algorithm. This library supports two primary functionalities: training and classification.
The code is written in C++, and the source tar-ball contains an example of how to call performTraining() function once. My woe started when calling performTraining() more than once. This gave me a crash:
*** glibc detected *** bin/linux/release/svmTrain: double free or corruption (out): 0x000000000b6e4820 ***
This was apparently triggered by the second performTraining(). After some (ok, ok, 2 days including CUDA crash course actually) huntings, it turned out that there really are two invalid memory accesses:
- one is during memcpy-ing from device to host memory (occur in the second-order heuristic function);
- another is due to the absence of boundary check in a cache object, which leads to accessing a non-existing object;
in addition to a memory leak (alpha array in performTraining()).
Wednesday, July 29, 2009
An old gem
[Original Post at my Blogs | My Blogs]
Just digging out my old bookmarks, and look at what I found...
An interview with Brian Kernighan (http://www.cs.cmu.edu/~mihaib/kernighan-interview)
Sunday, June 28, 2009
Thumbs up for Incheon Intl. Airport, Big Boo for Google's Language Auto-Detection
[My return flight will be departing in about 1.5 hours. Not surprisingly, there're some time to spend on, and here're the outcome...]
:)
There's a free wifi in the airport. It's one of the few airports with such a service. Most airports I've visited provides only paid wifi.
X(
Google's language auto-detect sucks.
Oh well, to clarify (now I'm a bit calmer), the idea is good. But, the execution is not perfect.
See the following screenshot. The blogger.com by default displays Korean characters. There's absolutely no clue for a layman on how to change the displayed language to English.
After a-couple-of-second's screaming within my head, I somehow became curious enough to click the top-right drop-down box. Luckily, it was what I looked for.
Btw., notice how the Flash ads are still in English?
Monday, June 1, 2009
Idealism vs Realism
Sometimes, just sometimes, idealism must give ways to realism.
As much as I like the idealism of KHTML, I've to be realistic that many Javascript-heavy websites such as “fb.c” work better with Webkit. Well, it shouldn't be surprising since Webkit (which is a derivative of KHTML) is THE engine that powers up Apple's Safari and Google's Chrome. Therefore, it's expected to have a better compatibility with many websites out there.
And the combination of Konqueror+Webkit in KDE-4.3 (beta-1) seems promising enough --- apart from the occasional benign crashes due to “nsplugginwrapper”. In KDE-4.2 (or before), I didn't use this combo because (i) it's unstable, and (ii) Webkit ignored all my settings particularly the font size.
Still, it shows that idealism is not for nothing. In fact, it arguably occupies a significant place in society & history. Without KHTML, would Safari and Chrome be born? In a way, this reminds me to scientific research, where theories and their applications can be separated by decades.
Wednesday, November 19, 2008
New Lodging
Been in Austin, Texas, USA, since the evening of Thu 13-Nov-2008. The purpose? To attend Sun HPC Consortium and SC'08.
After staying at the Hilton Airport Hotel, earlier today I had to move to AT&T Education and Conference Center which is owned by the University of Texas at Austin.
One thing I immediately noticed at this AT&T center is its phone+network+TV setup.
The phone is IP-phone (Cisco 7941), the same as what our school (back in Singapore) are using.
The network + TV is exactly the same as the Mio Plan + Mio TV setup, which I happen to use at home. Both the router and the IP-based TV box are located in my room.
The router (2WIRE) looks exactly the same as mine, though it may be slightly bigger, and perhaps, of a different model.
The IP-based TV box looks exactly the same, though this one has an additional USB port at the front. Oh, and the brand is Motorola, while mine doesn't seem to carry a (recognizable) brand. And oh (again), the TV remote control is exactly the same too.
The internet seems to be free since I was not asked whether to pay for a 24-hr internet access (like what some other hotels do). Well, I'm just too lazy to find it out now. So, just plug-in the LAN cable, and everything is set to go.
The internet speed is pretty good too. I tested downloading a kernel-source rpm from an OpenSUSE repository in Germany, and got a reasonable speed (350+ KB/s). The speed was noticable faster when downloading from servers located in USA. Fetching a 170+ MB file (Sun Studio Express 11/08) took less than three (??) minutes to complete (about 4 MB/s).
Well, perhaps this relatively high internet speed is the good thing of staying in a university-owned or AT&T-sponsored accomodation (or whichever it is)...
[Note: “Sun Studio software [is FREE and] delivers a high-performance, optimizing C, C++, and Fortran developer toolchain for Solaris, OpenSolaris, and Linux operating systems, including support for multicore x86- and SPARC-based systems. The toolchain includes parallelizing compilers, code-level and memory debuggers, performance and thread analysis tools, OpenMP support as well as optimized math libraries. With a next-generation NetBeans-based IDE, development of multicore applications has never been easier.”]
[Note: “Sun Studio Express releases contain the latest features and enhancements under development. Express builds are fully-functional; the focus is on new features being introduced into the Sun Studio product”. I am personally enthutiastic with the latest Express version due to the inclusion of a new MPI performance analyizer tool.]
Thursday, October 9, 2008
GotoBLAS on Intel Core Duo + SS12
GotoBLAS is renowned as the fastest BLAS library. It has been used by many supercomputing sites to run HPL, the infamous benchmark that determines their position in the Top500.
I've had a chance to test the combo of Goto+HPL using Sun's compilers (Sun Studio 12 aka. SS12) on OpenSUSE 11.0 x86 (i.e. 32-bit version). The machine is a laptop: IBM Thinkpad R60 with Intel Core Duo T2400 1.83GHz. [In the past, I've had relied on ACML when building HPL for AMD platforms.]
Here're the steps to build GotoBLAS on the abovementioned environment, assuming that the source archive has been extracted and you're in the source-code directory:
- Open detect in a text editor, then change FCOMPILER=NULL to FCOMPILER=SUN
- If your SS12 is installed in a non-standard directory (e.g. /tmp/sunstudio12), then open Makefile.rule in a text editor. Then, apply the following two changes:
- ifeq ($(F_COMPILER), SUN)
COMPILER_F77 = f90
into
ifeq ($(F_COMPILER), SUN)
COMPILER_F77 = /tmp/sunstudio12/bin/f90
- ifneq ($(OSNAME), SunOS)
SUNPATH = /opt/sunstudio12
into
ifneq ($(OSNAME), SunOS)
SUNPATH = /tmp/sunstudio12
- ifeq ($(F_COMPILER), SUN)
Note that on this particular environment, -fast must not be used as it results in a floating-point exception on one of GotoBLAS's self-tests. YMMV (your mileage may vary) though.
Note2 that -xtarget=native is safe (again, it has to be qualified as “only on this particular CPU architecture”).
In addition to the built-in self-tests, another test was to build HPL with libgoto.a (and CT8), and then run the xhpl. And, not surprisingly, everything went smoothly; no further hiccups or whatsoever.
Friday, April 18, 2008
Dilbert and Friends Underwent Plastic Surgery
A well-known guru for self improvement of IT-and-management got a total face lift.
Plus:
- strips are in color
- animations (new)
Minuses:
- pages are more crowded compared to the old, plain version
- more Flash usage!
- Animation pages refuse to work in Linux (web-browser = Firefox 3.0 beta 5)
Saturday, April 5, 2008
Blokkal: a Blogging Client
Blokkal is a blogging client that supports multiple protocols and blogging sites. Think of it as an alternative to web browsers in creating-and-editing blog entries. Blokkal's features include posting new entries into multiple blogs at the same time.
- Pro: cross-platform; it'll be available for Windows in addition to UNIX. Why? Because the latest version is for KDE 4 and KDE 4 is slated to run on Windows.
- Cons: no WSYIWYG HTML editing (whops, so many cryptic capital letters). This simply means that we won't get the typical experience of editing using a web browser:

Instead, we'll be directly working with the HTML source code:
[FYI, this entry is completed using a web browser (i.e. the WYSIWYG editing route). Yes, I've been pampered with its convenience. But rest assure that Blokkal can really upload entries to your blog; this I've tested.]
Supported protocols:
- Blogger 1.0 (http://www.blogger.com)
- Blogger/GData (the recommended protocol for http://www.blogger.com)
- LiveJournal (http://www.livejournal.com)
- MetaWeblog API (http://www.wordpress.com)
- MovableType
Before we can use Blokkal to create/edit blog entries, we need to let Blokkal know about our blog account. Let's take a look at how to let Blokkal know about a Blogger blog — the technical way of saying this is “to add a Blogger blog into Blokkal”:
- Start Blokkal, then “Settings” -> “Configure Blokkal”, and then “Add...”.


- Select “Blogger/GData...” from the protocol list, then click “Next”.

- Enter your Google's username on field “User Name”. Normally, if you have abcd@gmail.com, then your Google's username is abcd. Then, click “Next”. [Note: there's no need to touch field “Account Name”.]

- Click “Finish”. If “Connect now” is checked, a new dialog will request for the account's password which is required to connect to the newly added blog.


Friday, February 1, 2008
Linking [was: Away (Again)!]
Finally the COW code can be built using Pathscale, though it still encounters runtime crashes. Well, at least I can tick one field in my battle plan as both completed :-) and defeated :-(
The problem was solved by compiling the library in which the COW code depends to with a certain name-mangling convention. Basically, the functions name (in Fortran objects) must not be ended with double underscore.
And now, let's conclude the porting activities for this week; let the battle continue after the Lunar New Year.
Away (Again)!
In less than 6 hours I'll start my journey back to my hometown to celebrate the Lunar New Year. So what I'm doing in this hour? As usual, last minute express packing and making sure not to oversleep.
And who says coffee is needed to stay awake? The COW codes I've been porting is giving me all sort of trouble when linking Fortran objects (using Pathscale). And I have zero knowledge on Fortran! Okay, maybe 0.00000000001 since I managed to solve a compilation problem by commenting out two lines of "implicit none".
Come think about it: my cohorts who still stay in the IT field are "moving forward" with all sort of MVC or RDBMS mappers or whatever frameworks. Not to mention those who've attained "enlightenment". I, on the other hand, am "going backward" to Fortran.