29 March 2005

sql + python, large project with javascript, minibufexpl.vim

I'm not familiar with database design, but I find integration SQL with Python quite interesting. Check article Fast, Easy Database Access with Python and SQLObject.

Is it easy to build large project using javascript? How about implement 60,000 lines of javascript?

I found minibufexpl.vim useful for my daily usage of vim. Try it!

27 March 2005

How fast you can type?

How fast you can type? Type this line in the console:
> date ; wc -m ; date
Then type the words you want. Lastly, type 'Enter' and 'Ctrl+d' to get the result. An example of my session:
Sun Mar 27 07:33:14 MYT 2005
helmi bin ibrahim
Sun Mar 27 07:33:16 MYT 2005
Number 18 show how many characters typed include new line character.

23 March 2005

back to screen

I don't like much use screen before since can't run my favorite applications properly (vim, mplayer, centericq).
Add this line in the .tcshrc:
setenv TERM 'xterm'

Now, the key-binding for my favorite applications when run in screen work properly. Thanks to Kamal.

21 March 2005

Risk when update FreeBSD ports!

This morning before go to work, I did weekly task to update my FreeBSD ports manually (I don't use cron, since I don't want my cpu load when using other apps). Usually I use 'portupgrade -PP -varR', but this time without option PP.

In /usr/ports/UPDATING, 20050312 user can upgrade gnome, gtk/glib with the script gnome_upgrade.sh. I use this script and then I noticed that the firefox, open-office, py24-gtk were uninstalled ! I need to install these apps again :-(. And the worse thing happen then. I got this error message when run the py-gtk demo:
> python pygtk-demo.py

(process:30237): GLib-GObject-CRITICAL **: gtype.c:2254: initialization assertion failed, use IA__g_type_init() prior to this function

(process:30237): GLib-GObject-CRITICAL **: gtype.c:2254: initialization assertion failed, use IA__g_type_init() prior to this function

(process:30237): GLib-GObject-CRITICAL **: gtype.c:2294: initialization assertion failed, use IA__g_type_init() prior to this function

(process:30237): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed
Failed to load Pango module for id: 'BasicScriptEngineFc'
(process:30237): GLib-GObject-CRITICAL **: gtype.c:2254: initialization assertion failed, use IA__g_type_init() prior to this function

(process:30237): GLib-GObject-CRITICAL **: gtype.c:2254: initialization assertion failed, use IA__g_type_init() prior to this function
I had try writing a gtk application using glade and pygtk by refer this article. I feel the pygtk demo better than last time I playing with this toolkit (it quite similar to wxpython demo approach). Yesterday I happily browse the pygtk demo, but this gtk problem give me headache.
Emm... I give up :-(.

Today I start my first project (start from scratch) at bytecraft for Kementerian Pembangunan Usahawan dan Koperasi.

15 March 2005


Debugging in firefox: open Tools>Javascript Console

Favorite references:
1) w3schools
2) Javascriptkit reference.
3) javascript-reference.

12 March 2005

Chatting in IRC.

People in channel #twisted.web, #vim, #python-gilliam at server irc.freenode.org are nice. They still answer my stupid question (since I am newbie).

Antidesktop. No mouse.
How to report bugs effectively. (get from Han)
How to ask questions the smart way.

I just found w3m. (/usr/ports/www/w3m-image). This is an alternative for links. Now 2005-03-13, there are two links version in FreeBSD-5.3, links-0.98 and links-2.1.p15.

Just add another program in my .xinitrc. (oneko-sakura)
oneko -bsd -bg red &

10 March 2005

How to run Plone?

Googling doesn't much help. How to run Plone in my FreeBSD box? This guide do not explain much about installation Plone in FreeBSD. I had once install Plone in my Windows box (it's easy, just click button 'next' then 'next', 'next', ...). But to run this service in my FreeBSD box give me headache. Usually when I try new software, I start with Read The Fine Manual. But there is 'No manual entry' for plone and zope, though.

Actually there is INSTALL.txt in /usr/local/www/Zope/doc. Create zope.conf (I put it at /usr/home/helmi/project/zope/etc) and add this 2 lines:
products /home/helmi/project/zope/Products
products /usr/local/www/Zope/Products

09 March 2005

Socket Programming in Python

I had tried a simple chat program this morning. The bad thing is you need to run 2 programs at same time (client and server).
An article from Python HOWTO explain basic about socket programming.

This couple of months, I involved in web application programming using PHP. This guide is very useful to remind me about web development mistakes. Plone, an open source Content Management System is quite interesting to be explored. After read this article and the definitive guide to plone, I'm become interested in this plone thing.

08 March 2005

Cannot startx

I cannot startx !
The message ask me to remove the /tmp/.X0-lock.
Then when try 'rm -vf /tmp/.X0-lock', a message say 'Bad file descriptor' appear and the file cannot be deleted.
When, I run 'fsck', a message like 'unlink ... /tmp/.X0-lock ... REMOVE? no' display.
I guess something wrong with the filesystem/harddisk since last night I saw a message in terminal 'ad0 write error..' message. My FreeBSD don't like my new Western Digital harddisk.
The solution: reboot in single user mode, then run 'fsck -y'. Now the /tmp/.X0-lock is removed. Exit single user mode, then I can startx now.

Harddisk problem?
You can use badblocks to search for device for bad blocks. (I not found yet badblocks in my FreeBSD, 'Command not found').
Use fsck to file system consistency check and interactive repair.
Still got problem, then better read this mail for solution :).

To monitor harddisk use smartctl. This article give good explanation to monitor hard disk with SMART. (Thanks to Han). In FreeBSD it is in /usr/ports/sysutils/smartmantools.
Got this error
Smartctl open device: /dev/ad0 failed: Inappropriate ioctl for device
when '> smartctl -a /dev/ad0' ? That's mean, you need to be superuser to run this application.
View here for my 'smartctl -a /dev/ad0'.

Cannot login to flyspray.
I cannot login to flyspray in IE (Internet Explorer 6). The address is something like http://helmi_ibrahim.com.my/flyspray. The solution is get ip address for this address (hint: ifconfig) for e.g. then now you can login. Why? The IE assume address with underscore '_' as security risk, so not allow flyspray to set cookies.
A quote for today "the antivirus program give more hassle than the virus".

Malaysian Bloggers, MYOSS.
Python development in Eclipse.

07 March 2005

python extension using pyrex for itl

I had create a python extension for itl/prayertime.

If interested:
1) extract solat.tar.bz2 to itl/libs/prayertime/src
2) run 'make pysolat'. If got error:
Cannot assign type 'double (*)' to 'int (*)
just 'make pysolat' again.
3) to test, run 'python test.py'

- pyrex (tested using pyrex-0.9)
- itl libs (tested using lib-0.6.3)
successfully run on my FreeBSD-5.3, python-2.4

The stupid geocities not allow me to upload solat.tar.bz2. So the trick is rename solat.tar.bz2 to solat_tar_bz2.zip then upload.

05 March 2005

Mount CD in FreeBSD.

By default user don't have permission to mount CD or other removable device.
There is no instruction in Handbook??? Actually the instruction was in FAQ, a little bit confusing though.

To mount cd:
> mount_cd9660 /dev/acd0 ~/mnt/cd
or for an odd type of cd,
> mount_cd9660 -v -o rw -s 0 /dev/acd0 ~/mnt/cd

I just found an easier way to play VCD using mplayer without mount the cd.
> mplayer vcd://1

This tool for acceptance/functional testing of Web sites (Selenium) is quite interesting.
While playing with nevow this morning, my boss ask me to take a look at ERP5. What is erp? Maybe this article will help you.

03 March 2005

PIL rocks!

Today I need to create a program for an image processing function. First I try the ImageMagick using the command-line. The problem is, it quite hard (at least for me) to get image width, height and use the parameters in shell script.
Another option is use PIL (Python Imaging Library). Then I manage to implement the script before due time.

Since I spent most of time programming using PHP, I always put semicolon ';' at the end of line in python script. Obviously it unnecessary in Python (not syntax error). I only notice that after my colleague correct me. This is one advantage of pair programming, though.

01 March 2005

Got problem with my hard disk again

Arghhhh... My seagate harddisk give me headache again. It contain my precious FreeBSD 5.3 with all the setting for the desktop. Then it crash again this weekend. It stuck at boot: prompt :(

And the happy thing is I bought new hard disk. 80Gb Western Digital 8Mb. But I still need to spent some times to configure my desktop and download my favorite packages again. Install openoffice always give me headache, something like:
> openoffice.org-1.1.4-setup
/usr/libexec/ld-elf.so.1: Shared object "libm.so.2" not found, required by "javaldx"
/usr/libexec/ld-elf.so.1: Shared object "libm.so.2" not found, required by "setup.bin"

My hard-disk uptime until this post
> uptime
8:16AM up 1 day, 2:12, 7 users, load averages: 0.01, 0.07, 0.14