Friday, April 20, 2012

Still here

I haven't died or anything, just haven't been assigned much 16-bit related tasks at work at the moment. Stay tuned!

Wednesday, January 27, 2010

Partition/Volume/Disk Madness

New Hardware

It seems I only blog when something goes badly wrong so I'll continue this tradition, but first I'll point out some things that have gone really well for me technology-wise:

New Hard Drive
I upgraded to a 1.5TB hard drive and installed Windows 7 (64-bit) onto this new drive. Windows' Files and Settings Transfer Wizard is great, it does exactly what the name implies with minimum fuss.

Windows 7, 64-bit
Windows 7 is really good, I used Vista a little at work and didn't like it but with 7 they have cleaned up a lot of the rough edges Vista had and driver compatibility is a non-issue now. After some reasearch I went with the 64-bit version because my processor can handle it and choosing 32-bit would have bitten me in the bum sooner or later. I've had no trouble with 64-bit at all which is a big relief. The drivers are all there and all of my apps and games run without a hitch. The only thing I could say against it is the slight irritation of having two Program Files directories but I'm just nitpicking.

X-Box Controller
I got myself an X-Box 360 wired controller because there are some games (e.g. driving) that don't really fit the keyboard and mouse. I've had zero trouble with that- installer the drivers off the disc then plug it in and you're away. A very satisfying purchase. I was apprehensive because the site I got it from said it is "Windows XP Compatible" and I know the driver model changed between XP and Vista/7 but I took the plunge and couldn't be happier.

Extra RAM
To go with the new 64-bit OS, I upgraded to 6GB of DDR-2 RAM (an extra 4GB to go with my existing 2GB) and everything is very snappy. Specifically Alt-Tabbing out of games is instant whereas before it would grind for a few seconds.

Backup Strategy
Now onto the disk madness. Now that I have a 1.5TB hard drive which is about half full I'm thinking about backups as there is data on there that I don't want to lose. So I went about researching backup strategies and I'll lay out my research here to save you time if you are thinking about doing the same thing. My requirements are that I will be backing up every month or so to another hard drive and the backup should be an entire drive image so if my current drive catastophically fails, I can shove in my backup drive and be up and running right away minus the last month's changes (worst case scenario). I didn't think this would be very difficult but it is a nightmare.

My first idea was to look into RAID 1 (mirroring) as I could just attach the spare hard drive, let the mirror build, then disconnect it and put it away for safekeeping. Perfect! Well it turns out that RAID is a minefield.

Hardware RAID
This requires a dedicated RAID controller which can either be integrated into the motherboard, or an add-on card e.g. PCI-Express. My current motherboard has an on-board RAID controller so I had a read up on them. Apparently they are notoriously unreliable and can cause data corruption, so I'm definitely not doing that.

Next I read up on add-on RAID cards and the Internet told me the cheap ones are terrible and the good ones are ridiculously expensive. Add to this the fact that if your RAID controller dies you need to get another one EXACTLY the same to be able to read the data again. Different controllers have different proprietary data formats so ones from different companies - and sometimes even from the same company - can't interoperate. Also I believe that hardware RAID cannot be done retroactively- you have to set up RAID before you even install the OS, so hardware RAID isn't for me.

GRRRR! It seemed like the perfect solution but everywhere I turn there is bad news so I looked into software RAID...

Software RAID
Windows Disk Management can create a mirrored volume as a Dynamic Disk but the downside is that there is a little CPU overhead involved in disk access. Well I don't mind a small tax if it means my data is rock solid safe. So I added a second drive and mirrored it which required converting my existing OS drive into a dynamic disk. I didn't know what that meant so just agreed to it. After mirroring everything looked fine but when I tried to boot into Ubuntu (I use Wubi to install Ubuntu into Windows as an app) it freaked out and wouldn't boot. If I want to continue using Ubuntu via Wubi, software RAID isn't for me either.

So I thought I'd put my system back to how it was previously but it's impossible to convert a dynamic disk back to a basic disk which is a big pain. After some research on the differences between these two disk types, I decided to leave it as it is even though it mean I have an annoying little 1MB partition sitting at the end of that disk now.

Offline Imaging
My last idea and one that I was hoping to not have to resort to is offline drive imaging. There are several tools available which boot from CD/DVD/USB and can perform a full image of a drive or partition onto another one. This is quite a bit of hassle, having to babysit the backup rather than just putting in another disk and pulling it out later as I envisioned for the RAID solution.

I downloaded CloneZilla and booted from a flash drive but to my great annoyance when I tried to select my OS partition as the source, it would only show me the tiny 1MB partition that converting to a dynamic disk created!! At this point I was completely crushed and couldn't be bothered exploring the options any further.

Now there are two things I can do. I could "convert" my drive back to a basic disk by installing Windows on the blank drive and copying everything across to it from the dynamic one. This would mean that I could continue to use Ubuntu and backup by performing full disk images. I don't like that option so I'm going for the other one- uninstalling Wubi (Ubuntu) from my system and using it in a virtual machine and using Windows' software RAID to mirror my drives. It makes me feel dirty that I have to boot into Windows in order to use Ubuntu instead of running it on the bare metal but that's something I'll just have to live with.

If anyone out there has suggestions on how to accomplish what I tried, please let me know.

Sunday, November 15, 2009

Windows 7 Impressions

I've had Windows 7 RTM installed for more than a month now as my primary OS. I clung to XP for as long as possible but I think it's time to make the shift.

Let me start off by saying that I really like Windows 7 and there are some improvements in the window manager (Win+Left/Right/Up/Down keys, desktop preview) which are really nice. On the flipside, some of the niggles I've experienced that I thought would disappear as I understood the OS better but have turned into full fledged annoyances. Let me enumerate them:

1. The new Taskbar. My main gripe is that the program icons don't stay put. In XP I had a toolbar on the taskbar with double-sized icons (no text) in which I would put shortcuts to my most frequently used applications. The new Taskbar approximates this functionality except now that the shortcuts double as running programs, my shortcut icons move to the right as I open other things. This is a pain because I have to visually search for the icon of the program I'm looking for rather than it being in a fixed location.

A concrete example:
I have a bunch of applications open and I decide to play some music. Where's my Winamp icon? Oh, it's all the way along there to the right. It doesn't take long to find the icon but should I really have to?

I'm aware they are trying to pull an Apple and merge the concept of shortcuts with running programs but what if I prefer it that way? Hopefully I can cobble together what I want out of deskband toolbars.

2. Reshuffing settings. Something I do reasonably often is change my network settings, enable/disabled adapters to switch from wireless to wired. In XP (classic start menu) I would go Start->Settings->Network Connections->LAN Connection (right click)->Disable. I had my network connections expandable via a start menu setting so all my adapters were visible right there in the start menu.

In 7 this becomes a much more labourious task. You have to enable a setting to even show "Network" on the start menu to begin with. Now there are two ways to access Network and Sharing Centre: 1) Start->Network (right click)->Properties or 2) Start->Network->Network and Sharing Centre. From there click Adapter Settings to see your network adapters. So one step turns into about four. I guess a good thing about this is that because of the tedious and clumsy ways I have to access my configuration options, I'll be using the command line a lot more ;-)

3. No classic start menu. In XP I had a very particular way of setting up my start menu. At work I have about fifteen different apps I use every day. Accessing apps quickly speeds me up and keeps my focus on what I'm doing. I'm not sure how many people know this because I figured it out by accident. When you have the classic start menu open and you press any other key on the keyboard, any visible icon that starts with that letter/number on the start menu will be selected. If there is only one icon that starts with that letter/number, it will be activated.

So I set up the apps I use most frequently as top level start menu shortcuts with numbers preceding their titles. e.g. "1-Visual Studio 2005". To activate any given app I'd hit the Window key (note that I don't have to hold it down) then 1-9 for the app I need. You might say "just pin these apps to the Windows 7 taskbar and activate them with Win+1, Win+2 etc. noob!". With fifteen apps pinned to the taskbar it would just be chaos and you know that.

You might then say "use the built in start menu search to find what you want!", this is a big waste of time. It's much faster to hit two keys one after the other than to hit start then start typing a description of what I'm after. It's also non-deterministic- if I start typing "Visual Studio" it might select the VS2005 icon by default or if might select a PDF in My Documents with "Visual Studio" in the title. I have to engage my brain to make sure I'm selecting the right thing which slows me down. I know exactly what app I want to run, don't make me parse through a bunch of noise to find it.

3. Explorer changes. I know this was brought in in Vista but why on earth does the backspace key now make you navigate Back rather than Up? If I'm in directory C:\Eclipse\bin and I hit backspace, I want to go to C:\Eclipse, not to whatever directory I happened to browse to the current one from! What really kills me is that there's already a key combo for Back, Alt+Left, but for some reason they though we'd rather have two ways to go Back rather than one for Back and one for Up.

Edit: I've just had a look in Windows Help and it appears Alt+Up works for Up in Windows Explorer. I'm still not happy that they stole my backspace ;-)

That's all I can be bothered venting for now. Hopefully as I find out more about the OS and the keyboard shortcuts my speed at using Windows 7 will return to XP levels.

Thursday, September 3, 2009

Pyjamas vs. Django

My hobby project is to create a website for my girlfriend's business. I don't want to reveal too much but the website will need to display the usual corporate information like services available, contact details, previous client testimonials etc. There will also need to be a section where potential clients can view available timeslots and apply for a booking with a consultant at any of those timeslots. This will be the hard part.

I don't want a username login sorta thing as that's too complicated. I think it will be enough to show an Outlook-style date/time calendar showing what times are available and allowing the user to select from the remaining timeslots, providing their name and contact details so a consultant can call them back and arrange the booking. Once the booking is arranged, the consultant will have to update the system so that the timeslot is shown as unavailable.

As these is a certain amount of dynamic data involved in the site, I'll use Python and a web framework to make serialisation to a database easier. After shopping around I have found many people happy with Django. The needs of this website are very modest so when people complain about Django not holding up under heavy load those arguments don't really apply here. I'm all about building this site rapidly and robustly.

The other side of the fence is Pyjamas which is a Python port of Google Web Toolkit (GWT) which allows you to write code in Python (originally in Java) which will be automagically converted to HTML and JavaScript when you compile using the GWT/Pyjamas toolset.

I have decided that Django is the tool for the job as I have no need to AJAX functionality, just basic client/server communication with a little pizazz on the client end to make it look nice.

(edit) In further reading it appears these are pretty different tools- Pyjamas is a front end development and Django is a total solution. All the better for me.

First step: Django Tutorial
I installed Django 1.0.2 from the Ubuntu repo and some of the other Django related bits and pieces that sounded interesting. I'll stick with SQLite for now until I need a proper RDBMS. I see that Django is dependent on JQuery which is good- I was intending to use that to flash up the site.

I have set up a Pydev project and tried to run the command to create a Django site in that location but it can't find the file First I had to find out how to search the filesystem for a file (find -iname "filename") then I had to find out how to add that location to the system path.

Now the file is on the system path but when I cd to the project folder and run the command I get access denied. Next I sudo the command and it says it can't find the command. WTF?

So I find the file and edit it and the first line (which I believe indicates which binary should execute it) says "#!/usr/bin/env python". I had a look and /usr/bin/env doesn't exist! No idea why the default installation of Django would reference Python from a location that doesn't exist. Maybe I'm supposed to make a symlink there that points to my Python interpreter of choice? I'll learn how to create symlinks then try it out.

I don't have to create a symlink, it turns out that /usr/bin/env is some sort of environment variable list allowing me to change the location of the Python executable easily. It's a level of indirection so that the location of Python doesn't have to be hardcoded into .py files.

After much toiling around I have found that I can get it to work by running "/usr/bin/python createsite xxx". Not sure why I have to manually invoke Python, I would have thought it would automatically be associated with .py files? Anyway, that was needlessly difficult but I finally have a site up. I'll continue the Django tutorial and get started on the real work.

Second Time's a Charm

With my renewed vigor to get my hobby project off the ground, I've wiped my Ubuntu install, re-installed it from scratch and updated it via Synaptic. This time I'll draw on my previous experience and install the correct version of Subversion.

1. Eclipse
Eclipse install went smoothly. I won't upgrade it to 3.2.2 as that seemed to cause problems last time.

2. Subversion
I'm aware now that I need version 1.4.x of Subclipse to integrate with version 1.5.4 of Subversion that's available in the Ubuntu repository.
Subversion installed fine. Again I get the "No features available" message from the Subclipse 1.4.x update site. I will try downloading the site package but if that doesn't work I'm giving up on Subclipse.

This seems to be working- now it shows me the contents of the archive site on my local machine. Selecting to install Subclipse indicated that I need Draw2D dependency so I cancel out and request new features again, this time selecting the Callisto Discovery Site and Eclipse Update Site hoping the dependencies will be resolved automatically. It didn't resolve automatically but I found online that I need to manually select the Eclipse Graphical Editing Framework which has solved the issue. This step could definitely be made easier.

I choose to install Subclipse and Subclipse SVNKit Option. The Mylyn integration package sounds good but has dependencies that I can't find so it's not getting installed.

Great! Subclipse is installed and I can open a project from SVN. Better than last time already.

3. Pydev
I've elected to install Pydev + Extensions via the Eclipse update site. While this is proceeding I've had a look at what Mylyn is and it looks fantastic. Pity it appears to only be available in Eclipse 3.3+. Once I've got this version stable I might upgrade.

Right, Pydev installed fine and I'm ready to go! Woooot! Much easier this time around.

I still wonder why Help->About in Eclipse shows me that the version is 3.2.2 but when I look at the updates section it shows me Eclipse 3.2, Eclipse 3.2 Updates, Eclipse 3.2.1, Eclipse 3.2.1 Updates, Eclipse 3.2.2, Eclipse 3.2.2 Updates. I assume I should be installing the last one but the fact that displays old updates makes me apprehensive to install anything. I'll leave it alone for now as it's all stable and working.

Tuesday, August 25, 2009

Open Source Struggle

After having decided on Python 2.6 as a platform it's time to find an IDE and get on with a few tutorials. You may snicker at me wanting an IDE but I'm trying to keep the barrier to entry as low as possible initially so I don't get discouraged. I'm already coming in cold to Python and Ubuntu so having to learn emacs/vi as well is a step too far for me. Plus I have a .NET background so I'm used to the power of Visual Studio.

I decided on Eclipse as an IDE mainly because it's full-featured and is relatively equivalent to Visual Studio. I may take a look at Java as well so using the same IDE for multiple languages is a bonus.

Pydev is a plugin for Eclipse which supports Python development. This is where the journey gets a bit interesting. The organisation for Pydev is horrendous. Whereas projects like Python and Eclipse have easy to understand websites that provide a unified front, Pydev is all over the place.

Apparently Pydev is owned by Aptana although it is still free and open source. There are also "Pydev extensions" which provide some extra functionality, also free and open source. Why these are two distinct things escapes me and fragments the product. Some of the downloads are from SourceForce, some are from Aptana and others from Fabioz. All I wanted was a simple plugin, why not just bundle it all together as one Eclipse plugin with a link to the update site on the front page?

After going through the Getting Started section I had Pydev installed correctly and was ready to start. First things first, I need to download the Subclipse plugin which seamlessly integrates Subversion commands into Eclipse. So I find the update URL on the Subclipse site and enter it into Eclipse to which it replies "No features found on the selected site(s)". First roadblock.

Updating Eclipse
So I Google 'Ubuntu Subclipse "no features found"' and I come up with a very limited result set. Some of them suggest using the Sun JDK instead of GCJ which I have no idea how to do. Others suggest making sure my Eclipse 3.2 version is up-to-date. I ask Eclipse for a list of updates and it asks me what mirror I wish to use, naturally I select Australia which gets me an error message saying there were network problems- 404 meaning the server is down. Great. So I try again with a US server, bingo! I assume I want to install the latest version which is 3.2.2 so I check that and continue. Up pops an error saying it can't find particular files and that the installation has failed. Second roadblock.

So I Google the error message and it turns out that I need to install Eclipse 3.2.1 before I can install 3.2.2. There seriously needs to be a version check before allowing me to witlessly try to install a version that can't be installed! Again I fire up the Eclipse update UI and find the 3.2.1 version (for some reason under "Find new features" rather than "Updates") and install it. Back to the update UI, I select 3.2.1 Patches as I assume I'll need this as well to update to 3.2.2. Trying to select that results in an error saying

Eclipse Java Development Tools 3.2.1 performance patch (bug:159325) (1.0.0) requires feature "org.eclipse.jdt (3.2.1.r321_v20060905-R4CM1Znkvre9wC-)".

Great. Now where would I find that and why can't it just automatically resolve this dependency?
I give up on this for now and take a look back at some of the other Google results for installing Subclipse.

