Tuesday, 29 September 2015

Adding WinMerge as your merge tool in SourceTree

Set the merge tool to custom and use this command:
C:\Program Files (x86)\WinMerge\WinMergeU.exe
With these arguments:
-e -u -dl "Mine" -wr -dr "Theirs" $LOCAL $REMOTE $MERGED
Taken from this SO answer

Wednesday, 23 September 2015

Cordova WP8 System.SystemException Microsoft.Phone.Interop.ni.dll

I just lost hours diagnosing the following error:

CordovaBrowser_LoadCompleted Apache Cordova native platform version 3.8.1 is starting Exception thrown: 'System.SystemException' in Microsoft.Phone.Interop.ni.dll

I replaced 'execScript' with 'eval' where Browser.InvokeScript was called, as suggested here. This didn't make things better. I also replaced the XHRHelper code with code written by Marius Seimanovs, as suggested here. No joy. I removed all my plugins. Still no dice.

So I setup a new blank WP8 cordova project and worked backwards, trying to break it by introducing my own pre-existing code that was already working in iOS, Android and locally on a Win machine.

I discovered that I had a poorly formatted Content-Security-Policy meta tag. That's all it was! I'd missed off the closing quote from the content attribute, and this brought it all crashing down.

The missing quote!

Wednesday, 16 September 2015

iOS and Android build numbers in Cordova

If you want control over your build numbers for iOS and Android you can do it in your config file like this:

Wednesday, 9 September 2015

Umbraco current culture in Ajax calls

When making an ajax call in Umbraco current culture may be lost, and access to things like dictionary items on a multilingual site becomes a problem. I fixed this like so in the controller method handling the ajax:

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(GetCurrentCulture());

Where GetCurrentculture simply gets the lcid culture value from session, which is set in on void Session_Start(object sender, EventArgs e) in Global.asax using:


Friday, 4 September 2015

Chrome session cookies with apps running in background

I just discovered something about session cookies in Chrome, after seeing some behaviour one wouldn’t expect.

A by-product of the setting shown below is that session cookies remain active even when all instances of the browser are closed. They are only lost if the user signs out (rather than switch user) or restarts. 

I had this setting checked and I believe it is on by default for all users with apps, because I never specifically chose it: