Thursday 11 December 2014

Navigating away from a page in Windows Phone 8.1 with Prism throws a System.ArgumentNullException

I just had a little headache with something that should be fairly trivial, but unfortunately the exception & stack trace weren't particularly descriptive. I was navigating from one page to another in my universal app. The navigation worked for Windows, but not for Phone, and I got the following:

{System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)}


Well it turns out when you create a new Windows Phone XAML page in Visual Studio, it kindly overrides the OnNavigatedTo method in the code behind (of course I didn't look here, I'm using MVVM!), which seems to throw Prism out of whack. Remove the overriden method (or just call it's base) and navigation succeeds, yippee.

Sunday 5 October 2014

Visual Studio 2014 CTP Crashes on Get Latest when using a touch screen

So, just a quick one. I downloaded Visual Studio 2014 CTP and tried to get some code from source control. Unfortunately, Visual Studio crashes without warning. A quick look in the event viewer shows that it's a touch related issue (null reference exception). I installed VS on my Surface Pro, and when using the touch pad it seems to work fine.


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

Exception Info: System.NullReferenceException
Stack:
   at System.Windows.Input.StylusLogic.IsTouchStylusDevice(System.Windows.Input.StylusDevice)
(Complete stacktrace omitted) Looks like I'll be sticking with the trackpad for now :-)

Sunday 28 September 2014

Introduction to ASP.NET MVC

I did a talk for Black Marble's Friday training last month. I recently passed a Microsoft certification on MVC and it seemed appropriate to talk about what I had learnt. There are also some tips on Microsoft exams.



The slides are available here

Friday 14 March 2014

Diagnosing a lean condition using VCDS-Lite

I recently went on a rolling road day to get an idea of my current cars performance (Seat Leon Cupra R, 1.8T), and was happy to find it wasn't too down on power for a 9 year old car.



Unfortunately I was (ill-) advised that the engine was running lean (the air to fuel ratio was too high). There are several areas to look at when diagnosing this, but the common one tends to be an air leak in the crankcase ventilation system.



I sprayed all the pipes in the system with (flammable) electrical contact cleaner. If there is a leak, then the engine will ingest some of the fluid into the engine via the leak and it will combust, creating an audible RPM change. Unfortunately this didn't help in diagnosing, but did lead me on to purchasing a VCDS-Lite Registration ($99 / £60) that enabled me to use my KKL VAG-COM cable I got from Amazon for around £6. The free version does some basic stuff such as reading error codes, but the registered version provides extended logging capabilities.



By measuring blocks 001 (RPM) and 031 (Lambda Control Actual & Specification) it provided enough data to calculate the air/fuel ratio requested by the ECU and the actual fuelling measured by the lambda control sensor. Just to note, a faulty lambda sensor is usually easy to spot, as the figures provided by it are either flat-lining or erratic. The figure must be multiplied by 14.7 (stoichiometric) to calculate the AFR.

Anyway, after consulting with one of the tuners on SeatCupra.net, the 1.8T BAM engines typically run more lean on the standard ECU map than other cars do, which is the only reason I can think of why I was ill-advised to the running of the engine. To confirm this, I used VCDS to to log the above measuring blocks (in 3rd gear, from 2500rpm to 6800rpm) to log the data required. As you can see in the graph below, the fuelling is almost exactly as the ECU requests (as the manufacturer intended) - and where it differs is where the engine is running richer (lower air fuel ratio, therefore more fuel is being combusted). Running rich is much less deteritmental to the engine, and whilst it is an increase in fuel consumption, it also means that the fuel keeps the cylinder walls cooler. Running lean can mean detonation, which is very bad.

Saturday 1 March 2014

12 steps to becoming a mouse widow

So a few months ago I was tasked with going by my day without using a mouse. Easy I thought! and it actually wasn't too bad. I knew, as long as I could open the browser and navigate to Google to find the keyboard shortcuts, I would be OK... so here are some of my favourites.

Windows

Reverse Tabbing

So most people probably know they can tab through GUI's, and what not, but did you know you can go back too? Try it... Shift & Tab.

Open an Application as an Adminstrator

Search for an app in the Start Menu and hit Ctrl & Shift & Enter.

Open an Additional Application To What Is Already Open (Windows 8 Special)

So you already have an instance of Remote Desktop open. Want another without loading up the current instance? Then search for the app and hit Shift & Enter.

Right Clicking

Ever wondered what the key on the bottom right of the keyboard is? The one between the Windows and Right Ctrl key? That's the menu key, and it behaves the same as if you right clicked the mouse on the currently selected item.

Task Manager

Ctrl & Shift & Escape... no need for Ctrl & Alt & Delete.

Magnifier

Win Key & [+ Key (Addition)]

Moving Windows

Align to the side of the window: Win Key & Left Arrow / Right Arrow
Maximise/Minimise: Win Key & Up Arrow / Down Arrow

Settings Charms in Windows 8

Need the settings for the app? The power menu to shut down the PC? Adjust your volume? Find it here with Win Key & I 

Browser

Chrome is my main browser, but as far as I'm aware, most other modern browsers support these shortcuts.
Switching Between Tabs
Ctrl & Number of the tab

Closing Tabs

Ctrl & F4

Reopen Last Tab

Ctrl & Shift & T

Jump to address bar

Alt & D


While it was good fun, I actually use these shortcuts very frequently and they without a doubt increase my productivity.

In summary, I think the only thing I had trouble doing was modifying an image in Microsoft Paint (Win Key & R -> pbrush, by the way).