jest

by David LaVallee 19. November 2009 22:25

As in surely you jest.

As in JSON + REST (why should this be hard at all?)

As in: "I need web services, but I don't want to construct and deconstruct XML to get data out of my C# based IIS server to my Javascript based client".

So, yesterday I built an ASPX page class that takes a JSON object as its "arg" and returns JSON data with the mime type "text/javascript".

On the server side the JSON gets fully deserialized into a C# System.Collections.Hashtable object. Each JSON type, dictionaries, arrays, strings numbers and bools become their equivalent C# types.

To use Jest you create your ASPX page by subclassing JestPage (instead of Page). Very abbreviated aspx file:

and a pretty simple code behind.

You implement the override method Jest:

The Hashtable is serialized as a JSON response. Excitement should be building at this point, so let's look at a full circuit use example.

Let's keep it simple, Here's my index.html:

The output...

Here's JestPage.cs which is the whole thing:

JustPage.cs (11.16 kb)

Tags:

Patterns

by David LaVallee 19. November 2009 21:28

As a student and practitioner of design, programming, writing and music I've come to see that there are sequences of ideas and relationships between objects that repeat again and again across domains. The best way I can illustrate this point is to talk about design patterns. Pattern language was introduced in a series of books by Christopher Alexander in 1977, that catalogued repeating patterns in architecture, buildings and landscaped spaces.

I think it is a very human thing to look for patterns, and to play with patterns, take a look at Aza Raskin's Algorithm Ink an implementation of context free grammar in the spirit of processing. Each of these shows the playful side of patterns.

Computer programmers use patterns all the time, in the 90's it was recognized that whether they know it or not most programming is CRUD, so gain some REST, learn the patterns.

Story tellers use patterns too, though our mentor in this case came a few thousand years before Chris Alexander. Aristotle wrote Poetics in 335 BCE. Poetics stands the test of time so well that my most recent book purchase is Aristotle's Poetics for Screenwriters by Michael Tierno (a script reader for Disney).

Pattern discipline is also evident in these areas:

...

Tags:

Ubuntu 9.10, Sun Virtual Box

by David LaVallee 12. November 2009 23:19

I am liking my HP dv7 laptop very much.

I had one small regret in that the 2GHz Core2 Duo Intel processor that it has does not support hardware virtualization, that means no Hypervisor Virtual Machines, that means no Microsoft Virtual PC or XP mode under Windows 7.

Yesterday Google announced the Go language, and I wanted to give it a "go".

First I installed Ubuntu 9.10 desktop on a USB key, downloaded all the google stuff and got to writing Hello World in one tenth of the time that it takes to do that with Windows 7 and Visual Studio. Very cool to have a USB flash drive that has a personal bootable system on it, but I really need multiple OSes for testing.

I'd heard about Sun Virtual Box, but after the less than fantastic experiences with VMWare Fusion One (VPC for OSX), Hypervisor and Virtual PC, I wasn't sure that it would be worth it to take the time to look at another virtualization platform.

Sun Virtual Box works great. The time from downloading Virtual Box... Installing Ubuntu 9.10... Installing updates... Installing Google Go... to running the Hello World a.out was about 40 minutes total.

Using Virtual Box to "hibernate" saving Ubuntu's running state takes about five seconds, as does restoring Ubuntu. That seems much faster than opening a document in Word!

Tags: , ,

© 2009 David LaVallée | 206.601.9322 | Resumé