[OT] Whinging Australian farmers

[OT] Whinging Australian farmers

Ok, firstly before I go further on this post I would like to apologise to any farmers who are reading this post and feel that I’m out of line with these comments. I acknowledge that I’m neither a farmer or an environmental expert and I welcome any feedback to enlighten me.

I have just been listening to the Australian world news (thanks to the ABC’s podcast series) hearing about how the Australian farmers are all hard done by and that the recent lack of water has meant that they may have to run livestock instead of crops. Ok, correct me if I’m wrong but Australia is predominantly a dry continent, and most of the crops and livestock are not native to Australia. Subsequently we run into issues such as drought and salinity…..

You would think that one of the best ways to tackle this would be to start farming native plants and animals. For example, farming Kangaroos – this is seen as taboo because it is one of our national icons. The reality is that in some areas the number of these animals actually makes them a pest; although the flavour of the meat is more gamey it generally means you eat less of it (potentially less obese people???) and they have skin/fur that can be used for clothing and fashion items.

Anyhow, before you start emailing the government in support of our whinging farmer, take a thought about whether money will fix the underlying issue facing the Australian primary industry sector!

Project Glidepath

Project Glidepath

Having recently installed Vista RC2 I have been eagerly installing all my favourite applications: Office 2007, Visual Studio 2005, Orcas VS extensions, WF designer extensions, Live Messenger, Guidance Automation Extensions/Toolkit. Most of these installed without a hitch, although I did get continually prompted to allow Administrative permissions. Note: I did NOT have to disable User Access Control (yet).


Yesterday I got an email from the Project Glidepath team announcing that v2 is now available for download, so I eagerly downloaded it. After installing the Guidance Automation Extensions (although they include the Dec 2005 release, I had already installed the most recent release) I proceeded to install Project Glidepath. Half way through the install fails, “Error 2869”. This seems to relate to the infamous User Access Control(UAC). Work around is to create a batch file with the following lines:


msiexec /i ProjectGlidepathRepositoryManagerSetup.msi
msiexec /i ProjectGlidepathMicroISVFactorySetup.msi


Then right-click the batch file and select “Run as Administrator”. This will get the installer to work. However, the UAC issues are not over yet. The post-installation instructions suggest running Visual Studio 2005 and creating a new Project Glidepath project, from which you can “update” to retrieve the latest guidance information. Unfortunately, what they don’t tell you is that you MUST run Visual Studio as administrator, otherwise the database can’t be created and you won’t be able to update. Again, this can be done by right-clicking on Visual Studio 2005 in the start menu and selecting “Run as Administrator”.


Well, back to “synchronising” project glidepath – will hopefully have an update as to what is actually included once this has completed.

Occasionally Connected Systems Sync Framework

Occasionally Connected Systems Sync Framework

Earlier this year Microsoft announced that they would be re-banding SQL Mobile to SQL Server Everywhere. One of the ideas behind this initiative is to provide a better story for developers who want to build applications that support working in disconnected, or occasionally connected, mode. In the past the only solution in Microsoft-Land was to use either Access or MSDE (now SQL Server Express), neither of which provided a suitable solution. Access requires an Office license, while MSDE/SQL Express runs as a background service making it unsuitable for a single application local datastore. SQL/e addresses this issue as it runs in-process with the application. It will also be able to be deployed alongside the application using ClickOnce deployment.

One of the issues with using SQL/e as an offline datastore is that configuring merge replication was difficult and wasn’t always suitable, depending on the server datastore. As such the Smart Client data team at Microsoft have been working on a new sync framework. Steve Lasker has just posted a powerpoint presentation and a screencast that demonstrates where this technology is going!

VB.NET Event Handlers

VB.NET Event Handlers

I was just listening to Bill McCarthy chatting with Ron Jacobs on Arcast about the rich feature set of VB 2005.  One of the points of interest was around the declarative approach to event handlers that VB.NET uses.  For example say I have the following class with an event declaration:

Public Class ClassWithAnEvent

Public Event TestEvent As EventHandler

End Class

Now in VB.NET to wire up an object of this class so that I can receive notification on the TestEvent I can do it declaratively as follow:

Public Class ClassThatConsumesAnEvent

Private WithEvents x As ClassWithAnEvent

Private Sub TestEventHandler(ByVal sender As Object, ByVal e As EventArgs) Handles x.TestEvent

End Sub

End Class

The question is what does this do under the hood.  Well the easiest way to explain this is using our good friend, Reflector, to regenerate the code:

Public Class ClassThatConsumesAnEvent

<AccessedThroughProperty(“x”)> _
Private _x As ClassWithAnEvent

Private Overridable Property x As ClassWithAnEvent

Get

    Return Me._x

End Get

Set(ByVal WithEventsValue As ClassWithAnEvent)

    If (Not Me._x Is Nothing) Then

    RemoveHandler Me._x.TestEvent, New EventHandler(AddressOf Me.TestEventHandler)

    End If

    Me._x = WithEventsValue

    If (Not Me._x Is Nothing) Then

    AddHandler Me._x.TestEvent, New EventHandler(AddressOf Me.TestEventHandler)

    End If

End Set

End Property

End Class

As we can see from this code, VB.NET is doing a lot of the heavy lifting around adding and removing eventhandlers.  This means that we can easily reassign an object to variable x without having to worry about adding and removing eventhandlers.  This also clears up, for those that were wondering, where eventhandlers are added/removed in VB.NET.

Hiding my password

Hiding my password

Following Alastair’s post regarding encrypting sections of a configuration file I ran into a similar issue where I wanted to protect a password that my application was using.  Obviously there are a couple of big NO NOs. I can’t hard code the password into the application because it is too easy to use something like Reflector to crack it own and grab the password in clear text.  I can’t easily use the standard crypto functions that require a private key, cause then I would have to hide the private key somewhere).  Luckily v2 of the .NET Framework exposes DPAPI through the ProtectedData class.  As such I can do the following to encrypt/decrypt data:


    Private pData As Byte()
    Private Sub Encrypt()

        Dim sensitiveData As Byte() = System.Text.Encoding.Unicode.GetBytes(“Some sensitive data”)
        pdata = ProtectedData.Protect(sensitiveData, Nothing, DataProtectionScope.CurrentUser)
        MsgBox(pData.ToString)
    End Sub


    Private Sub Decrypt()
        Dim sensitiveData As Byte() = ProtectedData.Unprotect(pData, Nothing, DataProtectionScope.CurrentUser)
        Dim str As String = System.Text.Encoding.Unicode.GetString(sensitiveData)
        MsgBox(str)
    End Sub


You will of course need to add a reference to System.Security to your application and import the System.Security.Cryptography namespace into your code file.

The Side Effects of Debugging Code

The Side Effects of Debugging Code

David Kline makes a great point about the side effect of debugging code.  In particular, if you have properties that actually do more than simply returning a value, you can unexpectedly modify the state of the system just by exploring an object in the watch window. 


Visual Studio 2005 supports a number of attributes that can help control how objects are viewed during debugging:


DebuggerDisplay – This controls how the single line summary of the object is rendered when you hover your mouse over an object when in break mode.


DebuggerHidden – Can be used to attribute a method/property that you don’t want the debugger to step into when debugging.  Note that you can’t place a breakpoint in a method/property with this attribute, nor will this method/property appear in the call stack if you place a breakpoint further down the call stack.


DebuggerStepThrough – This marks code that will appear as “external” code when debugging.  Again you can’t place a breakpoint in this code.


DebuggerNonUserCode – Just when you thought there couldn’t be any more permutations on what will/will not be stepped through…. This attribute controls whether your code is stepped through when the “Just My Code” option is enabled (see Tools –> Options).


DebuggerTypeProxy – This attibute allows you to redirect the debugger data tip to display a substitute object in place of the object you are hovering over.  This can be great if you want to simplify the way your object is displayed during debugging.


DebuggerVisualizer – Use this attribute if you want a richer display for your object.  For example if you hover over a String object you will notice there is a magnifying glass in the data tip.  Clicking this brings up the String visualizer which is a window where you can view the entire string.  You can write your own visualizer by inheriting from the DialogDebuggerVisualizer class and then attributing your class with the DebuggerVisualizer attribute.


<Shameless plug>Samples of using these attributes is available in Professional Visual Studio 2005</Shameless plug>


 

Google cache to the rescue

Google cache to the rescue

In my previous post I mentioned the book review that was on Amazon but had subsequently been removed.  Anyhow Dave Gardner pointed me to Google cache (normal search with “cache:<url>” as the search string) and there it was.  So that we (Australians) can laugh at our perception elsewhere in the world, here is the review in full:


1 of 20 people found the following review helpful:


Worst book ever about .NET/Visual Studio, September 29, 2006





Reviewer: W. WEI “WW” (CA, USA) – See all my reviews
(REAL NAME)   
First, I did NOT buy this book, only came across it in a bookstore while trying to learn a few details about the new visual studio compilation system.

I guess every serious developer knows most Wrox books are junk, but still can’t believe they managed to publish such a stupid and worthless one.

It’s even worse than a simple rehash of the MSDN online documentation, which would at least save you some time to search through it.

The table of contents said it all: 56 chapters in 900 pages, most of which are made up of boring screenshots. Do the math and you’ll ask yourself the question: who are the targeted readers?

