Always Get Better

Archive for May, 2009

Minesweeper: The Movie

Tuesday, May 26th, 2009

What is PictureFreakz?

Wednesday, May 20th, 2009

Did you get an MSN message that looks like this? says (2:26 PM): ?!?


Be careful – this is a scam site that invites you to enter your login information and password – then uses it to rope in your contacts with similar messages sent from your account.

C#: using Statement

Thursday, May 14th, 2009

One of my absolute favourite statements in C# is the using statement (not to be confused with the using directive, which is what we use to import libraries like System.Web into our projects).

using forces us as programmers to be honest about releasing memory to the CLR. Whenever we use an unmanaged resource like an SQL connection or file IO handler, the garbage collector will eventually eliminate any open streams or connections associated with that resource. However, “eventually” doesn’t cut it when we’re dealing with SQL connections on a production server – we need to make sure the connections are released no later than when we’re done with them.

If you come from the C++ world, you’re probably (hopefully) used to calling delete to deallocate any memory you reserved. You also know that forgetting the delete (or delete [] on arrays) results in a memory leak. You might think of Dispose() as C#’s implementation of the delete statement.

using ( SqlCommand cmd = new SqlCommand( sqlStatement, sqlConnection ) )
// Do something

using acts as a try…catch…finally block, so if your code fails your object will still be disposed. The using statement keeps everything wrapped into a neat little package so you don’t forget to keep your local variables in scope.

Like I said, this is one of my favourite features in .NET (lock { } is similarly beautiful). You can use the same construct in VB as well.

Prevent Link Rot From Suffocating Your Blog or Web Site

Sunday, May 3rd, 2009
Anchor Chain
Creative Commons License photo credit: chefranden

Link rot occurs when a page linked to from within your web site becomes invalid. Visitors to your site who click on that link will receive a 404 “Not Found” message rather than the quality content they were expecting to find. This matters to you as a web site operator because:

  1. The value of your content is diminished because your well-selected links no longer provide value to your readers
  2. Search engines indexing your site treat the broken links as a sign that your page is out-dated and therefore needs to be relegated to the bottom of their indexes

Fortunately, it’s very easy to deal with link rot. Essentially it boils down to arming yourself with a link validation tool – I recommend Xenu as the best free tool for this purpose – and run it periodically (once a month should suffice for smaller sites). Xenu will point out which links on your site are no longer working and on which pages they can be found so you can take action. The only problem Xenu has is that Wikipedia blocks this application so any links you make to Wikipedia will have to be manually checked (but, you really shouldn’t be linking to Wikipedia anyway, it is not good reference material).

When you find a broken link, you have a few options available:

Fix It

Sometimes website owners change their site’s structure without regard for incoming links. When you operate your own site, try to take all possible steps to prevent this from happening. If you are the victim of this kind of foolishness, you may be able to go to the offending site and find your link’s new path.

Change It

If you have referenced a news article or other topical content, try searching for it on the host site as above. This kind of content is the worst for being removed by its owners when it is no longer current, but often the same content can be found on another news organization’s site. If that’s the case, make the change. The original site won’t benefit from your link, but they don’t deserve to anyway.

Remove It

If your content can be re-written so removing the link doesn’t reduce its usefulness, this can be an option.

Remove the Article

If your post is written in response to content that no longer exists, just delete your post since it isn’t useful anymore. Be sure to protect the validity of any incoming links by checking your site for any internal references to the post. In order to maintain incoming links from other web sites, you may consider writing a brief explanation as to why the content is no longer available and poitning toward some of your newer work.

Credit where credit is due: I thought to write this post because of a prompting from Problogger who featured an article dealing with link checking on blogs this weekend. I found a good number of broken links on my various sites and ended up re-discovering and updating content I hadn’t thought about for some time.

If Only Ignoring Pirates Made Them Go Away

Friday, May 1st, 2009
Creative Commons License photo credit: saxman1597

I’m sure they’re not unique in their philosophy, but StarDock games is a terrific example of a company which has taken the high road in the battle against software piracy. In principal, the company believes that if someone would steal/pirate their software, that person would not have likely bought it anyway if piracy wasn’t an option. To that end, the company stands against putting DRM measures – which they feel only serve to detract from the experience of legitimate customers – into its products.

The bet seems to have worked. Their newest title, Demigod, was last week’s #3 top selling PC game. [\] I haven’t tried Demigod, but I have a (legally purchased) copy of their Galactic Civilizations 2 title. It is refreshing to play a game whose developers have obviously focused on the software rather than on its protection.

As a software developer, I understand why companies would want to take steps to prevent piracy. It is a lot of work to develop software (and a lot MORE work to develop _good_ software). $60 for a title that cost thousands of dollars to produce doesn’t sound like a bad deal to me.

As a software end-user, I hate EULAs, dongles and CD verification. After spending my hard-earned money on a game or application I don’t want to be made to feel like a thief; just let me use the thing. Let me install my game to my hard drive and put the CD somewhere safe.