Code Camp {where}

Code Camp {where}

For some reason this week seemed to disappear.  After getting back from my trip around the globe last weekend I was excited to launch back into work.  Dave and I are now working out of the Perth Annex – the Perth extension to the R & D Centre for [Intilecta] based in Wellington.  Part of my time while I was in NZ was to help with the transition from SourceSafe to Subversion.  This was only one part of a much larger initiative to upgrade our internal infrastructure.  Already we have noticed a massive improvement in our ability to work remotely.

This leads me to my next point which is that I’m again on the road, this time at the Qantas Club in Melbourne on the way to Code Camp Oz.  This is definitely one of the developer highlights of the year, although being in Wagga Wagga it is a pain to get to for people who don’t live on the East Coast – not only do we have to fly to the East (Sydney, Canberra or Melbourne), we then need to organise transport to Wagga, not to mention the additional days leave in order to get to and from the event.  For future, guys (Mitch and Greg) I think it is time to rethink this decision and move it to a more hospitable location.  This would also encourage international developers, such as Alex, to come across.

. " , ‘ ; ! – ? _ Are all examples of …… Often Misused Punctuation

. " , ‘ ; ! – ? _ Are all examples of …… Often Misused Punctuation

Rod has an interesting post about where and when you should use apostrophes (arguably the most misused punctuation).  If you were ever curious, and want a good laugh while being educated, you should read “Eats, Shoots and Leaves”.  This book contains hundreds of illustrations of where you should and shouldn’t use a range of punctuation and IMHO should be a core teaching requirement for all high schools!

Hosted Exchange 2007 for SoftTeq

Hosted Exchange 2007 for SoftTeq

Yesterday morning didn’t start out particularly well for me.  If you have ever played around with adding/removing mail accounts from Outlook you will probably know that if you remove your Exchange mail account it removes your primary mailbox (ie the OST file).  Normally this isn’t a problem because you can setup your mail accounts, reconnect to the exchange server and sync your mailbox.  Unfortunately the reason I was playing around was because the SoftTeq mail server had died so I couldn’t reconnect.  Luckily I was able to download a OST to PST application that did the trick.

The real reason for this post is that I then went looking for an alternative to us managing our own server (basically we were only using the exchange portion of SBS anyhow as SoftTeq is no longer a commercial venture). This is when I came across ExchangeMailHosting, which is actually run by IT Solutions Now.  I was looking for a hosted exchange solution that was relatively cheap, that used Exchange 2007 and supported RPC over HTTP (so I could sync on the run and from my mobile device).  For $9.95 per mailbox per month this service is quite good value.

It gets better – if you want a baseline to compare service against then these guys are quite high up there.  I filled in their online application form and within an hour I had an email saying that the service was up and running.  Within 2 hours I had setup Outlook (as per instructions in the welcome email), I had accessed their web access site and I had sync’d to my mobile device.  When their application form said that someone would contact us within 24 hours I’d assumed I’d get a phone call at 3am to complete the process – but instead “It All Just Works”!

Lastly I want to point out a great new feature in Exchange 2007:  After Windows Mobile 5 was released there was a service pack for Exchange 2003 which allowed an administrator to remote wipe a device that was syncing with the Exchange server.  Clearly this was a little inefficient since it requires an admin to get involved at 3am when a drunk employee realises they left their phone in the Taxi.  The new and improved Outlook Web Access in Exchange 2007 has the ability for the user to Self-Serve through the Options -> Mobile Devices screen, as shown in the following image.

Synchronisation Strategies

Synchronisation Strategies

The author of sync-mobile has added another post that discusses scheduling strategies for synchronisation of data.  In this post they outline three strategies for scheduling or kicking off a sync:

  1. SMS – There is definitely a risk that messages can be delayed or might never reach the target but on most networks this latency/risk is pretty low.  In fact in NZ they use SMS as a mechanism for paying for parking – the latency is 5-10 seconds which is usually adequate for most scenarios.  Don’t forget that Windows Mobile 5+ now has the notification engine means that you can write managed code using the .NST Compacty Framework to intercept SMS messages, even if you application isn’t running!

  2. HTTP/TCPIP – Their main point with this strategy is that battery life is a premium which I would have to agree with.  There is also the additional cost of network traffic (for those countries like Australia/NZ where data is still expensive).  This said, since the release of the Security and Messaging Feature Pack for Windows Mobile 5 we have had Direct Push email – this basically establishes a connection to the Exchange server that remains open even when the device goes into standby.  There is a great article on MSDN that discusses how you can use this technique in your application.  In my experience the drain on battery power is actually not that bad using this technique.

  3. Scheduled Sync – Ok, now we are talking – this is a technique I have used a couple of times.  The biggest issue here is that in managed code any sort of timer you use has the issue that it won’t be triggered if your device has gone into standby (which it is likely to do in order to extend battery life).  This is where you really need the power of the Smart Device Framework from the guys at OpenNETCF so you can use the Large Interval Timer in order to wake your application up.

It would be great to hear what other techniques people use in order to trigger synchronisations – do you monitor network availability, sync on application startup/usage or do you have other business rules that drive when you synchronise.  Do you detect what type of network you are connected to and determine whether you should sync based on the cost of the network (see the Mobile Client Software Factory – Disconnected Service Agent and Connection Monitor blocks for quite a nice implementation of this)

Why having a Database Engine in ROM is a good idea

Why having a Database Engine in ROM is a good idea

Yesterday I came across an interesting site dedicated to Mobile Synchronisation and noticed they had a post regarding Symbian and the fact that in the next version of their OS (v9.5) they will follow Microsoft’s path of including a database engine (SQLLite fo Symbian, SQL Server CE for Windows Mobile) in ROM.

The author attempts to make the point that he doesn’t understand why you would want to include a database engine in ROM, or a runtime such as .NET CF for that matter. They point out that you “still need to install your mobile application so what is the big deal of reducing your install size by a few 100KB?”.  IMHO there are a couple of compelling reasons to include both the runtime and database engine in ROM:

  • Firstly it means that you don’t need to package it with your application – although the size saving isn’t that great, it is just another thing that you have to include in your installer (better that someone else deals with this). 

  • It also means that the database engine is only deployed once (since SQL Server CE can be deployed as a set of dlls, in theory you could have multiple applications all with their own instance of the database engine).

  • I think the most significant reason for including the runtime and database engine in ROM is to make the OS more appealing to developers.  If I know that all WM6 devices are going to be able to run my application because it has the runtime and db engine included then I am likely to target that device for any new applications.  This is similar to the decision to include the .NET Framework v3 in Windows Vista (in contrast to previous versions of Windows where the .NET Framework is an optional install).

I was also intrigued by the author’s comment regarding the inclusion of SQL Server Express in [VS2005] a marketing ploy.  Perhaps it was but developers still have the choice as to whether it gets installed (as with other components of VS) and it does mean that developers don’t need to worry about downloading/purchasing a database engine in order to build database applications.

Get your WCF on the run

Get your WCF on the run

Mark Prentice of the .NET Compact Framework team has just posted an introduction on how you will be able to work with the WCF-over-email solution that will come out as part of v3.5 of the .NET CF.  At the MVP Summit we saw this in action and enough to say it is way cool.  Although I can’t see Steve getting all enthusiastic about using Sync Services across this binding, I think there is a huge potential here for organisations to start leaveraging their investment in Outlook/Exchange by building peer-to-peer messaging based applications.


BIG NEWS for TFS users – Microsoft Acquires DevBiz

BIG NEWS for TFS users – Microsoft Acquires DevBiz

Anyone working with TFS will be over the moon to know (as per Brian Harry’s post) that Microsoft has just acquired DevBiz.  This is a significant gap stop in a fundamentally v1 product where simple web accessibility was not readily available.  Team Plain was almost a no brainer, despite the additional per seat cost.  Now with the Microsoft acquisition you have no excuse.  Of course, don’t forget the per seat CALs you need to access TFS!

Visual Studio Refresher: Tools -> Options (2)

Visual Studio Refresher: Tools -> Options (2)

This post continues the discussion around the Tool -> Options screen in [VS2005].

[Goto to root post]

Environment – Add-in/Macro Security

