coding in colour

published 28 Aug 2011

I spend quite a bit of time setting up my development environment to a perfect state. I define a perfect state as one where I can innovate, create and debug without thinking about -- or being distracted by -- my input/output environment. There are quite a few separate elements I'd like to focus on and share, but this time around let's take a look at colours and syntax highlighting.

While I believe my colour scheme was originally based on another, I have unfortunately since lost its origins. It has been through many revisions over the years, but I have been using it for over a good length of time without any changes, so believe it is at a stable point to release!

You can download my visual studio 2010 colour settings here. Preferred colour schemes are quite a personal thing, so I'm interested in hearing about which parts people like/dislike about this scheme!

comments

local game dev meetup

published 27 Aug 2011

Today I attended and presented at a local game development showcase event run by letsmakegames.org -- "Show us your Bits". I decided to focus on the process involved with porting osu! to the mobile platform, and the technical decisions and optimisations that consumed a large chunk of the development time.

I also had the chance to talk with more local game developers than I knew existed, and give some eager people a shot at osu!stream :).

The event was recorded so there will likely be a recording of my presentation (and others) available in the future, at which point I'll make sure I link it.  For the time being I'm going to dump my presentation's slides here for public consumption. They may not completely stand-alone, but will give an idea of the stuff I covered. If you are interested in anything in particular, leave a comment and I can go into more detail!

Note that due to the filesize, videos are not included in this web-viewable copy.

comments

decommissioning a wordpress blog

published 25 Aug 2011

One of my long-term goals has been to cut down on the number of servers under my control that require frequent maintenance and attention. For over a decade I have hosted personal content (including my blog) on a PC in my house, which has served many purposes over the year including streaming media, storage, web hosting and just as a general shell box for IRC and other persistent connections.

While hosting things locally can be great in some ways (full control, minimal latency), there comes a point when you realise you just don't want to have the hassle of dealing with power and network failures that come with the household environment. Things also change over time, and most of the services provided by a local server -- to myself as well as my family -- are no longer being used; in fact the only remaining uses I have for it is hosting my personal sites and as a shell for IRC.

In moving my blog over to a hosted solution (tumblr, as you can see), I decided to use this as an opportunity to consolidate my hosting and make a step forward towards decommissioning my home server (falco).

The main two sites still being hosted on this server were my blog and splash page for ppy.sh. Today I will cover the wordpress side of things, and leave the other for next time.

My thoughts were to create an archived copy of my blog, keeping a fully navigable copy of the content without any security risks caused by maintaining a wordpress install or web server. A quick google search led me to a plugin called Really Static, which allows for static caching of pages. It has a manual option to create a static content of every page in one swoop, which was exactly what I was after.

After adding a "deprecated" header to the top of every page, I went ahead and ran the plugin (which took a good two hours due to my crippled apache2 configuration).

"Really Static" Wordpress plugin

Apart from a few manual corrections for stray images (which could have been avoided with some better configuration choices in the Really Static settings), everything seemed to work perfectly. The static copy ended up being around 68mb of HTML and images.

I had been meaning to give NearlyFreeSpeech a chance for web hosting once I found a project small enough to do so, and this was the perfect opportunity. They offer hosting with a unique payment system where you deposit money and only pay for the storage and bandwidth you use. Kind of like cloud hosting without the running costs. A few calculations showed that with my expected traffic and storage requirements the costs would be well under a dollar a month. Couldn't hope for any more than this!

So my old blog is already up and running on the new hosting in a completely static form. Go take a look if you are that way inclined (but don't try to leave a comment on it; it won't work :p).

comments

managing and repairing partition tables w/boot camp

published 24 Aug 2011

