Saturday 26 December 2009

My presentation for netponto about Lucene.net

A couple of weeks ago I did a presentation for a .net user group (netponto) here in Portugal about Lucene.net, an open source textual search engine. You can see the slide deck here, and I've uploaded the source code used in the demo to my github page.

What went well

Using git (with the git-extensions gui) to bookmark the various steps I wanted for the code demo. This is something that surprised me on how well it worked and actually ended up being remarked upon. It also generated a few questions about git that were answered mid-demo in a bit of a detour.

The pattern here is to build the demo as a series of linear git branches, each a small step in the demo, and instead of writing the code in-loco at the demo or storing snippets to be used, I just move up along the branches. Each step is small and self contained, and I spend more time just highlighting the important parts and the decisions I made and less time typing.

Also, using git gives me the advantage to rewrite history, so that if I figure out that the demo app needs to have a foo somewhere from the start, I can switch to the root branch, make the edit, and rebase the branches to update them with the change. With some care, this propagates the change upwards with little to no conflicts.

Short deck of slides, demo with ongoing q&a. While the initial presentation didn't take long, the demo ended up going into overtime. If there's no hard and fast timebox, this is good, otherwise answering questions in the middle of the demo can push a well timed demo out of its allotted time. But the audience seemed to be enjoying it, and I think this helps spread knowledge a bit better than just giving a presentation and showing code.

What could have been better

The "oh dear, a crash" gimmick had an interesting effect, but I think it was wasted on a slightly minor point. A better and more important part to emphasize would have been the impact of the analyzer on both indexed fields and search query. I should have had an unexpected result for a search be the "crash" and not the lack of values for fields.

I used a transition I saw on slide:ology in 3 slides, which while cool, might have been more distracting than useful. On the other hand, I think it emphasized the fact that the index was shared between the indexer and the searcher, which part of the point I was trying to make.

What I'll improve

Relax. Although the feedback I gathered from some of the audience was that it didn't show, I felt like I had zipped through the initial presentation. Ended up taking a bit of a breather while answering questions.

Might be interesting to consider dropping even more slides in detriment of more code. Although I think there's a minimum needed to intro the subject matter. Otherwise people will look at the code but the concepts will not gel.

Feedback

If you were there, I'd love to hear from you. I've received the report from Caio with the flattering comments, but I'd also love to hear your opinion on what could have been improved.

Sunday 30 August 2009

I wish I could put 4gb of ram on my macbook...

According to an article on cnet Snow Leopard boots by default into a 32-bit kernel and mentions that macbooks with an older, 32-bit EFI chipset (which handles the early boot process) cannot boot the 64-bit version.

Although having a 64-bit kernel would be good, I'm more interested in the side effect of the 32-bit chipset memory limitation. The same article mentions that a 32-bit EFI chipset cannot address more than 3Gb of ram. Since most likely this is the chipset installed on my mac, I think that's the reason why 4 Gb are not supported. I wonder if the chipset could be replaced. Doubt it, since it must be soldered into the board.

Sadly, that's pretty much the largest reason I'm envious of the new macs. 2 gb isn't much, specially if you're like me and have tons of apps loaded all the time.

Wednesday 19 August 2009

Man, it would be awesome to go...

Roy Osherove is giving an hands-on TDD Masterclass in the UK, September 21-25. Roy is author of "The Art of Unit Testing" (http://www.artofunittesting.com/), a leading tdd & unit testing book; he maintains a blog at http://iserializable.com (which amoung other things has critiqued tests written by Microsoft for asp.net MVC - check out the testreviews category) and has recently been on the Scott Hanselman podcast (http://bit.ly/psgYO) where he educated Scott on best practices in Unit Testing techniques. For a further insight into Roy's style, be sure to also check out Roy's talk at the recent Norwegian Developer's Conference (http://bit.ly/NuJVa).


Full Details here: http://bbits.co.uk/tddmasterclass

Update:

bbits are holding a raffle for a free ticket for the event. To be eligible to win the ticket (worth £2395!) you MUST paste this text, including all links, into your blog and email Ian@bbits.co.uk with the url to the blog entry. The draw will be made on September 1st and the winner informed by email and on bbits.co.uk/blog

Saturday 8 August 2009

Windows 7 blues

why haven't I learned yet not to go for first releases?

With Windows 7 reaching RTM status and the general low working demands of August, I decided it was time to kick Vista to the curb on my dev machine and get myself a brand new shiny OS.

Triple-headed Blue-screens

Because it can never be two easy, the upgrade experience ended up being rather painful, with both attemps resulting in blue screens before the setup was finished. Deciding that perhaps it was some conflict with device drivers, one of the many programs I had installed or just bad luck, I decided to cut my losses and just repave the system partition to do a clean install.

Still no joy. Same bluescreen at the end of the setup.

The dev machine's most unusual part is the two NVIDIA display adapters installed on the PCI-E slots, which are used to drive 3 monitors. Remembering that vista also had some troubles with the secondary adapter, I removed it and gave it another shot.

Yap, that worked. Setup finished and gave me a brand new Windows 7 installation to play with.

You no like restart?

With a folder full of drivers for the display adapters, chipset, SATA controllers and audio, I spent some time updating them before heading home. Somewhere around the end ,after a restart, another bluescreen.

That's no good.

After some fiddling I found out that it only happened on a restart, and never on a cold boot.

Oh well, that's a bother but at least it's work-around-able. Off I go to install sql server, visual studio and a miriad of essential software for a dev machine. Thankfully with portable apps living in a dropbox folder most of it takes little to no time at all.

System Interrupts should not interrupt all the time.

Some time afterwards, while installing some software I decided to look at resource monitor as a source of "oh, look at all that data" entertainment.

And it showed "System Interrupts" using about 40% of the cpu, all the time. What. The. Hell. At first I thought it would have something to do with the troublesome display adapters, and reverting to the standard VGA adapter driver reduced the usage, but it still was too high (about 20, 25%)

Again, after some fiddling around, uninstalling drivers, disabling devices I found out that the problem was with the "Marver 88SE611 SATA V12069" drivers. Reverting the drivers to the default drivers makes the cpu usage go back to normal.

Sadly, the reboot bluescreen still appears from time to time. I think it always happened when the second display adapter was installed, but I'm not sure.

In a nutshell.

  • When upgrading/installing, remove the secondary display adapter.
  • With two display adapters, don't reboot (away from the machine)
  • Don't install the Marvell SATA driver
  • Get a rabbit's foot.

I do hope the reboot bluescreen gets fixed soon, but for now I'm happy with having a usable machine.

In the case someone has the same problem, this machine has the following specs:

  • Core2Duo E8400
  • 4 x 2Gb Kingston ValueRam
  • Asus P5Q Pro
  • NVIDIA 7300 LE
  • NVIDIA 7200 GS
  • Western Digital 150Gb Velociraptor
  • Seagate 200Gb

Thursday 11 June 2009

Dr. Googlelove or: How I Learned to Stop Worrying and Love the Cloud

written in full blown hipster <censured> mode on a macbook, listening to an ipod and sipping an iced mocca at a starbucks.

Having three different machines that I work with daily tends to cause me some pain whenever I try to send an email from the two that are work/fun related. I've got 3 pcs that I use on a daily basis:

  • My personal laptop is a black Macbook called mac-sendai. It handles my email, IM, photos, videos and contacts. My social life is stored in it, being it work or personal and I carry it around for most of the time.
  • My home machine is armitage. It's a Windows XP machine that I use mostly as a gaming/movie machine.
  • My work machine is 2finn. It runs Windows Vista 64 and is my main development machine at the office.

From each of the 3 pcs I usually need to send off emails. I use Gmail on any of the desktops and Mail.app on the laptop. Since mac-sendai handles the social part, my address book there is where I aggregate and collate most of the information about contacts and sync both the cell phone and an ipod touch to it.

Up until now the only connection to the cloud was from the laptop to Plaxo, to get auto-updates for contact information of friends and "business associates". It works rather well and the best way to prove it is that most of the time I don't even notice it.

But lately I've noticed that OS X is able to sync remotely to google contacts, and since I use gmail on the desktops, having it synchronized with the address books is the last step in having a always available and up to date contact store on all machines, with the added benefits of remote backups (besides the time machine I store at home).

So nowadays here's the replication flow for my "personal network":

Sync network

  • Dropbox handles the "utils", which are about 50 or 100 megs of portable apps including notepad2, gnu utils and Launchy's preferences, current working set documents, emacs site-lisp and .emacs. Some time ago I used foldershare for the utils, but it was too finicky, and with hard links from the dropbox to the correct places, it all works much better.
  • Gmail handles the email. I've used IMAP even before gmail on all desktop programs and now on the ipod touch, so I haven't even thought about that particular issue for a while.
  • Google Calendar keeps some of my appointments, with a shared calendar for weListen.
  • And now, Google Contacts stores the emails and phone numbers for my little social network.

The migration of contacts ended up costing about half an hour of deduplication and merging, but thankfully the address book includes a shortcut to merge contacts, so most of the time it was spent cleaning up emails that I don't need and just checking the contacts to see that nothing was mangled.

My biggest worry now is that the address book will become bloated. GMail adds any address that you send email to to the contacts list, and most of the time if it's a one time only reply I won't want it to be replicated, so the jury's still out on how I'll handle that.

But for now, I'm a happy camper. No more copy pasting of emails, and my inner software engineer feels more confortable at not having duplicated information spread around.

Edit: thanks to Edgar Gonçalves for the title fix :) In my defence Starbucks had no wifi, and I was unsure of the correct title :)

