charity, Windows Phone 7, programming, paypal, WP7, hacking »

[23 Sep 2010 | 3 Comments]

So I went to Charity Hack and as promised have put together a video of the event.

The Event

It was a great event (again) with the standard of apps even better than last year. John Lunn has done a write up of the event with videos of all the winning hacks.

There is also a great write up by Ben Matthews about all 18 entries which is well worth a read to get a overall feel of the event. http://benrmatthews.posterous.com/28520434

There is also a great photo stream here of the event: http://www.flickr.com/photos/martin_88/with/5004083392/

Our App

We created a Windows Phone 7 app which used a number of API’s provided by JustGiving and PayPal to collect the donations from users. We only had a limited time to learn what the development tools for Windows Phone 7 could do but it was really easy to pickup and get something doing pretty complex api calls in a very short time. It does an number of restful web service calls in the background which was made even easier with the http://restsharp.org/ library. We were really pleased with the outcome so please enjoy the video!

MS CRM4, MS CRM, C#, programming, Software Developement »

[17 Sep 2010 | 0 Comments]

Now this might seem like something that would be easy to do but I’ve just spent 2 days struggling to do just this because of what I consider a bug in one of the SDK wrappers. I have now found a work around to enable unit testing which I will share with you now.

The Error message

Test method XrmEntityWrappers.Tests.CaseEntity.GetCaseByTicketNumber threw exception:  System.TypeInitializationException: The type initializer for 'Microsoft.Xrm.Client.Caching.Cache' threw an exception. --->  System.IO.DirectoryNotFoundException: Could not find a part of the path 'appDomain=UnitTestAdapterDomain_ForC:\Projects\Thg.Ohov.Crm\SourceCode\Thg.Ohov.Crm\TestResults\dh27_WIN-51UPWVCUQ6V 2010-09-16 18_21_40\Out\XrmEntityWrappers.Tests.dll:key=Microsoft.Xrm.Client.Caching.InMemoryCacheProvider'..

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
b__0(Object userData)
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action`1 action)
Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService)
Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService, Action`2 addToCache)
Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Func`2 loadFromCache, Func`2 loadFromService, Action`2 addToCache)
Microsoft.Xrm.Client.Caching.InMemoryCacheProvider.GetExtendedCache()
Microsoft.Xrm.Client.Caching.CacheManager.GetExtendedCache()
Microsoft.Xrm.Client.Caching.Cache..cctor()
Microsoft.Xrm.Client.Caching.Cache.Get[T](String label, Func`2 load)
Microsoft.Xrm.Client.CrmConnection..ctor(String connectionStringName, String connectionString)
Microsoft.Xrm.Client.CrmConnection.Parse(String connectionString)
Thg.Ohov.Crm.Core.XrmEntityWrappers.XrmAdapter..ctor() in C:\Projects\Thg.Ohov.Crm\SourceCode\Thg.Ohov.Crm\Core\XrmEntityWrappers\XrmAdapter.cs: line 28
Thg.Ohov.Crm.Core.XrmEntityWrappers.incident.get_XrmAdapter() in C:\Projects\Thg.Ohov.Crm\SourceCode\Thg.Ohov.Crm\Core\XrmEntityWrappers\incident.cs: line 25
Thg.Ohov.Crm.Core.XrmEntityWrappers.incident.GetIncident(String caseId) in C:\Projects\Thg.Ohov.Crm\SourceCode\Thg.Ohov.Crm\Core\XrmEntityWrappers\incident.cs: line 44
XrmEntityWrappers.Tests.CaseEntity.GetCaseByTicketNumber() in C:\Projects\Thg.Ohov.Crm\SourceCode\Thg.Ohov.Crm\XrmEntityWrappers.Tests\CaseEntity.cs: line 23

The reason for the error

The Microsoft.Xrm.Client.dll tries to create a Mutex object with the

Thread.GetDomain().FriendlyName;

When running ordinary in a console app or web app this is not a problem as the FriendlyName does not contain any ‘\’ characters. However UnitTest frameworks do put ‘\’ characters in the GetDomain().FriendlyName which then causes the Mutex object to throw a ‘System.IO.DirectoryNotFoundException’.

The fix

The real fix is for Microsoft to update the Microsoft.Xrm.Client.dll so that it doesn’t put any ‘\’ characters into the Mutex constructor. However my work around for this is thanks to Nick Watkins who found this article on how to change the GetDomain().FriendlyName

http://www.timvasil.com/blog14/post/2008/11/Fixing-Instance-names-used-for-writing-to-custom-counters-must-be-127-characters-or-less.aspx

The key bit of code being this if you want to set the FriendlyName to ‘Test’ (which doesn’t have any ‘\’ characters!):

typeof(AppDomain).GetMethod("nSetupFriendlyName", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(AppDomain.CurrentDomain, new object[] { "Test" });

To rename the GetDomain().FriendlyName before calling any of the wrapper code in the unit tests. So the test might look a bit like this:

[TestMethod()]
        public void GetIncidentTest()
        {

typeof(AppDomain).GetMethod("nSetupFriendlyName", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(AppDomain.CurrentDomain, new object[] { "Test" });

            string caseId = "1234"; // TODO: Initialize to an appropriate value
            incident expected = null; // TODO: Initialize to an appropriate value
            incident actual;
            actual = incident.GetIncident(caseId);
            Assert.AreEqual(expected, actual);

}

Summary

I’m happy now I can unit test my custom code that uses the xRM Wrappers and I hope that my support call with Microsoft will result in the SDK dll being updated.

charity »

[14 Sep 2010 | 1 Comments]

I’ve just made a short 7min video blog about the results of the questionnaire I put out to help be shape what the app I create at Charity Hack will do. I hope people find it interesting!

»

[5 Sep 2010 | 0 Comments]

It is two weeks until PayPal’s charity hack and I have been working on an idea that I want to do for this years event.

My idea this year is to ‘Help the homeless’, I need to gather a little bit of information to help shape the app so this post contains a quick questionnaire I’ve put together. If you would be kind enough to anonymously fill it out that would be very helpful. I will do another post at the end of the week to say how the app is shaping up!

Employment, entrepreneur, internship »

[6 Aug 2010 | 0 Comments]

I recently read this article on the BBC website: http://www.bbc.co.uk/news/business-10822784 it outlined how un-paid interns are probably illegal and they can claim back pay for the last 6 years at the minimum wage. This made me feel as if someone had poured some cold water on my entrepreneurial spirit as I had been seriously considering looking for some interns to help get my websites off the ground. In this article I will outline why I think that there is a lot of value in having un-paid internships for both the employer, the un-paid employee and UK plc as a whole.

So what is the problem

image The problem is there is a risk that an employer could be sued and then be liable to pay backdated pay for 6 years. This could be a lot of cash all of a sudden when there was an open and well know agreement in place between consenting adults.

If the cost of hiring an Intern was known up-front then it could well have been that the employer would have decided it was not worth having them in the first place. There are such things as cost benefit analysis and if the numbers don’t stack up the it is not worth doing it. In my view business deciding not to take risks makes everyone a looser and having cheap labour to try some things out is a good thing.

Employing people is expensive

image From personal experience I can safety say that employing people is really expensive.

  1. There is the obvious bulk of the cost, salary.
  2. There is national insurance to pay to the government as a thank you for having 1 less person on the dole.
  3. There is getting them a chair, a desk, a computer, coffee, toilet paper, heating, ink for the printer, paper for the printer, phone calls, etc (there is a lot more)
  4. There is then buying insurance to cover them from hurting themselves when at work or being negligent to one of your customers, extra payroll costs to the accountant, mileage, travel expenses etc.
  5. There is the sick leave and holiday you have to pay for.
  6. If someone goes on maternity you have to keep paying them and keep the job open
  7. There is training them and showing them what to do. This takes up my time which means is costs me money.
  8. I’m sure there is more but that is just what comes to mind

Will I employ people again? For another self funded start-up or idea i have, probably not. For an organisation that makes money, yes – in fact I have a knack of putting together great delivery teams in companies I contract for.

Experience can be better than cash

image So an Intern will be taking home a £0 salary. Perhaps some travel expenses but that will not be much so why would people do this work? The answer is getting experience, industry knowledge and making business contacts. This, in my opinion, is better than cash. If you get the right experience the you can convert that to cash later on in life by getting a better job or work on a better project or know how to do your own start-up. In fact this is the exact argument that the government uses about levying student fees on university courses in the UK.

If I was an employer looking to hire someone and I saw that a candidate had worked un-paid in the industry just to get relevant experience it would say a few things to me:

  1. They are keen about the industry
  2. They have a good work ethic to achieve a goal in their life
  3. They understand about long term investment / strategy for reward rather than short term gains.
  4. A good attitude and a will to get on in live, knowing that it isn’t always fair but something will work out and that nothing is truly given out in this world.

It would certainly set them apart from candidates that have not done this. It does not guarantee them a job but it will certainly help.

Helps pre-revenue low revenue start-ups at a time of need

image So I’m pretty sure that I cannot afford to employ anyone at the moment, but I still believe there is value in my websites. The whole project would really benefit from having someone do some basic customer management, research and social media updates. It is not going to be technical stuff but it needs someone to put in the hours. The cost benefit analysis is marginal but if I had the time then I would want to be doing this work.

So my situation is that I think I have a good idea but can’t afford to take the risk of paying to see if it works or not. I looked at getting grants from the likes of SEEDA and Business Link (I won’t miss you when you are gone) but that would be a lot of work with no guarantee of money or benefit at the end of it. I would be better off spending that time doing what I felt needed doing.

So a good solution in my mind would be to able to give an eager motivated person the opportunity to prove (or disprove) my idea. They can get some real work experience of dealing with customers, technologies and business tools and I get to see if my idea works at a low cost (remember I would still have to pay for the interns running costs). If they do a good job, I’ll give then a professional job reference to further their career or perhaps I know of other opportunities they could take advantage of.

What can be done about it?

I have a couple of ideas which would make me think about spending my time and effort to getting an intern.

  1. Formalise an clear path for interns to be un-paid and take away the risk of employers being made to cough up back pay for the last 6 years.
  2. Can I just become a department at the University of Life? I could then charge interns (which then makes them students) to take my Business Course. These students will graduate with excellent and relevant business experience. Perhaps I could even get some government funding for my new department?

Round up

I’m not going to risk trying to find an intern at the moment. I just cannot afford to justify it. In the economic climate where it is hard to find jobs, University funding is being cut, student fees will probably be raised soon, there is talk of a ‘lost generation’ we surely need to encourage people to try things, get new skills. If this means that they have to work for free, then so be it. At least it will allow those who have a healthy outlook on work will be given the opportunity to show what they can do.

If people with industry experience and ideas can be given the opportunity to see if the idea works at a low cost then this is surely the definition of a win-win-win situation for the entrepreneur, the Intern and UK Plc. Allowing un-paid internships is an enabler of the Entrepreneurial Spirit of both Interns and businesses.

WP7, Software Developement, programming, Windows Phone 7 »

[29 Jul 2010 | 1 Comments]

Just writing a quick article about going to the first Windows Phone 7 User Group @wpug last night. With the device release within touching distance I get a feeling there is more and more excitement growing about the device and what developers will be able to do with it.

First off a bit thank you to Matt Lacey for organising the event, EMC Consulting (especially Michelle Flynn)hosting the event and Microsoft for great information about what is happening, buying beer and showing off some prototype phones.

It was a great format, an opening presentation then 5 demo’s from participants an a closing presentation.

Is Microsoft doing any thing new?

Personally I don’t think that there is anything particularly new in what Microsoft is offering. What is new is how it has been packaged up and delivered to the end user with a lovely new handsets and OS. The core components of building applications on Windows Phone 7 are:

  • Visual Studio
  • Expression Blend
  • Silverlight
  • Xna

wpug All these tools are tried and tested, they are well known, they have excellent support from both Microsoft and the development community. I think this is fantastic, it really lowers the risk of developing an app for this device. Microsoft are just leveraging these existing technologies to make development easy.

 

 

 

Is Microsoft doing anything differently?

I think this is a big YES. Microsoft know that it is them ‘on the hook’ for the user’s experience so they are taking ownership of a lot of what controls this.

The devices are new but Microsoft have set a very high minimum specification for the hardware manufacturers. This is again excellent news, I feel that a number of the Windows Mobile handsets were underpowered and gave a poor user experience.

The Marketplace is the only way that you can get apps onto your handset (unless you have unlocked your phone via a Marketplace developer account). Again this is excellent news for two reasons.

  • Before finding an app was hard. They were very distributed with a few 3rd party market places or vendors selling their apps on their own websites. The new Marketplace means that there will only be one place to look and one way to purchase which puts this important part of the user experience right in Microsoft’s control
  • Microsoft can ensure the quality of the apps that are put on the Marketplace. This should mean that people don’t pay for or have to wade through 1000’s of sub quality apps that would reduce that all important user experience.

The last thing which I think will make a difference is how controlled 3rd party software is on the device. While the device is multi-tasking 3rd party apps are not allowed to leverage this. The reason being that badly behaving applications running in the background could drain the battery, use cpu and generally slow down the device. Making 3rd party software exit when a phone call is received for example is a sensible approach but a little frustrating for us developers.

A big thanks to Microsoft’s Paul Foster for his very interesting session about what’s going on with Windows Phone 7 and an even giving me the chance to use his prototype phone.

It is easy to create an application

Yes it is very easy. The development tools are free and can be downloaded from http://developer.windowsphone.com/ .

There are some excellent tutorial labs to follow which are very clear and easy to follow. They touch on all the key points of development using the development tools and the Windows Phone 7 os. I blogged about my attempt to create an iPhone app back in January which was a horrendous experience, I found this process much clearer and painless. I have been a .Net developer for 10 years which probably helped but I’m sure that the Microsoft tools are far superior to Apple’s XCode IDE.

Rob Fonseca-Ensor showed how easy it was to create an Xna game on the phone, and it was surprisingly easy. Create a picture, load it in the app and then pop it on the screen and that was about it.

At the user group there were 5 demo’s of apps that people had created. The app which I thought was the best (although I naturally voted for myself!) was Hosain’s tube app. It was a beautify clean design with lots of useful information being displayed from a data feed on the TFL website. I spoke to him afterwards and he had only spent about a week on the app, very impressive.

Other slick apps that were shown where UkTree’s CryoDefense which was a Tower Defence game. This was a very nice game created by seasoned mobile developers.

 KeyboardP had created a really nice app to store information that can be used In Case of Emergency (ICE) he also had the best line of the night:

“I hope you buy my app and never use it” KeyboardP

 

I didn’t spend much time on my app at all It was a client to read and display skillbooks from my www.skillbook.co.uk website. I spent a day doing the labs I downloaded and then a day writing the bulk of my app and it was really really easy. I had another few hours to do a few tweaks on the app but in total probably about 12 hours, plus it was the first time I had used Silverlight. I didn’t win the X-Box but I hope people found the concept useful, here is a video of my demo:

A video of me demoing my Skillbook App

 

 

 

 

 

 

 

 

 

 

 

Summary

I really enjoyed the event, it was great to see Microsoft engaging with the development community and to also see what other developers are doing on the platform.

I was pretty sceptical about the ‘new windows phone’ when I first heard about it because of the previous pain I have had with Windows Mobile. However Windows Phone 7 is a completely different beast and looks fantastic, and I for one am getting very excited about it’s launch in the not too distance future!

»

[6 Jul 2010 | 1 Comments]

I read a very interesting article today by Aaron about why he thinks Microsoft .Net Lags Among-Start-ups. There were a lot of interesting comments on the blog which I wanted to reply to so I start writing a comment as well but it just got too long! Aaron’s main theme was that .Net is used in big enterprises and the developers do not think and engage in a way that start-ups do / need to do to be successful.

I think I would have to generally agree with the view that a large number of .Net developers are so ingrained into enterprise solutions and climbing the corporate ladder working for 'The Man' that they do not look outside to see what is new and cool in the start-up scene.

There are 3 points I would like to make:

Enterprise software have big budgets and teams to deliver projects. It is hard to change that thought process

Here is my anecdote. I am your typical corporate dev who has worked up the ladder and got the the position of developer team lead in delivering £1m+ projects. A couple of years ago circumstances came together creating an opportunity to do something I had always wanted to do, create my own start-up and build a couple of websites on the .Net stack. My original idea didn’t work out but the two spin off websites from that idea http://www.skillbook.co.uk and http://www.tcbooker.com are starting to look good (lots more work required though!). I ran out of money at the end of last year to work on them full time and am currently back working for 'The Man'.

Why did I run out of money? I was used to the enterprise and having a large budget to spend on resources. So I carried that mentality over and hired a team of people to deliver the project. Looking back I could have done it a lot cheaper. I think this would be a problem for lots of enterprise devs – looking at a problem and making it harder than it has to be, over engineering the solution and probably giving up before they got started or not giving up and having a very high burn rate.

It is just not on .Net developers radars

I’ve been a software developer my whole adult life, I got my MCP back in 1999 and I only attended my first Hacking event a year ago. This was PayPal’s Charity hack. There were about 100 developers attending and guess what, there were only 2 .Net developers there. Myself and Lee Mallon.

The event was for the dev’s there to create an app in 24hours that could make money for charity. I teamed up with Lee and took my idea of allowing people who volunteer for charities to publish their expenses which can then be paid for by the public (we had to try and incorporate PayPal’s new API’s in the app btw) on the charities behalf. You know what we actually had a fully functional working prototype after 24hours. I’ve done a bit more work on it since but it is not quiet live yet: http://test.localvolunteers.org.uk/ I might finish it off at this years charity hack.

Why were there only 2 .Net devs there? This really highlights the lack of momentum there is in the .Net community around these sort of events. If you want to make a career out of .Net programming the safe option is to know about WCF and middleware development, not how to make social media work for you. Going to hacking events and learning what is on the bleeding edge just isn’t going to be useful in their work as big companies like to play it safe. Where else is there to go and earn a living as a .Net developer?

What will change things

Successful .Net start-ups will breed more successful .Net start-ups and Microsoft need to build a critical mass and I think Bizspark is getting there. The barriers to entry for .Net technologies are also getting lower.

If I was to look at working for a relatively new Internet companies which uses .Net technology I would be looking at companies like www.huddle.netwww.kashflow.co.uk, www.justgiving.com, www.unusualhotelsoftheworld.com.

The cost of running .Net apps is going to be more. However with the advent of cloud computing and Microsoft’s Azure platform application developers can now pay for what they use rather than trying to guess what they will use and I believe the pricing is pretty reasonable. (I actually use AWS for my websites as Azure wasn’t released when I went live). So I don’t think the price issue holds water any more, especially as Bizspark gives you free hosting for 3 years.

The barriers of entry are getting lower and competition is good and keeps Microsoft honest. Yes they do tend to copy ideas but I still think the tooling they provide for software development is excellent. There were comments that it was a steep learning curve for hobbyists, which I can sort of understand, but there are also learning curves for whatever tools get chosen.

Summary

It takes a long time to change peoples behaviours and until there is some proven success stories of people using .Net to build start-ups on then it will be seen by most .Net developers as a risky career option compared with that corporate ladder and working for ‘The Man’. I hope that there will be a growing .Net success stories (including mine) over the next couple of years and make it easier for the all those .Net devs working for The Man to think that it is possible to give it a go.

Microsoft Expression »

[29 Jun 2010 | 0 Comments]

This is a short promotional video about something called Sketchflow which can be found in Microsoft Expression Studio 4. I thought it looked pretty cool so thought I would share it.

It is a collaboration tool to help prototype the functionality of a site and allows the customer to view and comment on the prototype via a web browser using Silverlight – which is pretty cool.

I have downloaded it and when I’ve had a good play around I’ll create a longer post with what I think of it but in the meantime if you can spare 90seconds to watch the video please do!

»

[25 Jun 2010 | 0 Comments]

This is a short article about a workaround for a really annoying problem I had when trying to run some unit tests in visual studio. The tests would not run because of the following error:

The location of the file or directory ‘c:\projects\bowlingkata\bowlingscorelib_test\bin\debug\Rhino.Mocks.dll’ is not trusted

My situation

I’m working on a large Microsoft Dynamics Crm project at the moment. Dynamics Crm has something called Plugins which fire when something is saved. However they are not the easiest things to unit test so I decided to follow Luis Rocha’s article on how to use Rhino Mock to help.

Looked good, so I created a test but it didn’t run. A quick look on google lead me to David Starr’s article which was the same problem. I tried the unblock thing but it didn’t seem to work.

I asked myself the question, why was this .dll blocked? The answer was because I downloaded it from the Internet onto straight onto my development machine.

The solution

The solution was to download the Rhino.Mocks.dll onto another computer on the network first then copy it to my development machine. This way the Rhino.Mocks.dll came onto my development machine from a trusted source.

After this my tests ran. A real WTF moment!

»

[3 Jun 2010 | 0 Comments]

I hope that this post might help a few people who have been having the same problem as me.

I have been creating a custom workflow for my project that can calculate working days for the organisation. This went really well until I tried to deploy it to my Crm instance. All I was getting back from the Plugin Registration Tool was:

Creating CRM Connection...
* 1 Duplicate Solutions Deleted
Solution Registered: Thg.Ohov.Crm.Core.Plugins
*** Error occured execution Request
*** <error>
  <code>0x80040216</code>
  <description>An unexpected error occurred.</description>
  <type>Platform</type>
</error>

This was no help. I tried changing a few things in my workflow but it kept errorring. To get some more information about the error I downloaded the Crm Diag Tool and turned on tracing. The trace had the following entry:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' threw an exception. ---> System.ArgumentException: Type 'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' does not define a static dependency property with name 'InputStartDatePropertyProperty'.
Parameter name: ownerType

The clue was the phrase:

'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' does not define a static dependency property with name 'InputStartDatePropertyProperty'

I didn’t define the property called ‘InputStartDatePropertyProperty’ I had just called it ‘InputStartDateProperty’

I then found by renaming the property to just ‘InputStartDate’ fixed the problem:

public static readonly DependencyProperty InputStartDateProperty =
           DependencyProperty.Register("InputStartDate", typeof(CrmDateTime), typeof(CalculateWorkingDays));

That was the fix! I hope that helps someone out there ;)