Thursday, October 24, 2013

// // 1 comment

Enable-Migrations Error

Ran into an error earlier regarding enable-migrations. In the past is has worked perfectly, but suddenly it seemed to barf all over my screen in red paint like so - Argh, My Eyes!!

PM> Enable-Migrations
Exception calling "BuildProject" with "3" argument(s): "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
At D:\development\Dev-Training\TaxMate\packages\EntityFramework.6.0.1\tools\EntityFramework.psm1:866 char:45
+     $DTE.Solution.SolutionBuild.BuildProject <<<< ($configuration, $project.UniqueName, $true)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

Get-Package : Cannot validate argument on parameter 'ProjectName'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
At D:\development\Dev-Training\TaxMate\packages\EntityFramework.6.0.1\tools\EntityFramework.psm1:878 char:40
+     $package = Get-Package -ProjectName <<<<  $project.FullName | ?{ $_.Id -eq 'EntityFramework' }
    + CategoryInfo          : InvalidData: (:) [Get-Package], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,NuGet.PowerShell.Commands.GetPackageCommand


Turns out, it was a simple case of the default project not being selected because I had deleted the start-up project


Read More

Thursday, October 17, 2013

// // 2 comments

Choosing the right desktop development technology

I've recently had a requirement to build out a desktop offline application that mostly does data collection.

Here are the requirements technical and otherwise
  • Must work offline
  • Will be mostly installed on Windows laptops (assuming Windows 7+)
    • Nice to have the ability to run it on Mac as well
  • Simply data entry application
  • Should be easy to maintain by a group of unknown future developers. 
    • This is not for a company, but a volunteer based organization
As I started evaluating different technologies, I went from

Native Technologies

1. Windows Forms Application - Rejected because styling is difficult 
2. Silverlight Out of browser application - Rejected because silverlight is rapidly becoming obsolete
3. WPF application - Not bad. This is, after all, the recommended technology by Microsoft. But I balk at this choice simply because it unnecessarily complicates development (one has to learn XAML). Also because after having done years of XAML development, I realized that even a gap of a few months had wiped out my expertise.

Local Web Server 

Having rejected most of Microsoft's recommend technologies, I decided to explore some form of HTML 5/ Javascript backed application. 

The simplest option is to, of course, run some sort of lightweight web server on the user's machine( Maybe IIS express) and use ASP.Net MVC. But remember that I'm going for a simple install, and running an IIS express is not part of the plan. There are far too many things that can go wrong with an IIS express instance like port configuration, administrator privileges etc.

Shell Application

Since I'd been working lately with phonegap, it occurred to me that something of that sort should work well. After all, I don't need http capabilities - simply the ability to use HTML 5 / CSS and javascript as my front end programming stack.

The most promising option in this direction seemed to be App.js - a framework designed specifically for this purpose. A quick review of technology shows that this depends on node.js (not something i want to throw into the mix), but more importantly that this open source project has not had any check-ins for a month and a long list of bug. Won't do.

Other options seem to be


  • TideSDK - Looks a little too heavy for the purposes i have in mind.
  • node-webkit - backed by intel.
  • Brackets Shell

Clint Berry has a good run down on these options on his blog - http://clintberry.com/2013/html5-apps-desktop-2013/

As for me - I have a long night ahead evaluating these option. If node-webkit works, I'm all for it.
Read More

Tuesday, October 15, 2013

// // 1 comment

Automating PhoneGap Build build.

No - that's not a typo. I'm referring to the build process when using Adobe's phonegap build service. I won't go on much about phonegap build, except to say that it's brilliant and probably saved me from buying an expensive mac for 2 weeks of development work. Can't completely eliminate the need for a mac, but at least day-to-day phone gap based web development does not require one.

Phonegap build offers you the ability to zip up your web application and upload it for a build. 2 easy steps right ? Wrong! Doing this around 50 times a days is quite annoying and repetitive. So naturally, I looked around for a simpler way to do this

1. Zipping up files

I use 7-zip, which comes will a command line interface. I had to add the install location to the PATH, and then it was as simple as issuing

7z a [targetpackage.zip] [targetdirectory]

2. Uploading to phonegap build 

Luckily phone gap provides an http API to interface with it. It's sparsely documented, but fairly intuitive. Since I was uploading a zipped file instead of using a github repository, the command was

curl -u [username]:[password] -X PUT -F file="@[full-file-path]" https://build.phonegap.com/api/v1/apps/[appid]

You can download curl for windows from here 

A few gotchas

  • For windows users, the fill-file-path needs to be enclosed in double quotes. This is more of a curl quirk than anything to do with phonegap build.
  • Finding the application id: the application id used in the curl URL can be sourced quite easily from phonegap build URL for your project. For instance when navigating via the browser to your app, the URL is https://build.phonegap.com/apps/598899/builds , then 598899 would be the appId that needs to be plugged in to the curl command at [appid]
  • Excluding git files: I'm using git as source control and this creates a .git\ sub directory. The problem is that i don't want this to be part of the zipping process. adding -xr!?git\* to the zip command does the job nicely.
  • Reset the archive: the zip command adds to an existing archive, which means that if i delete files off my directory, they won't get removed from the archive. So - I delete the target archive before zipping.

All of this is taken and put up into a batch file 

del [target-archive]
7z a [target-archive] [target-directory] -xr!?git\*
curl -u [username]:[password] -X PUT -F file="[target-archive]" https://build.phonegap.com/api/v1/apps/[appId]







Read More