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, 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.
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.
Labels:
.NET Framework,
101,
70-486,
ASP,
ASP.NET,
ASP.NET MVC,
ASP.NET MVC Framework,
c#,
Developing ASP.NET MVC Web Applications,
Exam,
Introduction,
Microsoft,
Microsoft Exam,
Model-View-Controller,
MVC,
Software
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.
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.
Maximise/Minimise: Win Key & Up Arrow / Down Arrow
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).
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 ArrowMaximise/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 tabClosing Tabs
Ctrl & F4Reopen Last Tab
Ctrl & Shift & TJump to address bar
Alt & DWhile 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).
Tuesday, 17 December 2013
Increasing the maximum received message size for WCF with SharePoint 2013
Today I was tasked with an issue of fixing a file upload problem. The server was returning a 413 "Request Entity Too Large" message. The file I was trying to upload was around 3MB, but the server refused anything this big. A few problems arose that are worth noting in fixing this issue.
A bit of Googling brought up the following result: http://msdn.microsoft.com/en-us/library/ff599489.aspx
Which in theory works. However it's not as straightforward as the article implies, as a few things were missed:
A bit of Googling brought up the following result: http://msdn.microsoft.com/en-us/library/ff599489.aspx
Which in theory works. However it's not as straightforward as the article implies, as a few things were missed:
- Run the code as farm administrator
- Ensure the service name is lower case (this one caught me out..)
- Clearing up
Run the code as farm administrator
Simply using the code in the MSDN article won't work if you try in your WCF service, you'll get an Access Denied error on SPWebService.Update(). The way I got round this was creating an event receiver on my project Feature that was scoped at the farm level, this allowed me to override FeatureActivated and FeatureDeactivating and run the code with the right permissions.Ensure the key for the service name is lower case
There is no mention of this in the MSDN article, but it's very important as otherwise the changes won't take effect. I noticed that all the other keys in SPWebService.ContentService.WcfServiceSettings were lowercase, and it turns out mine has to be too. This should be the same name of your *.svc file under ISAPI.Clearing up
Nothing is mentioned about clearing up either, but it needs doing and this caught me out too. Make sure you override the FeatureDeactivating and remove your settings from SPWebService.ContentService.WcfServiceSettings otherwise you will get strange behaviour (like the settings persisting). Also make sure you set the SPWebService.ContentService.MaxReceivedMessageSize back to 0 (the default setting).The Code
public class MyApiEventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebService contentService = SPWebService.ContentService;
contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;
SPWcfServiceSettings wcfSettings = new SPWcfServiceSettings();
wcfSettings.MaxReceivedMessageSize = (1024 * 1024) * 15;
contentService.WcfServiceSettings["wizard.svc"] = wcfSettings;
contentService.Update();
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPWebService contentService = SPWebService.ContentService;
contentService.WcfServiceSettings.Remove("wizard.svc");
contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = 0;
contentService.Update();
}
}
Tuesday, 23 July 2013
Specifying an Assembly's Location with MEF
Today I came across a problem with dynamically loading assemblies using MEF, when the assembly being loaded has a dependency on yet another assembly. In my case this was SignalR.
I was typically seeing the error:
Could not load file or assembly 'AssemblyNameHere, PublicKeyToken=xxxxxxxxxxxxxxxxx' or one of its dependencies. The system cannot find the file specified.
The reason for this is because the CLR is looking for the dependency in the directory in which the assembly host is running, and not the location of the assembly MEF loaded in.
The way around this is in this MSDN article. By using the probing tag in the app.config, you can specify the directory to look for dependencies. The caveat with using probing is you can only specify sub-directories of the assembly host, so if you want to use an absolute path to another place on the disk then probing isn't the solution, but I'd argue whether you needed it in another place anyway.
The config change required should look something like this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Modules\"/>
</assemblyBinding>
</runtime>
</configuration>
Assembly Host (.exe) -> Assembly (.dll) -> SignalR (.dll)
Could not load file or assembly 'AssemblyNameHere, PublicKeyToken=xxxxxxxxxxxxxxxxx' or one of its dependencies. The system cannot find the file specified.
The reason for this is because the CLR is looking for the dependency in the directory in which the assembly host is running, and not the location of the assembly MEF loaded in.
The way around this is in this MSDN article. By using the probing tag in the app.config, you can specify the directory to look for dependencies. The caveat with using probing is you can only specify sub-directories of the assembly host, so if you want to use an absolute path to another place on the disk then probing isn't the solution, but I'd argue whether you needed it in another place anyway.
The config change required should look something like this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Modules\"/>
</assemblyBinding>
</runtime>
</configuration>
Dragging a ListView control in a fullscreen WPF touch app causes the whole window to shift
I recently had a bug with the ListView control in WPF where I had a ContentControl using a ScrollViewer with the ItemsPresenter inside of it. When using touch, and navigating through the items, the whole window would shift when you reach the end of the list, which then allowed the user to access the underlying Windows shell.
The cause of this is due to a potential bug in the ScrollViewer control, where the UIElement.ManipulationBoundaryFeedback event is fired, and is not handled by the ListView. As this is a routed event, it continues up the chain and eventually reaches the Window control, which then handles the event and results in an animation of the entire window.
MSDN states:
The ManipulationBoundaryFeedback event enables applications or components to provide visual feedback when an object hits a boundary. For example, the Window class handles the ManipulationBoundaryFeedback event to cause the window to slightly move when its edge is encountered.
The fix (or hack) for this, is to hook in to the event and handle the event, so that it does not bubble up to the Window control.
The cause of this is due to a potential bug in the ScrollViewer control, where the UIElement.ManipulationBoundaryFeedback event is fired, and is not handled by the ListView. As this is a routed event, it continues up the chain and eventually reaches the Window control, which then handles the event and results in an animation of the entire window.
MSDN states:
The ManipulationBoundaryFeedback event enables applications or components to provide visual feedback when an object hits a boundary. For example, the Window class handles the ManipulationBoundaryFeedback event to cause the window to slightly move when its edge is encountered.
The fix (or hack) for this, is to hook in to the event and handle the event, so that it does not bubble up to the Window control.
Subscribe to:
Posts (Atom)



