Posts

Showing posts from May, 2009

Introduction to Vimscript

A useful page to give a decent introduction to Vimscript, a scripting language used to extend vim.

Difference between function, macro and special form in Lisp

A very good description of the differences between function, macro and special forms in Lisp. Read all the way through the end of the email thread.

A list of WYSIWYG editors for content mangement

There are times when you would like to have a text area in your web site that resembles like a word processor's page, with a lot of controls to format your text. If you have worked with any content management system (CMS) or a wiki, you have most likely come across one. I was looking for a WYSIWYG editor and came across a few of them. Thought I sould share the list with everyone so that you don't have to waste your precious time. The list below is not in any particular order.

FCKEditor. Looked like the editor that had the most features. This site provides a demo and a very good documentation as well.TinyMCE. Wherever people talk about WYSIWYG editor, they invariably mention both FCKEditor and TinyMCE. Provides a demo and by looking at the source of demo you can find how easy it is to integrate this editor.Xinha.They have an excellent demo page that allows you to customize the editor on the fly and see.Kupu. Kupu is from Open Source Content Management team. I could not see a de…

Django tutorial

I manged to complete the three parts Django tutorial today. I haven't worked with many web frameworks before. I have a very good experience in CGI and some flaky experience in JSP and PHP. I liked Django for the reason that they coupled the model and the database and provide the ability to almost worry nothing about writing database queries. I don't know how much more time it would have taken if I had written the poll application myself in either JSP or CGI. Especially setting up the database and the tables.

Now that I have first hand experience in developing application in Django, I am yet to see the performance under reasonable and heavy loads. I am also yet to discover how Django is deployed in production. As per my understanding, the design of the Python interpreter itself is not suitable for multi-threaded applications. The best way to scale Python is not to create a multi-threaded application, but to have more instances of Python running with some load balancing server i…

Mounting folder shares in xVM

In xVM, you can access folder shares from the host system in your guest Linux system. The prerequisite is to install all the guest additions. The following is the process that I followed to install guest additions and mount the shares in my Ubuntu desktop (Linux ubuntu-desktop 2.6.24-24-generic).

Installing guest additions is very easy. Once you start your guest OS, you click on the "Devices -> Install Guest Additions" in the xVM. Then it will mount a CD ROM for you. Once the CD ROM is mounted, just let it auto run or you can run the appropriate shell script from the mounted CDROM. Usually it is mounted under /media/cdrom. So doing an ls under that directory should tell you which shell script you need to run.

To create a share, go to "Devices -> Shared Folders". Click on the add share icon (the one that has "+" in it). Select the folder you would like to share with the guest and then give it a name. It is preferable to give a short name for the share.…

A useful regular expression tutorial

This is one of the most useful regular expression tutorials I have seen in the recent times. The tutorial is not only clear and concise, it just hits what is actually needed to be fully productive.

BTW, the tutorial was written by a high school student!

xVM's vboxmanage.exe command

You can view and edit the configuration of your guest OSs using the vboxmanage command. To view the list of guest OSs you have, give the following command:
C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe list vms
VirtualBox Command Line Management Interface Version 2.2.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

"MySolaris" {dc6dc85f-5583-4a1b-bf3e-969941a2cd91}
"Ubuntu" {eb973bbf-d86e-4579-85eb-6ea2cd12bf95}
"Debian" {3e784597-89d8-4f17-90cb-63e866c651a3}
"openSUSE" {6862884e-60e1-4c65-8aab-b57ec38a3922}
"Debian-Lenny" {4b561432-abac-4a27-a501-b42af956b96b}

To view the specific guest, you can use the UUID of the guest. For e.g.
C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe showvminfo eb973bbf-d86e-4579-85eb-6ea2cd12bf95
VirtualBox Command Line Management Interface Version 2.2.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Name: Ubuntu
Guest OS: Ubuntu
UUID: eb973bbf-d86e-4579-85eb…

Installing matplotlib - the hard way

I recently installed matplotlib from the source. It was quite an experience that I thought I would share my experience so that others don't have to waste time searching how to do that. So here it is!

What is matplotlib?
Matplotlib is a libarary to plot figures from your Python program. It has much more features than just plotting. You can read more about that from the library's home page.

If you are planning to install matplotlib on Linux everything from the source by building everything yourself, this guide is for you. Please read on.

You will have to install the dependencies first before you can install matplotlib. Matplotlib depends on numpy, zlib, libpng and FreeType libraries. You can get the full dependency list (including the optional dependent libraries) from here. Let us see how to install each one of these components.

Phase 1: Installing numpy
Numpy requires the same Fortran compiler that was used to build blas. There are two flavors of Fortran compilers possible: f77 or …

Paper on garbage-first (G1) garbage collector

This is the paper on garbage-first (G1) garbage collector. It is an interesting read.

A better way of printing heap usage in Java

If you rely on getting the heap usage by methods provided in Runtime, then consider making use of the MemoryPoolMXBeans. The code to print the memory usage is extremely simple:
List mpool = ManagementFactory.getMemoryPoolMXBeans();
for(MemoryPoolMXBean b:mpool) {
System.out.println(b.getName() + ": " + b.getUsage());
}You will see something like this when you run this:
Code Cache: init = 163840(160K) used = 468672(457K) committed = 491520(480K) max = 33554432(32768K)
Eden Space: init = 917504(896K) used = 202792(198K) committed = 917504(896K) max = 4194304(4096K)
Survivor Space: init = 65536(64K) used = 0(0K) committed = 65536(64K) max = 458752(448K)
Tenured Gen: init = 4194304(4096K) used = 0(0K) committed = 4194304(4096K) max = 61997056(60544K)
Perm Gen: init = 12582912(12288K) used = 108360(105K) committed = 12582912(12288K) max = 67108864(65536K)
Perm Gen [shared-ro]: init = 8388608(8192K) used = 6162160(6017K) committed = 8388608(8192K) max = 8388608(8192K)
P…