Maximum PC takes an in-depth look at the stable and beta releases of the big names in the browser wars, rounding up in all 9 incarnations of browser’s competing to be your gateway to the web (Firefox 3 and 3.1 beta, Internet Explorer 7 and 8 beta, Opera 9.6 and 10 beta, Safari 3 and 4 beta, and Google Chrome). We recently walked you through our browser speed tests, putting the latest and greatest browsers through the paces, but if you’re looking for a more in-depth examination, the MaxPC article is seven pages full of charts and graphs thoroughly evaluating each offering. [Browser Battle: Nine Browsers of Today and Tomorrow Compared]
Monthly Archives: March 2009
An Exhaustive Look at the Web Browsers of Today and Tomorrow [Browser Wars]
Magic Formation is a Circular Dock Launcher [Downloads]
Windows only: Application launcher Magic Formation adds a circular dock that can be triggered by hotkeys or mouse gestures—just draw a circle on the desktop to make it show up.
Using the application is fairly simple—just invoke it with your mouse gesture; adjusting the mouse gesture sensitivity through the options dialog is probably necessary to trigger the dock more easily. There are plenty of other advanced options in the preferences, from using a hotkey to trigger the dock to assigning a mouse key instead—making this interesting application worth a look for anybody in the market for a better application launcher.
Magic Formation is a free download for Windows only. For more ways to quickly access your programs, check out the five best application launchers, or get full-featured mouse gestures with previously mentioned gMote.
Free Book Helps You Stand Up to an IRS Audit [Tax Time]
Fred Daily, tax attorney and author of Stand Up to the IRS, has put the book’s entire content up online, and it’s a great read if you and the tax collectors are having some disagreements.
Photo by mjmalone.
Daily’s book runs topic-by-topic through the common audit points and taxpayer confusion, covering family and inheritance, self-employed and small business income, penalties and interest, and a lot of other ground. It’s also full of wisdom on what you should and shouldn’t worry about, which anyone who’s gotten the stark white envelope with the distinctive logo can benefit from. Get Rich Slowly likes, in particular, the 25 most frequently asked questions, and so do we. Free to read and print.
Improve Photographs Taken from Airplanes [Digital Photos]
Airline seats can give you and your camera lens an amazing vantage point over new locales, but washed-out lighting and skewed colors seem to be the norm. A Photoshop pro offers step-by-step fixes for your aerial landscapes.
Helen Bradley’s guide relies on Adobe Photoshop tools and terminology, but any pro-level image editor should have the layer, color, and level-balancing tools she’s detailing in the post linked below. If you’re prone to fixing photo mishaps on your own, Bradley says most airplane window shots need more strong whites and blacks, are over-saturated with blue, and need more even contrast.
From my own experience, Picasa’s “I’m Feeling Lucky” and simple slider tools usually leave me with unimpressive results, and your truly rare airplane shots could be worth the detailed digging in with an image editor. Found another guide or trick for fixing your shots from thousands of feet up? Tell us in the comments.
Turn Microsoft Word Into a Distraction-Free Editor [Microsoft Word]
The Microsoft Office Word Team blog details a number of options to streamline the Word 2007 interface, from hiding toolbars to turning Word into a full-blown distraction-free writing environment.
If you're just looking for a bit of extra space on the screen, the guide advises you to minimize the Ribbon by double-clicking on the tabs, set the Windows taskbar to auto-hide, and switch to Web Layout to let the writing area fill the screen. If you are looking for the full distraction-free effect, you can change the page colors and add the Full Screen button to the quick access toolbar—hit the link for the full walk-through.
For more distraction-free writing, check out the previously mentioned Writeroom for Mac, Darkroom for Windows, or do your writing online with Writer.
Xcode Code Completion
What follows is a quick review of how I use code completion in Xcode. Chances are that options and features exist beyond what I’ll cover here, so comments and suggestions are welcome.
Let’s say I want to insert a CGRectMake method. I can begin by typing CG and pressing F5 or Option-esc, which will popup a [...]
Offline Google Calendar Goes Live for Everyone [Offline Access]
Roughly one month after Google Apps users got it, Gears-powered offline access comes to all Google Calendar users. The same limitations apply, but it’s not a bad way to ensure access to your agenda.
Head to your calendar page and hit the “Offline (beta)” link to start the syncing process. If you don’t have Google Gears installed, you'll need to do so, and you'll be prompted to install shortcuts to GCal on your computer. The first sync only applies to your primary calendar, though—click the green checkmark in the upper-right and hit "Offline Settings" to bring more of your calendars offline. I didn't notice any kind of limitations, but Alex at Google Operating System wrote that his calendar only synced Feb. 4 through June 4 of this year when he synced his calendars today.
The big missing Feature Elephant in this online room is that you can’t create new events while you’re offline to sync up later. How will GCal offline be useful to you? Tell us your take in the comments. [via]
IKEA Planner Visualizes Your Dream Rooms in 3D [Downloads]
Windows only: IKEA has released its own 3D room design tool to help you plan the modernist, clean-lined kitchen, bedroom, or workspace of your dreams. Check out screenshots of what the Swedes have given us below.
IKEA’s Home Planner download site lists three separate downloads, but they all seem to be the same exact file of the same size, and feature the same planning tools. It’s a Windows-only tool at this point; anyone want to give it a shot in WINE on Linux or Mac and tell us how it runs?
Here’s the Home Planner in action:
IKEA Planner Tool is a free download for Windows systems only. Thanks empkae!
Use jQuery to catch and display ASP.NET AJAX service errors

If you don’t properly handle the inevitable errors in your web applications, you can expect your users to eventually react about like this guy. Since they typically squelch any server-side errors, AJAX service calls are especially problematic. In fact, they rarely even throw a client-side error when they fail.
Even when a client-side error is thrown, most users won’t notice it and the ones who do notice won’t know what the error means or what to do next. In fact, I’ve found that even many developers don’t notice client-side scripting errors that occur while they’re debugging their own applications!
To help you remedy this problem in your own applications, I want to show you one way that I handle AJAX service call errors with jQuery. To do this, we will build an error-prone web service, make an AJAX request to it via jQuery, handle the resulting server-side errors gracefully, and use a jQuery plugin to attractively present those errors.
Building an erroneous method
To experiment with error handling, the first thing we’ll need is an error. We could use throw() to raise a synthetic error, but let’s build a page method that’s apt to throw a couple of real errors:
[WebMethod] public static int DivideByZero(int Dividend) { // To fool the compiler into not saving us from ourselves. int zero = 0; return (Dividend / zero); }
If this method is called with a parameter that cannot be parsed as an integer, it will throw a type conversion error. If we do correctly call it with a string that can be converted to an integer, we’ll get a division by zero exception.
Using jQuery to call the page method
To interface with the page method, we’ll need an input field to supply the dividend and a button to trigger a call to the page method. Something like this:
<html> <head> <title>Division by Zero Utility v1.0</title> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript" src="default.js"></script> </head> <body> <input type="text" id="Dividend" /> <input type="button" id="Divide" value="Divide by 0" /> </body> </html>
Using jQuery to call an ASP.NET AJAX page method is easy once you understand the required syntax and a few quirks. In default.js, we can use jQuery’s click() to wire our DivideByZero method up to the input button’s click event:
/// <reference path="~/jquery-1.3.2-vsdoc.js /> // When the page loads... $(document).ready(function() { // ...attach an onclick handler to the Divide button. $("#Divide").click(function() { // Trigger a request to the page method. $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "Default.aspx/DivideByZero", // Supply the Dividend value from our input field. data: "{ 'Dividend': '" + $("#Dividend").val() + "' }", // Error! error: function(xhr, status, error) { // Display a generic error for now. alert("AJAX Error!"); } }); }); });
Notice the error callback function. This function will be raised in the event of any error or timeout when calling the service. For now, we’ll just display an alert() with a static error message.
If you were to run this example now, typing anything in the input field and hitting the “Divide by 0” button will result in the error handler being called. That’s better than nothing, but wouldn’t it be more useful to display specific information about the exception that occurred?
Inspecting the server’s response in Firebug
To improve the detail of our message, we need to dissect the error returned by the server and find where the specific detail lies. To accomplish this most effectively, I recommend using the Firebug addon to Firefox.
Using Firebug to set a breakpoint on the error handler, we’re able to inspect the request’s state at that point and quickly drill down to the information we’re after:

While the status of “error” may seem unhelpful, it is a useful bit of information in some cases. In a more sophisticated error handling scenario, it would allow us to distinguish between a server-side error and a timeout.
However, the undefined error parameter certainly is not helpful.
To find the detail that we need, we’ll have to explore a bit further. Our request’s XMLHttpRequest instance should contain what we’re looking for. Clicking on the green XMLHttpRequest text will shift the Firebug window to inspect that specific object in detail:

Now we’re getting there: The XMLHttpRequest’s responseText property contains a JSON object with all the detail that the server returned.
As you can see in the Firebug screenshot, the Message variable contains a more familiar .NET error. In this case, indicating that the empty string I submitted was unsuitable for conversion to the Int32 parameter that DivideByZero expects.
Making effective use of the error data
As a string, this JSON object isn’t quite what we need. The last thing we should do is try to parse the error message ourselves. While technically possible, it would be messy and prone to breakage, or require using an extra library such as json2.js.
One of the nice things about JSON is that it is a native JavaScript construct. Thus, JavaScript’s eval() will evaluate a JSON string and return an actual JSON object.
To take advantage of that, we can modify the error handler like this:
error: function(xhr, status, error) { // Boil the ASP.NET AJAX error down to JSON. var err = eval("(" + xhr.responseText + ")"); // Display the specific error raised by the server (e.g. not a // valid value for Int32, or attempted to divide by zero). alert(err.Message); }
Now, the properties of the error that we got a glimpse of in Firebug are available via the same dot-notation that you’d expect from any object. In particular, the errors returned by ASP.NET AJAX provide three variables in their JSON response: ExceptionType, Message, and StackTrace.
Note: I would normally recommend against using eval() to evaluate a JSON string. However, it is relatively safe in this case since these messages come directly from the .NET framework and do not contain any user-injected content.
Presenting the error message with jQuery
I’ve written about Mike Alsup’s BlockUI plugin before, showing you how to use it to display modal progress indication and confirmation windows. An often overlooked feature of the plugin is the ability to display basic “growl” style notifications.
See the demo at the bottom of this page for an example of that.
After adding a script reference to blockUI.js, displaying the error “growl” couldn’t be easier:
error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); // Display the error "growl", with a title of "Error", // the error message as content, and a 20s display time. $.growlUI('Error', err.Message, 20000); }, success: function() { // On the outside chance that our method manages to succeed, // clear any lingering error "growls". $.unblockUI(); }
Since it’s important that the user notice the error message, we can specify a much longer than default timeout for the “growl”. Twenty seconds in the example above.
The success handler is added to make sure any leftover error is cleared after a successful request completes. This avoids any confusion that would be caused by an error message remaining even after a successful request completes.
Because $.growlUI() is just a shortcut for a complex BlockUI usage, $.unblockUI() works on “growl” messages just as if they were $.blockUI() modals.
Note: As with the rest of BlockUI, these “growl” messages can be customized via CSS. For this simple demo, I’m happy with the default styling, but you can easily change it to match your application.
Conclusion
You should never assume your service calls are 100% reliable. This seems obvious, but I’ve encountered mountains of production code without error handling.
As you’ve hopefully seen in this post, it is trivially easy to add great looking error handling to your jQuery service calls. After all is said and done, you’re only looking at about 3-5 extra lines of code. This substantial improvement in usability is well worth the minimal effort.
We focused on an example of using a page method here, but keep in mind that this technique can be implemented to work with both page methods and web service calls.
Source
###
Originally posted at Encosia. If you’re reading this elsewhere, come on over and see the original.
Use jQuery to catch and display ASP.NET AJAX service errors
Video – Getting Started with LINQ in .NET 3.5
A few weeks back my company offered a free online webinar on LINQ technologies to help developers more easily make the transition to LINQ. While there was a great turn out at the webinar, I received several emails from people who couldn’t attend asking if I could provide a video recording of the webinar. It turns out that the audio for the recording wasn’t up to my standards so I put together a video that provides an introductory look at different LINQ technologies including:
- Lambda Expressions
- Extension Methods
- LINQ to Objects
- LINQ to XML
- LINQ to SQL
- LINQ to Entities
You can view the video here (46 minutes). If you’re interested in additional video tips or want to know about future webinars on .NET, SharePoint and Silverlight topics you can sign-up for the video tips newsletter here.
For more information about onsite, online and video training, mentoring and consulting solutions for .NET, SharePoint or Silverlight please visit www.TheWahlinGroup.com.