These 56 chapters covered every aspect of .NET: C#, VB, ASP.NET Web development, Windows Forms, Team System, Debugging, Macros, Refactor, Compact Framework…, in a very very very poor and shallow fashion.

So the next thing i did was to find out who were the authors, and there you are: two experienced/accomplished but “Australian” developers. In my albeit limited experience, the majority of Australian developers were shallow in their understanding of highly complexy technical stuff, and they write code in an exremely sloppy fashion. But these two guys are supposed to be the creme de la creme of .NET developers in that country, or maybe not?

In any case, next time you buy a book make sure where the author(s) are from first.

The Microsoft Developer Show #9 – Certification

The Microsoft Developer Show #9 – Certification

The next installment of the MS Dev Show is now available on The Podcast Network where I chat with Rob Farley on the topic of Certification. More specifically we talk about Microsoft Certification and the examination process involved in becoming certified. We also talk about the value of certification in both the eyes of the candidate and their employer (or potential employer).


IMHO vendor certifications are probably not worth much more than the paper that they are written on.  Maybe the samecan be applied to a University degree.  I must admit that when I’m looking for new employees I look for a University degree, yet place little value on whether they are vendor certified.  What do you do? How important are exams, or for that matter any form of tertiary education.  Do you think that ongoing professional development is a good thing?

Australian Developers are "shallow" and "sloppy"

Australian Developers are "shallow" and "sloppy"

Over the weekend the co-author of our recently published book, Professional Visual Studio 2005, contacted me to point out a fantastic review of on Amazon.  Well, it was fantastically funny and as Andrew points out it would be great if anyone else who has read the book could post a review ;-).


Unfortunately the actual review has been pulled from the Amazon website, but in summary it makes the following claim:


So the next thing i did was to find out who were the authors, and there you are: two experienced/accomplished but “Australian” developers. In my albeit limited experience, the majority of Australian developers were shallow in their understanding of highly complexy technical stuff, and they write code in an exremely sloppy fashion. But these two guys are supposed to be the creme de la creme of .NET developers in that country, or maybe not?


Does this apply to New Zealand developers or are we all too busy farming sheep and making award winning films?

Windows Mobile Device Center

Windows Mobile Device Center

For those working with Vista and are armed with a Windows Mobile device you should check out the beta version of the Windows Mobile Device Center which extends Vista RC1.  If you aren’t already aware Vista will ship with a cut down WMDC which simply allows you to connect to your device.  In order to partner with your device you need to download this update.  AFAIK the plan is to make this an update that will appear in Windows Update when you have a device plugged in.  IMHO this sux and is again another black mark against mobility.  In the same way that the Windows Mobile 5 sdks should have shipped with Visual Studio 2005 (instead of just WM2003SE), the full WMDC should ship with Vista!

Database roles

Database roles

Brian Madsen wrote an interesting post following Greg Linwood’s presentation at my home user group, the Perth .NET Community of Practice.  I would like to make a follow up comment on this as I have a slightly different opinion to Brian:

When it comes to an application that uses a database there are a number of roles associated with building that application.  I don’t want to get into the nitty gritty of what the roles are called but essentially they fall into a couple of broad categories IMHO.

  • Interaction Designer:  This role is primarily responsible for building the front end application such that it is usable, presents the information in an appropriate format and will get good user adoption.  NB: This function is actually where a LOT of applications fail!
  • Developer: This role is responsible for coding the business logic for the system – extracting and manipulating data into a format that can easily be consumed by the user interface.  Quite often this role is merged with the Interaction Designer role but in large projects there are quite often coding tasks that just require manpower to get classes written that serve a particular function.  NB: Most of the code this role rights should be easily tested using Unit testing.  This role should NOT be concerned with how indexes are structured etc, rather they need to define what data they need to retrieve and update.
  • Database Designer: This role is the only role that should be concerned with what indexes are on the database.  If an application is performing badly (at the data tier), it is NOT the responsibility of the developer to reindex the database.  Through collaboration with the developer (ie the user of the data) the database designer is responsibile for structuring the database such that the developer can work with the data.
  • Database Administrator: IMHO this is an operational role and if an application has a good SLDC then the database administrator should NOT be reindexing.  Any changes to the index should be applied as a new version of the application.  Of course, this doesn’t hold where a database is being used by multiple applications and is not being versioned in line with the application.  Regardless, there should be some lifecycle management around any changes that are applied.

There may be other roles/points that I haven’t considered, so please feel free to add your 2 cents worth 😉

Building Cross Platform Applications with The Microsoft Developer Show

Building Cross Platform Applications with The Microsoft Developer Show

The next show has just been published where I chat with Jeff Arnett, Windows Embedded MVP, about building applications that work across multiple platforms.  As a fellow mobility MVP I can associate with the difficulties faced by developers wanting to port code between different platforms.  In my previous role at AutumnCare we spent a lot of time maintaining a common code base, and now at Intilecta we are having to do the same process.  Check out the latest show to here more!

