Skip to content

Consuming WCF Services

April 24, 2012

While I’m flying into low clouds providing for a turbulent landing in Slovenia I find myself once again thinking about WCF and how far we have come from doing things with xterm like protocols and raw sockets(and to help distract myself, I don’t enjoy flying). WCF has been around in .net since 3.0 where it was codenamed Indigo and is a powerful solution to building service orientated applications. Visual Studio works nicely with adding WCF connections to applications, whether it be WPF, Winforms, Silverlight or windows phone apps. The right-click “Add Service Reference” on a project and fill in all the details is great for novices and testing idea’s quickly. However I find the proxy classes it generates a little heavy and updating them through the IDE to be repetitively time-consuming.

At the moment while im working on the next version of the Rosetta Stone Challenge and changing the server endpoints and data contracts for the wp7 Object Recognition Toolkit, I can be updating them every 15 mins. Then having to update the WPF and wp7 solutions  respectively. Their is command line applications however that can be automated through batch files and the whole thing is done in seconds.

“Svcutil.exe” (or “slsvcutil.exe” for silverlight and wp7)can be started easily through a visual studio command prompt or saved in a pre/post build batch file with the necessary parameters.

You can just automate with a batch file and optional parameter to not recreate data contract’s that you may have in a shared library between your server and client projects.

In the end a successful download and update should look like this from the command line.

Working and usable are two different things

April 15, 2012

While the version I tested with-in the museum worked, it was by no mean user-friendly. It would take up to 30 seconds to save a new image, starting up the app could take up to a minute once it had a large number of image points in their. When developing I always work on the premise of just getting it working for the first version, what ever library’s or what ever takes me the least amount of time to code to see if the concept works.

For example on the phone I was saving every point from the picture which could be in the thousands of points but further testing showed I am getting away with using 150 points and that only takes a few seconds to save which is in the background while the user is typing in the name. On saving points to the phones isolated storage I was just using the built-in .net serialization, while it worked it is not fast enough for the amount of data. In the end I decided to give a .net port of google’s Proto buffers which is giving an acceptable level of performance around 1 point per millisecond so it is loading in under a second generally which the user wont even notice.

There are still a lot more optimizations I can do but the sample app is now changing from something that is working to becoming a usable product.

Rosetta Stone Challenge – Success!!

March 31, 2012

Well, I’m in London for less than 48 hours before I fly out again but I stopped into the British Museum. I fired up the app, took a snapshot of the Rosetta stone to add it into the system and then let the app scan and it found it! I did come away with a lot of good experience though, the Rosetta stone itself is behind a glass case which is highly reflective and a constant stream of tourists taking pictures with flash’s on making the glass even more reflective so the number of feature points found is quite small, so that has given me something to think about. I have taken some pictures to prove it but to be honest the pics are pretty poor.

What I later did was test the app with a statue of Amenhopted and then remembered I had a screen capture app installed which gives a much better result as you can see below.

Debugging WCFservices between the phone and local machine

March 30, 2012

As I continue travelling through the south of France I find a lot of time I don’t have an Internet connection so debugging a WCF service running on the laptop to the phone plugged in wont work with the standard setup. There is a solution however, all you have to do is install the Microsoft network loopback adapter card(software). It will probably just get a default 169.x.x.x ip address but that is okay, we just need a IP address somewhere. Update your local web.config with the machine name to use the same name in WCF client host name, I further installed the IIS Express edition to test with but you will have to update your config in C:\Users\user name here\Documents\IISExpress\config\applicationhost.config with the machine name so the service binds to that address on something like this   <binding protocol=”http” bindingInformation=”*:80:eee” />

Dynmically loading XAML content

March 14, 2012

So I have had a few tight deadlines with work over the last month working many 12 hour days, but now I’m free and travelling for the next 4 months. So while I have continued to work on the project I havent really been discussing my progress. I have a few break through and a few dead ends which taught me a lot although I dumped a lot of code.

But now that I feel that the engine is matching reasonably accurately on small data sets in real-time, I wanted to get a more end to end experience before I spend more time scaling out the system. So I have a known match, let’s get something on the screen. This is something that has been in the back of my mind for a while, I wanted it to be dynamic content that did not have to be preloaded on the phone. Ideally something that the phone could say to a web service I have found this object, you got anything we can show on the screen that is informative ?

