Archive for February, 2010
Here’s an interesting little tip for anyone who’s writing a C# and/or any .NET application.
I’ve been writing/maintaining a relatively large application used by many different users, and have discovered many bugs that can come up over hours and hours of use. Well, us programmers are all just human, and don’t always write bulletproof code, especially when that code is run by 10′s or 100′s of different people. Most of the time when something bad happens, an exception is thrown by the application. If this exception goes unhandled, the program just crashes. It would be kinda handy sometimes to be able to catch each and every one of these unhandled exceptions, and at the very least log the problem and gracefully exit the program.
This is pretty trivial to do in any .NET application, and for an example using C#:
The first line adds an event handler to the ThreadException event, which will be fired every time an unhandled exception happens inside the main UI thread of the application. So, if you have, say, 2 separate components to your application running on 2 different threads ( the main UI thread…Windows forms stuff, and a processing backend), you could gracefully shut down and restart the UI.
For the 2nd line, this tells the application to handle all exceptions, regardless of what the user has set in the application settings. This is directly then made use of in the next line, where we add an event handler to the UnhandledException event on the Current Application Domain. This way, any other unhandled exceptions from any other threads that are running in your application will be caught and this event will be fired with all the information you need. In my case, I gather up the exception details, allow the user to enter a description of what they were doing, and send an email to myself with all these details.
The one catch when dealing with unhandled exceptions is that once they occur, even if you catch them with this method, you won’t be able to recover from the crash. The programs is going to exit, regardless. But, like I said, at the very least you can log the error in some way, so you can figure out what went wrong and prevent it from crashing again.
I just figured this might help any potential .NET developers out there. I pulled most of this from Microsoft’s MSDN site here.
Until next time…
Well, it’s that time of the year again, where the whole world (or at least the US and Canada) sit down this Sunday to watch one of the biggest sporting events of the entire year, the Super Bowl. Some people watch it for the game, others watch it for the ads. Some people just watch it to see what all the fuss is about. To me though, I’m a die hard football fan through and through, and there’s no bigger event than watching the game that will crown the champion of the league of your favorite sport. No different than the Stanley Cup finals or the World Series are to hockey and baseball fans respectively.
This year, the “big game” is between the New Orleans Saints and the Indianapolis Colts. For the first time in 16 years, the #1 seed out of each conference will face each other in the Super Bowl. New Orleans went 13-3 this season, and played very well in the playoffs. They handedly beat the Cardinals 45-14 in the Divisional round, and beat Brett Farve and a turnover-ridden Vikings team (in overtime) 31-28 to make it to the Super Bowl. For the Colts, they shut down Joe Flaco and the Ravens 20-3 in the Divisional round, and promptly dismantled the league’s #1 defense in the Jets for a win of 30-17. For the Saints, it’s their first trip to the Super bowl in franchise history, and for the Colts, this will be their 2nd trip in 3 years (including 1 win).
As for who I would pick to win, it’s a tough call. Emotionally, the Saints will be there. They’re playing for a devastated city and franchise pride. Not to mention they have a great offense, both passing and running, along with a very good defense that can mess with the heads of their opponents. But, the Saints have also shown their weaknesses. They played horribly during the last stretch of the season, losing to my Cowboys (which was awesome, by the way), and then lost against 2 divisional rivals (and 2 very poor teams) in the Bucs and Panthers to round out the season. They had a great game against the Cardinals in the Divisional round, but even after forcing 6 turnovers from the Vikings, they only managed to beat the them in overtime (and arguably would have lost had it not been for Brett Farve making a huge mistake and throwing an interception while the Vikings were in field goal range at the end of that game).
For the Colts, it’s “been there, done that” for Peyton and his crew. Offensively, they stack up pretty much equally. Defense is a bit more questionable (especially if Dwight Freeny is out), but the one thing the Colts are good at is consistency and poise. They never get worried. They’ve been down going into half more than any other team this season, and have mounted so many 4th quarter comeback that is ridiculous. And Payton Manning is a coach right on the field. It won’t matter what the Saints throw at him. He will adjust and promptly score at will come the 2nd half. For the Saints to keep up, they will have to match the Colts point for point.
In the end, I think it will be the Colts, 31-28. But, that’s just me. I guess we’ll see in the final result in a couple days.
Until next time…
Mass Effect 2 is awesome…that is all….
I suppose I should back that up a bit, eh? I’m gonna warn you though, in the interest of full disclosure. I’m a bit of a Mass Effect fanboy, and therefore my views may be a bit biased. So, take these impressions for what you will. For that reason, I won’t be doing a full review on this game either.
This game is such a huge improvement over the first. I won’t lie and say the game is much different overall. It still feels very much like the Mass Effect we’ve grown to love. But, what Bioware has done is they practically took every single complaint about the first game, and either removed it, or fixed what was wrong with it. No more randomly driving around planets in the Mako. No more horrible inventory management. And no more long elevator rides!! There’s a lot more that they improved/changed, but to me, these were the big glaring problems in the first. The rest of the problems, for example framerate (which they fixed this time around) wasn’t so much a problem because of the style of game.
I’ll expand of these 3 things in particular…
First of all, the planet exploration bit it totally gone. Well, maybe not totally, but it’s completely changed. Instead of driving around on every planet you can land on, you now fly (actually control your ship) from system to system, planet to planet, and scan the planets, one by one. The scanning only takes 2 seconds, and if you happen to come across an anomaly, the system will alert you. You can then choose to land, and you’ll be placed on a very specific mission, with totally different environments every single time. No more cookie-cutter warehouses. You can also choose to scan the planets for natural resources, which are used in upgrades….I’ll go into that next.
For the inventory system, they’ve scrapped the entire system from Mass Effect 1, and have gone with something completely new. You don’t pick up individual guns anymore. Instead, you pick up sort of these blueprints for the guns. These blueprints are sent up to the Normandy, and you can now equip any team member with that gun (as long as their trained to use that type of gun). For armor, you no longer equip individual teammates. You can only customize your own. You can purchase armor upgrades for your own armor at the various stores, but all are variations on the stock N7 armor (unless you got some of the collector’s edition or pre-order armors). As for the upgrades, you can buy the upgrades (or I guess I should say the right to upgrade), and then use the raw materials from scanning the planets (as I said above) to actually unlock the upgrade, which is automatically available to everyone. Really, really slick.
Oh, and no more elevator rides either. In the first game, the long rides were used to mask loading times, and loading times still exist, but they’ve gone and created a custom load screen for almost every situation in the game. I won’t go into much detail here, but it’s just an incredible amount of detail and polish….just awesome. They even make fun of the old elevators during once scene. Hilarious.
Well, I suppose I’ve spouted on long enough for now….I’ll post again in a few days with some more impressions.
Until next time….