Wednesday 22 April 2009

My delicious tag wordle

Does it show that I am a .net developer with a python deviancy?

Delicious Tag Wordle.png

Tuesday 13 January 2009

Typemock Isolator Plug (to get a free license and try out something other than Moq)

Programming Visual Basic applications?

Typemock have released a new version of their unit testing tool, Typemock Isolator 5.2. This version includes a new friendly VB.NET API which makes Isolator the best Isolation tool for unit testing A Visual Basic (VB) .NET application.

Isolator now allows unit testing in VB or C# for many ‘hard to test’ technologies such as SharePoint, ASP.NET MVC, partial support for Silverlight, WPF, LINQ, WF, Entity Framework, WCF unit testing and more.

Note that the first 25 bloggers who blog this text in their blog and tell us about it, will get a Free Full Isolator license (worth $139). If you post this in a VB.NET dedicated blog, you'll get a license automatically (even if more than 25 submit) during the first week of this announcement.

Go ahead, click the following link for more information on how to get your free license.

Wednesday 7 January 2009

Evil Extension Method, or just handy?

 

I just realized I can have the following extension method:

   1: public static class StringExtensions
   2: {
   3:     public static bool HasContent(this string self)
   4:     {
   5:         return !string.IsNullOrEmpty(self);
   6:     }
   7: }

And then use it like this:

   1: [TestFixture]
   2: public class StringExtensionMethodsTest
   3: {
   4:     [Test]
   5:     [Category("Unit")]
   6:     public void TestStringHasContentWorksForNullStrings()
   7:     {
   8:         string s = null;
   9:         Assert.IsFalse(s.HasContent());
  10:     }
  11:  
  12:     [Test]
  13:     [Category("Unit")]
  14:     public void TestStringHasContentWorksForEmptyStrings()
  15:     {
  16:         string s = "";
  17:         Assert.IsFalse(s.HasContent());
  18:     }
  19:  
  20:     [Test]
  21:     [Category("Unit")]
  22:     public void TestStringHasContentWorksForStringsWithContent()
  23:     {
  24:         string s = "content";
  25:         Assert.IsTrue(s.HasContent());
  26:     }
  27: }

The interesting part is that a method call on a null object for an extension method works, which allows for the s.HasContent() idiom, instead of string.HasContent(s).

My question is the following: is relying on such “detail” good, in the way that it allows for less line noise and cleaner code, or bad for violating the idea that you can call a method on a null object and not get an exception?

I’d love to hear opinions on this.