It is no secret that I stand by Apple hardware — with my desk covered in far too much aluminium — but on a day-to-day basis I use OS X and Windows roughly equally. This means that for my portable setup (MBP 13" late-2009), I need a working copy of both operating systems, and the ability to switch between them with minimal effort.

Recently I have become more reliant on Dropbox in order to sync files between PCs (and in this case, OSes). This is generally more efficient than bringing git up-to-date each time i reboot, which would usually involve stashing, committing, pushing, pulling, popping stash every time. The problem created is that Dropbox doesn't sync instantly -- in fact it takes a fair amount of time.

Due to OS X not having write support to NTFS partitions (and vice-versa with Windows and HFS+) I had been unable to store dropbox in one location.

The plan? Create a new shared ExFAT (basically FAT64, with case-sensitivity and more goodness) partition which could be accessed by both operating systems, and use it solely to store my dropbox.

Intel 160gb SSD [120gb OS X | 8gb shared | 32gb Windows 7]

I have 11.2gb of dropbox storage using referrals and various promotions they have had over the years, but don't plan on using this much space in the near future, so settled for 8gb. Disk Utility on OS X allows resizing HFS+ partitions on-the-fly, so I freed up enough space and tried to make this happen... and then ran into some problems...

It was not meant to be:

No go. Disk Utility gave me random errors while trying to use the space that I assumed to be free. A quick reboot into Windows made it apparent that Disk Utility was unaware of the Lion recovery partition -- which exists after the end of the primary OS partition -- and was allowing me to create a partition larger than I should in fact be able to.

Settling for around 7.3gb, I set things up and did a test run. Found that the default cluster allocation size in both OS X and Windows when formatting ExFAT is 32kb (probably as an optimisation for USB/flash drives, which are the primary target medium for the ExFAT filesystem). So I reformatted the partition, and decided to try my luck and also remove the recovery partition. It shouldn't be used for anything under normal circumstances, right?!

It most definitely isn't, but in the process I upset the balance of things. During the Boot Camp setup process, a hybrid boot sector is made on the target disk, containing both MBR(windows) and GPT(os x) records. By changing the partition layout in windows, this caused the two do become desynced. OS X would no longer boot, and on further inspection (using a Lion install DVD.. err, memory stick) thought the primary HFS+ partition was now ExFAT.

"Ohshi--" was the first thing that ran through my head, and I mentally calculated how much data I would lose should I need to restore from backups (around 4 days, mostly iTunes imports/tagging). But of course I couldn't just give up and stop here; the night was young and I was curious as to how this could be fixed.

After doing a lot of searching around and finding some people in similar situations with the classic "reinstall your OS" responses, I set out with two utilities in hand that I was sure could be used to resolve the situation I caused.

rEFIt: an EFI boot manager and recovery suite, containing gptsync -- an app specifically made to bring the MBR record back in sync with the GPT table.

gpt-fdisk (aka gdisk): a release of fdisk which has gpt support. handily available in binary form for every OS!

A quick test using the rEFIt gptsync tool proved unsuccessful; it tried to sync the GPT over to MBR but failed due to the changes I made to the MBR in windows. I couldn't find a way to sync in the other direction. I took a photo of the disk's layout at this point, which showed start and end sectors for each partition in both MBR and GPT layouts. This would prove a life-saver after I proceeded to destroy my partition layouts beyond perceivably recoverable levels (let's skip this part lest this post turn into a book).

On to gdisk (running from windows), and I could now fix the gpt layout based on the photo I took previously. This process was fairly straightforward as I am familiar with fdisk commands, but there is plenty of information here that would help those that aren't.

End result? After about six hours I had recovered both OSes, removed the Lion recovery partition and created my new shared home for Dropbox. Was it worth it? I'll leave that for you to answer. I do recommend that if at all possible, you should do all your partitioning in OS X (and leave the recovery partition be) to avoid a similar situation.

I have been using a shared dropbox across both operating systems for a couple of days now and have hit a few bumps (which I will detail in a future post), but overall it feels *that* much better to not have to wait 10-30 minutes for Dropbox syncs. I have been switching OSes a lot more since the change, which means overall more productivity.

Lessons learnt:

  • Backup before playing with partitions.
  • Always keep a record of the original partition table layout, so you can restore if something goes wrong. As long as you don't format any partition changes all data is recoverable.
  • Windows prefers reading and writing the MBR when available, even though it supports GPT.
  • Keep rEFIt on a recovery USB stick or DVD (my 8gb usb stick now has OS X Lion Install and rEFIt).
comments

a personal challenge

published 24 Aug 2011

Following a twitter conversation with a good friend of mine, I have decided to attempt one-blog-a-day until I run out of interesting things to post about.

My aim is to post on topics that can't fit in a tweet, while not impeding on my schedule to the point where I can't make a daily post. As with all blogging experiments, I'm not sure how long this will last, but you can't do more than start positively and hope for the best.

I do have a good deal of things to post about saved up over the years, but not recorded anywhere, so this will be an impulsive process mostly focusing on what I am currently working on/with.

This will deprecate my previous blog (which can be found at pe.ppy.sh). I considered migrating content, but after weighing up the pros and cons decided to leave it be and start fresh.

It shouldn't need to be said that the majority of the posts will be of technical nature, so if this frightens you, run away now. Run for the hills.

update: looks as if another friend will be participating in this challenge too!

comments