Wherever you go, there you are.
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

My Development Environment

0

StackOverflow logoMy answer to a recent stackoverflow question got me to thinking about the long and painful process I went through in creating a development environment that met all of my idiosyncratic needs.

The question asks people what kind of setup they use for their development environments. My environment for building web applications and other personal projects went through a lot of iterations before I finally settled on one that met all of my needs and did not irritate me in any discernible fashion. Some of the personal requirements that I slowly identified as I went through this process were:

  • I need Windows: First and foremost, I'm a PC gamer. Additionally, my day-job requires a variety of Windows applications, so I need a functional Windows desktop no matter what the underlying task. Also, many of my personal projects are built in Visual Studio.
  • I need Linux: I'm also an open-source web developer and so I need Linux for many of those projects too. I use a Linux server for production deployments and it helps to have a functional Linux development server that matches that environment as closely as possible.
  • I treat personal projects like real ones: For even the simplest of personal webpages, I like to have a development environment separate from my production environment. I even like to have a test environment too, but that's not generally as critical. While it may seem like overkill for a lot of basic tasks, it enforces good habits and has saved my bacon too many times to count.
  • I need to edit locally: While I have nothing against network mounts, and in fact use a really cool NAS device for a ton of handy things, I've always found the random network delays an annoyance when editing text files. I'm a compulsive saver and every slight delay drives me nuts.
  • I don't like messing with character encodings: DOS newlines, UNIX newlines, UTF vs. standard ANSI... I'm very picky about my character encodings. I want files deployed to my production Linux environment to have UNIX newlines with UTF-8 encodings, no exceptions.
  • I'm power-conscious: At the end of the day, I want to be able to turn off as many of my electronic devices as possible, as easily as possible.
  • I like to share: I need to be able to share up-to-the-second changes in development with my wife and co-developer, with no more hassle than looking at the changes myself.

Of course, there's no single magic bullet that resolved all of these needs at once. Many of my setups excelled in some areas while falling down in others. I had several setups that were "good enough", but the slight deficiencies constantly irritated me. In some ways these were the worst, because I always felt guilty about spending time trying to improve the setup when I should have been working on code instead. But I did, finally, settle on a setup that meets all my needs and has no apparent annoyances. Without further delay, I present it to you!

The Host OS

I tried dual-booting various versions of Windows with a Linux desktop environment for a long time -- I've toyed on and off with that kind of setup for almost a decade now. But the maintenance overhead of a dual-boot system has always been a drawback to me, as well as the complexity and potential (often realized) for boot-sector SNAFUs. I've also tried Linux as my primary desktop with virtualized Windows environments, but that's always been a problem for gaming and performance concerns.

In the end, I finally settled on Windows Vista, 64-bit. 64-bit allows me to take advantage of all 4GB of my RAM (and more soon, I hope!), and I can play all of the latest and greatest PC gaming titles without problem. Further, because it is my host OS and not just a VM, I always feel like I'm getting "all the bang for my buck" when it comes to gaming or other intensive Windows tasks, like Visual Studio compiles.

The Dev Server

Finding a good choice for my Linux development server has likewise been a long and often twisting road. I've gone from dedicated servers to using my desktop as my development environment and all the way back again, before finally settling on the option that now works for me. I run a Linux (Ubuntu) server as a virtual machine (VM) on my desktop host, using Sun's VirtualBox.

Running a local VM for my development server has solved a lot of problems for me. I can edit files locally on Windows but have the guest OS serve them up without any hassle. The VM instance has its own IP, so other computers on my network can access it just like a physical host. It's easy to start and stop at will, and shuts down when I turn off my desktop at night. It also lets me experiment very easily; I can create a new server image (or clone my existing one) at any time to try out something risky or dramatic, with far less pain and suffering than in the past. It also lets me take advantage of my desktop hardware for something other than just gaming, which makes the cost of my inevitable and continuous desktop upgrades a little easier to justify. This allows me to concentrate my precious hardware funds into one machine.

The Editor

I can't even count the number of editors I've tried over the years. The one I had been using most recently was jEdit. It was powerful, had lots of optional plug-ins, and was cross-platform, which tended to come up a lot as I switched my environment around ad nauseam. But it never handled character encodings in a way that I liked, and it was always a little slow and a little clunky due to its Java implementation. I've always had problems with the damn installer too, which is a trite thing to get hung up on I suppose, but there it is.

Lately I've been using Notepad++ which is fast, lightweight, and handles character encodings exactly the way I want. I can force the default encoding to UNIX newlines and UTF-8 for all new files, and never worry about it again. It clearly indicates which encoding a file is using in case I need to convert something, and has no problem displaying any of the standard encodings I regularly come across. It has excellent syntax highlighting, but it doesn't have a lot of plug-in options, which has actually been a good thing for me. I'm no longer tempted to try all these stupid editor features which seem cool at first but ultimately become a waste of time and don't really address the problem I'm trying to solve.

So, there you have it. My ideal development environment, finally realized after almost a decade of experimentation. So... maybe now I should get on with the task of actually writing some code, eh?

How Not to Upgrade

0

I love doing stupid things. No, really, I mean that with all my heart. Every time I do something stupid and manage to recover from it without too much pain, I feel as if some part of my mandatory universal stupidity quota has just been filled. My normal sense of complacency is repealed, I pay better attention to all the buttons I normally push without thinking, and I become hyper-vigilant to avoid doing anything glaringly dumb. For a while.

The latest stupid thing I did happened while upgrading to Ubuntu Feisty. Actually, I upgraded several hosts without a hitch, so really, power to the people at Ubuntu for making such clean upgrade paths (and, I suppose, to the Debian folks for the underlying package manager on which it all depends). Unfortunately, when I pulled the big handle on my primary server and X11 platform, I wasn't paying enough attention. The upgrade rolled around just fine, updating old packages and removing obsolete ones, while I blindly agreed to every prompt that popped up.

The time to restart comes along and... oh, what's this? What do you mean you can't find a kernel?

It's not fair to say that it couldn't find the kernel, exactly. The kernel loaded just fine. Unfortunately the kernel is a Xen Hypervisor, which points to another kernel to use for the Dom0 machine instance which runs my actual server. And that kernel was nowhere to be found. After a bit of digging it became painfully obvious that one of the obsolete packages I had blindly thrown out was, in fact, my precompiled Xen generic x86 kernel.

Oops.

Thankfully I have lots of other internet connected machines at my disposal, and it was a quick matter to grab an Ubuntu Live-CD and boot into a root shell on my server from there. Another few minutes of fiddling and I had apt-get'ted myself the latest Xen generic x86 kernel package. One last smidgen of editing in the GRUB list, and all was well once again.

So other than my heart skipping a beat or ten, this was happily a very painless act of stupidity. At my current quota-filling rate, I expect I'll be posting something eerily similar to this in, oh, another 5 months or so. I can only hope it'll be as easy to fix as this one was.