[Valid RSS] This is a valid RSS feed.


This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <rss version="2.0"><channel><title>Learning VB.NET</title><link></link><atom10:link xmlns:atom10="" rel="self" type="application/rss+xml" href="" /><description>Benjimawoo - One man. No tagline.</description><language>en</language><managingEditor>[email protected] (Benjimawoo)</managingEditor><lastBuildDate>Fri, 16 Sep 2016 05:54:00 PDT</lastBuildDate><generator>Blogger</generator><openSearch:totalResults xmlns:openSearch="">228</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="">25</openSearch:itemsPerPage><feedburner:info xmlns:feedburner="" uri="benjimawoo" /><atom10:link xmlns:atom10="" rel="hub" href="" /><image><link></link><url></url><title>Benjimawoo - One man. No tagline</title></image><item><title>Yay me, and a question...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Tue, 28 Mar 2006 09:46:21 PST</pubDate><guid isPermaLink="false">,</guid><description>Firstly, yay me!&lt;br /&gt;&lt;br /&gt;I don't care what you might think about the pros and cons of &lt;a href=""&gt;microsoft certifications&lt;/a&gt;. You may think they're pointless. You may think they're not worth the paper they're printed on.&lt;br /&gt;&lt;br /&gt;Either way, I passed my first exam today. Woo and yay! &lt;a href=""&gt;70-315&lt;/a&gt; - I have a certificate that says I can "Develop and Implement Web Applications with Microsoft Visual C# .NET and Microsoft Visual Studio .NET". Woo!&lt;br /&gt;&lt;br /&gt;The second thing was a question that someone actually asked me this morning that piqued my interest.&lt;br /&gt;&lt;br /&gt;What this guy was trying to achieve was filtering on a Date field in a &lt;a href=""&gt;Dataview&lt;/a&gt;, but rather than filtering on a continuous date range, he was trying to filter on a series of date ranges.&lt;br /&gt;&lt;br /&gt;Put simply, he wanted to pull out all the records that had a date somewhere in March (for instance). I don't know the exact context he was coming from, but it would be useful if, for example, you had sales data spanning a few years and wanted to see how things were looking on a month-by-month basis.&lt;br /&gt;&lt;br /&gt;Well.&lt;br /&gt;&lt;br /&gt;I discovered it doesn't seem to be as easy as all that to do.  I started out by creating a Dataset in &lt;a href=""&gt;Visual C# Express&lt;/a&gt;, just by dragging the Employees table from the AdventureWorks database on my toolbar (Ah, the company name may change, but the samples stay the same!).&lt;br /&gt;&lt;br /&gt;My goal was to pull out Employees as a DataTable in my dataset, create a DataView from it and filter the view to just contain everyone that has a birthday in March.&lt;br /&gt;&lt;br /&gt;To start, I thought I'd create a new column populated with an &lt;a href=""&gt;expression&lt;/a&gt;, something along the lines of BirthDate.Month (or something similar). However, it looks like you can't do that. Although you can take DataColumns and do simple stuff to them, adding values, subtracting values etc, you can't do anything (it would seem) that's specific to a slightly more complex datatype, like a &lt;a href=""&gt;DateTime&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The next thing I though of was to try a do some quick filtering with a &lt;em&gt;LIKE&lt;/em&gt; clause in the dataview's &lt;a href=""&gt;RowFilter&lt;/a&gt; property, so it looked something like 'view.RowFilter = "BirthDate LIKE '03/%'"' think I could pull out all the March birthdays that way. (n.b. I didn't have to worry about the formatting of the Date because of the &lt;a href=""&gt;culture insensitivity of the expression used to filter DateTime columns&lt;/a&gt;.)&lt;br /&gt;&lt;br /&gt;Apparently not, though. Apparently you can't apply 'LIKE' and wildcards to DateTime fields. Which, I must admit, makes sense. I was pretty much clutching at straws when I went down that route.&lt;br /&gt;&lt;br /&gt;So, to recap, I wanted to filter on a set of dates. These happened to be all the dates in March for a number of years, but that's by the by.&lt;br /&gt;&lt;br /&gt;In then end, this was how I managed to do it. When I started out, I though it looked a bit hokey, and a bit of a fudge, but as I looked into it more, I'm actually quite impressed with it. It may not be &lt;em&gt;that&lt;/em&gt; elegant a solution, but hey, it does tha job, and at the end of the day, if it works then that's cool.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;TestAdventureWorks.dsTest data = new dsTest();&lt;br /&gt;TestAdventureWorks.dsTestTableAdapters.EmployeeTableAdapter da = &lt;br /&gt;    new TestAdventureWorks.dsTestTableAdapters.EmployeeTableAdapter();&lt;br /&gt;da.Fill(data.Employee);&lt;br /&gt;DataView view = data.Employee.DefaultView;&lt;br /&gt;&lt;br /&gt;StringBuilder s = new StringBuilder();&lt;br /&gt;int StartYear = 1945;&lt;br /&gt;int Month = 4;&lt;br /&gt;for (int i = StartYear; i &lt; 2000; i++)&lt;br /&gt;{&lt;br /&gt;    if (i != StartYear) s.Append(" OR ");&lt;br /&gt;    s.AppendFormat("BirthDate &gt;= #{0}/01/{1}# AND BirthDate &lt; #{2}/01/{1}#", Month, i, Month + 1);&lt;br /&gt;}&lt;br /&gt;view.RowFilter = s.ToString();&lt;br /&gt;Console.WriteLine(string.Format("Rows: {0}", view.Count));&lt;br /&gt;Console.WriteLine(string.Format("Total: {0}", data.Employee.Rows.Count));&lt;br /&gt;Console.ReadLine();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I don't know what the performance is like on it, though. In this case, going through 55 years on a set of 290 rows took around 70ms to complete. Not too shabby, I thought. Considering the length of the RowFilter string that went into it!&lt;br /&gt;&lt;br /&gt;However, my question is this (and if you've read this far, perhaps you know the answer!) Is there a better way of doing it? &lt;br /&gt;&lt;br /&gt;I thought of 1, which is to pull out the month component of the date in the original select statement, so your SELECT would look something along the lines of 'SELECT *, Month(BirthDate) FROM Employees'. It acheives the same thing as my first plan, and would allow you to just set the RowFilter to be 'BirthDateMonth=3'. But that's cheating!&lt;br /&gt;&lt;br /&gt;Anyway, just wanted to share.&lt;br /&gt;&lt;br /&gt;Yay me!</description><thr:total xmlns:thr="">1</thr:total></item><item><title>This is what happens when developers aren't network guys...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Tue, 21 Feb 2006 23:36:31 PST</pubDate><guid isPermaLink="false">,</guid><description>In a &lt;a href=""&gt;previous post&lt;/a&gt;, I was confused over which user account TfsBuild.exe executes under. I kept on getting various file exceptions and whatnot.&lt;br /&gt;&lt;br /&gt;Well now I know. It runs using the account you specified for all your Team Foundation Server Services to run under (In the installation guides, it's the one called &lt;em&gt;domain&lt;/em&gt;/TFSSERVICE). I can't remember if I specified this account at install-time or not. But there you go.&lt;br /&gt;&lt;br /&gt;Which brings me to the next thing that was causing trouble recently. I wanted to create a new build type that, as well as compiling my application, published it to our test server as well. Very quickly, it was just a matter of creating a new target in the .proj file called "AfterCompile" (overriding the one in the default .targets file), and adding an &lt;a href=""&gt;AspNetCompiler&lt;/a&gt; task to it for each website I wanted pushed up there.&lt;br /&gt;&lt;br /&gt;Problem was, the TFS Service account couldn't see the folder I was deploying to. No problem. Browse to that folder in explorer, fire up the properties, grant TFS write access and bob's yer uncle. Right? Wrong. &lt;br /&gt;&lt;br /&gt;After a couple of us pored over it for a while my boss' boss casually asked "Have you enabled write access to the share itself?" DOH! Although according to NTFS, the TFS account had write access to that directory, the initial fileshare (about 3 levels up) only had read access enabled. So I could browse to the directory I wanted to in explorer, but writing to it was being blocked by the share permissions.&lt;br /&gt;&lt;br /&gt;I didn't know it worked like that. I figured NTFS alone governed the access level to that directory.&lt;br /&gt;&lt;br /&gt;And that is what happens when developers aren't network guys.&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Something I really could do with finding out...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Thu, 16 Feb 2006 14:05:16 PST</pubDate><guid isPermaLink="false">,</guid><description>... But I don't know how.&lt;br /&gt;&lt;br /&gt;Here are a couple of things I know:&lt;ul&gt;&lt;li&gt;&lt;a href=""&gt;Timers&lt;/a&gt; aren't thread-safe&lt;/li&gt;&lt;li&gt;&lt;a href=""&gt;BackgroundWorkers&lt;/a&gt; are thread-safe&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;It's a shady proposition setting a timer running on a form, and doing a straight method call to update the form's display. It works sometimes, but because the timer runs (or at least &lt;em&gt;can run&lt;/em&gt; ) on another thread to the rest of the form, it sometimes falls over.&lt;br /&gt;&lt;br /&gt;There are a few nice elegant ways of sorting this all out and getting everything running properly in .NET 1.x, but .NET 2.0 brings with it the BackgroundWorker class.&lt;br /&gt;&lt;br /&gt;Which is a nice thing, particularly if you want to do some long running processes and update your UI as they go.&lt;br /&gt;&lt;br /&gt;This I know.&lt;br /&gt;&lt;br /&gt;But what I don't know is: what does the timer do when it's not elapsing? Obviously it's ticking away, just... well... being a timer, but is that it?&lt;br /&gt;&lt;br /&gt;What I'm getting at (albeit in a roundabout and thoroughly confused way) is this:&lt;br /&gt;&lt;br /&gt;I have a countdown timer that updates the form every second. I can't just use a timer to do it and handle its Elapsed event, but what if I fired up a BackgroundWorker, and then just called System.Threading.Thread.Sleep(1000) in a loop, raising the ReportProgress at each cycle through the loop?&lt;br /&gt;&lt;br /&gt;Is that a good idea? It seems to me to be the easiest, certainly the quickest way to achieve it, but is it really good practice? Thread.Sleep() always strikes me as being a bit of a hack, but it works.&lt;br /&gt;&lt;br /&gt;I'm sure I'll work something out eventually. Who knows. Could be I'm doing it a good way. Doubt it, though.&lt;br /&gt;&lt;br /&gt;Just wanted to share my bafflement. Of course, if anyone knows the answer, then let me know.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Scheduling builds using Team Build</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Mon, 06 Feb 2006 14:01:05 PST</pubDate><guid isPermaLink="false">,</guid><description>Today I've been having big fun trying to get an automatic build schedule together for the project I'm working on at the moment.&lt;br /&gt;&lt;br /&gt;Yes, that's right. Trying. Nearly there, and there are several things I've learnt along the way about Team Build. Here are the important ones (in no particular order):&lt;br /&gt;&lt;br /&gt;1) &lt;strong&gt;There's no inbuilt scheduler. &lt;/strong&gt;&lt;br /&gt;No real biggie, but before you spend half the morning looking for it, know that it's not there to be found. You'll just have to schedule it to run via Windows' task scheduler.&lt;br /&gt;&lt;br /&gt;2) &lt;Strong&gt;The command line tool TfsBuild.exe rules&lt;/strong&gt;&lt;br /&gt;See 1. Actually, I must say, the command line tool is really useful. It lives at:&lt;br /&gt;&lt;em&gt;&amp;lt;TeamBuildInstallDir&amp;gt;\Common7\IDE\TFSBuild.exe&lt;/em&gt; and is surprisingly good.&lt;br /&gt;It can be called using: &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TfsBuild.exe start &amp;lt;TeamFoundationServer&amp;gt; &amp;lt;ProjectName&amp;gt; &amp;lt;BuildType&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;As you might have guessed, it'll go to your TFS Server, find the build type you've specified, download the configuration from source control (the current checked in version) and build based on that. Which I think is really neat.&lt;br /&gt;&lt;br /&gt;It's not without its quirks, though. I spent ages feeding it different renditions of our server name (http://server, http://server:8080, etc...) and it kept on saying it couldn't find the server I was pointing it at. I found &lt;a href=";SiteID=1"&gt;this post from someone who was having exactly the same problem&lt;/a&gt;, though, and the solution at the bottom worked for me. Go into the registry and find &lt;em&gt;HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\Servers&lt;/em&gt; and add your server in there. Admittedly, I mimicked exactly what Joey Bradshaw did and put the friendly name of our server in as the key, and the full server name as the value. I don't know if the key is significant, but by this time I was getting hungry and wanted to go to lunch. Worked, though, which is the important thing.&lt;br /&gt;&lt;br /&gt;3) &lt;strong&gt;Any kludges you've put together for getting your project to compile - better fix them properly&lt;/strong&gt;&lt;br /&gt;Yes, I know, this is pretty much the whole point of an automated build. But still. I came a cropper a couple of times with dll references.&lt;br /&gt;&lt;br /&gt;We have a bunch of 3rd party and legacy dll's that we reference from our current project, which is fine. We keep them on a shared drive, the dll paths in the reference and the .refresh files in websites are pointing to that share, everything's happy. Until...&lt;br /&gt;&lt;br /&gt;4) &lt;strong&gt;I'm buggered if I can work out what user account TfsBuild.exe runs under.&lt;/strong&gt;&lt;br /&gt;I kept on getting reports that the drive out shared dll's live on didn't exist. And fair enough, the standard shared drive mapping that all the developers use wasn't there. No biggie. Just log in under the account the Team Build service runs under, map the drive, and Bob's your uncle, yeah? No. Kept on getting the same errors reported that the drive didn't exist. &lt;br /&gt;&lt;br /&gt;So I changed all the references in the source code to full network paths. Sorted, eh?  No. Changed the permissions on the network share to allow the Team Build Service account read access, and it all worked fine. Go figure. It wouldn't pick up the drive I mapped under its account, but it's definitely the account that goes fishing about on the network to find those pesky dll's. &lt;br /&gt;&lt;br /&gt;Oh well. It's done now.&lt;br /&gt;&lt;br /&gt;So (at last!) I've got a successful build going on. Yeah?&lt;br /&gt;&lt;br /&gt;Almost...&lt;br /&gt;&lt;br /&gt;5) &lt;strong&gt;Your project may well compile, but your Unit Tests might not...&lt;/strong&gt;&lt;br /&gt;Once I got my main project to build, I shifted my Test project from the old server to the new. Yeah yeah, I should have done all that when I first moved the rest of the project, but hey, this is me. It was Friday and I just wanted to get everything working and go home.&lt;br /&gt;&lt;br /&gt;So I moved my Unit tests over, changed all the external references (as I had discovered already. Built fine. Go to run it? Nope. Unit Tests don't run at all. Compile fine, but won't run. You'll need to give the dll's in the shared folder elevated elevated privileges to get them to run (elevated from the normal Intranet code group, anyway).&lt;br /&gt;&lt;br /&gt;6) &lt;strong&gt;There's nothing better on this earth than that little green tick!&lt;/strong&gt;&lt;br /&gt;No matter what people tell you. When you see that green tick, there's nothing better!&lt;br /&gt;&lt;br /&gt;7) &lt;strong&gt;Once it all works, it Team Build really does rule!&lt;/strong&gt;&lt;br /&gt;The reports Team Build produces are so cool. They're so comprehensive, and the integration with the rest of Team Foundation Server is fantastic. Once your project builds, it'll go back and See what changes have been checked in since the last successful build. It'll find all the work items associated with those changesets, indicate on them all that those changes have made it into a build, and give you some friendly statistics and scary numbers to tell your boss.&lt;br /&gt;&lt;br /&gt;It'll even create a new work item if it fails that links to the failed build report and tells you to fix it!&lt;br /&gt;&lt;br /&gt;All in all. It's been a bit of work today, and it's not &lt;em&gt;quite&lt;/em&gt; over yet. But we're now running automated nightly builds and loving every second of it!&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">1</thr:total></item><item><title>The Midas Touch</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Fri, 03 Feb 2006 15:25:41 PST</pubDate><guid isPermaLink="false">,</guid><description>There are some people that just have the touch of gold for some things.&lt;br /&gt;&lt;br /&gt;Carl Franklin is one of them.&lt;br /&gt;&lt;br /&gt;I've been listening to &lt;a href=""&gt;DotNetRocks&lt;/a&gt; for a couple of years now, and it's always been fantastic. In fact, when I'm not talking to my boss, I crdeit my entire career to DNR. Obviously, I tell my boss it's all down to me being fantastic!&lt;br /&gt;&lt;br /&gt;But now he's come out with &lt;a href=""&gt;DnrTV&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;It does rule. I've seen much love in the blogosphere (although I hate that word!) to prove it.&lt;br /&gt;&lt;br /&gt;The only thing I have trouble with is remembering everything. Not only do I have to seclude myself from the missus for an hour, but it is also like a total vulcan mind-meld taking it all in!&lt;br /&gt;&lt;br /&gt;BUT. It does rule. It's right there on the top of my list of things to do when Mrs Mawoo is out.&lt;br /&gt;&lt;br /&gt;PS - Nobody can ever beat &lt;a href=""&gt;Geoff's hair&lt;/a&gt; (nb Geoff is second from the right, the one up from the... well ... you'll spot him from  his hair! It's the greatest, I have dreams where my hair is as cool as Geoff's!)&lt;br /&gt;&lt;br /&gt;PPS - If anyone wants an MSN 8.0 Beta invite, just &lt;a href="mailto:[email protected]"&gt;email me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PPPS - Did I say right? I Geoff's in fron the left! In fron the right is &lt;a href=""&gt;ActiveNick&lt;/a&gt;.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Have these always been here? Or am I being stupid?</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sun, 29 Jan 2006 12:52:19 PST</pubDate><guid isPermaLink="false">,</guid><description>In the code editor in VS 2005 (any edition I guess, but I've been using VS Team Edition for Software Developers):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Right Click.&lt;/li&gt;&lt;li&gt;Expand the 'Breakpoint' menu item.&lt;/li&gt;&lt;li&gt;&lt;em&gt;Click 'Insert Tracepoint'&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Enter a message&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;You'll now have whatever message you want printed out in the output window. It can print the calling method, stack trace and a whole raft of other stuff.&lt;br /&gt;&lt;br /&gt;Although I'm quite inclined to use Trace.Write() in a web app (I figure if it's something you want to know when you're writing it initially, it'll be useful to know when it's actually in use), there are times when it's a bit of overkill putting a permanent trace in for some of the stuff you're debugging.&lt;br /&gt;&lt;br /&gt;Neat eh? I've just discovered that it's there is Visual Studio but not the Express Editions.&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>I mean Really....</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Thu, 26 Jan 2006 22:06:00 PST</pubDate><guid isPermaLink="false">,</guid><description>Honestly, though.&lt;br /&gt;&lt;br /&gt;Who checks in breaking changes 10 minutes before going-home time, eh? &lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">1</thr:total></item><item><title>In the midnight hour...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Thu, 12 Jan 2006 22:09:49 PST</pubDate><guid isPermaLink="false">,</guid><description>She may well have cried 'More, More, More', but that's beside the point.&lt;br /&gt;&lt;br /&gt;The point is I have more Live Messenger Beta invitations to give away.&lt;br /&gt;&lt;br /&gt;As &lt;a href=""&gt;before&lt;/a&gt;, mail me &lt;a href="mailto:[email protected]"&gt;here&lt;/a&gt; if you want one.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Quickly...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 07 Jan 2006 11:45:49 PST</pubDate><guid isPermaLink="false">,</guid><description>Just in case anyone actually visits this blog 'in person' (rather than subscribing to the feed) the comments seem to be on the blink at the moment.&lt;br /&gt;&lt;br /&gt;If they're not sorted out shortly, I think I might move back to Blogger's native commenting system. It's been made much better since I first moved aaway from it all those many moons ago...&lt;br /&gt;&lt;br /&gt;If you don't visit the blog itself (You're not missing much. I really need to have a sit down and redesign it) then ignore this post.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Anyone for Windows Live Messenger 8.0?</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Fri, 06 Jan 2006 23:41:32 PST</pubDate><guid isPermaLink="false">,</guid><description>I have a some invitations to the &lt;a href=""&gt;Windows Live Messenger 8.0 Beta&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;mail me &lt;a href="mailto:[email protected]"&gt;here&lt;/a&gt; if you're interested.&lt;br /&gt;&lt;br /&gt;Just want to share.</description><thr:total xmlns:thr="">2</thr:total></item><item><title>Quick thought before bed</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Thu, 05 Jan 2006 14:15:20 PST</pubDate><guid isPermaLink="false">,</guid><description>I've heard it said that the biggest security hole in any system is the one between the keyboard and the chair. People (or at least a lot of people) need to be kinda protected from themselves. Particularly when it comes to 'all that technical stuff' like computers. Which is a shame, considering how ubiquitous they've become.&lt;br /&gt;&lt;br /&gt;Here's a really tiny thought, but one that only occurred to me today.&lt;br /&gt;&lt;br /&gt;Would it really be that hard to have a header or a flag or something on a web page that told the browser that under no circumstances should they cache, autocomplete, or in any way retain on the computer and values put into a form?&lt;br /&gt;&lt;br /&gt;Just occurred to me today when Firefox autocompleted my bank details and password when I was paying some bills online.&lt;br /&gt;&lt;br /&gt;Don't get me wrong, most of the websites I go to that need authentication have their username and passwords autocompleted. I love it. I'm even right down with Firefox's domain-level password remembering stuff (so if your site of choice puts its session ID in the URL, it'll still complete your details). But there are just some places that I really don't want to be &lt;em&gt;able&lt;/em&gt; to do it, event if I wanted to!&lt;br /&gt;&lt;br /&gt;PS - Yes, it's fixed now. I was in a rush one time to see my bank statement for various reasons, working on a brand new machine that I hadn't configured yet, so that's why all the details were there. But very few people I know even know &lt;em&gt;how&lt;/em&gt; to clear their saved passwords.&lt;br /&gt;&lt;br /&gt;Just wanted to share. I'm off to bed.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Well whaddya know?</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Mon, 02 Jan 2006 10:32:23 PST</pubDate><guid isPermaLink="false">,</guid><description>If you type something into the address bar in Internet Explorer and hit ctrl+enter, it forms a complete .com URL from that word, so enter 'microsoft' and hit ctrl+enter and it'll complete it to ''.&lt;br /&gt;&lt;br /&gt;This is not new. It's been there for donkey's years, and it even got through to Firefox.&lt;br /&gt;&lt;br /&gt;However, Firefox took it one step further.&lt;br /&gt;&lt;br /&gt;FF completes the addresses with the following top-level-domain extensions:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;th style="border-bottom:black 1px solid;border-right:black 1px solid"&gt;Key combo&lt;/th&gt;&lt;th style="border-bottom:black 1px solid"&gt;Suffix&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1px solid"&gt;CTRL+ENTER&lt;/td&gt;&lt;td&gt;.com&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1px solid"&gt;SHIFT+ENTER&lt;/td&gt;&lt;td&gt;.net&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1px solid"&gt;CTRL+SHIFT+ENTER&lt;/td&gt;&lt;td&gt;.org&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Who knows - there may even be more. I just haven't found them yet, though.&lt;br /&gt;&lt;br /&gt;Discovered it on the last day I was at work before christmas. Been running round like a madman since then, though. I'll be glad to get back into the office for a break!&lt;br /&gt;&lt;br /&gt;Anyway, hope y'all had a good one. &lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">1</thr:total></item><item><title>Quick SQL Reporting tip</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 03 Dec 2005 13:07:30 PST</pubDate><guid isPermaLink="false">,</guid><description>I usually have to customize the data that's presented in a report in SQL Reporting services based on the currently logged in user. I'm guessing I'm not the only one.&lt;br /&gt;&lt;br /&gt;The good news? It's really &lt;em&gt;really&lt;/em&gt; easy!&lt;br /&gt;&lt;br /&gt;What you can do is simply create a new String parameter (called something imaginative like 'CurrentUser' or something). When you create the parameter in the report designer, it'll give you a bunch of configuration options for the parameter. The main one you're interested in is the Default value.&lt;br /&gt;&lt;br /&gt;Select 'Non-Queried' from the radio button list on the left, and then in the text-box that's enabled, enter the following function:&lt;br /&gt;&lt;code&gt;=Right(User!UserID, len(User!UserID)-instr(User!UserID, "\"))&lt;/code&gt;&lt;br /&gt;Looks ugly, yeah? But it's quite logical, if you break it down a bit:&lt;br /&gt;&lt;code&gt;Right(&lt;em&gt;string, length&lt;/em&gt;)&lt;/code&gt; gives you the right &lt;em&gt;n&lt;/em&gt; characters of &lt;em&gt;string&lt;/em&gt;. So if you entered &lt;code&gt;Right("Monkey", 3)&lt;/code&gt; the resulting string would be 'key', the right 3 characters of the work 'Monkey'.&lt;br /&gt;&lt;br /&gt;In this context, the string we're initial string is &lt;code&gt;User!UserID&lt;/code&gt;. This is a report function that gets the login of the user viewing the report. The value is in the form DOMAIN/USER, which might be fine as is for your reporting. However, when I was using it, I just wanted the name part of the login, rather than both the domain and name. &lt;code&gt;instr&lt;/code&gt; and &lt;code&gt;len&lt;/code&gt; both combine to give me the user portion of the UserName. &lt;code&gt;len(User!UserID)&lt;/code&gt; returns the length of the UserID string in its entirety. So for 'MARVIN\Ben' (my current login) it would return  10.&lt;br /&gt;&lt;code&gt;instr(&lt;em&gt;String, StringToFind&lt;/em&gt;)&lt;/code&gt; returns the index of StringToFind within String. So taking my current login as an example, &lt;code&gt;instr("MARVIN\Ben", "\")&lt;/code&gt; returns 7.&lt;br /&gt;If you evaluate those 2 expressions, the outer expression then reads &lt;code&gt;=Right(User!UserID, (10-3))&lt;/code&gt;, which is why the expression returns 'Ben' in my report.&lt;br /&gt;&lt;br /&gt;That's not the clever bit, though.&lt;br /&gt;&lt;br /&gt;The clever bit lies in the rest of the parameters.&lt;br /&gt;&lt;br /&gt;If you have a datasource that requires parameters, say you're pulling results from a stored procedure, the report designer automatically adds those parameters to the parameters collection off the report. Since all the report parameters are evaluated in the order they appear in the list (Or are displayed in the order they are evaluated, if you like) you can out your CurrentUser parameter at the top of the list, and then if any of your query parameters need the current username, rather than repeat the function, you ca just refer to the CurrentUser parameter using &lt;code&gt;Parameters!CurrentUser.Value&lt;/code&gt;. Just hide those parameters (more on that in a minute), set their defaults to the CurentUser parameter's value, and you're away!&lt;br /&gt;&lt;br /&gt;The final stage is to hide the current user parameter. This differs depending on which version of SSRS you're using, but the 2 I know about are:&lt;ol&gt;&lt;li&gt;the SSRS 2005 parameter dialog box has a 'Hide Parameter' check box. Just tick that and you're done&lt;/li&gt;&lt;li&gt;In SSRS 2000 (which is what I'm using at home) if you clear the 'Prompt' value in the dialog, it'll automatically hide the parameter for you&lt;/li&gt;&lt;/ol&gt;But wait, there's more! Something that I was absolutely overjoyed to find out!&lt;br /&gt;&lt;br /&gt;You set the default value of the CurrentUser parameter when the report fires up. Now normally, if the parameter is hidden, that value will never change. However if you un-hide that parameter, you can edit it and re-run the report using that value. This makes it an absolute doddle to debug and test. If you want to test the report output using several different users, you can just do it right there and then. And if you've set all the rest of the report parameters' defaults to refer to CurrentUser, then they'll all pick up the value you enter.&lt;br /&gt;&lt;br /&gt;When you're done testing and are happy with the results that are being produced for your users, then you can just re-hide the parameter in the designer and publish the report. Once that's done, your report will produce custom output for each user, with no user intervention required or, in fact, allowed.&lt;br /&gt;&lt;br /&gt;Clever eh? I love SQL Server Reporting Services. They're my friend.&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>So much stuff, so little time...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Wed, 23 Nov 2005 12:03:52 PST</pubDate><guid isPermaLink="false">,</guid><description>Gah! So busy of late! Been writing lots of C#, and here are my cool features, in no particular order, and with no (at the time of writing) links (Sorry).&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Refactoring Support&lt;/li&gt;&lt;li&gt;Windows Forms designer guide lines&lt;/li&gt;&lt;li&gt;Generics - say no more&lt;/li&gt;&lt;li&gt;Partial classes&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;There are so many more as well. I just love it. The joy is back.&lt;br /&gt;&lt;br /&gt;Been working on some other cool stuff as well:&lt;br /&gt;&lt;a href=""&gt;SQL Reporting Services&lt;/a&gt; - Just check it out. They rule!&lt;br /&gt;&lt;a href=""&gt;SQL Server 2005 in general&lt;/a&gt; - Okay, I'm cheating. I'm on a SQL Server 2005 course this week.&lt;br /&gt;&lt;br /&gt;Yes. I'm afraid there's nothing new to report. I'm just a jobbing developer, after all.  Although I must admit, that amid the furore over the minor bugs that still inevitably remain in VS2005, &lt;a href=",289142,sid8_gci1146746,00.html"&gt;Mike Gunderloy has some words of sanity&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Not a lot to share, but I have anyway. So there!</description><thr:total xmlns:thr="">0</thr:total></item><item><title>It's only a real little thing...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Wed, 16 Nov 2005 01:22:15 PST</pubDate><guid isPermaLink="false">,</guid><description>... But am I the only person who thinks that it would be a good idea fo a text editor to not only use punctuation and spacing to skip from word to word when you ctrl+crsr, but to include CapitalLetters in how it delimits word boundaries?&lt;br /&gt;&lt;br /&gt;It's just been plaguing me over the past few days. I guess the alternative is to learn how to type properly...&lt;br /&gt;&lt;br /&gt;Just asking the question...</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Great articles about Generics</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 29 Oct 2005 09:18:38 PDT</pubDate><guid isPermaLink="false">,</guid><description>Like most people, I daresay, the only way I've really been using generics over the past couple of months is for creating strongly types collections with System.Collections.Generics.List&lt;T&gt;'s, but I know in my heart of hearts that that's only half the story. Not even half of it. It's more like the first paragraph in the novel of Generics.&lt;br /&gt;&lt;br /&gt;There are some great articles about generics and their use up on MSDN (Gratuitously nicked from the excellent &lt;a href=""&gt;;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;a href=""&gt;Generics FAQ: Fundamentals&lt;/a&gt;&lt;br /&gt;&lt;a href=""&gt;Generics FAQ: .NET Framework&lt;/a&gt;&lt;br /&gt;&lt;a href=""&gt;Generics FAQ: Best Practices&lt;/a&gt;&lt;br /&gt;&lt;a href=""&gt;Generics FAQ: Tool Support&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Not just sharing, I wanted to remember them as well...</description><thr:total xmlns:thr="">0</thr:total></item><item><title>A grand day out. And a Grand night in!</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Tue, 25 Oct 2005 13:34:31 PDT</pubDate><guid isPermaLink="false">,</guid><description>So I spent my Saturday in the company of a whole bunch of UK nerds this weekend. And oh my, what a cool day! I've never really been to any real developer events, certainly not one that was so fiercely community driven as &lt;a href=""&gt;DeveloperDeveloperDeveloper &lt;/a&gt;on Saturday. And oh my what a day it was.&lt;br /&gt;&lt;br /&gt;In keeping with my general philosophy of trying to learn new stuff that I wouldn't really have an excuse to get to know about otherwise (i.e. pretty much avoiding anything that I'm likely to encounter in work) I saw some really great people enthusing about some really cool things.&lt;br /&gt;&lt;br /&gt;My personal highlights included:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=""&gt;Barry Dorrans&lt;/a&gt; being very excited about MsBuild.&lt;/li&gt;&lt;li&gt;&lt;a href=""&gt;Liam Westley&lt;/a&gt; being very quick and cool about SubVersion (Despite the organisers' best efforts to kleep him off the agenda ;-))&lt;/li&gt;&lt;li&gt;Ben Lamb bubbling over with the funky new stuff headed up for C# 3.0&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Those are just the ones that leap readiliy to mind. I also saw some cool stuff around the CLR in SQL Server 2005, new stuff in the System.XML namespace and many many more.&lt;br /&gt;&lt;br /&gt;It was also just really cool to see so many people there, all of whom sort of share a bit of an interest. I've discovered through my travels in the world of the fledgling developer that it's something of a solitary path to tread. Thanls to all the organisers and attendees who made it such a fun day out. No doubt I'll be at the next one.&lt;br /&gt;&lt;br /&gt;And then, to cap it all, got home from Reading only to find that Mrs Mawoo had organised a surprise birthday party for me, so there was much beer, merriment and general fun afterwards as well (although I'm ashamed to say I was the first to leave the party. Sat down for 5 minutes, and all of a sudden all of my friends had gone and Mrs Mawoo was waking me up to put my PJ's on. That's what you get for going out all day then trying to party after!)&lt;br /&gt;&lt;br /&gt;And last but not least, a big thanks to John who let me scrounge a ride from my house to Reading. And back. Eventually!&lt;br /&gt;&lt;br /&gt;That's it for now. No doubt there'll be more coming. I've got a bunch of tech stuff in my head just dying to come out, but so little time to actually write it! Damned commute! Gah!&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Non Smokers look away now...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 01 Oct 2005 17:28:05 PDT</pubDate><guid isPermaLink="false">,</guid><description>I know it's a particularly anti-social habit, as well as being about the least politically correct thing one can do, but I am a smoker.&lt;br /&gt;&lt;br /&gt;Even worse, I don't even have the decency to be a victime of smoking. I dont't smoke 'Because I Can't Help It' or 'Because I need to' or any ligitimate reason like that.&lt;br /&gt;&lt;br /&gt;I smoke because, bad as it is, and an unpopular an opinion as it is, I actually enjoy it. Every cigarette is as good as the last, and so on and so forth.&lt;br /&gt;&lt;br /&gt;I smoke for the same reason some people eat chocolate. It's nice. It makes me feel good and I like it.&lt;br /&gt;&lt;br /&gt;So I've just got one thing to say in this post. If you're a smoker, try a shisha pipe. I brought one back from my holiday in Egypt, and it's a really nice smoke. Bought back 4 flavours of tobacco, Cappucino, Pistachio, Apple and Cola (just to see what it was like). I'm working my way through my Cappucino at the minute, and it's really quite nice. Doesn't taste much like coffee, but it certainly has something about it that's coffee-esque.&lt;br /&gt;&lt;br /&gt;Really quite nice. And smoing a shisha's very nice as well. I heartily recommend it.&lt;br /&gt;&lt;br /&gt;Apologies for irrelevance, political incorrectness and bad-for-your-healthness.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Debugging and testing serviced components</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 24 Sep 2005 09:12:42 PDT</pubDate><guid isPermaLink="false">,</guid><description>I've been working over the past couple of weeks on a new data access component at work. For many and varied reasons I decided to implement it as a serviced component. I wanted to take advantage of COM+'s ability to pool and maintain objects, as well as its tried and tested transaction management capabilities for slinging stuff in and out of a SQL Server database. &lt;br /&gt;&lt;br /&gt;Since we're using VS 2005 to develop this new project, I wanted to take advantage of the integrated Unit Testing tools that come with it straight out of the box to make sure my component was working as expected. It was here that I encountered one or two things that I'm noting here so I can remember them:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;You'll never get good code coverage stats&lt;/strong&gt;&lt;br /&gt;One of the things that needs to be configured when you enable Code Coverage in VS 2005 is exactly which DLL's it's going to create code coverage stats for.&lt;br /&gt;&lt;br /&gt;Unfortnately there are 2 things that prevent VS from allowing it for DLL's that contain serviced components.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;COM+ only looks in the GAC&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If you want COM+ to recognise your component and run it as a server component (as opposed to a library component - more in that in a minute) you must install it in the GAC. This is no biggie. You just open up you WINDOWS/Assembly folder and drag/drop your DLL into it. Job done (thanks to the Fusion shell extension). You can also use GACUTIL.exe, but isn't dragging and dropping so much easier?&lt;br /&gt;&lt;br /&gt;So you've got you component installed in the GAC, you then need to register it as a serviced component. Easy. Just use REGSVC.exe and bob's your uncle. One serviced component, configurable through the Component Services management utility. Cool.&lt;br /&gt;&lt;br /&gt;The problem arises, however, when you try to set up code coverage to get stats on your component. You can only reference DLL files directly, and by default the 'Select Artifacts to Instrument' dialog only incldes those DLL's in your solution.&lt;br /&gt;&lt;br /&gt;You &lt;em&gt;can&lt;/em&gt; add other DLL's to the list, but try to navigate to the GAC and add them from there, and no dice. It somply won't allow you. This is either an intentional feature, or a side-effect of Fusion. Although in real life, the GAC is organised as a bunch of folders with subfolders and DLL files within them, when viewed in Explorer (as in, for instance, the Open File dialog) the assemblies appear as assembly objects. Since these aren't actual DLL files, the dialog won't allow you to add them.&lt;br /&gt;&lt;br /&gt;Oh well. I'll have a play about and see if I can't work out a way around it. I've got a couple of ideas, but they all generally revolve around changing the way the component is referenced, and as such, change the overall context in which the abject will be used. Change the test environment too much from how it's actually going to be deployed, and you've negated your tests - they're no longer valid. &lt;em&gt;Some&lt;/em&gt; (and I really do mean a very small amount) things can be changed for the purposes of testing and debugging, but not too much.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Serviced Components don't run in the normal application context&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Actually, this isn't strictly true. Serviced components &lt;em&gt;can&lt;/em&gt; be run inside the context of the calling application. And it's really simple to do, too. On the property sheet for the COM+ Application you've created, under the 'Activation' tab, select 'Library Application'. This will create the objects created by COM+ in the context of the calling application. &lt;br /&gt;&lt;br /&gt;This can even be demonstrated really easily - just step through some code that calls a serviced component you've made in the debugger. If the application's running as a Server application (i.e. objects are actually created and run in dllhost.exe, rather than in the calling app) the debugger will just step over that code. Press F11 all you like, it won't do any good. Because the object isn't in the same process as the app being debugged, it won't step into it. However if you change the configuration to a Library application, you will be able to debug to your heart's content.&lt;br /&gt;&lt;br /&gt;So what's that got to do with Code Coverage? Well, (I think) VS only produces results for code running in the TestHost process, or the ASP.NET equivalent, if you configure it that way. So, even if I did manage to add the GAC'ed DLL, my code coverage stats would be poor. UNLESS, for the purposes of testing I configured the app as a LIbrary Application.&lt;br /&gt;&lt;br /&gt;I guess you'd only need to do it the once, though. Once you know your unit tests cover x% of your component's code, you can configure it how it'd be in production and leave it - if you're using Team System you'll be able to publish the results and keep a record of the coverage stats to take away. Nice!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Ignore the error messages&lt;/strong&gt;&lt;br /&gt;Okay. Don't ignore the error messages, just don't drill down to fixing the exact problem in the message. Because when you're working with Serviced components, you're working with (at least!) 2 sets of technology, the COM+ stuff and the .NET framework. As a result, the errors that get caught and passed between the 2 can lose a little in the translation. I had several errors crop up with null references and invalid security priviledges. They were invariably caused by either not installing the DLL in the GAC, or forgetting to register the component in the first place. Doh! Still, it took a bit of investigating, and I spent a while looking through the code trying to work out what was wrong. Guess I learnt a bit of a lesson - &lt;em&gt;It's not always just about the code you've written.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Remember which actual file's being loaded&lt;/strong&gt;&lt;br /&gt;I spent a while building, rebuilding and generally buggering about with the code the first couple of times I made significant changes to how the component worked. Either I spotted a mistake and corrected it, or I got rid of a method, or I added a method and tried to call it. Some of the corrections got me all confused since I'd made various changes to the behaviour, but the results weren't changing.&lt;br /&gt;&lt;br /&gt;Or, I'd add a method, write some code to call it, and then get a Mising Method exception. &lt;br /&gt;&lt;br /&gt;What was going on? It's obvious now that I've spotted it, and it's even more obvious after what you've just read about Unit Testing, but the wierdness was being caused by the DLL not being re-installed in the GAC. I'd rebuild, and then when the test app called that assembly, it wasn't the fresh up-to-date assembly being called. It was the assembly that I'd already identitfied as being wrong that was running.&lt;br /&gt;&lt;br /&gt;Doh!&lt;br /&gt;&lt;br /&gt;All in all, though, everything seems to be working nicely now, though. I just wanted to get some stuff to remember written down to help me remember it. &lt;br /&gt;&lt;br /&gt;Jurt a quick plea for help, I wrote this pretty much off the top of my head. If anyone spots anything that's very incorrect, please drop a comment and let me know. Just to re-iterate, I certainly wouldn't take this post as gospel. They're just some things I wanted to make a note of, and generally thought I'd share.</description><thr:total xmlns:thr="">1</thr:total></item><item><title>And... Breathe...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sun, 18 Sep 2005 09:39:42 PDT</pubDate><guid isPermaLink="false">,</guid><description>So I've been a bit busy over the past couple of weeks.&lt;br /&gt;&lt;br /&gt;What have I been up to?&lt;ol&gt;&lt;li&gt;&lt;a href=""&gt;Spent 2 weeks in Egypt&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Spent a week at work&lt;/li&gt;&lt;li&gt;Went book shopping&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Actually, that doesn't sound too busy at all. How come I feel like I haven't had 2 seeconds to sit and do anything? Oh well.&lt;br /&gt;&lt;br /&gt;Doing some interesting stuff at the moment with &lt;a href=""&gt;System.EnterpriseServices&lt;/a&gt; and &lt;a href=""&gt;.NET remoting&lt;/a&gt; in C# 2.0. It's big fun, and if it all works, should make my life at work a bit easier. Nothing huge, but I'm currently replacing a web service with a remotable serviced component. The web service works fine, but because of the job it does, it needs to be as quick as possible. WebServices are great for a whole host of reasons, but for out purposes it could be better. It's a logging component for our intranet, which can be called across sites, but always to and from applications we've written.&lt;br /&gt;&lt;br /&gt;There's no need for it to be interoparable over multiple environments (one of the biggest advantages of WebServices). As a result, one of the first advantages remoting has over WebServices is being able to send messages over TCP, and serialized using .NET's &lt;a href=""&gt;BinaryFormatter&lt;/a&gt;. This makes the messages going backwards and forwards much smaller. I haven't get any data on actual message size, but it took approximately 8 times as long to pull a dataset out through the webservice than it did to pull the same data out as business objects through a remoted component.&lt;br /&gt;&lt;br /&gt;Add to that the nice things that COM+ brings to the table like &lt;a href=""&gt;JIT Activation&lt;/a&gt;, &lt;a href=""&gt;transaction management&lt;/a&gt; and &lt;a href=""&gt;object pooling&lt;/a&gt; and it should be a nice replacement. &lt;br /&gt;&lt;br /&gt;And I get to play with C# and VS 2005.&lt;br /&gt;&lt;br /&gt;What more could a boy want?&lt;br /&gt;&lt;br /&gt;I'm sure I'll be writing more about my adventures in C# 2.0 shortly, but for now, I've got a couple of new books to read (&lt;a href=""&gt;this&lt;/a&gt;, &lt;a href=""&gt;this&lt;/a&gt; and &lt;a href=""&gt;this&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Very Very Quick...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 03 Sep 2005 06:37:18 PDT</pubDate><guid isPermaLink="false">,</guid><description>...Before Mrs Mawoo finds me...&lt;br /&gt;&lt;br /&gt;I'm currently blogging from a hotel lobby in Luxor, just about half way down the east coast of Egypt. I'll write more when I get back in a week or so, but here's a summary:&lt;ul&gt;&lt;li&gt;Egypt rocks.&lt;/li&gt;&lt;li&gt;Luxor rocks.&lt;/li&gt;&lt;li&gt;Aswan rocks&lt;/li&gt;&lt;li&gt;Pyramids rule.&lt;/li&gt;&lt;li&gt;Temples kick arse&lt;/li&gt;&lt;li&gt;The desert's ace&lt;/li&gt;&lt;li&gt;You can have too much of a train trip&lt;/li&gt;&lt;li&gt;Cairo doesn't rock.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I'll elaborate further when I've re-learnt how to type (funny how you can get out of practice with these things ;-)) But for now, I'm in Egypt. And that's cool.&lt;br /&gt;&lt;br /&gt;Just wanted to share. I'm sure one day  I'll get onto some .net stuff again one day...</description><thr:total xmlns:thr="">0</thr:total></item><item><title>The perils of stubbing out methods</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 20 Aug 2005 17:26:25 PDT</pubDate><guid isPermaLink="false">,</guid><description>I only have a single-thread brain. Sad, but true. I can only really concentrate on one thing at a time.&lt;br /&gt;&lt;br /&gt;For example, when I'm writing, I like to stub out sections of code so I can some back and flesh them out when I've finished something else. Take thei example of some code in process:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Public Function GetString(AllTheString as Boolean) as String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If AllTheString Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Return "You asked for all the string"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Add the 'Not-All-The-String' in  a minute.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Why not make a coffee?&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You get the point. I can deal with the other path the code can take at some point in time. Perhaps after a coffee. However, this approach doesn't work in SQL Server 2000. I'm sure it's well documented and whatnot, but it really did give me some grief earlier today. Take this example:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;CREATE PROCEDURE ThisIsATest&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(@TestValue int)&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;IF EXISTS(SELECT TheKey FROM TheTable WHERE TheKey = @TestValue&lt;br /&gt;BEGIN&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;INSERT INTO AuditTable(Event, Time)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;VALUES ('This value was found: ' + @TestValue, GETDATE())&lt;br /&gt;END&lt;br /&gt;ELSE&lt;br /&gt;BEGIN&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/*I'll worry about this part in a minute&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I quite feel like a coffee roundabout now...*/&lt;br /&gt;END&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Hit the 'Validate SQL' button, and it'll return an error. A nice error? A helpful error? An error that might vaguely suggest that you might have a code path that doesn't actually so anything? No. What does it come back with?&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Incorrect syntax near the keyword 'END'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Pointing at the last line of the script.&lt;br /&gt;&lt;br /&gt;Took me ages of sifting through a long SPROC before I realised that was what it was trying to tell me. Bugger. All I was trying to dso was vlidate the SQL I &lt;em&gt;had&lt;/em&gt; writen so I could move on to the other part. &lt;br /&gt;&lt;br /&gt;Just wanted to share. Apologies for irrelevance and brevity, but it's late. All because of this very thing!</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Firsts, firsts and more firsts...</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 13 Aug 2005 00:39:13 PDT</pubDate><guid isPermaLink="false">,</guid><description>We're just starting a new project at work for the next few months. It's a fairly standard data mangling app, retreiving deatails about people, updating them stashing them back in a database. Nothing really out of the ordinary.&lt;br /&gt;&lt;br /&gt;Well, it would seem that my team doesn't like to do the same thing over and over again (fair enough, neither do I!) so we're going to be doing a whole bunch of stuff that none of us have ever really done before. Our next project will be:&lt;ul&gt;&lt;li&gt;Written in C#&lt;/li&gt;&lt;li&gt;v2.0&lt;/li&gt;&lt;li&gt;in VS 05 beta&lt;/li&gt;&lt;li&gt;All developed on virtual PCs&lt;/li&gt;&lt;li&gt;Managed by Team System (Also running on a virtual server)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;It's times like this that I really like not being chrged for by the hour. We had a meeting yesterday where we kind of figured that we can get the data-mangling parts written relatively quickly, so we could spend a bit more time doing nice twiddly bits for the UI. Nice. So there's going to be a few AJAX-easqe bits (I'm not even going to pretend that it's a new thing, but I'd never found a library quite as nice as &lt;a href=""&gt;Michael Schwarz' AJAX.NET&lt;/a&gt; for making it happen). IN real life, I;m sure we could knock something very dull rogether in a few weeks, but that would be it. It would be a very boring bit of kit. Just another in a long line of data mangling applications, And if I was being charged for by the hour, I'm sure that would suffice ('I don't care how boring it is, just do it as quick and cheap as possible!'). &lt;br /&gt;&lt;br /&gt;But I'm not. And that's cool. We get to learn new stuff (none of us have written in C# before) use new things (all betas, which is why we're doing it all on VPC's) and have some real fun (if you're into that sort of thing) with it.&lt;br /&gt;&lt;br /&gt;Nice!&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Disaster at Benjimawoo Towers!</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Sat, 06 Aug 2005 02:20:52 PDT</pubDate><guid isPermaLink="false">,</guid><description>Of all the keys that had to stop working after my &lt;a href=""&gt;little bit of clumsiness a couple of weeks ago&lt;/a&gt; why did it have to be F11!&lt;br /&gt;&lt;br /&gt;Yes, I know I can change the default key bindings, but i'm too lazy to change them from the VS defaults and reconfigure every time I rebuild.&lt;br /&gt;&lt;br /&gt;Grr! Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item><item><title>Short-circuiting comparisons</title><link></link><author>[email protected] (Benjimawoo)</author><pubDate>Fri, 05 Aug 2005 15:09:54 PDT</pubDate><guid isPermaLink="false">,</guid><description>This was one of those things that I read about and though 'Huh. When am I ever going to use &lt;em&gt;that&lt;/em&gt;?' Turns out it's pretty useful at times.&lt;br /&gt;&lt;br /&gt;VB.NET can short circuit comparisons using the AndAlso an OrElse keywords. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What's short-circuiting?&lt;/strong&gt;&lt;br /&gt;Short circuiting occurs when you have multiple comparisons on a line and the outcome is known before you get to the end of the line. Take the following line of code:&lt;br /&gt;&lt;code&gt;If 1=2 And 3=3 Then&lt;br /&gt;    'Do some stuff&lt;br /&gt;End If&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You know after the first part (1=2) that the comparison is going to return false, but the second part is still evaluated (i.e. the machine still checks to see if 3 does in fact equal 3). However, if you were to use this:&lt;br /&gt;&lt;code&gt;If 1=2 AndAlso 3=3 Then&lt;br /&gt;    'Do some stuff&lt;br /&gt;End If&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The machine skips the 3=3 part of the comparison. Just ignores it. It knows that since 1!=2 the result is going to be false, so it just skips over the second part.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;So?&lt;/strong&gt;&lt;br /&gt;That contrived example doesn't look too useful. However, if we look at a real world example, all becomes clear:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Dim ds as Dataset = GetMyDataset()&lt;br /&gt;Dim dr as DataRow = GetMyDataSet.Tables(0).Rows(0)&lt;br /&gt;If Not IsDbNull(dr("FieldName")) And dr("FieldName") &gt; 0 Then&lt;br /&gt;    'Do some stuff&lt;br /&gt;End If&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Because we're using the normal 'And', if the value in the row specified is null, the method will throw an exception because a value of type DBNull can't be cast to an integer. Although 'Not IsDbNull(dr("FieldName"))' returns false (because it &lt;em&gt;is&lt;/em&gt; null) the second section is still evaluated. And because it's a null value, an exception is thrown.&lt;br /&gt;&lt;br /&gt;However, if we use AndAlso, the comparison is short-circuited and it doesn't throw an exception:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Dim ds as Dataset = GetMyDataset()&lt;br /&gt;Dim dr as DataRow = GetMyDataSet.Tables(0).Rows(0)&lt;br /&gt;If Not IsDbNull(dr("FieldName")) AndAlso dr("FieldName") &gt; 0 Then&lt;br /&gt;    'Do some stuff&lt;br /&gt;End If&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Because the first part of the comparison return false, the framework &lt;em&gt;knows&lt;/em&gt; that the overall expression is going to return false, so it doesn't bother trying to evaluate the second part, and it doesn't throw an exception.&lt;br /&gt;&lt;br /&gt;Needless to say, OrElse works in exactly the same way, but for Or's rather than And's.&lt;br /&gt;&lt;br /&gt;It's come in handy for me a couple of times recently, anyway.&lt;br /&gt;&lt;br /&gt;Just wanted to share.</description><thr:total xmlns:thr="">0</thr:total></item></channel></rss>

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda