Orlando Code Camp: ASP.NET WebAPI and SignalR for Data Services presentation

17 Mar

On Saturday March 16th 2013 I presented at the Orlando .NET Code Camp on the topic of ASP.NET WebAPI and SignalR for Data Services.  This was a merge of two other presentations I did, the first being SignalR I did for Tampa WinDev back in November.  The WebAPI aspect was done at SMUG on February 7th in Key West.

Thanks to all who attended my session!  As promised, below is a link to my SkyDrive folder on the slides and code I used in the presentation.

I will be presenting the WebAPI aspect of this presentation again at the Tampa Windows Developers Usergroup following Brent Schooley in a few days on March 19th at the Tampa AgileThought office.  The signup for that event is here:



Presenting at the South West Florida Code Camp Sept 8th 2012

07 Sep

Tomorrow I will be presenting at the 2012 South West Florida Code Camp at Hodges University.  My topic will be ‘Creating a HTML5 Windows 8 native application’.  This is a very intro level presentation on the basics of how to use Visual Studio 2012 and the provided templates. From this presentation you will get familiar with the development environment to start creating your first native application using HTML and JavaScript.  I will be touching on Basic template, the Grid template, and Expression Blend 5.

This is the nearly the same presentation I did at the Orlando .NET Code Camp back in March, but I felt this is an important presentation to keep going for people who are not .NET stack developers but are HTML/JavaScript developers who want to get an intro level presentation on how to get started with Windows 8 Runtime/RT/Native application development.

If you miss out on this presentation I will be doing it again both at the Tampa Windows Developers user group on September 26th at the Tampa Microsoft office and at the Tampa .NET Code Camp on October 13th at the University South Florida campus.  I hope to see you at one of these venues!


‘File…New…Metro’ presentation follow-up

25 Jan

Last week on Jan 18th I presented at the Tampa Bay Windows Developers User Group.  The presentation went well, it was my first full session presentation I did.  This has been a goal of mine I have been looking to accomplish for a while.  I hope to do some more in the near future.   Below is a panorama of me in the middle of the presentation.


Someone asked in the presentation if you can use JavaScript libraries like jQuery in HTML5 WinRT apps.  The answer is yes, as can be seen in this blog post:

Thanks to all who showed up!  Attached below are my slides.


Update – Credit to Joe Healy for the pic!  Thanks for the support!



Presenting at the Tampa Bay Win Dev user group Jan 18th!

14 Jan

This coming Wednesday January 18th 2012 6pm at the Tampa Microsoft office I will be presenting to the Tampa Bay Windows Developers user group.  My topic will be on Windows 8 development which will go into the templates that come with Visual Studio 11 Express for Windows Developer Preview and how they can be easily changed to make useful applications for Windows 8.  I will be going into the XAML and HTML5 templates, some of the new .NET Framework 4.5 features, and some tips and tricks with Windows 8 Developer Preview OS.  Hope to see you there!

Tampa Bay Windows Developer User Group site:

Please sign up at the Eventbrite site here:


APODViewer7 2.3 released

01 Sep

A new update is available today, version 2.3.  I wanted to get this out earlier this month but the new ad rotator I added ( see previous blog post on multiple ad providers ) was giving me some odd stability issues. It magically corrected itself which was a bit unsettling.  I’m starting to think it was Google AdMob not serving the ads correctly up until recently.  If it starts acting up I can remotely kill the AdMob adds without an update.  The most significant change with this version is the automated slideshow.  You need to see this, its pretty cool just to let the images automatically go through random images you haven’t seen before.  I found myself just letting this run at work and looking at the details of images I found interesting.   On to the new features/changes:

  • Added an automated slideshow option from the main menu.  The slideshow picks random images, downloads them, and then picks a random zoom (1 or .5 vertical scale) and panning path to scan through the image. A menu is available when the screen is pressed.  Menu options are to go to the previous image, skip to the next, view the images details and description, or save to your favorites. As its showing the image, its actively downloading the next one in the background. This slideshow has settings available in the settings page which gives you the option to enable/disable the title bar, enable/disable the lock screen, and set the delay time for each image to either 5, 10, 20, or 30 seconds.
  • Live Tile now has a ‘Titles’ option that overlay’s the images title over the live tile image.  This will only work with the Latest image of the day or the Multi App Latest Image Left tile, for now.
  • Added Vimeo video identification and internal video playing.   Occasionally APOD would feature Vimeo videos.  Previous versions of APODViewer7 just returned an error saying it could not find an image.  Now it will show a video link much like the YouTube videos.  Currently there is no support by Vimeo to to play videos on WP7 in the web browser.  There is an app called Vimeo Viewer for WP7 by Max2 available ( the developer helped me through a Vimeo play problem I had, thanks Maxim! ) but there is no means to directly load Vimeo Viewer with a video from my app.  I implemented an internal Vimeo player to play these videos.  Its somewhat unstable due to how I attempt to load the video, but so far it seems to work well.  There is also a chance this could cease working completely, so I provided an option to attempt to load the vimeo web page in the web browser in hopes Vimeo eventually supports WP7.   As of today this does not work as vimeo does not support HTML5 in both the desktop and WP7 version of Internet Explorer 9.  Vimeo developers do state they are looking into, but its low on their priorities.  I read this they will not address it until WP7 gets significant market share.
  • Added a Random pivot from the main page.  These random images are pulled down from a list on my web server that tracks what random live tile images were shown.  This way if you want to see more detail on the random live tile from the start screen you can go to this pivot to find it quickly and view its details.
  • Added location services support.  This is purely for loading location specific ads for the free and trail versions.  You can enable/disable from the main menu.
  • Corrected YouTube identification on certain days that it was/will be featured.
  • Bug corrected that made the description text size extremely small.  This was only seen on the Mango beta build, but future release builds of Mango would of ran into this.
  • Added crash handling code that asks the user on the next start up to email the exception text to myself.  Hopefully this can help me nail down those rare bugs I cant reproduce in my enviroments.


I plan to take advantage of Mango’s new live tile features, but that may be put on hold until a good portion of the user base has been upgraded to Mango.  Once I update APODViewer7 with Mango features I can no longer update pre-Mango version.  Hopefully carriers will upgrade their user base to Mango ASAP but this is unlikely based on the current pattern of Android and WP7 updates.

No Comments

Posted in WP7


Using multiple Windows Phone 7 Ad Providers

27 Jul

Yesterday, July 26th 2011, I presented along with 7 other Windows Phone 7 developers at the Tampa Windows Phone 7 User Group.  The focus was ‘Show and Tell’ of our apps and experiences with the platform.  I spent some time talking about my phone applications, but spent most of my time with my recent experiences in using multiple ad providers.  The complete PowerPoint presentation is attached here, but to sum up the multiple ad providers part of the presentation I compiled it into this blog post.

Revenue for Windows Phone 7 apps is generated mostly by one of two methods, Paid or Free with ads.  There are many other means such as subscriptions and micro transactions, but those are currently rarely implemented.  To sum up the two popular methods:

  • Paid/Trial
    • Advantages
      • Very easy to implement.  The marketplace takes care of the transaction and we only have to make a simple method call to determine if this user paid or not.
    • Disadvantages
      • Many users, perhaps a vast majority, are completely ignoring pay apps.  There is a perception that by a lot of users that they don’t mind paying for hardware, but they see no reason why they should pay for additional software on the same device.
      • The users who do browse and use the trial options of pay apps and extremely reluctant to purchase apps in general, even if its as low as 99 cents.


  • Free with Ads
    • Advantages
      • The counter to above, users are more likely to see see and download your application if its free.
      • There are many bloggers that have reported they have seen significant improvement in revenue from free ad apps over paid apps
    • Disadvantages
      • Less visual space due to the space the ads take
      • If there is a paid version of the same app, developers need to determine what features, if any, are to be reduced.  This requires more code throughout the app to lock down some features.
      • Each ad provider requires an account, configuration, and payment information setup.  Each provider has rules on how to use their ad components that need to be followed closely.
      • Revenue is highly variable, even with consistent user activity.  Effective cost per mille, or eCPM, drives what your revenue is per 1000 views of the ad, or impressions.  This can change dramatically every few minutes based on your ad’s topics, user impressions, and users clicks into the ads.


So with Windows Phone 7 the easiest and best ad component to use is Microsoft’s pubCenter.  Its now included with the latest WP7 SDK 7.1 Beta 2, but is available as a separate download.  Its very easy to implement and seems extremely stable.  Most bloggers have stated this is the best ad network for displaying ads in WP7, at least for United States users. 

However, there is a problem with using pubCenter exclusively.  The pubCenter ads can currently only produce ad revenue from users in the United States, United Kingdom, and the Netherlands.  There is planned support for Canada, France, and Germany, which may or may not already be in place.  Around half of my user downloads came from countries not covered by pubCenter.

So what to do?  Fortunately, there are many other ad providers we can utilize.  Here is a list of the ones I know about that currently support Windows Phone 7. There are many more ad providers out there that are geared towards mobile devices, but I’m just not aware if they support WP7 yet.


The next problem is how to use these providers.  We cant simply just use a vender exclusively on separate pages as we could have mismatched users to ad providers (e.g. New Zealand user to pubCenter).  We need to be able to load different ad providers based on where the user is from, switch to another ad provider should one fail, and possibly switch ad providers dynamically if one starts producing low eCPM.  You could code all this yourself but fortunately there are several groups working on this problem already.  The ones I identified are as follows:

  • MobClix
    • This provider gives you a single component to ad to your app and they handle all the ad switching among the various of providers they support.  I was not able to test their component out as I couldn’t log into their system.




  • ImproviSoft AdManagement Component
    • I talked to the CEO of ImproviSoft, Dan Colasanti, about his use of ads in his apps.  Me and Dan used to work together when I used to live in the cold tundra of Syracuse, NY.  He’s developing a very impressive ad handler.  However, its not available yet so I am mentioning his effort as something to track for future use. 


  • Windows Phone 7 Ad Rotator
    • This is the only component I had tried out completely.  It covers pubCenter, AdMob, and AdDuplex with future support for Inneractive.


Ad Rotator has some great features in setting what probability an ad vendor will be shown based on the users culture settings on their phone.  Here are the primary things you need to do to set it up.  First, drop the XAML code into your page:

<adRotator:AdRotatorControl x:Name="AdRotatorControl" Width="480" Height="80"  Grid.Row="0" 
            AdMobAdUnitId="" />


Note the two settings parameters.  You need to set that to a local file to your project as well as where your remote settings file on your web server.  You can load all your Ad Providers ID’s here also, but I suggest putting it all into your backend code.  This way you can specify different settings if your in a debug build.  It would look like this (with test settings):

AdRotatorControl.PubCenterAdUnitId = "Image480_80";
AdRotatorControl.PubCenterAppId = "test_client";
AdRotatorControl.AdDuplexAppId = "xxxxx";
AdRotatorControl.AdMobAdUnitId = "xxxxx";
AdRotatorControl.DefaultAdType = AdRotator.AdType.PubCenter;


Now you need to configure your settings file. 

<?xml version="1.0" encoding="utf-8"?>
<AdSettings xmlns:xsi="" 
        <AdCultureDescriptor CultureName="en-US">
            <Probabilities Probability="60" AdType="PubCenter" />
            <Probabilities Probability="20" AdType="AdMob" />
            <Probabilities Probability="20" AdType="AdDuplex" />
        <AdCultureDescriptor CultureName="en-GB">
            <Probabilities Probability="20" AdType="PubCenter" />
            <Probabilities Probability="60" AdType="AdMob" />
            <Probabilities Probability="20" AdType="AdDuplex" />
    <AdCultureDescriptor CultureName="default">
      <Probabilities Probability="1" AdType="PubCenter" />
      <Probabilities Probability="80" AdType="AdMob" />
      <Probabilities Probability="19" AdType="AdDuplex" />

In this file I have pubCenter used a majority of the time for United States users.  United Kingdom users see Admob a majority of the time.  All others rarely see pubCenter at all.  I left it 1 percent just in case the other two happen to fail to load immediately after each other.  This same file is used on your remote web server.  This is great when eCPM falls with one ad provider, you can switch your users immediately to a new probabilities file.

That’s pretty much it.  There are some great ad handlers out now and there are sure to be new ones and great improvements with existing ones.  There is no excuse to not use more then one ad provider.


Posted in WP7


Viewing GIF’s in Windows Phone 7

04 May

To display an image in Windows Phone 7 we are given one control to handle this, called ‘Image’.  It is very simple to use, just simply define it and load up the object with either a URI of the data source or load it with some local image data.  One glaring issue with the Image object is its not capable of displaying GIF images.

APODViewer7 had to display GIF images.  APOD’s archive was loaded with them especially from its first few years.  After those first few years GIF’s continued to be used for its animated capability.  I got it working by using the WebBrowser object.  It worked surprisingly well, it even gave me pinch to zoom and manipulation for free!  However, it required some clunkly code to make it somewhat seamless to the user.

Before I released my 2.0 version of APODViewer7 Diane Leeper did a quick run through and critique of the user experience of my development version of the application.  She gave me some great some tips on how to improve the app.  Notably, the waiting thumbnail animations and how I handle image preloading in the background. Thanks again Diane!

Diane noted other developers were struggling with this issue and that I should blog about it to inform others on how I got GIF viewing working.  That said, on to the details on how I did it.

Below are the two objects defined in XAML, an Image and WebBrowser object.  We will alternate the visibility of these objects depending on what type of image we want to load.

  1.  <Image x:Name="FullImage"/>
  3.  <phone:WebBrowser x:Name="wbViewer" Width="480" Height="696" Visibility="Collapsed" />

Three application bar buttons are defined to execute the three image loads.  Initially when the application executes nothing is rendered, pressing the application bar images loads its associated data. Pressing button 1 will render an animated GIF in the WebBrowser.  Button 2 is a JPG also loaded by the WebBrowser.  Button 3 is another JPG loaded into an Image object.  Give each call a few seconds to load, it has to download the complete image data off of the NASA web site.

When loading the GIF in the WebBrowser, we need to hide the Image object.  Then we need to create an HTML string to properly display the image.  Here is the method that formats the HTML string and loads the WebBrowser object:

  1. private void ViewImageInWebBrowser(string ImageURL)
  2. {
  3.     FullImage.Visibility = System.Windows.Visibility.Collapsed;
  5.     wbViewer.IsEnabled = true;
  6.     wbViewer.Visibility = System.Windows.Visibility.Visible;
  7.     string backgroundColor;
  9.     if (IsThemeDark() == true)
  10.     {
  11.         backgroundColor = "<body bgcolor=\"#000000\">";
  12.     }
  13.     else
  14.     {
  15.         backgroundColor = "<body bgcolor=\"#FFFFFF\">";
  16.     }
  18.     string imageHTML = "<html><head><meta name=\"viewport\" "+
  19.         "content=\"width=480\" id=\"viewport\" />" +
  20.         "</head>"+ backgroundColor + "<IMG SRC=\"" +
  21.         ImageURL + "\"></body></html>";
  23.     wbViewer.NavigateToString(imageHTML);
  24. }

Notice it initially hides the Image object and then makes the WebBrowser object visible.  The two objects are layered on top of each other, making the appropriate object visible and hiding the other. The HTML string uses a meta tag to prevent the image from being scaled incorrectly when initially rendered.  Note the IsThemeDark call.  This is used to determine how to set the WebBrowser background color based on what the user has the theme set to, light or dark. This is defined as:

  1. public static bool IsThemeDark()
  2. {
  3.     bool ThemeIsDark = false;
  5.     Color themeColor = (Color)Application.Current.Resources["PhoneForegroundColor"];
  7.     if (themeColor.ToString() == "#FFFFFFFF")
  8.     {
  9.         ThemeIsDark = true;
  10.     }
  11.     else if (themeColor.ToString() == "#DE000000")
  12.     {
  13.         ThemeIsDark = false;
  14.     }
  16.     return ThemeIsDark;
  17. }

JPG in the WebBrowser is no different then GIF’s, just a different URL loaded into the ViewImageInWebBrowser method.  Loading a JPG in an Image object is much simpler.  First we hide the WebBrowser, then create a URI of the image location and load the Image object with it.

  1. private void JPG_Image_Click(object sender, EventArgs e)
  2. {
  3.     wbViewer.IsEnabled = false;
  4.     wbViewer.Visibility = System.Windows.Visibility.Collapsed;
  6.     FullImage.Visibility = System.Windows.Visibility.Visible;
  8.     Uri u = new Uri("", UriKind.Absolute);
  9.     FullImage.Source = new BitmapImage(u);
  10. }

Some negative aspects of using WebBrowser for images is we cant directly deal with the loaded image data.   With the image object we can load image data from memory locally to the object, give it a URI to load, or extract its currently loaded data to manipulate it.  WebBrowser only allows us to load a specific HTML string using the NavigateToString method a URL using the Navigate method with no means to touch its loaded data.

There you have it, a way to display GIF’s in a WP7 app.  I admit this is rather crude, but it works and its done completely with out any external dependencies.  I have seen other solutions such as Imagetools for Silverlight that have specific calls to handle GIF’s, but I discovered this project after I implemented the above.  I’ll play around with the ImageTools to see if its worth changing APODViewer7 and blog about the differences.

If interested in the code, click here to download the complete VS2010 solution for this example.


Posted in WP7


APODViewer7 2.1 released

29 Apr

This is a minor fix to the application that corrected two bugs.  They are:

  • Corrected the first of the month bug.  Previously if executed on the first of the month and the app was set to load the latest month on load, no data would be produced on screen.  The workaround was to go back a month then return
  • The HTML descriptions for the images when referencing links from the APOD site were set as relative links from the APOD server.  When clicked the browser would only show what the link name was.  This was corrected by expanding the link to what server your mirror settings were set to.

Looks like I submitted the APODViewer7Pro’s title incorrectly, it reverted back to the original title.  This will only be noticeable when viewing it in the marketplace.  I’ll be submitting a new update today to correct that.


APODViewer7 First of the month bug

01 Apr

For those of you wondering whats going on with the APODViewer7 app today, there is a bug that preventing the current month from being shown.  On load it is attempting to load the current month and just showing ‘Latest’ in the pivot and not showing any data.    The reason for this is the event that goes and downloads the data only does so if the date changes.  It defaults to current date, as of now April 1st 2011.  When the app fires up it updates this value with the first of the current month being viewed.  If the same date is sent to control it does not fire the update event. 

I have this bug corrected, I will get it submitted and have the app updated before this occurs again next month.  For now, the workaround is to select the previous month and then back to the current month.  This forces the app to load the correct data.  The problem will go away tomorrow.  Sorry for the problems!

1 Comment

Posted in WP7


APODViewer7 2.0 Released

21 Mar

Whoa daddy I worked a lot on this update.  I’ve been working on this since mid-February on my free time.  This is a huge leap in features, performance, and stability then any prior release.  This was a major enough update I felt it deserved to be the 2.0 version.  The name was also changed to ‘APODViewer7’ to distinguish it from similar applications on other marketplaces.

The biggest changes was the addition of viewing the full APOD archive.  You can go back, month by month or to a specific month, to June 1995 when APOD posted its first image.  That’s over 5,400 images!   Searching was also added to do complete APOD text search’s of the title and description. Here are some screenshots of the main page from the pro version:

SplashScreenImagePro_Crescent 123

