datejs - the javascript date library that will let you work with dates like a ninja

Some thoughts scribbled down on Thursday 16 April 2009 at 07:50 AM

Dates in Javascript have always been a bit of a pain to work with because of the very limited API. Take this for example: Parsing a date string and adding a week var d = new Date(Date.parse("15/04/2009")); d = d.setDate(d.getDate() + 7); The above code is painful and unintuitive. Enter DateJS The above can be written like: var d = Date.parse("15/04/2009").next().week(); Or.. var...

Read more...

jQuery 1.3 - Case Insensitive :contains()

Some thoughts scribbled down on Wednesday 04 March 2009 at 06:24 AM

Ran into a bit of an issue today when I upgraded the jQuery on a website I was working on to the new 1.3.2 version . I got the following error: Object doesn't support this property or method. There is a fix for this. You will need to update your jQuery extension code to the following: $.extend($.expr[":"], { "containsNC": function(elem, i, match, array) { return (elem.textContent...

Read more...

ASP.NET Dynamic Data - Display Custom Text in a Foreign Key DropDownList/ComboBox

Some thoughts scribbled down on Tuesday 24 February 2009 at 01:21 PM

I got asked a question recently about ASP.NET Dynamic Data and how to customize the display text of foreign key dropdownlists/comboboxes The exact question was "I have a foreign key to a list of store locations. Each location has an address but the default drop down only shows the state. How do I get it to show: "State - Region - StoreName" Here's how you do it: Create a partial class...

Read more...

Visual Studio 2008 - Join the dark side *UPDATED*

Some thoughts scribbled down on Tuesday 17 February 2009 at 06:27 AM

Thanks to all those who pointed out my settings file was corrupted. This was indeed the case. Here are the new files: Envy VS PR 7 (thanks damieng) Settings file Download and install the fonts first as my settings relies on the font. Note: My settings are based off Tomas Restrepo's Ragnarok theme . Check out his site for more themes To import the theme please see my previous post Visual Studio - Join...

Read more...

Debug cryptic WCF errors with WCF Tracing and the Microsoft Service Trace Viewer

Some thoughts scribbled down on Monday 16 February 2009 at 01:13 PM

While working on a project involving Silverlight and WCF REST I ran into some errors that didn't give me much insight into the actual problem. The error I got was: System.Net.WebException: The remote server return an error: NotFound The usual culprit is the message returning data greater than the default MaxMessageSize of 64K. In my case I was sure my message less than that. I followed the following...

Read more...

Dynamic Data - Formatting Values

Some thoughts scribbled down on Friday 23 January 2009 at 01:27 PM

I had a quick question from Justin King just now about how to format a money field to be currency in ASP.NET Dynamic Data . There are a few ways to do this. You can specify the format at design time by using the DataFormatString property on the DynamicControl Or you can specify this on the model itself through metadata and the DisplayFormatAttribute public partial class OrderMetaData { [DisplayFormat...

Read more...

jQuery 1.3 released!

Some thoughts scribbled down on Thursday 22 January 2009 at 06:47 AM

jQuery 1.3 was released and the most useful new feature is the live event! Previously in older versions when you dynamically added new DOM elements into you page your event handlers would not automatically be attached to those elements. You run into this issue a lot if you use AJAX or are creating lots of elements on the fly. The only trick before this new feature was to rebind all those events whenever...

Read more...

Dynamic Data - Working with ASP.NET Membership provider and hiding the aspnet tables using T4 Templates

Some thoughts scribbled down on Wednesday 21 January 2009 at 06:03 PM

There are two ways to work when using ASP.NET Dynamic Data : Automatically Scaffold everything Scaffold only those tables you specify Scaffolding manually is alright but you need to remember to add the ScaffoldTableAttribute to the new tables you want managed by ASP.NET Dynamic Data I prefer to let it automatically scaffold all tables so as I'm developing and changing the database schema I automatically...

Read more...

Dynamic Data - Validation

Some thoughts scribbled down on Wednesday 21 January 2009 at 05:15 PM

ASP.NET Dynamic Data is fantastic in that it automatically picks up simple validation straight from your DBML/EF model. It will pick up things like required fields, data types and maximum lengths. You can also manually assign validation rules to your classes using metadata and validation attributes. The following is a list of available validators from the System.ComponentModel.DataAnnotations namespace...

Read more...

Cross browser copy and paste - with JQuery.Copy

Some thoughts scribbled down on Wednesday 17 December 2008 at 07:21 PM

Thank god for JQuery and addons The Scenario I was working on a client project for SSW when the client reported a bug in the web app. The bug involved a dynamically generated mailto link that got updated when you selected multiple employees. The client was reporting an error when he selected more than 10 employees to email. His Lotus Notes mail client popped up an error saying: Error processing command...

Read more...