Author Archives : Rob Sanders


About Rob Sanders

IT Professional and TOGAF 9 certified architect with over 16 years experience, 16 in commercial software development and 9 years in IT consulting. Check out the "About Rob" page for more information.


Review: Olixar Dock and Go Car Holder

IMG_2314_Small

Since I’ve been writing this year about mobile accessories, the next logical step was to literally take things on the road.

In car phone options have been around for years, however what to do with all these smart phones which are so prevalent these days?  Most modern cars seem to incorporate modern handsets in some fashion,but do they really provide the best value?  Given the quality of sensors and cameras, coupled with features like GPS, can we do something better?

Enter the Olixar PhoneDock.

This accessory essentially allows you to turn your smartphone into a bit of a Go Pro or a NavMan style application.

Before we get to the fun options you have with such a device, let’s look at what is included.  Out of the box, there’s the phone holder itself, which features a really smart approach to mounting to your dashboard or windscreen.  The attaching base appears to use a technology similar to what is used in the Executive Folio, it can be made adhesive by simply adding water.

IMG_2327_Small  IMG_2328_Small

The only obvious accessories to add to the Phone Dock, is a separate charging cable and an appropriate cigarette charging adapter, as pictured.  Attaching the Phone Holder to the dashboard or windscreen is simplicity itself.  You just need to clean the area and then hold the Holder in place and push down a tab on the base to achieve suction/adhesion.  The Holder is easily removed by reversing this process.

The Road Test

Placement of the Holder is paramount.  You don’t want it to obscure too much of your view – and make sure to factor in the profile of your handset too.  For my decidedly large iPhone 6, I opted for a dashboard mount, in front and to the right of the existing in-dash display.  The arm is easy enough to use that you can insert and remove the phone with one hand, if need be.  This is helpful if you are in a rush and are trying to do multiple things at once, e.g. starting the car or inserting car keys etc..

photo 1e_Small  photo 5_Small

Once you have your smartphone in place (the Dock holds he phone like a large arm), you have a few options in terms of the sort of apps you can take advantage of. On the basis of a referral from a friend, I purchased the iSymDVR app, and the Navmii app from the Apple iStore.  My phone is now effectively a dash cam and GPS navigator all-in-one.  The Phone Holder holds the phone securely and absorbs a fair degree of shock during driving.

IMG_2539_Small  IMG_2540_Small

As you can see from these screen captures, the Holder is so steady it allows the iPhone to take steady long exposure photos at night, although unfortunately it is still at the mercy of those golden Winter sunsets!

Verdict

I’ve been using the Phone Holder daily – almost each time I’ve been driving – and it’s achieved two key things for me: it gives me a logical place to put my phone when I’m driving, and I can easily charge the phone at the same time.  Recommended!

More accessories are available at MobileZap


Visual Studio 2015 – Using a Product Key 3

Introduction

Continuing from the experience with Visual Studio 2013, the next edition – Visual Studio 2015 – was officially released to MSDN subscribers early this morning.  This edition follows the trend established in the previous edition of providing two channels of licensing – by using a Microsoft Account or by supplying a product key.

Get a Product Key

You’ll need to have an MSDN Subscription which matches the version of Visual Studio you are using.  Authenticate to MSDN Subscriptions and go to the Subscriber Downloads section. 

image

Here you’ll see a tab for “My Product Keys”.  In the list of keys there should be static activation keys for your account.  Find and copy out the product key for your version of Visual Studio 2015 (e.g. Enterprise, Professional, Test Professional).

keys

  • If you don’t have a Product Key listed, as with Visual Studio 2013 it’s likely tied to the type of MSDN Subscription you have – whether you have assigned a perpetual license of not.  Whether or not Visual Studio carries a Product Key/perpetual license seems to depend on the type of MSDN subscription.
  • If you don’t have an MSDN subscription, but have instead purchased a retail copy of Visual Studio 2015 when it becomes available, there should be a Product Key with the product.  A boxed product should have a Product Key on the media (or box) and a soft copy should have a key associated with it somehow (maybe it is mailed to you?).

Install Visual Studio 2015

Once you have acquired a Product Key, the next step is to install Visual Studio 2015.  I’ve chosen to evaluate Visual Studio 2015 Enterprise edition, which replaces Premium and Ultimate editions (they have been merged into a single SKU).

image  image image

There’s some different options in this new edition (when using a custom install), the options I selected to install will absorb over 24 GB of hard drive space.  Probably best you avoid installing VS 2015 o a netbook!  If you want to minimise the install vector, unselecting the Cross Platform Mobile Development saves a lot of space.

Registering Visual Studio 2015

Once the installation completes, you’ll be able to launch the Visual Studio 2015 IDE.  You’ll be taken through the usual “first time user” wizard, which establishes your development and UI preferences.  You can skip logging in with a Microsoft account by choosing “Not now..”.