Allow macros to run: Toggles whether macros are able to be created, edited or executed.  Disabling this option will immediately disable all macro menu items in the IDE (both under the Macros item in the Tools menu and the Macro Explorer under the View->Other Windows menu item).  Note that if the Macro Explorer is already open it will remain visible, at least until you restart the IDE

Allow Add-in components to load: This option toggles whether Add-ins can load or not.  Unfortunately it really depends on how well the Add-in is written as to whether they are visible or not.  For example the AnkhSVN component still appears in the Tools menu on my machine, however clicking any of the items does nothing. Note that this option also disable the Add-in Manager item in the Tools menu.

Allow Add-in components to load from a URL: Well as you can guess this allows add-ins to be loaded from a url – well duh!  I guess this option is there if you really want to shoot yourself in the foot 😉

Add-in File Paths: This is a series of locations from which add-ins will be loaded (assuming Add-in components is enabled).  By default there are a series of predefined locations:

%ALLUSERSPROFILE% – C:Documents and SettingsAll UsersApplication DataMicrosoftMSEnvSharedAddins

%APPDATA% – C:Documents and Settings<username>Application DataMicrosoftMSEnvSharedAddins

%USERPROFILE% – C:Documents and Settings<username>My DocumentsVisual Studio 2005Addins

%VSAPPDATA% – C:Documents and Settings<username>Addins

%VSCOMMONAPPDATA% – C:Documents and SettingsAll UsersAddins

You can of course add your own or remove these at will to control where add-ins are loaded.

OpenNETCF – Quiet but not stagnant

OpenNETCF – Quiet but not stagnant

Anyone working in the .NET CF space will know that the team at OpenNETCF have been leading the way with their Smart Device Framework.  In v1 of the .NET CF the SDF was essential to have any reasonably functioning application.  Now with v2 the SDF is less essential, but you still quickly hit the limitations of the .NET CF. 

Recently Chris has posted about the new LargeIntervalTimer class that is coming in v2.1 of the SDF. A challenge faced by device developers is periodically waking the device up to say synchronise, poll for changes or do some other task.  When a device is in standby mode your managed code doesn’t get an opportunity to execute so you can’t rely on normal timers.  You actually need to hook the OS and to do that gracefully you really need the elegance of the SDF – check out the post for the code!

Personally I can’t wait for them to release v2.1 so I can start working with the new additions.

VB9 Features

VB9 Features

I’ve just noticed, care of Bill and Beth, that the VB9 features article has been updated as of February this year.  After a quick scan there are some clear changes that look great (and some that don’t)!

Object Initializers

Dim c as New Country With { .Name = “Palau”, .Area = 458, .Population = 16952 }

What I like about this notation is that it follows the VB tradition of using the With statement.  Previously you would have written:

Dim c as New Country()
With c
End With

The new notation is particular efficient if you want to initialise a collection of Country objects as each object can be instantiated and properties set in a single statement. For example:

