Welcome

This is the generic homepage (aka Aggregate Blog) for a Subtext community website. It aggregates posts from every blog installed in this server. To modify this page, edit the default.aspx page in your Subtext installation.

To learn more about the application, check out the Subtext Project Website.

Powered By:

Blog Stats

  • Blogs - 9
  • Posts - 717
  • Articles - 45
  • Comments - 348
  • Trackbacks - 3278

Bloggers (posts, last update)

Latest Posts

This Blog Has Moved

Hello all, this is just to let you all know that if you subscribe to this feed, it has now moved to a new home at http://blog.hmobius.com. Also, you may want to update the feed address in your aggregators. The new address is http://feeds2.feedburner.com/dansarchive.

Thanks for reading this blog and I hope you'll join me at the new address.

Dan

posted @ 1/22/2009 9:40 AM by Dan Maharry

Welcome to ReactionGrid

Some of you have caught up with what I’m up to these days via Twitter, others I’ve chatted to personally, but there may some folks out there who don’t actually know what I’m doing, and that’s entirely my fault.

Back in October, I think it was, I made the decision to step away from day-to-day SharePoint contract work in order to work with my good friends Kyle and Robin Gomboy on the ReactionGrid project. I’ve worked with Kyle and Robin for over a year now, first on Second Life, and more recently on OpenSim-based 3D virtual worlds. Together, we hosted the Heroes Happen Here event on Microsoft Island on Second Life, and we spent a long time reminding people that a virtual environment is not the same as a physical world environment, pointing out the potential of data visualisation, virtual collaboration and more – and then we started investigating the potential of OpenSim as a platform for making that happen and were amazed at how evolved it was.

Since that point, ReactionGrid has launched, and we now host a grid with around 76 regions, we have people joining the grid daily with fascinating and interesting projects. Seeing the potential of the platform, believing in the possibilities, and enthusing about it gave me so much more excitement and focus than in any part of my day job, and I came to the conclusion that I needed to put myself into this project as much as possible and see what could come from it. There is a real buzz and excitement around the grid, and some really interesting minds are involved in the project already. There’s nowhere else I would rather be right now than part of this project, because with so many interesting and intelligent people involved, this feels like the right place to be. As of January 1st this year, it was official – the three of us are equal partners in the ReactionGrid project. We all deal with slightly different aspects of the grid, but between the three of us we have a broad skillset that is absolutely necessary to get a grid of this size up and running smoothly, and get people in to the grid to make it so much more than a bunch of virtual land.

I spend my days doing all sorts of things – I have Visual Studio open all the time to look at OpenSim code, figure out what’s going on, and why the code is behaving oddly – and I can’t possibly say that I understand even half of how it works in any detail because it really is a vast project. I’ve concentrated my efforts, for the most part, on the SQL Server side of OpenSim, patching and improving the code there where I can, but that hasn’t stopped me from looking into other areas, investigating some interesting code, and submitting some other patches that have nothing to do with the data layer.

My main focus has been on making it possible to manage a large OpenSim grid. The main web interface for most OpenSim grids is MySQL-specific, so I have worked on a toolset incrementally based on what I know would make our lives as grid managers easier. The three of us now get alerted when new regions are added, when owners are changed – we live thousands of miles apart, so anything that helps spread the day-to-day news without IM overload is essential to us.

We only actually met together once, back in April last year, for a total of about 4 hours. When I mention this to people, many are baffled, but when you work in an environment such as this you can start to understand. We are in constant contact via IM, virtually on our grid, we interact all the time, we know each other well, having spent so much time talking to each other, working together - we are truly good friends, though it is a shame we are separated by that pesky Atlantic ocean!

So, that’s what I’m up to – I have a ReactionGrid blog for grid-related blogging, so if you are interested in that side of my life, head to the Ninja blog on the ReactionGrid site. I’m not leaving this blog, but I do use Twitter a lot these days, so if you are Twitter-enabled, follow dstrawberrygirl for my random ramblings! That’s probably the main reason why my blog has been silent all this long time :)

posted @ 1/17/2009 10:48 AM by Chris Hart

A Playlist for 2008

A couple of days late but there were a few CDs in Santa’s sack so here’s my track list of highlights from 2008. Not all from 2008 but I bought them then, so hey.

Guns and Roses - Chinese Democracy
It has to be said that if even one track from the unicorn that was the new GnR album was any good, then Axl Rose was going to exceed expectations. Then lo and behold, two tracks turned out to be OK. Don’t think I’ll be holding my breath for the next album though.

Gutter Twins - Bete Noire
The Gutter Twins’ Saturnalia is probably my album of 2008 - a gleaming, polished piece of melancholia from the lead men of the Afghan Whigs and the Screaming Trees. The arrangements are simple yet heartfelt and their voices aged old from years of abuse. Bete Noire in this case showcases Mark Lanegan’s almost sub bass vocals brilliantly. The link above is to a live performance in Helsinki, but you can find the album track here if you prefer.

Alps - Hallucinations
It would be easy to pull a tracklist just from the output of Type Records 2008 releases but for me, this is the highlight, a seven minute aural spliff. Dry and desert-like, the rolling bass figure is a calm anchor for the shimmering sounds the trio put over the top.

Portishead - Machine Gun
We didn’t wait quite as long for the new Portishead album as we did for “Chinese Democracy”, but the Bristolians delivered a much bigger punch than did those from Los Angeles. Ten years later, Third is a different, angrier beast from Dummy or the eponymous album but the quality control is just as high. The highly sample drum machine and pure John Carpenter breakdown towards the end (80s synth soundtracks ahoy) are a joy.

Ihsahn - Threnody
The second solo album, AngL, from Emperor’s front man was a revelation. While The Awakening was an obvious attempt to move himself away from the black metal sounds of his former band, AngL saw him not afraid to tread wheresoever he broke a path, albeit not mix-and-matching styles within individual tracks as Opeth would. Threnody comes late in the album; a calmer moment amidst a tightly focused storm.

Joe Satriani - Andalusia
I am an unashamed Joe Satriani fan and will probably remain so for a good while to come. Unlike the previous album however, the “Professor Satchafunkilus” album that appeared last year hadn’t the immediate appeal and bright songs of Super Colossal in 2006. This one required more listening to get past the standard issue with his songs that intro, verse and solo often jarred rather than flowing into each other. The final track however doesn’t have that problem. A homage to Spain in his own inimitable style, it begins with flighty flamenco guitars laying down theme and variations until his electric enters with a longform solo and more variations on a par with classics such as ‘Echo’ and ‘Slow Down Blues’.

Vangelis \ Scott Bolton - Launch Approval
Besides Ridley Scott’s Final Cut of the film and various HD box sets to accompany it, the 25th anniversary also saw the release of a 3-disc issue of the Blade Runner soundtrack comprising the original 1994 release, a second disc of more inserts from the film and a final disc comprising original music composed by Vangelis and collaborators taking inspiration from the sounds in recognition of the anniversary. For me, Launch Approval recaptures the spirit of the film the best. You can hear the police cars flying through neon-drenched snow between pillars of flame.

Slipknot - Danger Keep Away
A revelation for me this one. While they had their moments, the first two Slipknot albums were in general a bit Meh! for me and so I ignored them for a few years. Then All Hope Is Gone came out last year and by chance I saw the previous album, ‘The Subliminal Verses’ in a bargain bin and bought it for a laugh. And then got blown away by it. In a reversal of happenstance, there was but one bad track here and 13 solid tunes with the nonet confident enough not to rage through every track. Danger Keep Away closes the album, a brooding warning to be heeded.

Kingdom of Sorrow - Hear This Prayer For Her
Side projects have a tendency to imitate marmite - you either love ’em or you hate ’em. The Kingdom of Sorrow album has been a long time in gestation and while Kirk Windstein (Crowbar, Down) and Jamey Jasta (Hatebreed) have obviously been busy, this debut album is a bit of a one track pony. Listen to it from track 1, Hear This Prayer For Her, and you’re drawn into a rhythm and groove for the rest of the album but join at any other point in time and the hook is lost. Hear The Prayer then - either five or fifty minutes long. Linked is the (better) five.

Joseph Arthur - Morning Cup
By far the best find on the KEXP Song of the Day podcast, Morning Cup is a gentle greeting for a fine, warm spring day. From Arthur’s Could We Survive EP, one of four he released in 2008, for this we can forgive the facial hair borrowed from Liam Gallagher.

Fatboy Slim - Wonderful Night
The man Norm doesn’t often put a foot wrong in the Big Beat department and this three minute wonder from his Greatest Hits album is just one of many I could have chosen. Right Here Right Now is probably the best single dance track in history, but Wonderful Night is pure joy.

Mark Ronson - God Put A Smile Upon Your Face
I’m a bit late to the Mark Ronson party - the smarmy grin on Buzzcocks spoiled him for me and Lily Allen collaborations didn’t help, but I’m happy to admit that cockney girl and one other track aside (Yes, please do “Stop”) it is genuinely good. And this big band cover of Coldplay’s only upbeat tune in three albums is a great way to start the morning.

Meshuggah - Combustion 
Meshuggah have been due a good album for a couple of years and ObZen delivered in spades for the Swedish math-metallers. Harsh angular riffs, uncomfortable time signatures and drill sharp vocals characterize the sound they have delivered over several albums - like Tool but with extra hatred.

Clint Mansell - Together We Will Live Forever
Whether you know it or not, soundtracks are a true treasure trove for great music and Clint Mansell has composed several blinders since Pop Will Eat Itself broke up. This is from The Fountain.

posted @ 1/5/2009 10:16 PM by Dan Maharry

What would you like to see in the next edition of Programming ASP.NET?

With the .NET 3.5 cycle out of the way and ASP.NET 4.0 on the horizon, it's time to try and figure out a way to incorporate the many new features and techniques that have emerged \ been released into the next editions of ASP.NET books.

So then, what would you put in 'Programming ASP.NET 4.0' and what would you NOT put in it? Books are supposed to be for the programming community so here's your chance to have your say.

Feel free to add comments here or in the thread I've started on Stack Overflow about the same topic.

posted @ 12/1/2008 4:05 PM by Dan Maharry

Gallio \ MbUnit v3.0.4 Released

Jeff Brown has announced the release of Gallio \ MbUnit v3.0.4.

Today we are releasing v3.0.4 of Gallio and MbUnit.  This release incorporates many new features as well improvements for robustness.

New asserts, assertion diffs, 0rdered tests, Rollback, Repeat, ThreadedRepeat, R# 4.1, VSTS, CSUnit, TeamCity, Gallio.Ambience, clickable report links (IE/Firefox integration), and more...

Try it out!  Please be aware that there are now separate x86 and x64 installers.

Download here: http://www.gallio.org/Downloads.aspx

Documentation here: http://www.gallio.org/Docs.aspx

[...]

The whole alpha / beta thing got too confusing in the end due to scope creep so I dropped it. In any case, this release is pretty much feature-complete.

The full announcement and complete rundown of the new features can be found here on Jeff's blog. Congrats to him, Vadim, Graham and the rest of the team.

posted @ 10/17/2008 1:44 AM by Dan Maharry

MbUnit.Framework v2 Docs October CTP

Well, it's been a while and as Jeff leads Gallio into the autumn sunshine, it's time to push out a little something for those still using MbUnit v2. You may recall, back in August last year, we launched docs.mbunit.com. Regrettably, it's been quite static since then but now the monster is complete there's some progress.

Here then is a first draft of complete documentation for all the assert classes, attributes, helper and exception classes in the MbUnit.Framework namespace only as found in MbUnit v2.4. Call it the October 2008 CTP if you will.

You can download it from here on HMobius until I find somewhere stable to put it. Feel free to let me know what you think of the style, what other MbUnit namespaces you'd like documented in full either here or via the MbUnit-User group.

posted @ 10/13/2008 10:54 PM by Dan Maharry

Upcoming talk on SL and .NET

So I volunteered again for a .NET user group monthly meeting – this time I’m presenting a whole session on getting information into and out of Second Life using .NET on the server-side. If you can make it along on Saturday 27th at 12pm SLT, you may learn something about the following (agenda still to be confirmed!):


It's all about the data - storing data from SL externally, using external data in-world
                What can you store?
                What can you get in-world?
                How can you get data into and out of SL - HTTP, XML RPC.
The basics of HTTP - GET and POST
Making HTTP requests from SL
                Encoding request data correctly
                Handling a response
ASP.NET Pages and Handlers
                How to respond to data coming from SL
Using LSL to work with responses
                A brief overview of LSL lists
                Doing something fun with data
XML RPC - what is it? How can it be used?
                Walkthough of basic XML RPC code on the server
                Sending data in-world to a prim and doing something fun with it
Email – send feedback on a notecard, receive data
Future – LSL HTTP server (designed to replace XML-RPC) - still a work-in-progress
Breakout time!

 

Once I get slides and code demos ready I’ll package it all together for Saturday and make it all available after the event.

posted @ 9/23/2008 9:14 AM by Chris Hart

Expressing the Meme

Chris Hart has tagged me, so here are six random facts about me which are moderately interesting.

  1. I have, at various points, been referred to as 'Bamber', 'The Milky Bar Kid' and 'Beep', mostly in a friendly way. Sometimes not.
  2. The worst holiday I ever had was in Nice (sic). I intend one day to return and prove this was a fluke.
  3. I was, at one point, going to quit tech and become a session guitar player. It's still tempting
  4. For ten years, I helped out at the National Student Drama Festival. I still miss it.
  5. The first girl who ever kissed me was called Ruth. The first girl I wanted to kiss was called Angelique
  6. Of the schools and universities I attended, only one still exists as it was when I was there. And it ain't the university.

And, to perpetuate the meme, I tag Emma Jones, Emma Vieceli, Lou Barr, Ariana Osborne, Julia Gilbert and Vanessa Yaremchuk.

These are the rules. Should you break them, do it in an interesting fashion...

  1. Link to the person who tagged you.
  2. Post the rules on the blog.
  3. Write six random things about yourself.
  4. Tag six people at the end of your post.
  5. Let each person know they have been tagged. 
  6. Let the tagger know when your entry is up.

posted @ 9/6/2008 7:22 PM by Dan Maharry

Blog tagging

So I got blog tagged by Dana Coffey - and what does this mean? Well, I have to let the world know 6 random facts about myself. Here goes!

  1. I'm allergic to milk (diagnosed officially), and I think I'm allergic to almonds, possibly peanuts. Personally, I'd rather not test this out, so I just avoid them.
  2. I grew up with, at one time, 4 cats, a pair of lovebirds, two rabbits, and a tank of tropical fish. The fish died, Romeo killed Juliet, the rabbits tried making bunnies so we had to give one away... the cats lasted years, though.
  3. I once almost joined the RAF to be a pilot, but chickened out. Still would love to learn to get my pilots licence, and to fly a helicopter.
  4. I had ballet, tap dance, and modern stage dance lessons as a kid over around 13 years. During that time, I appeared on stage as a sailor, an icicle, a cat, and in quite a few outfits covered in sequins.
  5. Because of the dance lessons, I had real problems with my ankles as a kid, and once ended up off sport with ankle in plaster for 6 weeks. During all sports lessons, I would play on the BBC micro in the school, tinkering with BASIC programs. This may have had an impact on my chosen career.
  6. I used to go by the alias of Crustacean on several Telnet talker services (primitive chat rooms, for those of you too young to remember them) around the mid 90's, and it's because of those talkers that I ended up meeting my husband.

So, now, aren't you glad you read that? So, here are the rules:

  1. Link to the person who tagged you.
  2. Post the rules on the blog.
  3. Write six random things about yourself.
  4. Tag six people at the end of your post.
  5. Let each person know they have been tagged.
  6. Let the tagger know when your entry is up.

My victims for this are:

James Hart, Dave Sussman, Dan Maharry, Lou Barr, Kyle G, and Zain Naboulsi

posted @ 9/5/2008 1:38 AM by Chris Hart

Programming ASP.NET 3.5 Is Slated For PDC

9780596529567_cat Well, it’s been a while coming but it looks like Programming ASP.NET 3.5 will finally hit the shelves in late October just in time for this year’s PDC. Hurrah! So, to take a leaf out of John Papa’s blog, it’s time to take a few seconds out and thank those who were involved in its creation.

First off, my co-authors Jesse Liberty and Dan Hurwitz for their support and words. And to Lou Franco and Mike Pope as well for their contributions to the book. They were both timely and well received by those of us all worded out.

Second, to the reviewing team for the necessary evil of reminding the authors that their words are not the be all and end all of the subject and should never treat them as such. Especially when trying to incorporate ever-changing technology into a set of static pages. So, to Don Kiely, Eugene Osovetsky, Frank Wang, Scott Isaacs, Christy Henriksson, Kyle Beyer, and Miles Whitener my humble thanks, even if some of your comments made me want to throw the laptop in the bin because I knew you were right and it would mean writing another five or ten pages to cover the point.  Lou Franco and Mike Pope also get a second vote of thanks here because they not only provided really solid comments, they also decided to back their own comments up with words.

Next, thanks to the folks at O'Reilly. Lou Barr initially mentioned me to John Osborn as a potential co-author, so I thank her for the mention and John for getting in touch and then letting me get on with it at a pace I could manage. Brian MacDonald, Audrey Doyle and Rachel Monaghan have also been great as technical, copy and production editors respectively. I hope I'll work with them again (preferable on something smaller).

And finally, thanks to Jane for putting up with about thirteen or so months of the book-writing process.

Programming ASP.NET 3.5 is already up for pre-order on Amazon UK and Amazon US. Why not buy a copy?

posted @ 9/1/2008 10:31 PM by Dan Maharry

Catching up

I've been totally swamped with all sorts of projects recently, including hacking with OpenSim code, building a SharePoint deployment solution, building content for then hosting another fantastic event on Second Life, hosting Code Clinics on Microsoft Island every Wednesday, and watching Bob the Builder (we love BBC iPlayer).

From the recent code clinics I've had requests for some links and follow-up materials, so catching up on the past few weeks here's what I've got (it's not an exhaustive list, sorry, but I'll try to keep more notes following meetings in future!):

Data Access tricks - the Using statement

This one generated a fair bit of feedback from members who'd not discovered this extremely handy tool. With minor tweaks to your code you can ensure that data access code always closes your connections cleanly. For example:

Using conn As New SqlConnection(dsn)
  Using cmd As New SqlCommand("SELECT * FROM Employees", conn)
    conn.Open()
      Using rdr As SqlDataReader = cmd.ExecuteReader()
        While rdr.Read()
          Console.WriteLine(rdr(0))
        End While
      End Using
  End Using
End Using

And here is the C# version:

using (SqlConnection conn = new SqlConnection(dsn))
using (SqlCommand cmd = new SqlCommand("SELECT * FROM Employees", conn))
{
  conn.Open();
  using (SqlDataReader rdr = cmd.ExecuteReader())
  {
    while (rdr.Read())
       Console.WriteLine(rdr[0]);
  }
}

And it can be used for much more than just data access code too. Here's a starting resource for you:  http://msdn.microsoft.com/en-us/library/yh598w02(VS.80).aspx

 

Themes in Visual Studio

Tools - Options, in almost any flavour of Visual Studio. Head into that menu and you can customise your entire environment, showing line numbers, control how your code is formatted, and change your font styles and colours completely. Scott Hanselman's blog post on this has some great links to some dark themes for Visual Studio.

 

VS 2008 & .NET 3.5 SP1

Quite a lot of new features bundled in the latest point release - yes, the numbering system for .NET really is all over the place, since this service pack includes new features, not just bug fixes. But no, it's 3.5 SP1, not 3.6. Numbering aside, for more information, and links to the download, head here.

 

SQL Server 2008

The latest and greatest database from the MS; personally I'm interested in seeing if I can get my OpenSim database down from 1.4Gb to something more realistic with some of the new data compression wizardry! For more about new data types, new features, and the rest, head here.

 

10 Tips to Better Javascript

From the recent discussion on how to improve your JavaScript life came the following:

/* JavaScript 
    - it's not as bad as you think */
/* 10 steps to better JS Code */

var agenda = [
    'Use a proper editor and debugger',
    'Use var obsessively',
    'Understand "falsiness" and "truthiness"',
    'Learn to love object, function and array literals',
    'Grasp the symbol/string dichotomy',
    'Learn to use regexes and JS string functions',
    'Master scope and closures',
    'Don\'t try to build classes like you\'re used to',
    'Grok "this" and functions as values',
    'Use JQuery'
];

 

If you've not yet joined us for a Code Clinic on Microsoft Island, or have never even logged onto Second Life, why not give it a try? It's a great way to meet peers and learn about new and existing technology without having to leave your own home. Drop me a line if you need convincing - chris at codetorque dot com.

posted @ 8/25/2008 6:03 AM by Chris Hart

Red Gate Reflector

Well, it looks like one of the best .NET utilities out there has changed hands. Lutz Roeder, the original creator and developer of Reflector has agreed with Red Gate software (they of SQL Compare and SQL Toolkit fame) to let them continue development of it from now one. An interview with both Lutz and James Shore of Red Gate outlining the deal and what Red Gate hopes to do with Reflector can be found here on simple talk.

Red gate are quite clear that they “will continue to offer the tool for free to the community.” but don’t categorically state that they may not offer a corporate, paid-for version later down the line. As long as there’s a free version I’m not too fussed. Reflector’s new home is http://reflector.red-gate.com/

Technorati Tags: ,

posted @ 8/21/2008 10:20 AM by Dan Maharry

RadioButton Groups, Table Rows And NamingContainers

(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

<input type="radio" name="RadioButtonList1" value="1" />
   <label for="RadioButtonList1_0">Orlando Gee</label><br />
<input type="radio" name="RadioButtonList1" value="2" />
   <label for="RadioButtonList1_1">Keith Harris</label><br />
<input type="radio" name="RadioButtonList1" value="3" />
   <label for="RadioButtonList1_2">Donna Carreras</label> 

And in ASP.NET, the RadioButtonList control lets you set the name attribute for each radio button in the list using the control's ID property. 

<asp:RadioButtonList ID="RadioButtonList1" runat="server" /> 

Alternately, you can group individual RadioButton controls together using their GroupName property.

<asp:RadioButton runat="server" ID="rbSelectUnique" GroupName="selectList" /> 

And the effect is still the same; each HTML radio button (with the same GroupName) has its name attribute set to the same value.

The Problem

The main problem with RadioButtons though is that by default you cannot span a group of them across table rows. Let's take an example, I have a sortable, pageable GridView of customers which I like, but I want to make sure the user can select only one of those customers as we go down the list. The obvious (in my mind anyway) solution is to add a template field to the GridView containing a RadioButton for each row and make the table generated by a GridView into a big radio button list by setting their GroupName attribute the same.

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="customerid"
    DataSourceID="SqlDataSource1">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:RadioButton runat="server" ID="rbSelectUnique" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="name" HeaderText="name" ReadOnly="True" SortExpression="name" />
        <asp:BoundField DataField="customerid" HeaderText="customerid" InsertVisible="False"
            ReadOnly="True" SortExpression="customerid" />
    </Columns>
</asp:GridView> 

Perfectly sensible except that because each RadioButton is dynamically added to a table row by the GridView, ASP.NET generates the name attribute of each radio button by appending the value you give it in GroupName to the internal name it generates for it when rendering the GridView. Hence we get this code for the <asp:GridView> above.

<table cellspacing="0" rules="all" border="1" id="GridView2" style="border-collapse:collapse;">
   <tr>
      <th scope="col">&nbsp;</th><th scope="col">name</th><th scope="col">customerid</th>
   </tr>
   <tr>
      <td>
         <input id="GridView2_ctl02_rbSelectUnique" type="radio" 
            name="GridView2$ctl02$rbSelectUnique" value="rbSelectUnique" />
      </td>
      <td>Orlando Gee</td><td>1</td>
   </tr>
   <tr>
      <td>
         <input id="GridView2_ctl03_rbSelectUnique" type="radio" 
            name="GridView2$ctl03$rbSelectUnique" value="rbSelectUnique" />
      </td><td>Keith Harris</td><td>2</td>
   </tr>
   <tr>
      <td>
         <input id="GridView2_ctl04_rbSelectUnique" type="radio" 
            name="GridView2$ctl04$rbSelectUnique" value="rbSelectUnique" />
      </td><td>Donna Carreras</td><td>3</td>
   </tr>
</table> 

As you can see, the radio button's name value takes the form GridView2$ctlXX$rbSelectUnique, where XX changes for each row and renders the list of the radio buttons useless. You can select them all at the same time if you wish. And it turns out that this issue is by design, according to the bug report on MS Connect.

Each row in a GridView is its own naming container so the controls' names don't collide. However, RadioButtons do not support spanning multiple naming containers and having their groupname attribute still work correctly. We will be looking at solving the RadioButton GroupName/multiple naming container issue in future versions of the product.

Or, in English, asp.net generates a unique NamingContainer for each cell in a table generated by a GridView and then uses that as a basis for all control IDs within the cell. It seems to be the only way to keep track of which events occurred where when the page posts back.  That was written in April 2005 and it hasn't been fixed in VS2008, so it's time to look at workarounds.

The Solution

If you're using AJAX already on the page, or are prepared to use it on the page, one way to get a radio button list of sorts into your GridView is to use checkboxes and a MutuallyExclusiveCheckBoxExtender in each TemplateField.

<ItemTemplate>
    <asp:CheckBox runat="server" ID="chkSelect" />
    <cc1:MutuallyExclusiveCheckBoxExtender ID="mecbe1" runat="server" 
        Key="chkSelectGroup" TargetControlID="chkSelect" />
</ItemTemplate> 

Now this works fine, but if you're trying to keep your pages lean, the additional script for each MECBE added to the page might not be so good. From a UI point of view, you might also object to having checkboxes work like radio buttons and so might your users.

Fortunately, a quick check in Visual Studio’s Object Browser reveals that the RadioButton derives from a CheckBox, so you can easily swap out one for the other. And behold your RadioButtonList is back, spanning table rows.

<ItemTemplate>
    <asp:RadioButton runat="server" ID="rbSelect" />
    <cc1:MutuallyExclusiveCheckBoxExtender ID="mecbe1" runat="server" 
        Key="rbSelectGroup" TargetControlID="rbSelect" />
</ItemTemplate> 

Not The Solution, But Good To Know

If you’re not willing to use AJAX, the issue is always with the naming container clashing with the radio button list’s name property. Perhaps an obvious solution is to use your own RadioButton Control which overrides the name attribute for the button when it is rendered. Something like this.

using System;
using System.ComponentModel;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TryOuts
{
    public class MyRadioButton : RadioButton
    {
        public string GroupName2
        {
            get  {
                String s = (String)ViewState["GroupName2"];
                return ((s == null) ? "" : s); }
            set { ViewState["GroupName2"] = value; }
        }

        public bool Checked
        {
            get { return base.Checked; }
            set { base.Checked = value; }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            base.Render(hw);

            if (String.IsNullOrEmpty(GroupName2))
            {
                writer.Write(sb.ToString());
            }
            else
            {
                string html = Regex.Replace(
                   sb.ToString(), @"name=""[\w\$]+""", 
                   String.Format("name=\"{0}\"", GroupName2));
                writer.Write(html);
            }
        }
    }
}

Now this approach works to a degree. Replacing a standard RadioButton with this control does indeed override the control’s Name property and the RadioButtons all work within the table as required.

<cc2:MyRadioButton runat="server" ID="mrbTest" GroupName2="test" />

However, do anything simple such as select a row and post back the page (by clicking a button) and you’ll see that you can’t determine which radio button has been clicked.

foreach (GridViewRow row in GridView.Rows)
{
   RadioButton rb = (RadioButton)row.FindControl("mrbTest");
   if (rb.Checked)
   {
      lblSelected.Text = row.Cells[1].Text;
   }
}

And that’s because the NamingContainers for the cells containing the RadioButtons in the table generated in the GridView can no longer identify the RadioButtons in the cells in the table. Because our custom control has overridden the name attribute for each RadioButton to “test”, ASP.NET can’t find any controls called GridView2$ctlXX$mrbTest which is what it expects them to be called and why the naming container exists in the first place. Without the naming container producing these unique names in the way it does, we can’t do useful things like iterate over the rows in a GridView and why AJAX is the way forward when it comes to this particular problem.

Now strictly speaking, it should be possible to write a HttpModule that rewrites a RadioButton’s name attribute as it is sent to the browser so it works as part of a RadioButtonList and then rewrites the name attribute back as the page is posted back so the naming container appears to still be intact. But think about it, that’s a lot of effort for a small thing. Is the AJAX-free convenience worth the hassle?

posted @ 8/14/2008 5:42 PM by Dan Maharry

Three Different Ways To Find The Currently Edited Row In A GridView

The GridView, and indeed all the other templated data bound controls, are lifeblood to an ASP.NET developer when it comes to creating websites. A little DataSource control here, a GridView there and even if it isn't exactly what you want, you've got a prototype page up and running in no time to start the real development with. Today's chores involved tweaking the contents of a GridView's EditItemTemplate so that the contents of one DropDownList (Clients) would change based on the contents of another (Roles) and should the Update button be clicked the values of both DropDownLists saved out to the database.

EditItemTemplate

The roles DropDownList always contained the same items, so it was bound to a DataSource control separate to the GridView itself and then its selected value bound to the current value for the row in the GridView. The RoleId is two-way bound to the SelectedValue of the DropDownList so clicking Update works correctly.

<EditItemTemplate>
   <asp:DropDownList runat="server" ID="ddlRolesForEditUserDialog" AutoPostBack="true"
      DataTextField="Name" DataValueField="RoleId" 
      DataSourceID="RolesDataSource" SelectedValue='<%# Bind("RoleId") %>'
      OnSelectedIndexChanged="ddlRolesForEditUserDialog_SelectedIndexChanged" />
</EditItemTemplate>

The clients DropDownList on the other hand, needed

  1. to be populated dynamically when the the GridView's row was switched to Edit mode
  2. to be populated dynamically when the choice in the roles List changed. 
  3. to be accessed when Update is clicked and the DataSource is making changes to the database.

As it turns out, each occasion used a slightly different way to find the row being edited and through that, using FindControl to access the ClientList.

In case 1, by the time a GridView's OnRowEditing event (raised when 'Edit' is clicked on the GridView) is handled, the EditItemTemplate for the row hasn't become accessible yet, so the client list can't be found. The option instead then is to handle the GridView's OnRowDataBound event at which point the EditItemTemplate has been created and the client list is accessible. The trick is to identify the row being edited is to use its RowState property. Every row on a GridView is rebound when Edit is clicked, so we can use the following.

protected void grdUsers_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if ((e.Row.RowState == DataControlRowState.Edit) || 
       (e.Row.RowState == (DataControlRowState.Edit|DataControlRowState.Alternate)))
   {
      //Get the client dropdownlist
      DropDownList clientList = (DropDownList)e.Row.FindControl("ddlClients");

      //more stuff here
   }
}