So in comes XamlReader.Load(), the answer to my needs. It takes a string of XAML code and spits out XAML parsed code which appears to work for my little test demo. I have simple test class that spits out an Ellipse wrapped in a Grid that gets moved across the screen each time it matches per cycle of the engine. Nothing to exciting but an adequate proof of concept. I found the code here http://blogs.msdn.com/b/christophputz/archive/2010/10/24/windows-phone-7-dynamically-load-xaml.aspx and the author clearly knows more about it then me at the moment. One thing that is essential is having the top-level element contains “xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation.

So I guess I had better get working on writing a web service to store the xaml animations, it also builds a platform to create a more scalable image matching engine……

So little time, so much code to write…..

RSC Update 2

February 5, 2012

Rosetta Stone Challenge Update 2

Okay, so I have some basic recognition working. But the challenge requires me to walk up and have it recognize the rosette stone; this means I’m going to have to store the point information offline. So I have started experimenting, at the moment every time it starts up it loads some sample pictures(slow and painful) which I have associated with an image and adds it to the internal database. So far I have found that after loading, if we resize the image to the camera size it appears to greatly increase the detection rate. I’m also looking at taking pictures with several different cameras as well as my phone and see how they go. What I have also started developing is the ability to save each snapshot that goes through the engine so I can experiment with them offline and build some consistent tests around to further increase the accuracy.

RSC Update 1

January 26, 2012

Rosetta Stone Challenge Update 1

Well I have a half decent(barley) GUI with the simple workflow of being able to take a snap shot of an object and able to give it a title, and little Status panel telling us whats going on and what it has found.

How it works –  In the background the app will continually scan for interest points and select a subset of points to attempt to match them to the recently saved images. I will discuss the interest point extraction subset selection and matching algorithms over the next few weeks as i fine tune them the challenge.

But for now a few pictures to  of the progression…..

Saving USB

Saving USB

Scanning for USB

Scanning for USB

Found USB

Found USB

Rosetta Stone Challenge

January 22, 2012

While I have been developing a lot of WP7 apps not many of them have made it to the market place for various reasons. So to make sure this doesnt happen for the current project im working on around “Real time object recognition on wp7” Im setting myself a challenge and publicly releasing the code as I go on codeplex and blogging about it as I go. The challenge is by the end of March I have to have built an object recognition app. The test will be walking up to the rosetta stone in the british museum and having it recognising it in under a second and displaying the name and a link to further info on wikipedia.

The codeplex project is http://wp7ort.codeplex.com/ and is something i have been tinkering with since christmas 2011.

Let the challenge begin……

Free WhatIs (Beta) has been released!

June 30, 2011

This is another voice based App which builds on some of the earlier work i did in wikipedia viewer but takes it to a whole new level. Want to know “what is the first fleet”, “what is the average for 5 and 6 and 7” just ask it and it will determine the best guess answer!

Free WhatIs

My international friend it should be coming out in a lot more languages over the next few weeks so if you want to test it please drop me a comment below and i will let you know when it is out.

Can’t connect to your phone. Disconnect it, restart it, then try connecting again.

June 25, 2011

This is a painful error I have had in the past which has cost me more time than I was happy to spend on it.

“CONNECTION ERROR Can’t connect to your phone. Disconnect it, restart it, then try connecting again.”

Also in the system event logs

Log Name: System
Source: Schannel
Date: 11/30/2010 10:40:53 PM
Event ID: 36870
Task Category: None
Level: Error
Keywords:
User: SYSTEM
Computer: XXXXXXX
Description:
A fatal error occurred when attempting to access the SSL server credential private key.
The error code returned from the cryptographic module is 0x8009030d. The internal error state

This error I have received a few times now from my phone, if you plug your phone into another computer it works fine. So far i have found it is the result of changing your account password on your machine. The only reliable solution I have found so far is to make Zune forget the phone then resync your podcast and pictures via Zune Setting -> Device options -> FORGET THIS PHONE.