Dim countries = { _
   New Country With { .Name = “Palau”, .Area = 458, .Population = 16952 }, _
   New Country With { .Name = “Monaco”, .Area = 1.9, .Population = 31719 }, _
   New Country With { .Name = “Belize”, .Area = 22960, .Population = 219296 }, _
   New Country With { .Name = “Madagascar”, .Area = 587040, .Population = 13670507} _

Implicity typing

In the last section you will have noticed that I didn’t specify the type of the countries collection.  This is NOT because I haven’t allowed VB.NET to run riot, it is because we have implicit typing.  This defines countries to be of type Country(). Why, because the right hand side defines an array of Country objects – we can see that, and now the compiler can too.

WARNING: To all those developers (including C# developers using the new var keyword) out there who are going to start using this feature throughout their code you are as bad as those VB6- developers who used Variant objects, or for that matter .NET developers who use object objects cause they can’t be bothered getting it right.  The reason for this is that it makes your code harder to read and understand – you can’t just read the variable declaration and know what type it is, instead you have to dissect the right hand side.  The ONLY time IMHO that implicit typing should (and in fact sometimes has to) be used is in a Linq statement.


Yeh, yeh, yeh – by now I’m hoping we have all heard, if not seen, Linq.  So just for clarrification we are talking about:

Dim smallCountries = From country In countries _
                                  Where country.Population < 1000000 _ 
                                  Select country

Of course it goes without saying that this is fundamentally cool! Before we go further though, it is worth noting that smallCountries is an IEnumerable(of Country) – if you aren’t comfortable with Interfaces, now would be great time to begin using them!

Lambda Expressions


Function(Country As Country) country.Name
Function (Country As Country) country.Population < 1000000

These can be written as inline (like mini-anonymous methods) such as:

Dim smallCountries = _
   Enumerable.Select( _
      Enumerable.Where(countries, _
         Function (country As Country) country.Population < 1000000), _ 
      Function(country As Country) country.Name

IMHO this is probably one of the weakest of the new features available in VB9.  The VB.NET community has long been asking for both anonymous methods and interators.  Instead of giving us C#2.0 feature parity the team has leap frogged into Linq giving us only minimal lambda expressions.  Luckily this will only affect the hardcore developers out there who are building collections and doing fancy framework development (damn, looks like I might have to go back to C# afterall).

Nullable Types

Ok, so we have seen this before but this time we have the ? syntax, just like C#v2:

Partial Class Country
   Public Property Independence As Date?
End Class


There are a bunch of other features such as XML support and Relaxed delegates that didn’t make this blog post.  I’d encourage you to read the full article and be prepared.  These features, especially IMHO Linq, are going to have more impact than Generics did!

Snippets and Stored Procedures

Snippets and Stored Procedures

Mitch has posted a simple snippet that shows how you can work with stored procedures in C#.  I figured that I’d firstly translate this to VB.NET: 

‘ Execute a stored proc to read data
Using conn As New SqlConnection(connectionString), _
          cmd As SqlCommand = conn.CreateCommand()

   cmd.CommandText = “ProcName”
cmd.CommandType = CommandType.StoredProcedure

   ‘ Add any input Params…
cmd.Parameters.AddWithValue(“@SomeIDParam”, myID)

   ‘ Assuming Stored Proc returns a set of records…
   Using rdr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
      While rdr.Read()
‘ do something with each rdr row …
End Using

Now that we have this snippet it would be great if we could add this to the [VS2005] snippets.  The best way to do this is to grab the Snippet Editor from GotDotNet (not sure where this link will go when they close it down later this year, but oh well). 

Running the Snippet Editor will display a tree on the left which shows all the snippets which are currently in VS2005.  If you right-click one of the nodes you can “Add New Snippet”.  You then have to give the snippet a name; in this case we use “Simple Stored Proc”.  After creating the snippet you need to double-click it on the tree to open it in the edit window, as shown below (I’ve filled in some of the information textboxes on this screen).

At the moment the snippet is a great way to reduce the amount of code you need to write but doesn’t really highlight the parts of the snippet that you need to replace.  For example it is unlikely when you use this snippet that you will be calling a stored proc with the name “ProcName”.  To improve this snippet we can add replacements which will identify areas of the snippet that need to be replaced when the snippet is used. 

Using the Replacements tab of the editor is relatively easy.  You simply select the text in the edit window that you want to make a replacement (eg “ProcName”) and select the + (Add new) button on the navigation bar.  This will allow you to spectify a name, default replacement and much more.  Once you are done your snippet editor window might look like the following:

For my snippet I’ve also added System.Data.SqlClient to the Imports tab and System.Data to the References tab.  This will ensure that appropriate imports and references are added to the project when this snippet is used.

Don’t forget to click “Save” when you are done!

Lastly if you want to share this snippet with others in your team (or on your blog) you can click Export which will create a Visual Studio installer.

Test Your Knowledge of Visual Studio 2005

Test Your Knowledge of Visual Studio 2005

In case you haven’t already guessed from the fact that this is my fourth post today I’m currently sitting in Heathrow airport on my way back to Perth. I must quickly add that this is the first time I have travelled around the world on the “One World” alliance and have been pleasantly surprised.  The two reasons I switched was because there is no local Star Alliance partner flying internally in Australia, and I now have Qantas Club membership.  The latter is probably more significant at the moment as it meant I was able to jump the 1 hour check-in line and the 30 minute security line – today was crazy in departures according to the staff. This said, I would avoid both American Airlines and Chicargo airport like the plague!

Ok, so now to the point of this post – One of the issues I’m seeing as more and more designers are added to [VS2005] is that there are an increasing number of “options” in the Tools->Options screen.  Thankfully the options screen is fairly accommodating and each new feature can have its own node, or sub-node, in the tree.  The question is whether you as a developer a) know these options are there and b) can find them.  So, I thought I would put my knowledge of VS to the test and go through each “option” and see if I can describe what it does. Note that each parent node simply displays the contents of it’s first child, so for the purposes of this exercise they have been ignored….[This may span multiple posts, so hang in there]

Environment – General

Window layout: [Tabbed documents | Multiple documents] This controls how documents are rendered within the document (or main) area.  In the Tabbed case all documents reside in the same area; the user can switch between documents using the tabs along the top (and the dropdown at the end of the top bar). On the other hand the Multiple document layout is your traditional MDI child layout; each document appears as a separate window within the document area; windows can be tiled or arranged. In most cases the Tabbed case is preferred as you can achieve a similar effect to the Multiple layout by spliting the screen (horizontal, vertical or both). Note that even in Tabbed layout mode documents are treated as windows for the purposes of selecting the active Window using the Window menu.

Recent files – [1-24] items shown in Window menu: The number of documents shown at the bottom of the Window menu (above the “Windows…” option that opens a window selection dialog showing all open documents).

Recent files – [1-24] items shown in the recently used lists: The number of documents/projects that will appear in the recently used lists, namely the File->Recent Files and File->Recent Projects lists.

Show status bar: This usually appears in the View menu but since that menu is too busy with the numerous design windows (eg Solution Explorer, Toolbox) available in VS this option has been relegated to the options screen.  It toggles the status bar at the bottom of the VS window.

Close button affects active tool window only: For example the standard configuration is for the Solution Explorer, Class View and Properties Window to be grouped together on the edge of VS.  If this option is checked clicking the close button will only close the currently visible window.  Unchecked, all three windows would be closed.

Auto Hide button affects active tool window only: Similar to the previous option this controls the behaviour when you click the “pin” to hold an expanding window in place.  If this is checked then only the active window will be pinned/released when the pin is clicked.

Animate environment tools: This controls whether, and the speed if enabled, the tool windows are animated when they appear/disappear.  If VS is taking a while to open/close tool windows it is advisable to turn this off (in fact in 99.999% of times animation is just a PITA, so just turn it off anyhow).

Restore File Associations: In case you have assigned file types such as .cs or .vb (and a heap of others) to some other application this button allows VS to reassign them back to the defaults.  Unfortunately, unlike other applications that lets you know which file types it will affect, or even present you with an option as to which file associations you want, VS assumes it knows best and just goes ahead and does it.

Well, that was the General node of Environment; there are only like 100 or so more to do…. plenty of stuff to do on the plane.  For now I’m going to enjoy a glass of wine, some dinner and read a book before my flight.


     Environment – Add-in/Macro Security

Are Device Developers Second Class Citizens?

Are Device Developers Second Class Citizens?

Some of you may remember that when [VS2005] shipped I had a few words to say about the fact that the Windows Mobile 5 SDK(s) weren’t in the box.  Of course these decisions come down to what will/won’t fit in the box (well on the ISO as in this case). With the release of the Windows Mobile 6 SDKs and VS Orcas just around the corner, will device developers have to download 2 SDKs if they want to work with both platforms?  The irony here is that at the core they are the same version of Windows CE, so IMHO there should be a single project type that handles both OS types!

Another interesting (but almost useless) bit of trivia is regarding the Remote Tools that are available for device developers.  I’ve often wondered why these are in the Start menu (Start->Programs->Microsoft Visual Studio 2005->Visual Studio Remote Tools) and not in the External Tools section under Tools within Visual Studio. Turns out this is another packaging decision: In order to ship within Visual Studio the tool must be available in all 9 languages that Visual Studio ships in.

Someone in the JCP forgot to maintain their server

Someone in the JCP forgot to maintain their server

Following claims that I’m an idiot, which I still believe is unfounded I decided to go and do a bit more research around Java, in particular the Java Community Process (JCP).  Having read a bit about the announcement that Sun is open-sourcing their implementataion (welcome the OpenJDK) I clicked through to the JCP information.  Well I clicked the link, what I got was:

Network Error (tcp_error)
A communication error occurred: “Operation timed out”
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.

For assistance, contact your network support team

Try again…. oh, this time the same address works but there is the following message at the top of the screen:

Attention: site maintenance is currently experiencing some technical issues. Please be patient while we troubleshoot them.

Clearly this should be taken as no reflection of the fact that this is a community process?



I’m an Idiot!

I’m an Idiot!

Stephen are you happy now?

I’ll start by saying that while I might be an idiot I think that Stephen’s comment was just childish.  Judging by his resume (which came up with “page not found” the first time I clicked the link …. what server is it running on btw?) I understand that his background is firmly in the Sun camp.  My original comment was actually an attempt at trying to get some educated debate.  In typical Sun, Apple (insert any other Microsoft competitor) fashion his retort is to call me names – great show of maturity…. he wins.

So, I’m going to take the bait and continue the original discussion around the choice of open-source or proprietary technologies affected the ability to create open-source software.  This discussion could be generalised to discuss the pros/cons of these choices in building any software. 

Ok, for the purpose of this discussion lets assume that Java has been open-sourced and that no one company is in control of its future direction.  On the other hand lets use .NET as the proprietary technology which is controlled 100% by Microsoft.  Let’s examine some of the risks associated with these technologies. 

In the case of Java we have a technology that is disconnected from any particular operating system.  This means that in every case someone has to put in effort to optimise a JVM for a particular operating system.  This could be done by the OS manufacturer (oh, now hang on Microsoft did that but got slapped with a ruling that now prohibits them from doing it – Sun does know how to shoot itself in the foot ;-). Or it could be done by the Java community.  There might also be multiple JVMs for any one OS by different commercial providers, who then charge for the JVM which brings us back to the original point that Java was supposed to be the open-sourced side of the argument.

On the .NET side of the fence we have a technology that has been heavily invested into by Microsoft.  Now this is not to say that they won’t change direction in the future but I would say that it is a fair bet that Microsoft will continue to invest in this technology for many years to come.  They have support for .NET in current and previous versions of their operating system – which clearly they do the work for as it maintains customer loyalty.  Interestingly enough, since the C# spec was put up as a standard, there is an open-source initiative to build a cross-platform runtime, Mono.  My last point on the .NET side is that you can build open-source software on .NET without investing in the Microsoft (or other 3rd party) tools such as Visual Studio .NET.

I’m not sure I’ve really layout my position here, just added some food for thought.  Again I would be interested in others’ thoughts.  And please, if you are going to call me an “idiot”, please don’t call me a friend in the same sentence!

SQL Server CE Site Update

SQL Server CE Site Update

If you are looking at the Microsoft Sync Services which is likely to be part of Visual Studio Orcas you should check out the MS Sync Services FAQ across at  This has been updated to include the information posted by Steve Lasker on his blog. Steve also has a screencast which follows up from my previous post that looks at the sync designer.

Logging options for .NET Compact Framework

Logging options for .NET Compact Framework

Since the first coffee meeting I have been hassling Alan to start blogging.  After migrating the user group’s website across to Community Server I was able to set a blog up for him and he just submitted his first post.  One of the pain points for a number of mobile developers is what to use for logging.  Most developers end up doing their own custom solution.  At Intilecta we ripped out most of the useful bits from the Patterns and Practices Enterprise Library.  Based on what Alan has to say in his post I think I would definitely look at log4net as it seems to be quite comprehensive and it runs on the .NET Compact Framework.

SQL Server CE as a testing tool

SQL Server CE as a testing tool

I noticed that DevPrime has posted an interesting comment about using SQL Server CE (SSCE) is as source database for test data. This was followed up with some comments by Jay Kimble regarding taking a snapshot of a SQL Server database and pushing it into a SSCE database.

From DevPrime’s comments it implies that there might be stored procedures in the next iteration of SSCE.  Given what is available in the current March CTP of Orcas I would doubt if this is true.  Given that SSCE is typically used as an in-process database, is there any real benefits to having stored procedures and/or triggers for that matter?