jQuery DivFlip of MVC Partial

So you have a Partial in a div and would like to flip out the html contents with new results from just the partial… To para-phrase Obi-Wan ‘this is the JavaScript you are looking for’:

function Save() {
  var data = $(‘#PartialData’).serialize();
‘SavePartial’, data, function(result) {
    if (result == “success”) {
    else {

It uses jQuery to serialize form data, then an Ajax post sends the data to a controller action which auto-binds it to the model. All in all there are very few lines of code. If anyone needs to see the controller actions they can be found in this tiny sample project DivFlipExample.zip (click to download). It runs stand-alone and needs no database so is MVC noob safe 🙂

For the projects that pay my salary (high traffic public facing websites) we have a more sophisticated technique using JSON to read a .Net class graph of errors, success message etc passed from actions to the JavaScript. The JavaScript then does a divflip, redirect to next action, shows success or error messages as applicable. It is very simple too.

So, to the MVC experts out there: Am I missing something? RoR does this kind of thing auto-magically (so our RoR team says). For hours I searched Google on how to refresh an MVC partial without doing a whole page refresh. There were many people asking the same question and lots of people like my friend Rusty Zarse becoming very frustrated, but no-one had an answer that helped us. All the demos I used to learn MVC (MVCNorthwind, MVC Commerce, MvcMembership, Suteki, MVC Storefront) need full post-backs for anything semi-significant.

Posted in ASP.Net MVC | 2 Comments

Google’s shiny new Browser

Chrome is out, download it here: http://www.google.com/chrome. I know the title post was a little obvious, a quick web-search shows a stack of hits for it already 😦

Chrome is built on webkit and has worked fine for me on all my favorite sites so far, interesting tidbits:

  • Task Manger shows each tab is a separate process – for better stability one assumes
  • Love my new desktop shortcuts to gmail, hotmail etc 🙂
  • The new tab option shows screenshots of favorite pages – cool
  • Starts-up fast, renders fast 🙂
  • Username/ passwords were sucked out of Firefix – creepy
  • It evilly dropped a shortcut into my quick launch bar, grrr

So it looks like us web-devs will soon have three mainstream browsers to test for 🙂 All the more reason for everyone to start using JQuery etc.

Posted in Technology | 1 Comment

MVC guru == PhD wannabe?

This is a plea to anyone who blogs, writes or talks about ASP.Net MVC. This stuff is pretty simple, let’s not scare people away.

In the last four weeks of learning MVC I have:

All are guilty of requiring niche knowledge in some or all of:

  • Domain Drive Design
  • The Repository Pattern
  • JSON, REST etc
  • Automated Developer Testing
  • Mocking Frameworks
  • Active Record, NHibernate, LINQ to SQL – insert any other non mainstream data access technique here
  • Differences between MVC, MVP, Front Controller etc
  • Lamda expressions

Apparently every educator is trying to showcase their knowledge in a manner that is inaccessible to 95% of developers.  The presenters I saw at NYC are great guys, but almost all the faces in the audience soon were blank as decks became PhD thesis material. We soon dwindled down to ~50% attendance. I chatted with several ‘regular guys’ over lunch and they were pretty annoyed – what they need to see are simple samples.

Missing Samples: Hopefully the Manning book will improve before publication – the first chapter got me going with the framework, but the rest was almost useless to me. People who care about DDD, MVC details etc already know about them. What we need to see is samples of Grid controls, binding data to controls, how we get data back from a postback etc. At work we soon had screens working with jQuery and ext; perhaps because we do not worry about DDD, strict patterns etc?

Of course there is the argument that MVC is not targeted to all developers and only super-intelligent ones will understand MVC. Poppycock, RoR has been a huge success due to its simplicity – how many RoR developers know they are using Active Record? Not many I would gamble; most RoR people just want to build something quick and don’t have a CS background. MVC is not that hard, let’s present it clearly and simply guys.
Oh yes, and I do think the ASP.Net Framework is heading in the right direction. There again I love NUnit and wrote my own MVC framework for WebForms back in 2003 as I did not know how else to test my ASP.Net screens.

Posted in ASP.Net MVC | 3 Comments

DD-WRT on Linksys WRT54G v8

Update: Since writing this post in 2008 Linksys have produced v8.1 and v8.2 routers which may not be compatible with the instructions here. Luckily there are now ‘official’ guides for the dd-wrt site for v8 routers:



Many sites say v8 of the WRT-54G routers cannot be flashed with DD-WRT. I have now done this twice and here are simple instructions – these are re-worked from bauer-power who’s post I came across when fearing my first attempt bricked the router. First try on a v8 took me over two hours mostly in Google/ Forums, second time about ten minutes with these steps:

  1. Go to (default user/pass is admin/admin)
  2. Click on Administration tab, then click on Firmware Upgrade. Upload vxworkskillerGv8-v3.bin
  3. When you see ‘Update is successful, Rebooting….’ unplug the router for 120 seconds (some say to wait 120 secs BEFORE unplugging – do both to be safe)
  4. Plug in router, ping to verify it is still alive (you may have to hardcode static IP settings on your PC to have a gateway of, subnet and IP )
  5. Run the Linksys Tftp Utility, uploading dd-wrt.v24_micro_wrt54gv8.bin with these settings:
  6. Press Upgrade. When the upgrade GUI’s green dot appears press the router reset button
  7. Browse to and see the new firmware (default user/pass is root/admin)

If you are looking to flash another a non v8 router with DD-WRT I found these links to be the most helpful:
DD-WRT Installation wiki
Client Bridge Example (this is almost 100% correct for V24 firmware – you should have no problems following it)

Also be aware there are version specific firmwares on the dd-wrt website, but it may take you while to find them: Linksys is under the Broadcom (chipset) folder. More than likely a newer builder than I linked to will work with the v8, but I simply wanted another client bridge and have had one running with v24 for two months now.

Afraid to do this ‘hack’? Of the three Linksys routers I’ve flashed none became bricks. Heck they are only $40 now anyway, but if you do brick one it looks they are not too impossible to recover:
Recover from a bad-flash (unbrick a dead router) wiki

So Why did I do this?

This was left to last as the news that we can flash Linksys routers is years old. Still even me -a tech blog addict- was still not 100% sure what a wireless bridge is, and how to link to wireless networks into one seamless network. We need access points in many locations, but are renting so cannot run cat5 everywhere. Yes I could buy custom wireless adapters for the xbox (xbmc), HTPC, NAS drives, PCs and printers but they normally cost $80 or more each and are no where nearly as flexible as a DD-WRT flashed router which has 5 ports. Also the new V8 WRT54G router I bought for my theater room was losing the plot when the PS3 was turned on – I have no idea why but the voip phone etc would all lose their connection. Since being flashed it has been 100% stable.

This is a sample wireless bridge, to the machines it looks like one seamless network:

We now have three WRT54 routers with DD-WRT. One is a primary and two more are client bridges.. one for the xbmc and for my main PC in an office room. They seem to play fine together. The two client bridges have five Ethernet sockets as the wan port was reconfigured by DD-WRT. This is fantastic for many reasons, e.g. when moving large files I can plug a laptop or NAS drives into the same wired network. WiFi is fine for streaming media, but you trying moving a 10GB VirtualPC image or 4GB TV recording over WiFi and you’ll see how much faster/ reliable wired networks are.

Posted in IPTV, Technology | Tagged | 14 Comments

DDD6 UK Code Camp

For my slides and NAnt + Cruise Control config files click here.

DDD6 was the 6th UK ‘code camp’ and I was luckily enough for my session to be voted in. Many people missed out attending because there were ~450 registrations in 24 hours!! Everyone I met was incredibly bright – most of the tough questions I asked in my Continuous Integration session were immediately answered, by sometimes what seemed half the room!

Comparison to with US Code Camps is pretty easy. The UK version is was excellent too. Classic cultural differences were there: a little less pizazz, and the average attendee weighing 20->30 lbs less. Note the cycle racks outside reception in the photos below, if US gas were $9/gallon I think we’d be slimmer too.

It pleases me greatly to report TDD/ Automated Testing is certainly gaining traction with the .Net community here. Many people told me Mike Hadlow did an excellent talk on using Inversion of Control (IoC) with TDD. Speaker of the day must go to Ben Hall who gave an overview of xUnit tools, including MBUnit which he contributes to. Apparently Ben is a fairly recent grad and this was his first presentation – watch this guy he will do well!

Ben, Mike, Richard Fennell and Michael Foord blogged this event. Barry Dorrans shares some photos. Update: even more was said about the day here, here, here, here, herehere and here!

Ben Hall Presenting

Ben Hall – future tech superstar (no, not the back of his head, he is the guy speaking)


Microsoft UK at 7am in Winter- brrr!


Just before I left the speakers’ lounge to meet some smart people


This was in the halls, along with life size Halo characters!

Posted in Presentations, Tech Events | 3 Comments

How to suck at Presenting

Presenting involves elements of luck, I think we can rely less on luck…

After a series of extremely well received talks for the Atlanta .Net group I almost bombed last time. Not a total disaster and luckily few were present to witness it. I had given the presentation very successfully twice before, so what happened?

The Excuses

Late notice: I stepped in very late to fill the slot and did little preparation
Lack of Preparation: The only preparation was testing the demos and skim reading slides
Lack of enthusiasm: Lariam still affects me slightly, that was one of those weeks

Bad Luck

No crowd interaction: Advertising talks well in advance gets the word out and brings in people really interested in the subject – just one eager audience member can spur interest for others
Bored Blank faces: Need to learn how to handle this

Problems with my Old Style

Need short 10/15 minutes segments: The Cruise Control .Net talk was pretty technical, each section building on the last. If I lost an audience member they stayed lost. If one demo fails it could destroy every subsequent demo.
Relying on audience interaction: Good interaction makes for killer presentations – everyone learns and everyone has fun. I was relying on it, don’t!
Deja Vu: When giving the same presentation several times it feels insincere, especially when repeating jokes. This must be an experience thing, Comedy School could help too.

Posted in Presentations | Leave a comment

UK: DD6 on Nov 24th

== UPDATE: Registration is full. It took just a few days!!  ==

Registration is now live, these free conferences always fill up fast so register right now!

It is on a Saturday at Microsoft’s office in Reading and there are some great looking sessions – some good ones are bound to overlap with my slot 😦

See you there… Developers, Developers, Developers!

Posted in Presentations | Leave a comment