Last week I sat down to create a proof of concept for a Visual Studio-style intellisense implementation written purely in Javascript. I’m quite pleased with the results, although it’s not very robust. Let’s cut to the chase - have a look at the pure javascript intellisense demo, or download an archive.

Now, let me explain what’s happening there before you get too underwhelmed. Basically, when you type, the script runs a tokenizer to split your previous text into chunks. When that tokenizer hits upon a delimiter, in the demo that’s the “.” character, it’ll send your previous token to the server and popup the result in the intellisense box. You can tab to the box and hit enter to select an option. Pressing tab also cycles through the options in the box.

What I’ve written is very simple. The tokenizer can be totally swapped out, so you could define your own rules for parsing your input and obtaining a token. And when the token gets to the server, you can interpret it in any way, returning anything back to be put in the intellisense box.

Like I say, this is proof of concept stuff only but I can definitely see applications for it. It’s been tested in FF3 and IE8 Beta - nothing else. I’ve got an SVN repo online and would happily accept patches or comments. Download Javascript Intellisense here.

I’ve blogged before about the enabling features of Monorail and Active Record, part of the Castle stack. Another piece of software which is making my development life a pleasure is ExtJS - a collection of javascript goodies created by Jack Slocum and his team - and when these three things come together, watch that coding fly…. I’ve created a screencast in which I demonstrate how easy it is to build a paging, sorting, filtering, AJAX-powered grid using ExtJS and Castle, and you can watch it here. It’s 20 minutes long but filled with goodness - and a couple of hacks (forgive me :). Don’t forget to check out all my past screencasts too.

UPDATE: As requested in the comments, you can MonorailExt1 VS Project directory of this.

Using Delegates in Refactoring

May 29th 2007, 1:13 pm in .NET, C#, JSON.

I’m doing some work on a .NET 1.1 application right now, and I have a situation where I have very similar code being repeated in a number of different classes. The code does paging of a collection, which is then rendered as JSON; it’s not complex code but it did take me a few goes to get right, and so rather than copying and pasting it all over the place I refactored it so the core functionality was only written once. In order to do that, I used delegates. (more…)

I’ve been using libraries such as NewtonSoft’s JSON.NET or AjaxPro to serialize a class to JSON. There’s something about my approach which didn’t really sit too well, and C# 3 has an elegant solution.
(more…)