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.