In case 2, the EditItemTemplate already exists. Indeed, we're capturing an event on the roles List within a cell in the EditItemTemplate. One option to then find the client List in the cell next to it is to start with the object that raised the event, find the control that contains both it and the client List and then call FindControl.

protected void RulesList_SelectedIndexChanged(object sender, EventArgs e)
{
   //Get the roles dropdownlist
   DropDownList ddlRoles = (DropDownList)sender;

   //Get the client dropdownlist
   DropDownList clientList = 
      (DropDownList)ddlRoles.Parent.Parent.FindControl("ddlClients");

   // more stuff here
}

Or, as in Case 3, because we know the EditItemTemplate is visible, we can locate the row being edited through the GridView's EditIndex template. This returns -1 if no row is being edited or the index of a row in the GridView.

protected void usersDataSource_Updating(object sender, EventArgs e)
{
   GridViewRow row = grdUsers.Rows[grdUsers.EditIndex];
   DropDownList clientList = (DropDownList)row.FindControl("ddlClients");

   // more stuff here

}

Case 3 is the easiest way to find the currently edited row, though the other two are no less valid.

posted @ 8/5/2008 5:06 PM by Dan Maharry

Is this the truth of it?

Achieving perpetual mass for any community only takes place if the underlying purpose of the community is appealing to enough users that they decide to contribute some of their cognitive surplus to its furtherance.