MS Student Partners

MS Student Partners

Franks has just pointed out that the MS Student Partners are now (infrequently) blogging.  There is also a cool website where you can view where the Student Partners are based.  My only complaint with this page is that it breaks the mouse-scroller – by default this should scroll the page NOT zoom in/out on the map!!!

It would be great to have this functionality for “Meet the MS Team” – although I guess they are travelling so much that it is difficult to indicate a location.  Perhaps you need a “Where are they currently” or a “Where have they been” functionality.

Debugging code using UnitTests

Debugging code using UnitTests

James Avery makes a great point in his post about multiple assertions in unit tests.  I really like the concept of being able to run multiple asserts within a given testcase and having them all run, even if one fails. However, I would like an additional argument (boolean – “exitOnFailure”) for the Assert methods so that I can elect to abort a test if the assert fails

Using multiple asserts in this manner would really extend the concept of UnitTests, making it easier to trace what was the likely cause of a test failure.  Instead of looking at all the tests that failed to try and pinpoint the root cause (in a similar way to looking at all the compile errors to try to identify the single error that is causing them all), you could look at a test case and analyse the assertions to narrow down the cause.

Great idea James!

Visual Studio Productivity

Visual Studio Productivity

As Brian Madsen pointed out, Mitch Wheat did a great post on improving productivity using Visual Studio.  However, I would utter a word of caution, these short cuts DO NOT work for all profiles.  When you first install VS 2005 you will be prompted to select a profile (eg VB, C#, General…) which will configure VS to the type of developer you are.  As a VB.NET developer I was tempted to go with the VB profile until I realised that it has mapped the keyboard shortcuts to reflect what they were in VB6, which quite frankly sux.  Instead I go with the General Developer profile which seems to work for me (oh, and Mitch’s shortcuts all seem to work in that profile!)

A couple of other VS related things:

  • I would also like to reference the announcment that VS 2005 SP1 Beta is now available, as per Somasegar’s blog

 

  • <shameless plug>I can’t miss this opportunity to point to the book entitled “Professional Visual Studio 2005” that Andrew Parsons and myself wrote, and is now available from Amazon.</shameless plug>

New York Times Reader – technology sampler?

New York Times Reader – technology sampler?

Yesterday Intilecta‘s Chief Architect, Dave Gardner pointed me to the New York Times Reader beta which has been made available for download. Of course having done a bit of work with the .NET Framework v3 I thought it would be worth downloading the beta and taking a look at the technology sampler.  Here are some initial comments:



  • Installer: Take your hat off to the guys who put this together the installation process was so simple.  The only way it could have been improved IMHO is for the application to be ClickOnce deployed – I’m sure they had their reasons, but was a little surprised when I had to download the installer. Despite not having v3 of the .NET Framework installed it installed without a glitch, although it took significantly longer as it had to download and install the framework.

 



  • Look and Feel: The application looks great; very simple design with minimal menu or toolbar clutter.  The white colour scheme really works and the interface is very intuitive. As with all good Avalon (aka Windows Presentation Foundation) applications it has the ability to zoom in and out.  This makes perfect sense when reading newspaper-like articles as I can zoom in and out on the articles depending on whether I’m “reading” or “skimming” the paper.

 



  • Performance: I must say that I was a little disappointed at the performance of the application both at startup and navigating around the application.  I’m running a Dell dual core machine with 2Gb RAM so I would have thought it would perform exceptionally well.  The load time for downloading the articles was much slower than expected.  Ok, so I’m using a Woosh connection atm which is barely more than dial-up speed but I would have thought that most of the articles are 90+% text and could be quickly downloaded. I guess there is a download bottleneck due to the rather large ads that are strategically placed – can’t these download AFTER the articles have finished so that I can start reading while they are finishing?

 



  • Overall: Other than the ability to easily zoom in and out, there is not a huge number of features that would convince me to migrate to using v3 of the .NET Framework.  Lets look at the cons associated with doing v3 development now:


    • It’s in beta – which means that if I’m looking to deploy I have to either deploy with the RC or wait for RTM

    • It’s in beta – so I might have to change the application when it RTMs

    • It’s another version of the framework that needs to be deployed

    • I need to learn a whole different skill set for Avalon, Indigo and WF.

Now, asked the question as to whether I think that v3 of the .NET Framework is worth migrating to? I would have to answer yes but you need to be certain that they are going to give you a positive value proposition. The old saying “If it ain’t broken, don’t fix it” applies here.  If you have an application that works fine using Windows Forms, then you don’t need to migrate the whole application.  You can use Crossbow to interop!