Wrong Subclipse Version?
Some results suggest it could be something to do with JavaHL, whatever that is. I find a link to a Tigris page explaining which versions of Subclipse are compatible with which versions of Subversion. I check my Subversion version which is 1.5.4 so apparently I want the 1.4.x version of Subclipse. I was trying to use the 1.6.x version previously which is probably why Eclipse didn't like that update URL. Whoops.

No luck with the 1.4.x version either, it still says "no features found ...". This is becoming a real hassle. I wish Subclipse was just another checkbox in Synaptic Package Manager so I could avoid all this fuss. I have to say that it hasn't been an easy experience so far and the initial respect I had for the environment has been marred by this wild goose chase.

Back To Updating Eclipse
Having exhausted that line of inquiry I decide to update Eclipse again. One search result suggests opening Eclipse as a superuser using "sudo eclipse" and installing version Eclipse 3.2.2 SDK which works. I go back to the update UI and it's still showing me 3.2.1 Patches as an available option which seems weird considering I just upgraded to 3.2.2. I install 3.2.2 Patches and now I'm up to the latest version.

Back To Updating Subclipse
Considering everything's been working OK as superuser, I'll try to add the Subclipse plugin as superuser and see what happens. No luck, still says "no features found". Well my last resort is to add Subclipse as an archive. I shouldn't really have to do this but I'll give it a go, so I'll download the Subclipse zip file and add it to Eclipse as an archived site. This still doesn't work. Something is definitely missing from my Eclipse installation but I have no idea what. My solution is to install every update and feature for Eclipse that I can from the update site. OK almost everything in the Callisto Discovery site tells me that I need Eclipse RCP 3.2.2. WTF?!? I thought I just installed 3.2.2!

I have decided to uninstall Eclipse and reinstall it via Synaptic Package Manager to start again from scratch. After a "Complete Uninstall" and reinstall I still have all of the updates I had applied. How in god's name am I supposed to revert to a plain vanilla Eclipse? Do I have to reinstall the OS?

First Steps With Ubuntu

As a programmer using squalid decades-old technology at work, I'm looking to delve into something more interesting in my spare time.

First of all I figured I'd look into this new Linux thing that everyone's talking about. The most approachable distribution seems to be Ubuntu so I initially downloaded Ubuntu 9.4 Desktop and tried it out in a virtual machine.

A very slick and easy to use installer let me set up all the essentials and get in to the desktop. I'm impressed that out of the box it has recognised my video card, network card and sound card. Everything is up and running nicely.

Then I took some time out to learn about how the file system is arranged in Linux and a few basic terminal commands. Next I want to get some tools installed so I can start a hobby LAMP project including a webapp, web services and MySQL/PostgreSQL. First of all I installed Eclipse, Subversion and Apache from Synaptic Package Manager. It's a very simple point-and-click GUI to install and update all software on the machine which is fantastic. I really wish Windows had this instead of a mixture of various updating mechanisms which each want to run in their own process. Apparently Windows 7 has this feature for drivers but not for applications.

I shopped around and decided on learning Python to play around with. My initial field of candidates was Perl, PHP and Python. Perl is just too ugly and hacky- so many implicit rules to remember and it's OO syntax is obviously a bolted-on afterthought. I'll definitely use this at work though as there are plenty of times when a quick hacky regex script is just what I need. PHP looks good for hacking together code quickly but feels like a modern day VB6 which quickly turns into spaghetti code. It also shares the bolted-on OO syntax.

A couple of the reasons that I chose Python are:
- Google is using it fairly extensively and has contributed many performance updates to the interpreter. All of these languages are interpreted and therefore are much slower than their compiled counterparts. If some of the smartest programmers in the world (Google) are contributing to speed it up then it has the best chance at good performance.
- Easy syntax, great library support and community
- Google AppEngine can be used with Python which provides a free and highly scalable playground for me to test out my code. The only downside is I'd have to learn about the BigTable storage system which probably doesn't suit my needs right now.

Deciding between Python 2.6 and 3.1 was hard. 3.1 is the latest and greatest but in the real world I think 2.6 and earlier are almost universally used. For my career I think the best option is to go with 2.6 so any skills I learn are transferrable to the real world.

Next up you can see my struggles to get the tools I need working to start on my Python development.