Sunday, July 14, 2013

Problem trying to run a Web Application using Visual Studio 2013 Preview


I'm putting this here in the hope of saving some other poor soul the hour I lost this afternoon while playing around with a fresh Visual Studio 2013 Preview installation (Visual Studio Version 12).

I created a new Web Application (MVC Template) and pressed F5 to start it in debug mode.

Launch a new web application from within Visual Studio
 I was immediately presented with the following error dialog from within Visual Studio.

Microsoft Visual Studio.  
Process with an Id of xxxx is not running. 




   
I also saw the following text in my debug console window: The program '[xxxx] iisexpress.exe' has exited with code 0 (0x0)

The problem turned out to be an incorrect configuration for an IIS Express application pool setting which I found in my \users{your username}\mydocuments\IISexpress\config applicationhost.config configuration file.

The managedRuntimeVersion was mis-configured by default
I needed to change the framework version for the default app pool to match the current framework version that is installed for .NET 4.  In my case, that meant changing the version to v4.0.30319.


Thursday, September 13, 2012

How to Use Google Plus Circles

A common question I hear is "How can I get value from Circles in Google+" so I thought I'd list a few ways that I find them helpful.   Firstly here's an image that shows what my Circle strategy looks like:


As you can see, I don't have hundreds of Circles - although I wouldn't necessarily be opposed to having that many either.  Here are my top 5 reasons for using Circles:

Privacy
An obvious initial reason for segregating users into Circles is to limit the scope of information that you share.  Again, this is a key driver behind my [Colleagues] and [Family] Circles.  Having the ability to post information directly to those groups allows me to limit information from being seen by people that it might not be relevant for.  

Example: I'm at the beach and I use my mobile phone to take some photos.  When I get home, the photos are instantly sync'd with my G+ account as soon as my phone hits the Wifi.  From there it's just a couple of clicks to share those photos with my family members by posting them to the [Family] Circle.

Noise filtering
I know how frustrated I feel when I see other people clogging up my feed with their own personal interests (e.g. excessive posts about cats) and so, I believe that it is really important to be aware of and manage to the amount of "noise" that I emit to other individuals.  

Example: I'm confident my [Hockey] friends don't mind me posting several updates a day about hockey related stuff (e.g. pictures, embedded YouTube video's, etc.).  However add that up with my [Developer Community] related posts, and a few other general posts and suddenly I'm at risk of having people de-circle me because I'm too noisy.  

Having a [Hockey] circle allows me to post hockey-specific stuff to just those members and thus reduces the amount of "noise" that I'm sending to people with no interest in hockey whatsoever.

Tip: A neat feature is [Your Circles].  [Your Circles] is one step back from [Public] and allows you to easily share information with the widest scoped audience.  In Settings you can manage how wide that scope is by managing which Circles are included in the [Your Circles] scope:



Scanning
The Internet provides us with unlimited opportunities to access information, but managing the signal to noise level is a constant challenge.  [News and Information] and [Tech News] are Circles where I've add lots of providers and therefore receive a great deal of information.  To deal with the resultant "noise", I then tune the volume of information I receive from them in my main feed by using the following tools.  

Tune the amount of information displayed in the main feed

Click on filters to display all items for a given Circle

Drag Circles to change their order so that most common ones are displayed first


Search and Organize
In addition to the above mentioned benefits, posting to Circles acts as a way of grouping so that content can  easily be found later from among the masses of other posted content.  

Example: Although I may not remember the exact content of something posted, I may be able to find it by recalling that it was [Hockey] related.  Given that knowledge I could filter my main feed by the [Hockey] Circle and then scroll through the reduced amount of information to locate a post I'm after.

Integration across the Google landscape of products 
Given the integration of G+ across the Google sphere of products, it shouldn't come as a surprise that your investment Circles can be leveraged in other applications.  

Example: Circles flow through into Gmail, and therefore provide a useful way to find and organize communication from contacts by filtering based on the Circles they belong to.  This is a key driver behind having my [Hockey], [Family], and [Business] Circles.


Sunday, September 9, 2012

Getting started with using Pub on Windows – The Dart Package Manager

The Dart language is a thriving community that is growing and with it come the tools that assist with doing modern development.  One of the key tools that define modern development is a package manager and with Dart, the job of package management falls upon the Pub tool.  You can read an overview of the Pub tool on the Dartlang.org website.

A common question that I see in new groups is “How do I use pub on Windows?”.  In this article I’ll walk through using pub to help get the Dartsweeper application downloaded from GitHub and running on your machine. The basic steps that we are about to walk through are:

  • Install the Dart Editor on your machine
  • Install Git (distributed revision control and source code management (SCM) system)
  • Update some Windows Environment variables
  • Clone the Git source that we want
  • Run Pub to install dependencies
  • Run the application from within Dart Editor

OK, let’s get started

Get the Dart SDK

To get started, you need to have a few things in place on your machine.  The first thing is to ensure you have the Dart SDK.  The best way to get that is to download the Dart Editor which contains the Dart SDK files.  You can get this from the Dart Editor Download Page.

Once you have downloaded the .zip file, simply unzip the files to a location on your local machine.  The pub tool ships with the Dart SDK and you can find it at the following location: dart-sdk\util\pub

Configure Windows Environment Variables

You’ll need to configure a couple of Windows environment variables which make it easier to work with the SDK tools.  First, add an environment called DART_SDK and point it at the root SDK folder in your unzipped Dart download.  Next, update your Windows System Path variable and add a path which points to the bin folder of the SDK folder:

image

The reason for pointing the Path variable at the bin folder is because that’s where the main tools that you will need to use are located.  The DART_SDK variable however needs to point at the root SDK folder because it is used to access SDK resources other than just the SDK bin tools alone – e.g. Libraries, Packages, and other Utilities.

Test that you have configured your environment variables correctly by opening a Windows Command Prompt and type ‘pub help’ and you should see Help text for the Pub tool displayed:

image

Install Git

Many of the packages that you will want to include will require Git to pull them down.  Pub itself has support for working with Git via native protocol handlers which can be declared within the pubspec configuration files.  To get Git, download the latest stable build from the Git website.

Test that you have Git correctly by opening a Windows Command Prompt and type ‘git –version’ and you should see the version number for your Git installation displayed:

image

Grab Dartsweeper from Git

Now that we have all of our tools installed, it’s simply a matter of using Git commands to fetch the Dartsweeper files and then we’ll use Pub to update all of its dependencies.

Open a Windows Command Prompt and change to a directory where you want to work from and type the following commands:

> mkdir %USERPROFILE%\dart
> cd %USERPROFILE%\dart
> git clone
https://github.com/kevmoo/sweeper.dart.git
> cd sweeper.dart
> pub install

This will make a folder under your user profile called Dart and then clone the contents of Dartsweeper repo on GitHub into it.  Finally we run the pub install command from within the newly downloaded Dartsweeper folder.

Here you can see the result of running those commands in real time:

image

Running Dartsweeper

Now that we have Dartsweeper installed, it’s time to open it up in the Dart Editor and run it.  Open Dart Editor and open the sweeper.dart folder that we just grabbed from GitHub.

image

When you first open the application in Dart Editor, you will notice some red crosses against folders which indicate compiler errors:

image

The reason for this is that, currently in the Dart Editor, we need set the location for the packages on a per application basis.  In this case, we simply need to open Tools|Preferences and change the location that we want the compiler to look in for packages for this application.

image

After doing that, you can right-click on the test folder and exclude it by choosing Don’t Analyze to remove it from the compilation analysis process.  That should remove the remaining compiler error warning.

Now press Ctrl+R (or hit the Run button) to run the application in the Dartium build of Chrome:

image

Friday, September 7, 2012

BingItOn

imageBingItOn.com is another wasteful exercise by the Microsoft Bing team which attempts to con users into believing that its results are superior to those of Google’s Search product. 

I remember travelling to Seattle 5 or 6 years ago and seeing this tool used internally at Redmond - now finally it appears that the mighty Redmond marketing machine has unleashed it upon the public at large.

The premise of this tool is that you run a search and two sets of results are returned - one from Bing and one from Google.  You are then asked to make a choice about which set of results is more useful.

There are two problems here.  First, Microsoft simply needs to turn its back on some of these old Ballmer fights and look instead to the future.  Get back to innovating and delighting customers and walk away from this sort of stuff.  They really don't need to fight meaningless fights just because Ballmer made some dumb promise all those years ago.

Second, how relevant is it to make a choice when you strip away the added value pieces that Google delivers to me in a normal search?  Things such as personalized search results and added context through their knowledge graph enhancements.   For example, when I run a search using the Microsoft BingItOn tool for AFL Football legend “Buddy Franklin”, I receive two walls of results:

image

Picking through them both to find a winner is tough and quite subjective.  But let’s see how the results actually appear when I do the search on the actual site’s:

First I use Google and we can see that the results which are presented are far more useful than what is simply presented in the BingItOn tool.  I’m given personalized results which are more engaging, presented better, and which have added context and knowledge about the topic.

image

Contrast that with a search on Bing.com and we can see Bing doesn’t actually make it much easier than the BingItOn tool:

image

Less engaging, less relevant, and potentially a lot more work to do on my behalf to get a result that I might be interested in.

Here I repeat the result by searching for the term “Adelaide Crows Players” and let’s look at the results:

Google presents me with a scrollable list of the current players with their playing positions at the head of the SERP.

image

With Bing on the other hand, it appears that the first half dozen results might even be advertisements:

image

Yet run it in the BingItOn tool and the results are far less clear:

image

So the message that I take away from the BingItOn tool is this... if we strip away all the stuff that makes Google search great and dumb it down to a certain level, which search engine do you prefer.  It's not even a valid question to ask!

Tuesday, August 21, 2012

Are our words really wasted?


Scott Hanselman told us that our words are wasted, and then went on to ask how his post was controversial?  Well...

  • He said that my words are wasted?
  • He told me that I'm not blogging enough?
  • He implied that Google and Facebook will SURELY fail?
So, perhaps there is a bit of controversy there :)

It's not like I don't agree with Scott on a number of points.  I've hosted my own blog in the past and even written my own blogging platform.  In terms of portability, I created BlogML to help allow people to move from service to service.  And regardless, controversy is not such a bad thing.  I just don't think that the article was his best piece of writing (I hold him to a much higher standard than I hold myself :)  One point I have trouble with in the post is the list of things that we apparently find ourselves asking over and over again:

AttributeG+FacebookLiveOther?
Is a free or cheap social network for the people?????
Let's me control my content?????
Allows export of everything ?????
Allows me to own what I type?????
Has an open API for my content?????
Allows search posts over a month old?????
Limits available usernames?????
Allows me to be 'verified'?????

Is that the full list of 'product attributes' or is it constantly changing.  And how do you find a single product which meets those needs while also staying current with constantly changing expanding list of product features that users need.  And what is the cost of meeting those needs with any single boxed product?

The current state of software services is such a moving target and I'm continually rethinking how I use my journal to link it with and help my daily activities.  That includes things such as being able to link activities by location, having content delivered to whatever device I'm on, sharing stuff easily through a variety of ways, embedding rich content such as maps and documents through to having a variety of different privacy and sharing options.

I feel like I'm trying stuff out to help improve my life's process flow.

So I tend to focus on the benefits of that I get from "renting" an existing service and not so much on the fact that some greedy NASDAQ listed company is making money from my effort.  Those benefits include:

  • I get a fancier "apartment" :)
  • There are often added perks over the choices I have otherwise
  • I get to share costs/overheads with multiple tenants
  • It is generally cheaper and easier to relocate
  • Boring maintenance work is often removed
  • For me, I believe that there are reduced risks

So, as with most things in life, there are choices and trade-offs.

Tuesday, August 14, 2012

Constructors in Dart

Recently I've started using the Dart language and tools to maintain my interest in programming.  Coming from a .NET and JavaScript background, many of the features of the language are familiar to me but there are also some syntactical aspects that I like and which are particular to Dart.

One of the areas within the language that I'm enjoying is the constructor syntax.

Simple and default constructors
Every class will have a default constructor which is provided in case you don't specify your own.  To specify your own constructor, simply create a method with the same name as the class.

class WordContainer
{
  List _wordList;
  
  WordContainer(List words)
  {
    _wordList = words;
  }
  
  void Print()
  {
    _wordList.forEach((word) => print(word));
  }
}

In the above example, as you might expect, we have a simple constructor which allows us to construct new instances the class by passing in a list of words:



Assignment of constructor arguments to member variables
A handy shortcut exists in the Dart language for assigning constructor arguments to member variables which can save keystrokes and time.

class Point
{
  num x, y;
  
  Point(this.x, this.y);
}

Named constructors and default parameters
Another nice feature of Dart is the named constructor syntax which is designed to make it easier to identify the purpose for different constructor overloads.  In the following example I have created a separate, named constructor which takes a single word and provides an optional parameter to specify the number of times to add the single word to the word list.  To differentiate the purpose of this constructor method, I will give it a unique name.

class WordContainer
{
  List _wordList;
  
  WordContainer.fromSingleWord(String word, [num times = 10])
  {
    _wordList = [];
    
    for(var i = 0; i < times; i++)
    {
      _wordList.add(word);
    }
  }
}

When calling the overloaded constructor method, it now becomes more readily apparent as to what is happening from where the code is called:

Saturday, March 17, 2012

Serialization ordering causes problems when using DataContactSerializer in WCF services

Have you ever created a WCF service and, when you’ve called it from a consuming application, some values appeared to come through just fine while other values were ignored?  Perhaps you’ve been stung by the default ordering rules that are applied when using the DataContractSerializer (the default choice in WCF).

First up, if you are not aware of how serialization in WCF works, here is a link to a good Msdn article which compares some of the differences between the various serialization techniques that are on offer in WCF: http://msdn.microsoft.com/en-us/magazine/cc163569.aspx

A big issue is the fact that the DataContractSerializer works on the order in which it expects to receive fields in the incoming messages. This can cause some very unexpected behaviour.

To describe the issue, we will first create a data contract to model an incoming message. The contract that we are modelling here contains 4 properties, 3 of which are Integers, and the other is an Enum value (not that that's significant).

The Data Contract
clip_image001

Next we create a simple service to receive our message and to do some processing over it. In this case we will receive the message and then simply write out the values that have been set by the deserialization process.

A Simple Serviceclip_image002

When using the DataContractSerializer to handle serialization in your web service, it is important to understand the default ordering rules that it uses and what that means in terms of the order in which elements are expected to appear.

Given our fairly simple type above, the main rule that we need to be aware of is that the properties are expected to be ordered alphabetically. If we obey that rule, then the results of our message processing work out just fine.

Default Ordering – OK
clip_image003

However look at what happens if we change the order of the elements in our request message.

Changed Ordering - Errorclip_image004

In this case, the DataContractSerializer has skipped the elements that were not found in the correct order and then moved on to processing the next element. This can have some pretty disastrous consequences because, not only is the data skipped for the elements that were out of order, but the corresponding properties now have incorrect values set for them!

Use the XmlSerializer

The default ordering issue is probably not a big deal if you are in a pure .NET environment and you have WCF at both ends of the communication. But how often does that happen these days? In our environment at work it is typical to have all types of clients that want to connect to our service - Classic ASP, Client Side Web Pages, and External Vendor applications.

In each of these scenarios, it is likely that the consumer of the service will craft the messages in such a manner that it is difficult to enforce and verify that the correct order is always obeyed. And the resulting bugs may not get picked up unless you have a very sophisticated and well disciplined UAT process!

A solution to this problem is to configure your service to use the XmlSerializer approach which has been around since the early days of .NET. This is achieved by simply annotating your service contract with an attribute to tell WCF that you want to override the default serialization technique.

Overriding the default serialization technique

clip_image005

Once we do this, elements can appear in any order because of how the XmlSerializer uses names to do element mapping.

clip_image006

The downsides of using the XmlSerializer are:

  • Using the XmlSerializer incurs additional performance costs because it generates strongly typed assemblies for the classes that are subject to the serialization process. However this can be avoided by pre-generating the assemblies that you need using the SGen tool.
  • DataContactSerializer has some additional attributes (Order and IsRequired) that can help with certain versioning scenarios.

The benefits or using XmlSerializer are:

  • Get around the ordering issues which results in less fragility in consuming applications.
  • Ability to easily work with Xml attributes as part of the serialization mapping on .NET types can aid interoperability and makes it easier to adopt a “contract first” approach to service implementation