image  image

Once the IDE loads, you can select “Register Product” from the Help menu:

image  image

Once the registration dialog appears, use the “License with a Product Key” option, and enter your Product Key with the popup window.

image   image

Note: you don’t have to be online for the process to complete, so it looks like a good option for offline installs.

Housekeeping

None!  The normalised CamelCase menus are back by default.

image


Documenting a ASP.NET Web API with Swagger

MVC3    +   swagger2

In this article, I’m going to take a look at some ways you could generate documentation for ASP.NET Web API.  Unless you’ve never generated a Web API website, you’ll be aware that the default templates already include functionality to generate documentation for the API which you might implement, an example of which is here at authme.ws.

Getting started

There’s more than a couple of articles already written about how to generate documentation for ASP.NET Web API using Swagger (and there’s a NuGet package called Swashbuckle which you can easily integrate), but I needed something less dynamic – in fact, I needed to generate static documentation representing what we’d promoted to production (point in time), as it needed to be provided for an audit.

The traditional documentation (e.g. Sandcastle Help File Builder) i clearly not viable as it documents managed code rather than the more important API interfaces and runtime models.

Luckily for me, there’s a toolset complimenting Swagger called Swagger codegen which generates client code to consume APIs, and for me – an ability to generate static HTML (courtesy of [1]) Unfortunately I couldn’t find a .NET port of Swagger Codegen, so I bit the bullet and compiled the Java binaries from the source using Maven and the latest JDK.

What you need

You need to be able to generate a Web API site which you can spin up in IIS or IIS Express.  Ideally, what you’d do is integrate the previously mentioned Swashbuckle NuGet package into your existing (or new) Web API Project. Once installed, all you need to do is change the project settings to generate a comments XML file (not a mandatory step, but useful – see image below) and then configure the SwaggerConfig.cs file which is inserted into the project under the App_Startup folder.

image
Enable XML comments output.

image
Swashbuckle NuGet packages (Swashbuckle and Swashbuckle.Core)

Here’s a really brief (minimal) implementation of the SwaggerConfig with the copious comments removed:

public class SwaggerConfig
{
   public static void Register()
   {
       var thisAssembly = typeof(SwaggerConfig).Assembly;
       GlobalConfiguration.Configuration 
       .EnableSwagger(c =>
       {                      
          c.SingleApiVersion("v1", "API Services");
          c.IncludeXmlComments(GetXmlCommentsPath());
       })
      .EnableSwaggerUi(c =>
       {
       });            
   }
   private static string GetXmlCommentsPath()
   {
       var path = String.Format(@"{0}bin\Services.XML", AppDomain.CurrentDomain.BaseDirectory);
       return path;
   }
}

If you compile and run, you should be able to resolve the Swagger UI, like this:

image

image

A very, very impressive dynamic documentation UI.

The key here is in the generated JSON which is accessible via the URI in the textbox, in my case it is: http://localhost:2218/swagger/docs/v1 (swagger.json)

image
Example swagger JSON

Converting to static documentation

Moving on to swagger codegen, you’ll also need a copy of the Java JDK. After installing the JDK (if you haven’t already), you’ll then need to ensure that the JAVA_HOME environment variable is correctly to the correct directory (NOT the runtime directory) and install/extract Maven binaries.

I used the latest JDK (1.8, 32 bit) which has the following directory: C:\Program Files (x86)\Java\jdk1.8.0_51 I also installed Maven into the Java directory and added it to the system path (the bin directory, specifically):

image

When ready, al you need is to extract the swagger codegen code into a local directory, browse to that directory in a command prompt and type mvn package:

image  image

Wait a while while Maven grabs all the packages

Once successfully compiled, it’s a simple matter of executing the compiled jar file.  In my case, I had placed the extracted swagger files in C:\Tools.  Open a command prompt and browse to the following location:

C:\Tools\swagger-codegen-master\

To generate a static HTML document for your API use the following syntax:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://localhost:2218/swagger/docs/v1 -l html

This produces a nice static document of your Web API:

image

A nice static HTML file which you can “print” to PDF, or copy and paste into Word

Troubleshooting

If your generated .json produces an empty object like this:

“Object”: {
“type”: “object”,
“properties”: {}
}

It could well be due to a lack of sufficient information about the data type in a response.  For example, take the following example Controller definition:

public class VersionController : ApiController
{
private readonly IVersionQuery _query;
public VersionController(IVersionQuery query) { Guard.That(query, "query").IsNotNull(); _query = query; }

[AllowAnonymous] public IHttpActionResult Get() { var version = _query.GetVersion(); return Ok(version); } }

What we’re missing here is an attribute which provides the return type, like this, decorating the Get() implementation:

[ResponseType(typeof(VersionInfo))]

I was assisted in making this discovery by the issues logged at [2], [3].

Alternatives:

References: