Tuesday, August 28, 2007

Apple Mighty Mouse

I managed to get my grubby little hands on a Apple Mighty Mouse. Its the bluetooth version. What enthralled me was the little scroll ball. I guess in my old age, Im finding using a scroll wheel inaccurate for small increments and tiresome for long pages. When I tried the Mighty Mouse at the new Mac shop in KLCC, I was won over.
So on my ubuntu machine, I plugged in the bluetooth dongle. On the command line I typed in:

# hidd --search

The Mighty Mouse blinked, and on screen, the taskbar displayed this popup:
Clicking on it will display this dialog:
And the default passkey for the Apple bluetooth Mighty Mouse is "0000".

Infortunately the command returned this error:
# hidd --search
Searching ...
Connecting to device 00:14:51:C4:55:71
HID create error 13 (Permission denied)

Which was strange. I could only use the root login to successfully pair with the mouse.

However once paired, the mouse worked like a charm. The scroll ball was smooth and extremely efficient. However I can't seem to get it to scroll horizontally. Perhaps its not supported yet?

The three button feature of the Mighty Mouse was ok, although disconcerting considering the entire upper body of the mouse is one big button. Im finding the weight of the device heavy. I hope it doesnt lead to RSI in the future.

Im looking for a good mouse to use at work. Considering Im on the PC 80% of the time, Id wont mind investing in a really good mouse. I don't really need the bluetooth feature, and I noticed that the Mac shop was selling the USB version for RM199. The American e-bay sell them at USD29 but shipping is about USD20 = USD49 = RM171. Hardly worth the savings.

Still undecided. I wonder if there are any other mice out there with the same scroll ball?


[Update: Info on getting horizontal scroll here ]

Thursday, August 23, 2007

Adjusting your swap files

I have a small Xen server which wouldn't start up with a swap partition. Whenever I add it in, it gives a strange error. Something which Ill have to figure out one of these days.

However its not a big deal, because its easy to set up a file based swap file in linux anyway.

First thing is to create the file to allocate disk space for it, for this case I just need a 500MB swapfile:

# dd if=/dev/zero of=swap.file bs=1M count=500
# chmod 600 swap.file
# mkswap swap.file
Setting up swapspace version 1, size = 524283 kB

Next is to make sure that it gets used at each bootup.
# cat >> /etc/fstab
/mnt/data/swap/swap.file none swap sw 0 0

but if you need it now, you just use 'swapon':

# free | grep swap
Swap: 0 0 0
# swapon /mnt/data/swap/swap.file
# free | grep swap
Swap: 511992 0 511992

and if you do a top,
top - 17:13:31 up 1 day, 6:57, 1 user, load average: 0.02, 0.03, 0.00
Tasks: 53 total, 2 running, 51 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 257024k total, 251808k used, 5216k free, 1036k buffers
Swap: 511992k total, 0k used, 511992k free, 183108k cached

Nice swap!

You can dynamically change the size of your swap files using swapon / swapoff combos.


Thursday, August 16, 2007

Amir Hafizi: gone

Amir Hafizi's blog was certainly entertaining. Unfortunately because he simply "felt like it", he has deleted all the content and is leaving it blank. What a pity. With no hint to what he's working on now, it will definitely be harder to look for his material.

The wayback machine only has 8 pages archived in 2006.

Long Live Amir Hafizi.


Tuesday, August 14, 2007


This is such a nice Maths package. It almost makes me wish I was back in school. ALMOST. Instead of plotting my own graphs, drag and dropping mathematical objects on a virtual graph paper would be so cool. What is different from a CAD software where drawing primitives, tangents, perpendicular lines and measurements are available, GeoGebra actually provides the equations to create the objects.

For example, drawing a like between two points will give the equation y = 0.27x + 4.27. Additionally on right clicking and going to properties, you can set the equation type to ax + by = c. Otherwise, parametric form.

