One of the tasks my team was assigned was the ability to implement auto tabbing in a web application. 98 percent of the population would cringe as they read the previous sentence because auto tabbing is not natural. It is a business requirement, and because the business wouldn't budge on the feature, it HAD to be done.
Enter jQuery AutoTab by Matthew Miller
AutoTab is fairly simple, as are most jQuery plugins. It just extends the jQuery namespace adding a function called autotab. Apply this method to any text box, enter target, previous and format and the plugin does the rest for you.
Without copy and pasting the details of the plugin, click here to see the documentation.
Thursday, July 23, 2009
Thursday, July 9, 2009
Linq saves the day when sorting ui lists...
Have you ever been in a situation where you have to write elaborate code to order a list of something by date and some of the dates are null? Well worry not, Linq is here to rescue.
Background:
This list contains an object that has a created date. The created date did not exist in the legacy database, and was therefore null. Unfortunately using Linq from o in list orderby o.CreatedDate descending didnt work.
Solution:
After some investigation, (and whining about having to do lots of work for simple gain), I discovered Union in Linq. Sure enough this solved the problem and i could bind to the repeater with the correct order.
Background:
This list contains an object that has a created date. The created date did not exist in the legacy database, and was therefore null. Unfortunately using Linq from o in list orderby o.CreatedDate descending didnt work.
Solution:
After some investigation, (and whining about having to do lots of work for simple gain), I discovered Union in Linq. Sure enough this solved the problem and i could bind to the repeater with the correct order.
Tuesday, June 23, 2009
To Mock-You or to Moq?
Recently I have been introduced to a mocking framework build specifically for .net 3.5 and C# 3.0. This framework is called Moq. More information, downloads and documentation can be found @ http://code.google.com/p/moq/
As a brief introduction, Moq is simple. That is all their is to it. The complexity of record and replay has been completely removed from the framework, well actually it was never introduced. We all know how annoying it was to learn the syntax of record and replay, and even once you understood it, really you still didn't.
Moq takes advantage of LINQ and Lambda expressions to do all the work. Here is an example of a simple person presenter test:
Moq makes learning and using mocking simple.
As a brief introduction, Moq is simple. That is all their is to it. The complexity of record and replay has been completely removed from the framework, well actually it was never introduced. We all know how annoying it was to learn the syntax of record and replay, and even once you understood it, really you still didn't.
Moq takes advantage of LINQ and Lambda expressions to do all the work. Here is an example of a simple person presenter test:
Moq makes learning and using mocking simple.
Subscribe to:
Posts (Atom)