Monday, October 12, 2009

wxruby: wxWidgets for ruby on Ubuntu

A nice link on how to get the basic wxruby (wxWidgets for ruby) going on Ubuntu/debian.

Some examples in the examples folder require some more libraries. For instance, the opengl example requires libopengl-ruby (and maybe freeglut3 libglut [??]) and one of the drawing examples requires librmagick-ruby.

So this should be enough to get you going with most of the examples:
sudo apt-get install libwxbase2.8-{0,dev} libwxgtk2.8-{0,dev} librmagick-ruby libopengl-ruby
sudo gem install wxruby

Saturday, October 10, 2009

how to safely delete things in Ubuntu/Linux

I accidentally performed a `rm -rf` on a very big and important directory. I was able to recover close to half of the files using extundelete, but it still left me with a sour taste in my mouth. Now that there is a solid freedesktop specification for how to Trash things, it seems high time to remedy this situation.

In my ~/.bashrc file:
if [ ! `which gvfs-trash 2>/dev/null` ]
alias dl='mv -t ~/.Trash/' # for older systems
alias dl='gvfs-trash'
So, now we can simply dl files and they go to a safe place. Still, I find myself using rm, so this little alias will help cure my addiction, by reminding me that I should be using dl instead of rm. I can still use the rm command by putting it in single quotes (that's how to get past any alias) as in: 'rm' -rf some_directory.
alias rm="echo \"use dl or 'rm'\""

Wednesday, October 7, 2009

How to share a VirtualBox virtual machine with multiple users on Linux/Ubuntu

Have you ever wanted to share your virtual machine with other users? Doing so will save a lot of space (since you only need one virtual machine) and keep you more in line with the EULA of the distribution you are running virtual (assuming that's Windows or Mac).

There are many tutorials online (for example) that will help you to install VirtualBox on your linux machine. A couple things to note:
  1. You probably want to use the package from the VirtualBox download site (and not the open source one that you can get with apt-get) since it has many of the features that are important for a good virtual machine (like USB support and OpenGL acceleration etc).

  2. Make sure a vboxusers group was created and that everyone who would want to use the virtual machine is part of that group.
Prerequisite: right now the only way I can get this to work is if everyone wanting to share the virtual machine has sudo privileges. I'd be interested if anyone can suggest a way to do this without them. OK, we're ready to start:
  1. Make a shared directory for your virtual machines:
    sudo mkdir /var/local/VirtualBox
  2. Create a soft link from the home directory of each user sharing:
    ln -s /var/local/VirtualBox $HOME/.VirtualBox
  3. Now create a custom application launcher for your panel:
    sh -c "gksudo 'chown -R $USER:$USER /var/local/VirtualBox'; VirtualBox"
    (that command [or similar] could be wrapped up in a .bashrc function, a script placed in your $HOME/bin directory or whatever).
Also, remember when you buy your next computer to think about getting one with virtualization capabilities (for instance, an intel chart of core 2 duo desktop processors which support virtualization)