I really hate writing UI code. I’m bad at designing UIs in the first place, but the mindlessness of it bothers me. It is programming’s version of manual labour. There is no mental challenge in hooking up all of these signal handlers. There is no mental challenge in telling the user what part of their input was wrong. But you have to do it, and it takes forever. When contemplating how sorry I feel for myself right now, thanks to having to work on some web programming, I came up with this simile:
Interface coding can be likened to having a big pile of rocks. You need to sort the big pile of rocks into smaller types of rocks depending on what type of rock it is. You can only carry one rock at a time. The piles are not close together.I am not looking forward to the next few days. I haven’t even started on styling my site and am not looking forward to the nightmare of cross-browser support that comes with that.
Password complexity requirements really piss me off. While it isn’t my favourite activity in the world, lets do some math.
There are 52 characters in a-zA-Z. There are approximately 80 characters in a-zA-Z0-9 plus symbols. So for a password where the minimum requirements for a password include a lowercase letter, an uppercase letter, a number and a symbol, with 6 characters, is 80 to the power of 6, which is 262,144,000,000 combinations. Well gee, that’s a lot. It sure must take a bruteforcer a long time to crack that. Well, not really. This page I found for benchmarking CUDA with md5 calculates everything in millions-of-md5-hashes-per-second. That’s one computer, using consumer (albeit high-end) equipment. It wouldn’t take long to bruteforce that.
What if the password requirements were only a-zA-Z but SEVEN characters? 1,028,071,702,528 combinations. An order of magnitude more combinations, but with very lax character requirements.
Sysadmins, stop terrorizing us with your crazy password complexity requirements! If you want your passwords to be safe, make them long! A 12 to 20 character letter-only password can be far easier to memorize AND significantly stronger.
A few days ago, I purchased a Nintendo DS Lite from a friend of mine. It came with a R4DS, which much like the mod chip for the xbox, makes a decent gaming system into a great one. Aside from the nice part about being able to download all the games, a R4DS (which is only one of the many mod options) allows you to run homebrew code. That is, anyone with the desire to write and deploy their own programs to the NDS can; without the trouble of having to buy a development kit from Nintendo and pay licensing fees on the stuff we release. This isn’t to paint Nintendo in a bad light; I understand their business model and it works, but it can be frustrating sometimes when you have a cool device that is restricted by the unfortunate business policies of its corporate creator. See: iPhone, Zune.
The homebrew scene is a bit disjointed, but that’s to be expected. It could be described as both ragtag and mature. It has been possible to run homebrew code on the NDS for a few years now, so the community is well formed, and it is possible to jump in and have something running in a few days. It isn’t particularly hard to get from zero to “Hello World” in maybe a few hours of reading, downloading, and going through tutorials. After that however, the amount of available documentation starts to drop off. This isn’t the first time I’ve noticed this sort of thing either, and it seems really common with open source libraries. Ruby On Rails is a good example - tons of documentation on how to do really simple things, but as soon as you leave the basic tutorial behind, you’re on your own. That didn’t stop with RoR, and it hasn’t stopped me this time either.
The two main components to homebrew development are libnds, which is distributed as part of devkitpro, and palib.
libnds is almost essential, since it gets you off the bare metal; that is, it provides a barebones API on top of machine instructions, and little else. When I asked in the development IRC channel if there was somewhere I could find more documentation for libnds, I was told to go look at gbatek, which has the machine instruction specifications for GBA and NDS. That’s what I mean when I say ragtag. Like many tiny game development libraries, things are often functional, but not well documented, if at all.
palib is a bit higher level, providing what is actually quite a comprehensive library for all sort of things such as I/O, sprites, and filesystem support. I’ve been using it so far, but you can tell it is not a professional-level library. Still, it gets the job done, and the author has been nice enough to make a very large number of tutorials. I have no complaints yet, unless you count the sense of unprofessionalism it exudes.
The games for DS are pretty fun too. I’m currently enjoing Advance Wars: Age of Ruin, the Ace Attourney Series, Warioware, and Brain Age. I am NOT enjoying Stephanie saying her stupid Nintendog’s name over and over again, just to have it forget. I’m certain she ended up saying that stupid thing’s name over 100 times in the course of an hour.
More to come later on homebrew.
Amorphous is a game that was recently featured by Kongregate. It is a fantastically simple idea, which manages to be surprisingly deep. It is very hard. I’d be interested to know if anyone I know can get the “Exterminator Badge”, which is awarded for clearing the game on “big nest” mode.
The game’s enemies remind me a lot of S.T.A.L.K.E.R.’s mutants in that you start out with fairly simple enemies like dogs and bulls, and then gradually are introduced to tougher and more-WTFy enemies. There’s a lot of fun to be had in a game that throws you some rare enemies that you’ve never encountered before, with unknown characteristics. The key to the fantastic enemy progression is that the enemies have qualitatively more difficult characteristics; the author doesn’t just give the grunt some more health and a better gun to make them harder. Eventually, you have enough experience to know how to handle the strange new characteristics. Enemies that formally meant a respawn now fall to your sword in packs.
I die a lot. The game is really hard. But the game is addictive and fantastic because as a gamer I’d like to see how creative the next challenge is.
Also, add me on Kongregate: http://www.kongregate.com/accounts/Fitzsimmons
For the first half of the summer, I spent quite a bit of time working on a program for Cesmic, the company where my dad works. I used this as temporary employment while I searched for a better job. JobProposal is the unimaginative name of some custom enterprise software that I wrote for Cesmic. Their old job and proposal tracking system was painfully old-school - it consisted of two binders, filled with a bunch of pages where employees would write in the details of the job or proposal by hand. The design itself was quite similar to that of what you would see in a relational database; a proposal could be optionally linked to a job. This was achieved by having a column in the proposal table that someone could write the id number of the job that was associated with the proposal. The system worked pretty well for a while, but scales poorly. Now that Cesmic is seeing a huge increase in work, the binder has become cumbersome and difficult to search. Software was the natural choice. JobProposal was the first programming work I had ever done for hire, at least alone. I have done coding for hire before, but never to this scale, and I was always working for someone. Relatively speaking, JobProposal was only to be a fancy frontend to a database, like so many other internal custom software projects. From a purely creative perspective, this project is completely uninteresting. The code was not large scale, but it was far beyond trivial work as well. Just because the problem is common and has been solved already thousands of times doesn’t mean that making a friendly interface for a custom database is an easy task. UI coding is a huge pain in the ass. Also, this was the first time I would be completely responsible for every stage of the process, taking the project from conception to deployment, and maintenance. This time, all of the choices were up to me for language, platform, and design. The desired specifications were minimal - Cesmic just needed anything that was faster than using the stupid paper binder. The experience was quite educational for me, and although the project is trivial on the grand scale, I learned a lot from the process. One of the things I focused on for this project was the speed of coding. I picked my platform accordingly, mixing comfort from experience with easy APIs: Ruby, GTK, Activerecord, and postgres. I have a good deal of experience with all of the above. Ruby is a nice language, and I can code quickly without too many errors in it. Ruby was my top choice for languages because of its ability to have code blocks. They’re anonymous procedures that can be passed into function, much like variable arguments that contain data. This makes for streamlined UI code, since the ruby-gtk library allows you to use these blocks to specify what you want to happen when a signal occurs in the GUI. For example, here is a comparison between C++ and ruby, when I want to set up a signal that closes hides the current window when the user clicks the X: C++: preferencesWindow->signal_delete_event().connect( sigc::hide( sigc::bind_return( mem_fun( *preferencesWindow, &Gtk::Window::hide ), false ) )); ruby: win.signal_connect( "delete_event" ) { |win,event| win.hide } My options in C++ are cumbersome. I can either write an entire new function to call a single line of code, or I can use sigc’s crazy mutation and binding functions to hack a call to the GTK hide function into the calling convention that is expected for the signal in question. I should also point out it took a lot longer than I would have liked to figure out what combinations of the mutators would result in the signature that was required. In ruby, I just put the code inside code block. Another advantage to the ruby way is that should I at some point decide that I want the delete_event signal to do two things, I can simply add code to that block. In C++, my only choice is to write a function specifically to react to that lone signal, with the two things I need done. Ruby is great for UI work for other reasons, but I think this goes far enough in illustrating my point. I’m familiar with GTK. GTK works on the target platform. I have no complaints about GTK. No long winded explanation required. Activerecord is a fantastic ORM, of ruby-on-rails fame. It performs well even outside of rails, although this is an unconventional setup. Making sure that I could get activerecord to perform correctly despite being out of its element was the first thing I tested. There’s nothing worse than picking the wrong tool for the job, so I wanted to find out right at the beginning. Ask me about Adobe Flex sometime, if you want to hear a story of how that can go wrong. I’m confident that my use of activerecord significantly reduced the amount of time I spent in development. It is a fantastic DB API for my purposes. Not much to say on postgres. It is a free database, well supported, and unlike mysql, actually supports constraints. I had some previous experience maintaining postgres databases. At last, on to the part where I feel I really learned something. When writing my own programs for hobby purposes, I would often concentrate very heavily on doing everything the Right Way(tm), and ensuring that the architecture of the program was perfect. The result of this is that I would often sacrifice code simplicity for what I envisioned as a more correct solution. Famous words from Donald Knuth:
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.
Despite having read this quote several times, and agreeing in principle, I only recently realized that I was in many ways failing to code by these wise words. Why should I waste hours of coding time implementing a “perfect” solution to the problem when it will make a negligible difference in runtime, and needlessly add complexity to the codebase? The extra time I spend working on the improved algorithm is likely to dwarf the sum of the microscopic improvement in runtime of every execution of the program ever. However, something that I still needed to keep my mind on was scalability; while it may be acceptable for me to write a simple implementation now, the time may come in the future where the input is 1000 times larger than it is now. Only one person will be using the application right now, but what if business increases so much that some people need to work on it in parallel? These are considerations that must be taken into account when designing, and it is my belief that this kind of consideration is what separates a hastily written, or perhaps even sloppily written program from a WTF. In some ways, my code is a little sloppy. For example, one part of the program that I’m particularly embarrassed about is that the logic of some functions are determined by the state of something in the UI; and I’m not talking about a checkbox in a configuration page. A function will do different things depending on which tab the user has selected in the main window. With unlimited time, I would have gone back to fix what I consider to be a major although not critical design flaw. This flaw does not add a significant amount of complexity to the code base, and I don’t have unlimited time. It is better that this program is deployed and working than it is that things are done Right(tm). Some could say that this type of attitude is shortsighted, and will lead to issues when maintaining the codebase. I would agree. But, in the end, I decided that the tradeoff was worth it; I can even understand why it happens so often in stereotypical terrible enterprise code. Not everything can be perfect. Everything has some downsides. The good news is that the project was completed on time, is working, and the users are satisfied. I completed my first round of bugfixes and minor feature additions today, as part of the maintenance cycle. I leave you with this comic from Focus Shift, which I have re-hosted since I wasn’t able to find an archive on their site:

The Daily WTF, for those of you who have never heard of it, is a website originally dedicated to showcasing the use of horrible source code found being used in production environments. It has since grown to doing much more; it seems to currently specialize in demonstrating horrible business practice, which I suppose is still somewhat amusing. What isn’t amusing at ALL is the webcomic called Mandatory Fun Day, which is being featured on tdwtf. It is horrible. It is a waste of bandwidth. It is so bad that I don’t even want it showing up in my RSS feed for tdwtf anymore. So, I went to the trouble of actually fixing this problem. My RSS reader, Liferea, has a neat feature it calls a conversion filter, supposedly for support of non-RSS feeds, with the help of a script. It passes the data it fetches from the source URL to a script’s STDIN, and expects standard RSS from the script’s STDIO. I fashioned a script to get rid of the scourge that is Mandatory Fun Day. Here it is:
#!/usr/bin/env ruby require 'rexml/document' doc = REXML::Document.new( $stdin ) #select and delete all of the items with "Mandatory Fun Day" as the category doc.root.elements.delete_all( "/rss/channel/item[category/text()='Mandatory Fun Day']" ) doc.writeSlap that in a file, set it executable, and re-add the tdwtf feed. When adding, hit advanced, and enable the conversion filter. Point it at the script. Voila, no more Mandatory Fun Day. And people say XML sucks.
Sometimes I get bored on the weekends, and I just couldn’t stand having something new without geeking it up.
So, last night, I wrote a script that hooks into gajim (my IM client) via D-Bus (an interprocess communication interface) to send text messages to my phone when I’m set to away. It actually sends emails, since Virgin Mobile is nice enough to provide a free service that sends texts to your phone whenever someone sends an email to [yournumber]@vmobile.ca. I put a little more work into it this morning, to add an icon that shows up in the notification area, so I can toggle whether or not I want my messages to be forwarded or not.
Possible upcoming features: some sort of spam or flood protection, automated responses telling the sender that messages are going to my phone.
For anyone that is interested in the code for this sort of thing, you can find it on its gitweb page. It is written in python and is licensed with zlib/libpng.
I’ve been feeing the urge to get a mobile phone for a while. While rare, I do leave my computer sometimes, and that leaves me pretty much impossible to get ahold of. So, enter New Phone, for the limited number of people that actually care about me when I’m not at the computer. I’m going to assume that it’ll also come in handy when I need to coordinate meeting up with people somewhere, since that has been a problem in the past.
But on to the good part: I got a Virgin Nokia 2125i, which set me back $40 at a virgin mobile mini-store at the mall. They have the barest minimum of features; it supports little more than phoning and texting. The 2125i was on special today (lucky me), and usually go for $50. I don’t have much experience with the phone yet, so I can’t really comment on how good or bad it is. I like it so far, but first impressions aren’t everything.
So far I am extremely satisfied with virgin mobile. Virgin only provides prepaid plans, as far as I know. What first drew me to them was their complete lack of service or activation fees. I walked in to the mall, and walked out with a phone. When I got home, I activated my phone online, and got a free $15 credit to my account as well. Virgin does support monthly and daily plans, but I chose not to go with them. My goal was to get a phone I could use minimally or not at all, and not have to worry about it being a money sink. I really didn’t want to have to worry about not using a service that I was paying for. With Virgin Mobile, I don’t have to worry. This is a huge advantage for me. I could walk away right now and only be down the cost of handset - which would still be there should I decide I want to start using it again. Virgin mobile is the only provider in my area that provides this. Every single other provider has some sort of monthly fee, even for pay as you go, to the tune of $5 a month, and an activation fee of around $30. Stop paying your monthly fee, and the account becomes inactive; meaning you have to pay to activate it again should you want to use the phone again.
The setup process wasn’t as smooth as I would have liked it, but the customer service more than made up for it. When you activate your phone online, you are only given a choice of three different numbers, which will have a 289 area code (or at least, all of mine were). The area code for my area is 905. They claim it will act like a local number, but I wasn’t particularly satisified. This could still be confusing and ambiguous for people trying to call me. Virgin does provide free phone number changes after activation is complete though, and I was assured that I would be able to get a local number eventually. So, after activation with the ugly number, I needed to “program the phone”. Unfortunately their website died half way through, which was unsettling, so I called tech support.
Virgin mobile has the best tech support I have ever encountered. After choosing my lanugage, I was forwarded to a Real Person right away. Literally; there was no hold time. What’s more, the person I spoke with was accent-free and friendly. The representitive walked me through the steps to program my phone, and I went on my way. Once I had determined that everything was working as expected, I called back again and got my number changed. The number itself was randomly generated, but the area code was what it should be for local numbers. I was very satisfied. The service was again immediate and friendly.
My experience thusfar has been extremely positive. We’ll see how it goes.
I’m not comfortable giving out my phone number on the public internet, so if you’re reading this and want to know what it is, check my facebook profile, or get in touch with me.
I recently ran across something on reddit called the True Porn Clerk Stories. It is the self-told tale of a burgoning actress who is desperate enough for work to take up a job at a videostore. It is an Old Relic of the internet - I had stumbled across it many years ago but never had a chance to finish it, and lost the link. I was very happy to find it again, and I recommend it to any of my readers.
The writer has great style, and as I’m sure you would expect, a pretty open mind on pornography. It’s a good read.
Also for anyone who likes geeky things and politics, reddit is like a bidirectional digg with nested comments. As for the stories and the community, I for one thing they’re far better than digg and slashdot, but everyone has their own preferences. You’d do well to check it out as well.
I was a little bit embarassed to admit this, so I didn’t post earlier: I didn’t end up getting a job with Shotgun. For reasons not under my control, they were unable to hire me this summer. I’m still on good terms, and hopefully someday I’ll get a chance to work with them again; but not this summer.
Now that I’ve found some other work, I’m more comfortable with posting about it. I applied to and was accepted for a research position at UOIT, under the supervision of Dr. Heydari. I’ll be working with Dr. Heydari to model and simulate WAN networks, and more specifically the way that they fail. The concept will be that I will be simulating link and node failures, and watching what the network does in response. At first I will be using standard IP link failure handling, which is basically the stuff we learned in CCNA; routing protocols notice the change, and figure out the new best path, and then eventually converge. This takes between seconds and minutes. The goal is to make a huge improvement on this time within autonomous networks, possibly via a protocol called MPLS.
I’ll be working in an industry-standard network modeller and simulator known as OPNET. Part of my duties as a research student will be to study the capabilities of OPNET and find a way to fulfil the goals of the project. My first goals are to determine how to make a node or link disconnect, and furthermore, see if it is possible to disable all of the links within a certain radius of a coordinate (which will simulate severe a local outage, such as a natural disaster). The second goal that I have in the short term is to work on automation. I need to be able to get OPNET to load a topology, break the network in some way, log what happens, and dump that into a file for later review - all done thousands of times, in slightly different ways.
After that, I’m not sure. There’s a possibility might have to write some OPNET code (which is really just C with an OPNET library), in order to help with the modelling of MPLS and the improvement of speed of convergence. I’ll post more when I know.