More of that discussion here. Discuss

posted @ 8/4/2008 9:49 PM by Dan Maharry

Enabling SSL Certificates on any Given HTTP Port

Following on from my travails with HttpListeners not working as a non-admin user, it turned out that the Cardspace samples (download them here if you're interested) had one more sticking point up their sleeve before everything worked. The main example demonstrates how a simple Security Token Service is used to verify the managed card a user wants to send to a site. However, the service is accessible only through the HTTPS protocol on port 7001 and Cardspace was unable to access it. A little digging revealed that the setup scripts for the sample tried and failed to build a copy of httpcfg, a utility found on Windows Server 2003. I didn't have the necessary files to build httpcfg successfully, bit it turns out that the netsh utility that comes with Vista and helped me out previously could also help me out here to.

The command required to add the certificate to a port with netsh is

netsh http add sslcert ipport=0.0.0.0:7001 certhash=thumbprint appid=arbitrary_guid

And the corresponding one to remove it is

netsh http delete sslcert ipport=0.0.0.0:7001

The add command needs two pieces of information besides the port number.

  • appid is an arbitrary guid to represent the application accessing the port.
  • certhash requires the certificate's thumbprint to identify it to netsh

If you've never needed to find a certificate's thumbprint before, hit Win+R and run certmgr.msc from the prompt to open the Vista Certificates MMC Viewer. (If the certificate is stored in the Local Machine certificate store rather than your own accounts store, you'll need to run certmgr.msc as an admin). The certificate should be stored in Personal\Certificates. When you find it, double-click it and select the Details tab. If you scroll the view down, you'll see Thumbprint towards the bottom of the dialog.

CertThumbprint

You'll need to copy all 20 pairs of hex digits and remove all the spaces. Given the example above then, you can add the certificate shown to port 7001 using this command.

netsh http add sslcert ipport=0.0.0.0:7001 certhash=d47de657fa4902555902cb7f0edd2ba9b05debb8 appid={C61EC2E2-BC18-4522-903B-F44A56299787}

And then you can check that all's well with this command

netsh http show sslcert

This will show you all the certificates bound to a port on your machine. netsh - the network admin's swiss army knife

posted @ 8/1/2008 11:45 AM by Dan Maharry

Enabling HttpListeners for Non-Admins

I've just started working through the Cardspace samples to learn some more about online identity layers (download them here if you're interested). The first example demonstrates a web service running on http://localhost:4123 requesting a certificate from a client. However, as a non-admin, I get the following error from Visual Studio when running the sample.

AddressAccessDeniedException was unhandled
HTTP could not register URL http://+:4123/HelloService/. Your process does not have access rights to this namespace

Coincidentally, the error is totally analogous to a similar problem I've had while trying out the CR_Documentor plug-in that Travis Illig has created and it's Travis and co that figured out both problems in hindsight. To paraphrase,

By default, only local admins have permission to listen to http prefixes. Other accounts require explicit grant using either httpcfg.exe for WinXp/2003 users or netsh for Vista/2008 users. This isn't a .net permission, it goes right to the windows urlacl level.

Just as this cardspace demo relies on port 4123 being accessible, so too does CR_Documentor rely on port 11235. The full commands to call either can be found here, explaining the various options.

Thus, to solve my cardspace problem, I needed to open a command prompt as an admin and run the following command to match the URL given in the error dialog.

netsh http add urlacl url=http://+:4123/ user=cweb\dan

And hey presto, I can continue debugging my web services as a standard user.

Thanks again to Travis and the CR_Documentor guys for figuring this one out and explaining it here. I'm just passing on the info

posted @ 7/28/2008 1:50 PM by Dan Maharry

Tutorials

Note to self, there are some good tutorials and 101s out there which should help a lot in a few areas. Make time to get through

I'm looking for a good one on Ruby and on Javascript as well. Anyone got anything good? The new Wrox First wiki on Javascript frameworks looks good, but it does cost.

posted @ 7/25/2008 9:17 AM by Dan Maharry

Assert.AreValueEqual

One of the interesting aspects of backfilling documentation is uncovering methods few seem to have discovered. Case in point, the Assert.AreValueEqual method in MbUnit v2. Rather than the straightforward AreEqual methods to compare the values of a property in an object or the AreSame methods to compare whether two objects are actually the identical object or of the same type, AreValueEqual verifies that two objects, expected and actual,

  • both have a property described a PropertyInfo object,
  • that the property is not null,
  • and that the value of the property in both objects is equal.

It's a bit of a black box tester then and works across class hierarchies.

AreValueEqual takes three parameters and an optional fourth.

  • The PropertyInfo object indicating the property to be tested
  • The object containing the expected value of the property
  • The object containing the actual value of the property
  • The index of the value to compare in the property if it is an indexed property

Let's take a few examples to demonstrate its various pass and fail scenarios. First, some boilerplate. You'll need to include System.Reflection for the PropertyInfo class and MbUnit.Framework for the Assert class.

using System;
using System.Reflection;
using MbUnit.Framework;

namespace MbUnitAssertDocs
{
   [TestFixture]
   public class AreValueEqualTests
   {

 

The first test passes as it compares the Length property of two string arrays both containing four strings. Only the Lenght property is being tested here, so whether the strings are equal is irrelevant

      //This test passes
      [Test]
      public void AreValueEqual_SameValues()
      {
         // Create two arrays
         String[] a = new String[4] { "this", "is", "a", "test" };
         String[] b = new String[4] { "this", "is", "a", "camel" };
      
         // Generate the PropertyInfo object for an array's length
         PropertyInfo pi = typeof(Array).GetProperty("Length");
         Assert.AreValueEqual(pi, a, b);
      }

 

The next test also passes and demonstrates using the optional fourth parameter to test the value of an indexed property. In this case, we're treating a String object as an array of Char and testing the fourth character.

      //This test passes
      [Test]
      public void AreValueEqual_SameValuesUsingIndices()
      {
         // Create two strings
         String a = "this is a test";
         String b = "this is a camel";

         // Generate the PropertyInfo object for the string as a Char array 
         PropertyInfo pi = typeof(String).GetProperty("Chars");

         // Test the fourth letter
         Assert.AreValueEqual(pi, a, b, new Object[] {4});
      }

 

If one of the objects being tested is null, the test fails with an AssertionException.

      // This test fails with an AssertionException
      [Test]
      public void AreValueEqual_OneValueIsNull()
      {
         // Create two arrays
         String[] a = new String[4] { "this", "is", "a", "test" };
      
         // Generate the PropertyInfo object for an array's length
         PropertyInfo pi = typeof(Array).GetProperty("Length");
      
         Assert.AreValueEqual(pi, a, null);
      }

 

If one of the objects does not have the property specified by the PropertyInfo object, the test also fails with an AssertionException. This next test fails because the String reference class has a Chars property while the string value type does not. (One capitalised letter makes all the difference)

      //This test fails with an AssertionException
      [Test]
      public void AreValueEqual_PropertyNotPresentInOneObject()
      {
         // Create two arrays
         String[] a = new String[4] { "this", "is", "a", "test" };
         string[] b = new string[4] { "this", "is", "a", "camel" };
      
         // Generate the PropertyInfo object for an array's length
         PropertyInfo pi = typeof(Array).GetProperty("Chars");
      
         Assert.AreValueEqual(pi, a, b, new Object[] {4});
      }

 

Finally, if the value of the property shared by the two objects does not have the same value, the test fails with a NotEqualAssertionException.

      //This test fails with a NotEqualAssertionException
      [Test]
      public void AreValueEqual_DifferentValues()
      {
         // Create two strings
         String a = "this is a test";
         String b = "this is a camel";
      
         // Generate the PropertyInfo object for the string as a Char array 
         PropertyInfo pi = typeof(String).GetProperty("Chars");
      
         // Test the tenth letter
         Assert.AreValueEqual(pi, a, b, new Object[] { 10 });
      }
   }
}

 

Hopefully, this gives you a few ideas on how you might use Assert.AreValueEqual. MbUnit itself uses it in our DataAssert class, the source for which you can see here. There's also a discussion on the MbUnit-User forum discussing this method and whether or not it should make it into MbUnit v3. If you'd like to see it stay, or would like to propose an alternative, reply to the thread.

Technorati Tags: ,

posted @ 7/21/2008 10:13 PM by Dan Maharry

Learning that WAPs on IIS are for Admins Only The Hard Way

(Or rather "How a fixed bug and a rubbish COMException error dialog ended up making me take four months to learn that Web Application Projects running on IIS rather than Cassini can only be edited in VS when running with Administrative privileges" but that seems slightly long for a blog title post)

I've been happily running VS2008 as a standard user since it came out. And with TestDriven.NET and VisualSVN, I'm motoring along quite well. Yesterday, I decided to upgrade VisualSVN to the latest version v1.5.1. And then bang!! I loaded up my current work and got this dialog.

CropperCapture[1]

And my Web Application Projects have failed to load in VS2008. After mild panic has finished setting in, I try regressing to my previous version v1.3.2 and the project loads fine. Which is mildly inconvenient as v1.3.2 doesn't work with TortoiseSVN 1.5 which is something I also updated on my machine.

Looking on the intarwub, it's mildly amusing to see that Google's best match to this situation as I search for it is a forum thread that I started on VisualSVN's forums when I got the same error trying out v1.4. However, one response in there since I last read it suggests removing the <FlavorProperties> element from the wap's .csproj file. Which I do and it works. But having loaded the project back in again and reset it back up to run on IIS, the dialog appears again.

A bit more googling for Web Application Projects and COMExceptions yields this page from Martin Kulov bemoaning the same useless dialog but with the following golden nugget of information.

In order to load the Web Application Project ... if you are running Vista, you should run in elevated privileges as well.

Which is a bit of a shock as I've been happily running Vista and developing this project as a standard user for four months. Furthermore, it turns out that that useless dialog is a VS2008 bug that will be fixed in Service Pack 1.

So apologies to VisualSVN for doubting you. I'm never a fan of running Visual Studio as an admin, but I guess I have no choice. But whatever bug was present in v1.3.2 so I could develop WAPs on IIS as a standard user, maybe you could put it back?  :)

posted @ 7/10/2008 9:50 AM by Dan Maharry

Latest Images

From Me Photos
From Ebay
From General pictures
From Misc
From Me Photos
From Me Photos
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends
From Friends