Drawing circles is very easy. What is interesting about this graph editor is that its like a modern parametric CAD app. Because each primitive is based on specific points, when you modify the points, the object will change in real time. This is especially interesting when you have different tangents, angles and related objects linked to one point.

The application is java based, so its platform independent. I used the webstart version which would automatically download the latest version, or otherwise load up from the Java cache.

Whats nice about this app is that it doesn't look cludgy like most Java apps do. The lines are anti-aliased which gives it a very professional look, and the interface is quite responsive. The primitives respond to mouse overs well. However there are issues with the "drop down" buttons. I tend to need just one more click and pause before more selections appear.

The project overall is well developed, and appears to be well funded by the Austrial Academy of Sciences (2004-2006), Austrian Federal Ministry for Education (2006-2007) and US National Science Foundation (2006-2008). Additionally it has support from University of Salzburg and University of Luxembourg.

Eventually when Id have to tutor my kids maths, I hope this project includes other features like parabolic curves and other amazing mathematical beauties.

Update: There are parabolas! At the bottom of the screen, type in Parabola[ , ] (e.g. Parabola[ G, f ] ) and GeoGebra draws it in. Nice! Not sure why its not available in the button menus.


Saturday, August 11, 2007

Making X fast(er)

I always wondered about my sluggish OpenGL performance. I just attributed it to the poor support of my ATI Radeon Mobility 9200 in Linux. Im still using the "radeon" Open source drivers and not the fglrx binaries from ATI.

One "random" thread suggested to add a ModeLine entry in /etc/X11/xorg.conf file. So I tried. I generated my ModeLine entry using this online calculator: "The XFree86 Modeline Generator: create the mode thats just right for you!"

In the Basic Configuration, I just entered in the resolution of my Laptop LCD, which is "1680x1050" and put in the refresh rate of 60Hz.
Click on "Calculate Modeline", and this will be generated:
So in /etc/X11/xorg.conf, update the "Monitor" section as such:

Section "Monitor"
Identifier "Laptop Monitor"
Option "DPMS"
# 070809 yky - added modeline:
# http://xtiming.sourceforge.net/cgi-bin/xtiming.pl
Modeline "1680x1050@60" 154.20 1680 1712 2296 2328 1050 1071 1081 1103

You dont need to reboot your computer. You just need to restart X by pressing Ctrl-Alt-Backspace. When you've logged in, you may find X performing better. For example, the tilda application used to be quite jerky as it revealed itself. Now its smooth.

Additionally glxgears used to be a paltry 200-400FPS. Now its an OKay 2000-3000FPS. BZFlag also is now actually playable!

So if you think your X is underperforming, put a ModeLine in and see if theres any difference. Now to figure out why my laptop can't do dual-head/output video.


Wednesday, August 08, 2007

Open Project

Here's a nice cross platform application to do project planning. Maintained by Projity, it claims to be able to open Microsoft Project files. Finding an immediate need to open an old MS Project file, I needed to try it out.

I downloaded the tarball from the sourceforge page, and did this:

# tar -xzvf openproj-beta2.tar.gz
# cd openproj-beta2/
# ./openproj.sh

but I got this error:
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.70)
at java.awt.Font.tk(libgcj.so.70)
at java.awt.Font.getPeerFromToolkit(libgcj.so.70)
at java.awt.Font.
at javax.swing.plaf.FontUIResource.
No Java JRE installed. So used this command to install java in ubuntu:

# sudo apt-get install sun-java6-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
java-common odbcinst1debian1 sun-java6-bin unixodbc
Suggested packages:
equivs sun-java6-plugin ia32-sun-java6-plugin sun-java6-fonts ttf-sazanami-gothic ttf-sazanami-mincho libmyodbc
odbc-postgresql libct1
Recommended packages:
The following NEW packages will be installed:
java-common odbcinst1debian1 sun-java6-bin sun-java6-jre unixodbc
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.5MB/33.0MB of archives.
After unpacking 94.4MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirror.nttu.edu.tw feisty/multiverse sun-java6-bin 6-00-2ubuntu2 [26.2MB]
Get:2 http://mirror.nttu.edu.tw feisty/multiverse sun-java6-jre 6-00-2ubuntu2 [6324kB]
85% [2 sun-java6-jre 1544093/6324kB 24%] 106kB/s 44s
Fetched 32.5MB in 3m33s (153kB/s)

Had to agree with some java licenses, and after 5 minutes, all requirements were downloaded and installed. Then I ran the openproj script again, and I could open the old .MPP project which eluded me since my ubuntu migration.

Overall the interface is sluggish, but seems full featured. The fact that I now have access to MPP files certainly is a boon, without having to pay over RM1945 to access my old data.

I found this application via Bob Sutor's recent post, "Project Management via Open Source and Open Standards". What is interesting is that in a Computer World article "Saas rival to Microsoft Project goes open source":
Projity plans to invest “significant resources” into driving the creation of an open standards document format for project management that would be an alternative to the .mpp/.mpx formats used by Microsoft Project, and would eventually become a subset of the OpenDocument Format natively used by OpenOffice and StarOffice.
So what other productivity applications is Desktop Linux lacking? Ive been using Ubuntu for over 3 months now as my main OS, and Ive found that 90% of the things I need for daily usage are available for free.

Whats stopping you?


Friday, August 03, 2007

MySQL v3.23.52 on Red Hat 8.0

Had to set up an ancient MySQL database. Doncha just love legacy apps? So re-created the db server on Red Hat 8.0, installed the mysql-server rpms. Tested accessing it via localhost without any problems. Loaded in the data from the existing server (on its last legs) via this command:

@threelegs# mysqldump -h legless-server --add-drop-table --all-databases | mysql

Tested that the data was OK via localhost again. The ancient mysql-server v3.23.52 was running fine. Then I tried to access it via another client, and found this problem:

@client# mysql -h three-legs
ERROR 2013: Lost connection to MySQL server during query

Checked the log of three-legs (/usr/libexec/mysqld), and found that the server kept dying:

/usr/libexec/mysqld: ready for connections
Number of processes running now: 1
mysqld process hanging, pid 2762 - killed

Accessing from a more modern client (my ubuntu with mysql client v5.0), I got a more descriptive but just as useless error:

@clientv5.0# mysql -h three-legs
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I googled high and low to find a solution for this problem, and was frustrated because google pageranks newer "solutions". So I had to go through many MySQL v5.0 and v4.0 issues before I found this gem. Im hoping that linking to the real solution would help increase its pagerank!

So it seems that glibc has some problems. The work-around is to put this in the /etc/my.cfg file under [mysqld]:


Restart the server, and it surprisingly worked! Well this problem haunted MySQL users until v4.0.9. This is why I hate messing about with ancient legacy systems.


Tilda - Quake on Linux

I just installed this little program called Tilda. Its quite good. If you ever needed a console pronto, and couldn't wait for gnome-terminal to come up, and have good memories of First Person Shooters and invoking the console with tilda (~), try this out.

To install in ubuntu, just type:

# sudo apt-get install tilda

Then launch it using

# tilda -C &

A nice gui interface will help you configure it and it looks something like this:
You can change the keybindings to whatever you so desire, "None+F2" is the default. "None+grave" would be the original (grave == tilda), but may be difficult if you want to go to someone's home directory ( ~user ). So I chose something easy to hit: "Control+grave".

Clicking on OK will load up the tilda interface and it looks something like this:

It appears on the top left hand corner of my screen. Initially it was rather small. So I had to modify the size (in pixels) of the console. You can also do this via the GUI, or if you are in a hurry, on the command line with this command:

# resize -s 60 150

where 60 is the number of rows and 150 is the number of columns. Tilda will automatically resize the input screen (for this session only).

Now if only IDDKFA, IDDQD and nowadays "impulse 101" works in real life!


Thursday, August 02, 2007

Monkeyboys iZune!

Fantastic Advertisement!