Blog

Driving Gloves

Ever since getting my new car back in September, things have been great. That is, until things started getting colder. Besides having to brush off snow/ice after every snowfall, the cold weather also makes driving more uncomfortable.

More specifically, holding a cold steering wheel after you’ve just spent the past few minutes outside chipping ice off of your car sucks. Not having the benefits of a heated steering wheel (do such things exist?) I was left with the option of keeping my gloves on while driving, at least until the car warmed up sufficiently. The only problem was that my gloves didn’t provide enough grip and thus driving wasn’t as fun.

Continued

Handling mutable fields in Java

In Java, a mutable object is one whose state can be altered after it has been instantiated. An immutable object is one whose state is fixed after instantiation; that is, the data represented by the object cannot be changed in that object. Perhaps the most well-known immutable type is the built in String class; while there are methods on the String class that seemingly alter its state (such as toUpperCase() and trim()), in actuality these methods return a new String object if changes had to be made. In this article I’ll discuss how mutability will affect how you expose private fields in objects.

Pop Quiz

Consider the following code fragment. We create a MapContainer object, and then get the contained map, which is guaranteed to have a certain value associated with the key “today”. We then alter the value associated with this key, using our local reference to returned map. We then query the MapContainer object and get the contained map again. What is the value associated with the key “today” in this map?

final MapContainer mapContainer = new MapContainer();
final Map<String, String> map = mapContainer.getKeyValuePairs();

final String today = map.get("today");
assert null != today;
System.out.println(today);  // Returns the current date-time.

// Change the value using our local reference.
map.put("today", "tomorrow");

final Map<String, String> mapAgain = mapContainer.getKeyValuePairs();
System.out.println(mapAgain.get("today")); // What is output?

Don’t waste too much time on this problem, as it’s a trick question. The answer actually depends on the implementation of MapContainer. Depending on how it’s implemented, the second output could be unchanged from the first or be changed to the new value of “tomorrow”.

Continued

A (Canadian) Coalition of the Willing

Or perhaps the title should be, A Coalition of the Willingly Stupid. Canadian politics, normally a nice and relaxing reprieve from the politics to the south of us, has suddenly taken an unexpected ride on the rollercoaster, with talk of a “constitutional crisis” and “undemocratic seizures of power”. (You’d think this was an underdeveloped country ruled by a despot) It seems as though the opposition parties are intent on removing the current Federal Conservative minority government from power, using any means possible.

Continued

Getting Feedback with UserVoice

When developing any application, getting proper user feedback during the early stages is essential if you want to have the application suit your customers’ needs. Often this is done with staged tests, but with web applications you can have the benefit of using an online method of retrieving your users’ opinions.

However, doing so can be tricky. If you want to get feedback, you can implement your own system for soliciting it, however, this takes up extra time that could be used to further develop your core web application. Alternatively, there are some existing online services that can provide survey-like questionnaires to users, but honestly, these present more trouble to the user than they’re worth.

When I first started using Stack Overflow, I noticed that the feedback service they had been using, UserVoice, was an elegant and functional solution to this problem.

Continued

Google’s SearchWiki: Promote Search Results!

Yesterday, Google launched its SearchWiki tools, which allows registered users to promote or remove entries from a Google search to further personalize results. This will allow users to customize and tailor the results to what they’re interested in, but it’s worthwhile to note that Google has probably done something similar with their personalized search histories, already offered to registered users.

A few things to note: Firstly, while the act of promoting or removing a search result seems very akin to Digg, the result is not the same. The changes you make only affect your own search results, and Google is very clear on this. However, it would be madness to believe that Google would not use the data gathered from this social experiment to further improve their algorithms. You also have the option of adding your own results to further personalize your searches and there is an option for seeing what others have recommended/promoted or removed, providing for an interesting social experiment.

Continued

Stack Overflow is a great community and resource

When Stack Overflow publicly launched back in September, I registered immediately after learning about it from a coworker. The product of Joel Spolsky and Jeff Atwood (among others), the site aimed to be a collaborative Q&A site focused on programming and software development. You could ask questions or provide answers to any of them. In their own words it was combination of “Wikis, Blogs, Forums, and Digg/Reddit”. Furthermore, they made no attempt at hiding the fact that they were designed to be better than other questionable sites, such as Experts-Exchange.

