Saturday, February 24, 2007

Touchpad in Ubuntu

Ubuntu installations come with a mouse setup software, but it is a generic software that only allows you to setup stuff like double-click timeout, pointers, speed, etc. If you have a touchpad and want to setup other parameters like tapping speed, you'll have to install GSynaptics:

sudo apt-get install gsynaptics

After installing the software you can find it in the System/Preferences/Touchpad menu. Try to click it and you'll get an error message!

GSynaptics couldn't initialize.
You have to set 'SHMConfig' 'true' in xorg.conf or XF86Config to use GSynaptics

To fix this you need to edit your /etc/X11/xorg.conf file (e.g. sudo gedit /etc/X11/xorg.conf) and find a section like:

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"

Before the EndSection add an option with the code Option "SHMConfig" "on".

Now you need to restart X. Make sure you save all your work, because restarting X will log you out. Now press ctrl-alt-backspace. Login and you should now be able to run System/Preferences/Touchpad.

If you still have problems using your touchpad, refer to this complete guide.

Monday, February 19, 2007

Google Earth on Ubuntu

Google Earth is a great software to explore your home planet and your neighborhood. But if you have an nVidia video card in Ubuntu you may experience some... rather strange results!

To solve this problem all you have to do is update to the latest nVidia drivers. But if you're lazy like me you're probably asking "Isn't there an easier way?".

Well, the answer is both yes and no. You do have to update the nVidia drivers, but Alberto Milone has a great script called Envy that does all the hard work for you.

Just follow the instructions on the website and in 5 minutes you should have Google Earth running without a scratch!

Tuesday, February 13, 2007

ICDSoft Appraisal

If you're looking for a hosting server, my advice goes to ICDSoft. I host my sister's in law website there and it has all the features I need (PHP, MySql, Ruby, email accounts galore, ...) and I never had a problem with it.

Of course not having problems isn't good enough reason to recommend a hosting service. That's the minimum they can do for you! The reason why I recommend ICDSoft is for their support. Let me tell you about my two experiences with them:

Ticket 1: I tried to place a Rails application on the website. For some reason I wasn't able to make it work, so I decided to contact support. In 5 minutes I had a reply with all the required instructions to make my application work.

Being new to Rails I didn't really understand the response... So I told them something like "I couldn't make it work. Please poke my code and see what is wrong. And fixe it while your at it". And can you believe it? They did look into my code, corrected my scripts, changed the permissions to make it all work and sent me a reply with all they had done... In less than 45 minutes! Now that is great support...

Ticket 2: Still working on my sister's in law Rails version of the website I decided to use RMagick to resize the images and create the thumbnails. I uploaded the website to my account to test it and it didn't work. ICDSoft doesn't have RMagick installed.

So I contacted support. I don't know how long they took to reply, but I think it was about 5 minutes like the first time. The reply said something like "We're talking to the sysadmins and we will contact you soon". And they did!

Less than 30 minutes later I had a reply stating that the sysadmins had installed RMagick. I tested my website again and RMagick was really working!

As a client, my feeling was that they were there working just for me! They edited my code, they installed a package on the server because I asked them to. Never a support service made me feel this pampered!

Wednesday, February 7, 2007

Compiling Drivel in Ubuntu

So you want to use Drivel to add your posts to Blogger, right? By this time you probably noticed that Drivel doesn't work with the new version of Blogger. Shame...

If you look around you'll probably find rumors that the CVS version of Drivel supports the new Blogger login... This is not true, but if you care to compile Drivel anyway here are the steps to do it:

  1. Get CVS: sudo apt-get install cvs

  2. Get the gnome development environment: sudo apt-get install gnome-devel

  3. Install libsoup. This should be easy, something like sudo apt-get install libsoup2.2-dev. Unfortunately it's not so easy. The Ubuntu version of libsoup is 2.2.96 and Drivel needs version 2.2.97! You must go to Debian and search for the needed packages. I've downloaded and installed this one, plus dependencies.

  4. For some reason during the installation of the libsoup dependencies (the libxml) I had to do a apt-get install -f. This made some libs disappear, so I had to run sudo apt-get install gnome-devel again.

  5. Now get the Drivel source from CVS. Instructions on how to do this can be found at their site.

  6. Now just type ./ followed by make.

You can now start hacking the code and add support for the new Blogger Login API! :)

Tuesday, February 6, 2007

Registry Tips

Here's some tricks you can use to make the Windows Registry work for you:

Add a command to the context menu

Add a key to the HKEY_CLASSES_ROOT\[EXTENSION]\shell with the name of the application you'll be using (e.g. SourceEdit). In the default value, insert the name you want to appear in the context menu (e.g. "SourceEdit").

Inside the currently created key, add another key called "command". In the default value of the command key, add the command that will be invoked (e.g. "c:\Program Files\Source Edit\SrcEdit.exe" %1).

Note: [EXTENSION]can be "*" for all files.

Setting command completion in cmd

In the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor set the value of CompletionChar to 9.

Setting an application path to launch from the "run" window

In the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths create a new key with the name of the application you want to launch (e.g. ue.exe). Set the default entry to the application you REALLY want to launch (e.g. c:\Program Files\UltraEdit\uedit32.exe).

.reg Files

Adding an entry:



Removing a tree:



Remove an entry:



Thursday, February 1, 2007

Vertically align images

Ever tried to vertically align an image inside a div? I tried to find an easy solution for this problem but couldn't find anything that worked on the web, so here's the solution I found.

But first, let me go back to the problem. Imagine you're creating a photo gallery website. Being a Web 2.0 kind of guy you place the thumbnails inside divs, something like:

<div class="thumb">
<img src="mythumb.jpg" />

Your css might look something like:

.thumb {
width: 120px;
height: 120px;

.thumb img {
vertical-align: middle;

If your thumbs aren't all the same size (and 120x120) this approach will not work! All your thumbs will be top aligned instead of middle aligned.

The problem here is that the image is being aligned relatively to the height of the contents of the div rather than to the div height. To solve this problem we have to make sure the content of the div has the same height as the div itself.

The hack you can use to "fool" the div is to create an empty image with height 100%:

<div class="thumb">
<img width="0" height="100%" />
<img src="mythumb.jpg" />

The first image has no width nor source, to make sure it stays invisible. Because the height is 100% it will have the same height as the div (120px in this case). This means the content of the div has 120px height, so the "mythumb.jpg" image will be properly aligned.

I tried this trick with Firefox 2.0 and IE 7.0 and it worked fine. If you find any browser where this doesn't work, please let me know.