Thursday, January 18, 2007
Sussex Geek Dinner

Last night was another
Sussex Geek Dinner at the Black Horse in Brighton.
Mikel Maron gave a very interesting and informative talk about
OpenStreetMap. He covered the history, his involvement and, of course,
Brighton's coverage. This is all of particular interest to me at the moment as I've just done my first
snowboarding trip armed with a gps solution (although one with issues).
Our gps solution is a
mobile phone application paired via bluetooth with a
Globalsat BT338 x-trac bluetooth GPS receiver. This works reasonably well, but we've had issues with a) the client software only working on one of four available mobile phones and b) the web solution maps not working very well on a mac. All that said, it does allow export to
google earth and looking at our snowboard runs overlaid on satellite imagery is quite satisfying.

Labels: Brighton, Development, Geek Dinner, sussexdigital
// posted by Jane @ 9:50 AM
Comments:
Wednesday, January 17, 2007
ASP.NET: validators and client code
I found myself with a bit of a challenge yesterday. I have a form which has client validation but also has a message displayed back from the server after a save.
When a save happens a "Update successful" message is displayed on the screen as an <asp:label>.
When the client side validation happens, then one of many error messages are displayed on the screen.
This means that both the "Update successful" and the error messages are displayed on the screen at the same time. This obviously isn't ideal and doesn't give the user a clear message.
For a while I was going to do this using a <
asp:customvalidator> calling some javascript to clear out the label. And then I read "The custom validation subroutine is not called when the control being validated does not contain any data. The only control that you can use to check for an empty form field is the RequiredFieldValdiator control" which scuppered those plans.
I then did a bit of googling and discovered that I could use the Attributes property to get at the
client side events of an element. So, a bit of code that does
TextBox1.Attributes["onblur"] = "for(i=0; i<document.all.length; i++){if (document.all[i].id.indexOf('Label1') > -1) { var element = document.all[i];element.innerHTML='Changes have been made';};}";works like a charm and when focus leaves TextBox1, the text in the element Label1 changes to be "Hello".
I then manipulated it a bit more and discovered that if in the html the Label1 element is set to visible="false", then the javascript fails due to the non-existance of that element.
So, the final result is:
The basic form:

When a required field is missing (note both the validator text and the change of text in the label caused by changing the focus):

When the two textboxes don't have identical content:

With asp code of:
<asp:Label ID="Label1" runat="server" Text="Label">Please make some changes</asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server">TextBox1</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox1" Text="RequiredFieldValidator"></asp:RequiredFieldValidator>
<br />
<asp:TextBox ID="TextBox2" runat="server">TextBox2</asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator" ControlToCompare="TextBox2" ControlToValidate="TextBox1">CompareValidator</asp:CompareValidator><br/>
<asp:Button ID="Button1" runat="server" Text="Button" />
and a code behind of
protected void Page_Load(object sender, EventArgs e)
{
if (Label1.Visible)
{
TextBox1.Attributes["onblur"] = "for(i=0; i -1) { var element = document.all[i];element.innerHTML='Changes have been made';};}";
}
}
Labels: ASP.NET, Development
// posted by Jane @ 1:40 PM
Comments:
Brighton Girl Geek Dinner

Last night was the
first Brighton Girl Geek Dinner and most enjoyable it was as well. Great turnout, excellent organisation (name stickers, information sheet, guest book) and an interesting talk by
Rose Luckin on Learner Centred Design, covering completed projects on
homework and
augmented reality, and touching on a new project
vesel.

I had some interesting conversations ranging from
photography, through process management, training needs, print versus web and the benefits of both and finally what kind of
wings would be on Sophie's wellies.
Future Platforms hosted a text voting mechanism to vote for subjects we'd like to hear talked about at future events - everything got at least one vote, and the winners seemed to be in the game and social area as well as the future of technology.

Congratulations to
Devi,
Joh and
Rosie (in alphabetic order) for a great night. I'm looking forward to the next one.
Simon, you're going to have to raise your game for
this evening's
Sussex Geek Dinner - I'm expecting great things now...
Labels: Brighton, Development, Geek Dinner, sussexdigital
// posted by Jane @ 8:27 AM
Comments:
Monday, January 15, 2007
MSDN Virtual Lab: Express: What’s New in SQL Server 2005
I decided to take a look at the MSDN Virtual Labs after finding this a good way to work on my ASP.NET course. I figured I'd start off with the
Express: What’s New in SQL Server 2005 lab and see how I got on. This was a 30 minute lab, and I've got quite a bit out of it.
I hadn't read anything about the new
PIVOT and UNPIVOT functionality, and by following up on that I discovered about the introduction of
Common Table Expressions which look like a much more elegant way of temporarily storing data for use within stored procedures etc. This should give a lot more flexibility.
The other thing I knew about but hadn't seen examples of was the
TRY...CATCH functionality. This is a great addition, but it is a shame that it doesn't work with user defined functions as well.
Labels: Development, SQLServer2005
// posted by Jane @ 12:25 PM
Comments:
Thursday, January 11, 2007
WebDD
I've registered to attend the
WebDD event at Reading on February 3rd. Some of the
sessions look really interesting.
I'm definitely planning to attend the "Ruby On Rails for .NET Developers" talk by
Dave Verwer as Ruby is something I've been trying to find time to look at for a while now. I narrowly missed attending the
Brighton Ruby user group meeting on Tuesday, but maybe by the next one I'll have learnt a bit more about it.
I'm also likely to pop along to the two sessions on "End to End Web Sites" by
Scott Guthrie as they seem like a good comprehensive way to keep the content learnt at my
recent courses fresh, especially the AJAX bits.
Labels: Development, event, WebDD
// posted by Jane @ 7:26 PM
Comments: