Friday, June 27, 2014

Are you a programmer? ...Repost of a great article on software developers

- Software solves business problems

Windows Phone Application Bar

Had a great code review from the local MSFT Dev Rep here.  Thanks Gus!

The review brought out the issue of where is best to build the application bar.  I had chosen to implement it in the code behind.  Based on conversations with Gus and some other considerations
it was decided to implement it in the XAML.

It has been a bit since I last visited the theme.  I spent some time digging around the
windows phone website.  If you have not been there yet it is well worth the time and really critical
if you are writing mobile apps for Windows.

Basic syntax for the app bar in the xaml is:

<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" >
            <shell:ApplicationBarIconButton IconUri="/Images/save.png" Text="save" Click="Button1_Click" />
            <shell:ApplicationBarIconButton IconUri="/Images/delete.png" Text="delete" Click="Button2_Click" />
            <shell:ApplicationBarIconButton IconUri="/Images/help.png" Text="help" Click="Button3_Click" />
            <shell:ApplicationBarIconButton IconUri="/Images/settings.png" Text="settings" Click="Button4_Click" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="get default size value" Click="MenuItem1_Click" />
                <shell:ApplicationBarMenuItem Text="get mini size value" Click="MenuItem2_Click" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

This block created a series of icons across the bottom of the screen and a submenu as well.
Just remember to embed the reference inside the phone page tags!

<phone:PhoneApplicationPage>
.....
</phone:PhoneApplicationPage>

Source:
Adding AppBars XAML
AppBar Class
AppBar Sample code
AppBar Icons - C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Icons

Tuesday, June 24, 2014

Single controller with multiple GET methods in ASP.NET Web API

Problem:
Using a WebAPI pattern on a web services website, I ran into an issue.  The default WebAPI Pattern provides routing to the standard HTTP routes, GET, POST, PUSH, DELETE.  This is fine if you have no need to "overload" the routes.  My issue revolves around the need to have GET do mulitple actions besides just getting me all records or individual records.  I needed to return some attributes of the object being served up. 

Mike Wasson form MSFT has a great post on ASP.Net routing.  He describes how WebAPI has been designed.  The key was tweaking the routing table!


Solution:
I opened the WebApiConfig.cs file which is located in the App_Start directory of my WebAPI site.
The updated routing looks like

//Existing route
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
//New route
routes.MapHttpRoute(    
name: "ActionApi",    
routeTemplate: "apiaction/{controller}/{action}/{id}",    
defaults: new { id = RouteParameter.Optional }
);

I have noted from some initial testing, that the routeTemplate must be unique.  I had tried using api as the common root for both routing entries.  The issue was that at runtime the routing always defaulted to the initial path.



Source:
http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api
http://stackoverflow.com/questions/9499794/single-controller-with-multiple-get-methods-in-asp-net-web-api

Wednesday, June 18, 2014

Error Code 1026 XDE.exe - Can not start Windows phone 8 emulator

I installed VS 2012 and the WP 8 SDK.  I built a simple application and attempted to start up the emulator.

I got the following error:

Application: XDE.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.

Cause:
It was unable to enumerate the vSwitches. when I opened Hyper-V manager and clicked on 'Virtual switch manager'. It gave me an error saying 'An error occurred while trying to retrieve a list of virtual switches'

Solution:

This error, I was able to resolve by adding 'Hyper - V Extensible Virtual Switch' protocol in 'Ethernet Properties'
by Uninstalling and Reinstalling Hyper-V from 'Turn windows features on or off' in control panel.

Prometric test center in Wiesbaden

Testing center in Erbenheim.

 

1.) I just registered with prometric site - https://www.register.prometric.com

 

2.) Use location GR89K

Ordix AG

Phone 611 77840-00

Site Code   GR89K

Kreuzberger Ring 13

Wiesbaden-Erbenheim

Wednesday, June 11, 2014

Shortcut to SharePoint 2010 site template form

It is nice to be able to skip the GUI on SharePoint if you need quick access to certain functions.


1.) I was trying to remember the site template page. 

Structure:
http://<servername>/<path>/_layouts/savetmpl.aspx


Example:
http://www.mydomain.com/mysite/_layouts/savetmpl.aspx


2.) Now get the template out of the location where it was saved
http://www.mydomain.com/mysite/_catalogs/lt/Forms/AllItems.aspx

Tuesday, June 10, 2014

Connecting Windows Phone 8 Emulator to localhost.

A while back I blogged on connecting to localhost from windows phone emulator.  I was trying out a new dev build today and having issues.  Debugging was failing to connect on my VS 2013 build. I realized that I was having firewall issues.
I started by turning off all the firewalls to determine if this was the issue. Once the firewall was down I was able to connect from the emulator to localhost. I then modified the netsh command.

Change the profile to public on the firewall connection.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=public remoteip=localsubnet action=allow