The new splash page is show in the first image. Note in the second image the removed alternating colors compared to previous versions.  It was failing to alternate in some cases in the previous version.  More importantly, this looks more ‘Metro’ and saves power for the AMOLED users.  The date is also shown with the title.  The third shot is the same page but with the settings set to ‘Thumbnails only’.  I personally like this mode, makes picking more interesting images quicker.  The forth shot shows the search pivot.  Viewing the image hasn’t changed much, other then some application bar changes noted below.

Complete changes are as follows:

  • Renamed app from ‘APOD Viewer’ to ‘APODViewer7’ to distinguish it better from other APOD apps on other platforms out there.
  • Removed all feature restrictions from the free/trial modes, other than the Ads.
  • Full archive viewing. Browsing done month by month, either incrementing/decrementing or selecting a specific month/year. Limited to June 1995 to present month.
  • Dropped the usage of the RSS feed. The app will now automatically determine date changes and create the new URL. APOD uses a very obvious pattern on URL links so this works great.
  • Added Search pivot. This allows search of all the titles and description text. It only returns a max of 200 items. It’s a bit sluggish when a lot of returns come back. I plan to make this perform better in the next update.
  • The ‘Random Image Hourly’ Live Tile pulls from separate images on both the free and Pro version of the app.  This way you should never see the same image when using the same Live Tile across both apps.
  • When viewing the detailed images and pressing the Next or Previous buttons it will now go through the appropriate list, be it the currently viewed month, search results, or favorites.  Previously it would only shift through the latest images.
  • Cached all prior months’ data into the app from Feb 2011 to June 1995, except for the thumbnail image data. When viewing previous months all that’s needed to download is the image itself, all other image data is loaded locally.
  • Background downloading of images when viewing your initial image. You should see a progress bar on the first image, but the next selection loads instantly if given enough time (usually 1 or 2 seconds). It downloads the 2 next dates immediately before and after it. This way when hitting the Next/Back button, the image instantly loads.
  • Added Thumbnail only viewing from the main page using a Wrap Panel.
  • Main page now handles landscape viewing. The Thumbnails Wrap Panel views 5 thumbnails from left to right in landscape, 4 in portrait.
  • Removed alternating background colors in list box’s. The reason for this is the way I add new images to the list the alternating colors occasionally do not alternate correctly. Added bonus, AMOLED screens show more black, saving power.
  • Removed the ‘buy astronomy products’ link.  The experiment is over. For the curious, I didn’t sell one item.  It was pretty hard to view and navigate from that web page, it was not setup for mobile viewing.
  • Removed the ‘update’ nag prompt from the free version. The Paid version will still bug you, but only once every month.
  • Added GIF viewing including support for animated GIFs.  You cannot save GIF images to the Picture Hub.  They also do not preload into the cache, they are downloaded every time you go to view it.
  • Added a Waiting animation in the thumbnail area if it’s currently being downloaded.
  • Scaled and fit the thumbnails into 100×100 images.
  • Changed ‘Reload Image’ menu item to two items, ‘Reload Image (std res)’ and ‘Reload Image (high res). This will force the page download to show the specific image resolution regardless of what was loaded before. Makes the ‘Show high res’ in the settings less useful, but I left it there in case some people insist on it especially if they auto save the images on view.
  • Setting to load either the most current month or the last month viewed on application startup.
  • Haptic feedback on all buttons. This can be disabled in the settings.
  • Changed some of the mirror sites. Some of them appeared to not have been updated in quite some time. The only mirrors that made the cut are Russia, United Kingdom, and Italy. I would prefer to have more, but the other sites either are not updating or reformat how the images are stored in way that’s unique.
  • Separate Random Image live tile images for the free and paid/trial version. This way selecting Random on both apps will not duplicate the image.
  • Removed picture hub limit, made obsolete from recent changes.
  • Better thumbnail image downloads and recovery. If using a mirror and it fails, it will reattempt back to the NASA server. If it fails and shows the default thumbnail, it will reattempt the thumbnail download again on the next time that month/year is reloaded.
  • Added a default video thumbnail image for days where a YouTube link is present.