Just last month I kicked the tires on the Bing Code Search tool and found it to be a solid way to access code samples from MSDN, StackOverflow, Dotnetperls and CSharp411. Now here we are just a few short weeks later and I am downloading a significant makeover of that tool appropriately renamed the Bing Developer Assistant. With marked improvements in IntelliSense support and a new one stop location for code snippets and samples, it definitely improves on the original.

For me the best new feature is the inclusion of  Offline search, this provides the ability to define local directories that contain your own sample code, enabling disconnected search capabilities. Conceptually I am hoping offline search would help the onboarding process for new developers in my team, I find they tend to reinvent the wheel (sometimes unnecessarily). These Offline search capabilities could be further refined by allowing users to explicitly force disconnected searches or by giving priority to local code snippets in the search results.


Download links are here, check it out!

August 26, 2014 23:02    Comments [0]
Tagged in Tools | Visual Studio

Share on Twitter, Facebook and LinkedIn

I still remember being in Detroit in late 2002 with a conference room full of developers, Microsoft was pitching the wonders of a brand new framework called .NET. The pitch that really pulled me in was that the CLR guaranteed that my code would work anywhere the .NET framework was installed (no more checking for and installing COM DLLs). Anyone who distributed any significant software back then knew how much this kind of promise would resonate with frustrated operations teams everywhere. Your chosen language (C# or Visual Basic) compiler would  convert your code to the Common Intermediate Language (CIL), and the Common Language Runtime (CLR) would convert that into native code. Done! your code works everywhere … well … everywhere Windows runs.

At the time I was a Visual Basic programmer so the secondary appeal was that I could “upgrade” to VB.NET and work in concert with C# developers and from there make a clean break into C#. As it happens the switch to C# was not nearly as problematic as I had imagined and so I go the chance to jump ship. So while the idea of supporting multiple languages with a particular product was a much lauded benefit most folks opted to move to C# anyway. Back then Visual Basic never quite sat right with me, it reminded me of the opening conversation between Morpheus and Neo in the Matrix.

What you know you can't explain, but you feel it. You've felt it your entire life, that there's something wrong with the world. You don't know what it is, but it's there, like a splinter in your mind, driving you mad. It is this feeling that has brought you to me. Do you know what I'm talking about?  - Morpheus

Yes I do Morpheus, you are talking about Visual Basic 6!

Fast forward these ten plus years and we have  significantly more kinds of operating systems, devices and languages that drive and, in some cases, inhibit our software productivity. So today I wanted to talk about the approaches you might want to consider for being productive across an ever increasing range of platforms.

About 3 years ago I started to notice that my main programming skills (C#) were not stretching as effectively into a new breed of products targeted at the everyday consumer (as opposed to enterprise consumers). With the ascendency of iOS and Android the skills I honed over years in Visual Studio were only marginally helpful and these devices seem to be springing up everywhere. So in contradiction to the CIL and CLR approach, the idea of becoming a true polyglot appears to be more important than ever.

The Polyglot

So if you are of the iOS persuasion then your approach would inevitably turn to the  Xcode IDE and Objective-c (now Swift of course) on a Mac. Having never owned a Mac (much to the chagrin of my better half) I have been left out of any serious iOS development thus far. In general the IDE has witnessed a slow hard climb into the light but the most recent updates have some decent improvements, including the live rendering at design time (critical for my work flow).


The recommended approach for Android is the Eclipse IDE in combination with Java (it also has plugins for C/C++, PHP and others) on Windows. For me the Eclipse IDE has many more parallels to Visual Studio than does the Xcode IDE. Additionally Eclipse has been around since 2004 so many of the features I expect within an enterprise level IDE are readily available.


Java is relatively easy for me to read, but what is even more familiar is the use of Android XML, it is appropriately different to XAML, but as long as you are comfortable with general XML schema you can quite confidently make changes inline if necessary.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" >
<TextView android:id="@+id/text"
android:text="Hello World!" />
<Button android:id="@+id/button"
android:text="Hello World!" />

Aside: I do find it fascinating that most larger companies (like mine) appear to prefer the notion of developer specialists which runs counter to the prevailing Sprint and DevOps influence. I wonder which approach will win out?

New Portability features in Visual Studio

The Visual Studio team is doing an increasingly brilliant job of embracing the diversity of the programming world especially as it relates to open source and the web. What I am finding more remarkable is the embrace of other platforms, for example, the new .NET Portability Analyzer helps you determine how flexible your application is across a variety of platforms (including Xamarin). I fully expect Xbox will be added to this list in the very near future to and thereby support a truly universal windows app concept. The .NET API Port team is eager for your feedback!


This is an interesting first step and I am hopeful that this is a positive harbinger of collaborations to come.

Ultimate Portability in Xamarin

I have a growing appreciation for folks who write brilliant software and further have the discipline to write text to explain concepts clearly and articulately. In my chosen profession then, I hold Charles Petzold in the highest regard. I have read most of his books and follow his blog with some interest, while he blogs more about music these days it is still generally fascinating stuff (he actually encouraged folks to go see Atlanta Orchestra while at a Microsoft conference, it was quite brilliant!).

His seminal book, Programming Windows, laid the foundation for me and many Windows programmers of my generation. So of course I was then pleasantly surprised to see him working full time for the Xamarin team, writing a new book (“Creating Mobile Apps with Xamarin.Forms”). For me this upcoming book is like a bellwether for future mobile development practices for traditional Windows developers. I was initially skeptical that you could make compelling products across multiple platforms from a single IDE but I am seeing more and more evidence that this approach is both practical and indeed optimal.


So what is your approach? Are you conversant in multiple languages and multiple IDEs? Or are you relying on Xamarin and C# as *the* approach?

August 11, 2014 17:24    Comments [0]
Tagged in .NET | Android | C# | iOS | Programming | Windows

Share on Twitter, Facebook and LinkedIn

Browse the web on your phone much? I do, across multiple phones and tablets, and it can be a very inconsistent experience. According to my site analytics my mobile visitors are dominated by the iOS platform (second place is not even close). In response most of my attention was focused on how my site looks on the iPhone and iPad (still a work in progress).  Quite coincidentally, this week the Internet Explorer team published an article The Mobile Web should just work for everyone, which talked about the upcoming Windows Phone 8.1 Update which “greatly increase compatibility with the mobile web”.

Based on your feedback, we pursued a web experience for IE users consistent with what is available on iOS and Android devices – even where this meant we would be adding non-standard web platform features. We believe that this is a more pragmatic approach to running today's less-standardised mobile web.

I completely understand why they would do this but it seems like a really polite way of saying we are creating a shim that allows the web to treat us just like an iOS device. I applaud how Microsoft is approaching a mobile reality, that it almost wholly is owned by others. It also reaffirms part of the new global mantra (“…mobile first”), but in doing so they have gone a long way in conceding the future of the mobile web standards to iOS. I can only assume it puts the folks working on IE in a reactionary position from which it will be almost impossible to back track.

Here is a published example of how that change would positively effect a popular site like Twitter on Windows Phone:


Mobile Solutions

As a web developer I have found the best approach has been to use a framework that account for the greatest variety of devices, and after spending a considerable amount of time evaluating a crop of web UI frameworks I settled in on Bootstrap. It was created by a couple of designers at Twitter, and in the face of an increasingly mobile world it has flourished into a really popular front-end framework suitable for big screens all the way down to smart phones.

Feel free to check out my CSS (like I could stop you) and more importantly explore the Bootstrap site itself for some basic layout examples. If you are looking for some really strong design samples check out the Bootstrap Expo (curated by @mdo).

Additional Reading

August 2, 2014 20:24    Comments [0]
Tagged in Android | iOS | Windows Phone

Share on Twitter, Facebook and LinkedIn

geo-fencing image

A geo-fence is a virtual perimeter that maps over some geographic point or object in the real world. These digitally generated spaces can be used in conjunction with your location aware device to produce alerts and behaviors as follows:

  • Request to be notified when the device enters a geo-fence.
  • Request to be notified when the device leaves a geo-fence.
  • Specify a time window during which the geo-fence is active.
  • Specify a dwell time for each geo-fence (amount of time that the device should be in or out of an area).

The use-cases even for this partial list is quite large in both a professional and personal context, however, one of the best applications I heard of was at the Kenya Wild Life Service. “Near threatened” bull elephants were constantly leaving a conservation park and terrorizing local farmers, one particular elephant (Kimani) had a particularly long history of raiding crops…

The race to save Kimani began two years ago. The Kenya Wildlife Service had already reluctantly shot five elephants from the conservancy who refused to stop crop-raiding, and Kimani was the last of the regular raiders. The Save the Elephants group wanted to see if he could break the habit.

So they placed a mobile phone SIM card in Kimani's collar, then set up a virtual "geofence" using a global positioning system that mirrored the conservatory's boundaries. Whenever Kimani approaches the virtual fence, his collar texts rangers.

They have intercepted Kimani 15 times since the project began. Once almost a nightly raider, he last went near a farmer's field four months ago.

This topic applies to many location aware devices, but I will be covering the shared API that applies to Windows hardware (phones, tablets and laptops).

Windows.Devices.Geolocation.Geofencing Namespace

The Geofence class is the main construct for defining a geo-fence, it contains data points that define its shape and duration. The Geocircle is currently the only shape supported but, it is implemented as an interface which could support any shape you saw fit to create. The Geofence class is in turn supported by GeofenceMonitor, its primary task is to manage and assess the state of your defined geo-fences, and the following shows that in action.

private void CreateGeofence(double lat, double lng, double rad)
var position = new BasicGeoposition
Latitude = lat,
Longitude = lng

var circle = new Geocircle(position, rad);
var mask = MonitoredGeofenceStates.Entered | MonitoredGeofenceStates.Exited;
var dwellTime = TimeSpan.FromHours(24);

var geofence = new Geofence(Guid.NewGuid().ToString(), circle, mask, false, dwellTime);


Foreground Geofencing Detection

Once a geo-fence is created and stored we need a mechanism to respond to a breach in its boundaries, in the following code sample we accomplish this task in the foreground directly within the page of an app:

using Windows.UI.Core;
using Windows.UI.Popups;
using Windows.Devices.Geolocation.Geofencing;

namespace PhoneApp1
public partial class MainPage : PhoneApplicationPage
// Constructor
public MainPage()
+= Current_GeofenceStateChanged;


async void Current_GeofenceStateChanged(Windows.Devices.Geolocation.Geofencing.GeofenceMonitor sender,
object args)
var reports = sender.ReadReports();

await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
foreach (GeofenceStateChangeReport report in reports)
var state = report.NewState;
var geofence = report.Geofence;

if (state == GeofenceState.Entered)
var dialog = new MessageDialog(String.Format("Entered GeoFence {0}, your dwell time is {1}",
geofence.Id, geofence.DwellTime), "Entering A GeoFence");
await dialog.ShowAsync();
else if (state == GeofenceState.Exited)
var dialog = new MessageDialog(String.Format("Exited GeoFence {0}, your dwell time is {1}",
geofence.Id, geofence.DwellTime), "Exit A GeoFence");
await dialog.ShowAsync();



Security & Privacy

When developing apps that use geo-fencing technologies developers have a fiduciary responsibility to treat this data with extreme caution and care. A user's geographic location is personally identifiable information (PII). At a minimum you should do the following:

  • Get the users consent.
  • Tell the user how location data will be used.
  • Clear all cached location data when the user disables access to location info.

Related Posts

July 16, 2014 2:53    Comments [0]
Tagged in API | Windows | Windows Phone

Share on Twitter, Facebook and LinkedIn

Earlier this year I spent significant time with a vendor troubleshooting requests we were sending across the network. In the end I was convinced of my need to rely almost exclusively on the vendor to verify that the certificate were correctly applied. Well, a colleague shared this link that describes how to configure network tracing for WCF service.

Configure Network Tracing

<source name="System.Net" tracemode="includehex" maxdatasize="1024">
<add name="System.Net"/>
<source name="System.Net.Cache">
<add name="System.Net"/>
<source name="System.Net.Http">
<add name="System.Net "/>
<source name="System.Net.Sockets">
<add name="System.Net"/>
<source name="System.Net.WebSockets">
<add name="System.Net"/>
<add name="System.Net" value="Verbose"/>
<add name="System.Net.Cache" value="Verbose"/>
<add name="System.Net.Http" value="Verbose"/>
<add name="System.Net.Sockets" value="Verbose"/>
<add name="System.Net.WebSockets" value="Verbose"/>
<add name="System.Net"
<trace autoflush="true"/>

When troubleshooting complex systems never trust the well intentioned opinion of even the savviest technical mind, get the facts. This would have saved me days!

Related Posts

July 14, 2014 22:03    Comments [0]
Tagged in .NET | WCF

Share on Twitter, Facebook and LinkedIn