Choosing a new editor: Emacs vs. Vim

For php I use Zend Studio for Linux. We have a license at work for it and it is in my opinion the best editor for php. It's relatively fast and you can use it to quickfix php over an ftp connection.

For Ruby I use netbeans. I would also like to use it for php but it doesn't allow to quicly open a file via ftp/scp or whatever. And it can sometimes be sloooooowwww. I've  seen netbeans used on a Windows platform and there it is much faster.

When I right-click on a project in netbeans for the first time, it takes 5 seconds (not lying!) to render the popup-menu. Come onm take forever!

And because I was now developing with Python I decided to try a new editor. Something more hardcore and lighter. Something nerdy :) So ofcourse I only have two decent options: Vim & Emacs.

I already had try them with Ruby. But I found good Ruby (& Rails) support rather lacking by both of them. I believe that the python comminity is more hardcore and therefore are using more arcane editors :) And maybe because they aren't afraid to hack away in another language than their own (lisp, vimscript).

I think I have been comparing the two editors for nearly two weeks now. I have spent hours and hours comparing, trying and browsing for blog posts about the two. At the end, I really didn't know which one to choose. I really suck at deciding something :) So I made a little list of what I find to be strong points of each editor:

VIM:

  • Better syntax highlighting/theming supprt (wombat ftw!!)
  • Faster/smaller
  • No weird handling of new buffers like with emacsclient
  • No daemon like: emacs --daemon
  • Better python integration
  • Easier to make extensions
  • Preview of docstrings when using omni completion

EMACS:

  • Better python-mode
  • No commandmode/normalmode
  • Directory browser/editor
  • Debugger (better integration with external tools)
  • easier to begin
  • Everyting is a buffer™

And now I have chosen to be the editor with which I am going to work is...... (drum roll please) .......:

Gedit!

No, it's (g)Vim :)

And while writing this article I was looking for a Wordpress/blog plugin for Vim and Emacs. At a glance it looked like the wordpress plugin for Emacs was a little bit better. So already I was doubting my decision... So it could be that I switch editor in the next few months :) But I'm first going to really use gvim to see if it fits with my workflow and is really useable for me.

As cherry on the pie, a nice screenshot of my gvim in action:

Vim with python-mode

[update]
I've installed Netneans 6.8m2 and it feels a lot faster than 6.7 but python completion is as bad as in 6.7.
[/update]

[update2]
Found out about Vim's netrw. So Emacs no longer got "Directory browser/editor" as a strong point.
[/update2]

Zend and Compiz/visual effects

Zend logoWhen enabling Visual effects Zend wouldn't maximize anymore. So after a bit of googling I found a nice tutorial to fix the problem with Zend.

Courier/postfix certificates

The certificates of the courier imapd-ssl and pop3d-ssl were expired. After some searching I found how to renew them:

CODE:
  1. sudo aptitude install courier-pop-ssl
  2.  
  3. nano /etc/courier/imapd.cnf #edit the CN
  4. nano /etc/courier/pop3d.cnf #edit the CN
  5.  
  6. mv /usr/lib/courier/pop3d.pem /usr/lib/courier/pop3d.pem.old
  7. mv /usr/lib/courier/imapd3d.pem /usr/lib/courier/imapd.pem.old
  8.  
  9. /usr/lib/courier/mkimapdcert
  10. /usrlib/courier/mkpop3dcert
  11.  
  12. cp /usr/lib/courier/pop3d.pem /etc/courier/
  13. cp /usr/lib/courier/imapd.pem /etc/courier/
  14.  
  15. /etc/init.d/courier-authdaemon restart
  16. /etc/init.d/courier-imap restart
  17. /etc/init.d/courier-imap-ssl restart
  18. /etc/init.d/courier-pop restart
  19. /etc/init.d/courier-pop-ssl restart

With thanks to this post.

If first thought that /usr/lib/courier/mkimapdcert generates the certificates in the wrong path. But on another server the cp command complained that the two files were identical. So it looks like they are hard-linked or something...

Installing Haiku on libvirt/kvm

Haiku-logo

I read on OSnews about the alpha release of Haiku. It's been several years since I installed BeOS the last time so I decided to try Haiku.

I first tried it on virtualbox but I didn't get the networking to work flawlessly so I decided to install it on libvirt. I expected quite a hassle but it was done in a whissle.

First download the raw image of Haiku and run something like:

CODE:
  1. sudo virt-install --name="Haiku" --ram=512 --hvm --accelerate --import --file=/media/second_disk/vm-images/haiku-r1alpha1.image --vnc --bridge=virbr0

Next I had to edit the Haiku libvirt xml to change the default nic model.  I always stop the libvirt service just to be sure. Then edit this file: /etc/libvirt/qemu/Haiku.xml

Make sure the nic looks something like:

CODE:
  1. <interface type='bridge'>
  2. <mac address='54:52:00:6a:14:17'/>
  3. <source bridge='virbr0'/>
  4. <model type='e1000'/>
  5. </interface>

I first tried the rtl8139 interface but that isn't supported by Haiku :s A list of possible interfaces can be found on the libvirt website.

I can now access it via vnc. But Ubuntu has some kind of bug in the vnc client of virt-viewer so it is sllooooooowwwww...

Screenshot

Trouble setting up digital output

Too lazy to type something usefull here. Just for my own reference...

Useful links:

  • http://alsa.opensrc.org/index.php/DigitalOut
  • http://www.pulseaudio.org/wiki/PerfectSetup

Steps to take:

usermod -a -G audio $USER
sudo aptitude install pulseaudio
sudo nano /etc/pulse/default.pa

load-module module-combine
load-module module-zeroconf-publish
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/24

pulseaudio --start (or run pulseaudio in screen)
aplay ~/train.wav

Tomato firmware

sp-tomaatTomato is a replacement firmware for Linksys' WRT54GL and it rocks!

I've installed it on my home router and on the new router of my boss. Both had other routers ( a Belkin and a US Robotics) and a lot of troubles with the stupid things. After switching to Tomato we've had no troubles at all! Upgrading was a breeze.

At work we still have a D-link but the conncetion keeps dropping. If I set it to WPA1 OR WPA2: no troubles. But WPA1 AND 2 it can't handle :( So one of these days I've got to pick up a nice blue Linksys and install Tomato on it.

Linksys-WRT54GL

Rmp -> Pmpd

monty-pythonI've ditched Ruby for my mpd project and started using Python. Not that I like python that much more but the Gstreamer library for python is much more complete. I really wanted gapless playback and the Ruby Gstreamer libray just doesn't support that. If it does by the time you read this: please let me know :)

The new Pmpd project (looking for a better name) can be found on github. The hardest part so far is having to restructure the sources. Python is not a difficult language to master at all but I'm very picky on how everything fits together. My ruby project felt right on that part. But the python equivelant has some things I just don't like enough up to now.

Problems with suexec/fastcgid and virtualmin

Since a few version of virtualmin I had some problems with checking the server configuration.

Virtualmin 3.72.gpl_webmin_error

The problem is that I have manually patched suexec and the php fcgid script is in /var/www and not /home.

I had this error for quite a while but last week I fixed it. It was quite simple. Just change this code in "/usr/share/webmin/virtual-server/feature-web.pl:

CODE:
  1. # Make sure home base is under base directory, or template CGI directory is
  2. if ($tmpl->{'web_suexec'} && $suhome &&
  3. !&same_file($suhome, $home_base) &&
  4. !&is_under_directory($suhome, $home_base) &&
  5. (!$cgibase || !&is_under_directory($suhome, $cgibase))) {
  6. return &text('check_ewebsuexechome',
  7. "<tt>$home_base</tt>", "<tt>$suhome</tt>");
  8. }
  9.  
  10. <p style="text-align: left;">return undef;
  11. }

To:

CODE:
  1. # Make sure home base is under base directory, or template CGI directory is
  2. return undef;
  3. if ($tmpl->{'web_suexec'} && $suhome &&
  4. !&same_file($suhome, $home_base) &&
  5. !&is_under_directory($suhome, $home_base) &&
  6. (!$cgibase || !&is_under_directory($suhome, $cgibase))) {
  7. return &text('check_ewebsuexechome',
  8. "<tt>$home_base</tt>", "<tt>$suhome</tt>");
  9. }  return undef;
  10. }

So just add "return undef;" to the top of that piece of code. Then it will step out of the function before the additional check is executed.

# Make sure home base is under base directory, or template CGI directory is
if ($tmpl->{'web_suexec'} && $suhome &&
!&same_file($suhome, $home_base) &&
!&is_under_directory($suhome, $home_base) &&
(!$cgibase || !&is_under_directory($suhome, $cgibase))) {
return &text('check_ewebsuexechome',
"<tt>$home_base</tt>", "<tt>$suhome</tt>");
}
return undef;
}

Problems with Zend Studio on 64 bit Linux

When removing Wine, lib32nss-mdns got uninstalled and Zend Studio refused to connect with any FTP server. After reinstalling the package everything worked again!

Upgrading wordpreess

I had some small troubles with updating this wordpress blog. It kept wanting to upgrade via ftp/sftp. But I found this great post which has a solution.