Though I registered over two months ago I’ve mostly been lurking since, but have been most astounded by the rate at which questions – often complex and very specific issues – get answered. Since the site allows users to rate/vote up other people’s answers, it provides an incentive for users to give good answers that will be recognized by others, gaining them points and increasing their “reputation score”. In this sense, it’s like Digg, but with a global ranking system.

Continued

Subscribe to Comments for E-mail notification of replies

In response to the numerous comments received on my Acer Aspire One 6 vs. 3-cell battery comparison and subsequent full review, (thanks people!) I’ve added the popular Subscribe to Comments plugin to make dealing with responses easier.

Many of you posted questions in the comments, and having to keep checking back to see if anyone has posted a reply can be tedious and time-consuming. Instead, you can now subscribe to a comment thread when you post a reply; any subsequent comments will generate a notification that is e-mailed to you, keeping you up to date. The e-mail will also contain a link to where you can manage all the threads you are subscribed to and remove yourself from any subscriptions, so you have full control over what e-mails you receive. So don’t be afraid to use this feature!

The feature is disabled/unchecked by default until you enable it. This means it is purely an opt-in subscription, to prevent connotations of spam, which we all hate. I have tried it out and it appears to be working, but let me know if you have any problems.

Continued

Properly setting Axis Ranges and Data Scaling using the Google Chart API

The Google Chart API is a great way to dynamically create chart and graph images for any non-static data you might want to display to your visitors, such as stats for a runner’s training log.

Although you can use your own server-side solution for generating charts, using PHP’s GD Image Processing Library or even a fancy chart library like pChart, this can increase the drain on your server’s resources. Client-side solutions that utilize the canvas element and jQuery or Flash can be very nice and easy to use, but may slow down the browser if there are a lot of charts.

Google Charts offers a nice trade-off; by using their service you offload the processing and bandwidth and get back a simple PNG image, but you must learn to use the API. Additionally, there’s also the risk that the service may throttle you, even if there’s no current usage limit.

Problems specifying Axis Ranges – Data points are not changed!

The API for Google Charts essentially consists of passing different query string parameters and their values and getting back a PNG-format image. As a result of this, passing in parameters is a bit quirky, and information in the API guide is a bit sketchy in this respect.

Continued

The Beatles are coming to Rock Band!

Beatles and Rock Band

After much speculation about an upcoming game, it has been confirmed that the Beatles will be coming to a game produced by Harmonix, the makers of Rock Band. There is much to be excited about, besides the fact that this has to do with The Beatles.

Just the details, ma’am

Wired live blogged the event and while much of it is tangential ephemera, there’s a good summary at the top. The key points: The deal is exclusive, the game will be released during the 2009 holiday season, the game won’t be branded with the “Rock Band” name, and Giles Martin will be involved!

The lack of the “Rock Band” name was expected – The Beatles clearly didn’t want to dilute their trademark but from what I am guessing, the core gameplay will remain the same, with the “musical and visual journey” providing lots of trivia, information and history to placate rabid fans, such as myself. (Think of it as Rock Band fused with The Beatles Anthology)

Continued

Extracting X509 Extensions from a CSR using the Bouncy Castle APIs

The Bouncy Castle Cryptography Java APIs are an excellent set of APIs that act as a provider for JCE and JCA. Additionally, they take care of the mundane and tedious (some would say overly complicated) details involved in reading and creating the data structures associated with the X.500 and PKCS standards. (The APIs are also available in C#, for .NET developers out there)

One thing they handle well is the concept of certificate extensions. X.509 v3 certificates introduced the concept of these extensions, which are basically additional (potentially optional) fields containing information not contained in the older original X.509 specifications. Each extension is specified by an OID (Object Identifier); a good list of these extensions is available.

While it’s easy to read these extensions from an existing X.509 v3 certificate using the Bouncy Castle APIs it is a bit more involved to read these extensions from a Certificate Signing Request, or CSR; this is the data structure that is sent to a CA to request a certificate. The CA then reads the data from this and creates a signed certificate issued to the requester. In this guide I’ll present a brief way to extract X.509 extensions request from a CSR so that they may be included in the resulting issued certificate.

Continued

View all entries by month or by category