Tag Archives: linux

Developing for Open Source Languages on Windows the Better Way

When working with php, rails, python, etc, windows is sufficient, but definitely leaves something to be desired. The ports of these languages are definitely second class. With Microsoft’s backing php support with IIS is improving, but it’s not the same. And usually you are going to deploy those apps on a linux/bsd web server, so it’s nice to know if there are any nuances. A lot of developers opt for a mac if they are developing in these types of languages. But macs can be pricey, and buying a new machine to work on other platforms seems overkill.

Now I do have a mac, but have a windows 7 laptop at work, and sometimes I do work in ruby on various projects. So I have worked out a way that I think is worth sharing. At it’s core, the idea is to use a vm, but there are some other tweaks that make this method even better.

Install VirtualBox. It’s from Sun Oracle and it’s freely available.

Create a virtual machine with Ubuntu. Or your favorite flavor of linux or bsd. I used the server version of ubuntu.

Setup Networking (Optional). You can use bridge mode, but for added security I used NAT for the adapter on the virtual machine. To then access the machine locally, forward your local ssh port to the virtual machine using the following instructions.

Install Putty with Tools and XMing in Windows. Available here and here, these tools will let you do ssh with X forwarding in windows.

Setup a Connection in Putty.
connection info

Enable X-Forwaring in Connection.
X-Forwarding

Setup SSH Tunnels.
ssh tunnel

Setup a Proxy connection in Firefox
proxy

Create your user and install your language platforms in the virtual machine. For example in ubuntu, you’re looking for “sudo apt-get install ruby-1.8”.

Install your preferred editor in the virtual machineEmacs, Vim, Eclipse, Netbeans, etc.

Your environment is now setup. I’ll give an example with ruby:

  • Start the virtual machine
  • Start XMing
  • Connect with Putty
  • Start your editor (for example “emacs &”)
  • Open Firefox
  • Start your app (for example “ruby script/server”)
  • Go to http://localhost:3000 in Firefox

This virtual machine does not require a lot of software installed, and a small amount of ram (like 128mb) should be sufficient. And by backing up your virtual machine (which should be pretty small), you have backed up your entire development environment without getting the documents, media, etc that you have on the windows side.

Hopefully you find this helpful if you want to develop in environments that lend themselves to this environment.

Caps Lock to Control Key in Ubuntu

I like to remap my caps lock key to an extra control key (this can be common practice in the emacs world).  It’s closer to the common keys that are paired with control.  And besides, I only ever turn on caps lock by mistake. 

Recently, while installing Ubuntu on a box, I was looking for the way to do this.  I found a piece of code that remaps the key with calls to xmodmap.  You put the snippet in your ~/.profile file.  It worked, sort of.  I would get errors about the script when logging in via ssh remotely.  (There are ways to script around that).  And bouncing back and forth from a local screen to connecting via vnc would sometimes remove the setting. 

Instead of finding ways around those issues, I found “the way”.  Just go in to your preferences menu and to the keyboard.  Under control key, there is an option to make the caps lock and additional control key.  It doesn’t affect remote connections (the ssh client uses the local key mapping).   And the setting never seems to get lost.