Tuesday, November 10, 2015

Dell PremierColor Display Splitter on XPS15 9550

I've been setting up a Dell XPS15-9550 today. It comes with Windows 10 and the most awful Dell addin you have ever seen. I normally use Dell because they refrain from adding too much crapware or useless third party apps. However, this addin, enabled by default, is awful. It adds a popup menu whenever you try and drag a window (or dialog box or popup borderless window) to reposition it on the screen. It's totally unnecessary as Windows 10 already includes a perfectly good "Windows Snap" feature. The popup window is always "in the way" and when you release the mouse the window then flies off to an illogical place on the screen. Truly awful UI design.
Finally I've worked out how to stop it. It turns out it's a feature of "Dell PremierColor". To disable this right click on the "Dell PremierColor" icon in the notification area and select "Disable Display Splitter".
Why oh why are you including this enabled by default? Crazy. Please ensure it is disabled by default ASAP at it is confusing and totally unnecessary.

Wednesday, October 21, 2015

Getting field names from anonymous types using WPF DataGrid

Often it is useful to use a bit of LINQ to prepare data for display in a WPF control. Here is a very simple example. The WPF window contains a DataGrid used to display the data.

<Window x:Class="DCView.Window15"
        Title="Window15" Height="300" Width="300" Loaded="Window_Loaded">
        <DataGrid x:Name="DataGrid1" AutoGenerateColumns="False" SelectionChanged="DataGrid1_SelectionChanged">
                <DataGridTextColumn Header="Number" Binding="{Binding NumberX1}" />
                <DataGridTextColumn Header="Number x 10" Binding="{Binding NumberX10}" />

The data might be prepared for display with a bit of LINQ. A new anonymous type is created using field names that are then used in the WPF control bindings.

private void Window_Loaded(object sender, RoutedEventArgs e)
 List<int> data = Enumerable.Range(1, 10).ToList();
 var query = from d in data
      select new { NumberX1 = d, NumberX10 = d * 10 };
 DataGrid1.ItemsSource = query;

The problem comes when you respond to selection changed events. How do you get to the fields in the anonymous type. You could create a new class instead of using the anonymous type but the advantage of LINQ is it is quick and easy.

private void DataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 dynamic dynamictype1 = DataGrid1.SelectedItem;
 int number = dynamictype1.NumberX10;
 Title = number.ToString();

The problem is DataGrid1.SelectedItem returns an object and you can't cast it to an anonymous type. To solve the problem you can use a bit of dynamic black magic to get to the fields in the anonymous type. The example above shows how to use dynamic to get to the anonymous fields. There is no Visual Studio Smart Completion to help but as long as the field names match it will work.

Saturday, February 07, 2015

Changing the rear light cluster on 2013 VW Sharan (VW part VAG 7N0945096G)

A Cambridge cyclist managed to smash the rear light cluster on our car on Thursday night (thanks for riding off without having the courtesy to stop!). A new one is just £73 and really quite easy to fit yourself once you know this little trick.
The 12V power socket slides down to reveal a single screw that holds the light cluster in place. Press the top of the 12V socket  panel and slide it downwards. 
Using a 11mm socket set simply unscrew the central white nut which holds the light cluster in place. Once the light cluster is unscrewed unclip the power cable and replace the light unit. Total time about 5 minutes.
Sorry for a slightly random blog post. Please let me know if it was helpful to you!

Thursday, September 11, 2014

The Ultimate Times Table Excel Spreadsheet!

It's that time of year again. The kids are back to school and it's time for them to learn their times tables. Please find below an Excel spreadsheet that you can use to print out a sheet of random times tables (multiplications and divisions).

To use the spreadsheet simply select which times tables should be included from the yellow cells on the first tab.

Then switch to the "Random Multiplication" or "Random Division" tab and print. Job done!

Wednesday, November 13, 2013

No Windows Easy Transfer on Windows 8.1

I have a new PC Windows 8.1 laptop and need to transfer the 600Gb of files from my old laptop which is also running 8.1. Frustratingly I've discovered that Windows Easy Transfer in 8.1 no longer allows machine to machine transfer of files! Apparently you are supposed to copy everything to and from SkyDrive. Well 600Gb would take months over my ADSL and I've only got 100Gb on my SkyDrive account! It seems a crazy solution to remove this feature however I've found a solution. I found an old Windows 8.0 machine and copied the whole c:\Windows\System32\MigWiz folder to the two 8.1 laptops. You can then simply run the 8.0 migwiz.exe on the old and new laptops. I'm pleased to report that the Windows 8.0 version runs fine on 8.1 and successfully copies over the files.

I really think Microsoft should put the file transfer option back in. It would also be helpful if people sold USB3 Easy Transfer cables to speed up the transfer time.

Wednesday, October 09, 2013

MessageBox.Show does not work on Windows 7 Embedded

I have the world's simplest C# Winform application. A Form with a single button. Here is the entire app.

private void button1_Click(object sender, EventArgs e)
{MessageBox.Show("Hello World", "Button Click Event");
Amazingly on Windows 7 Embedded the MessageBox does not display. It works on every other non-embedded version of Windows.

It turns out that Windows 7 Embedded has an option to automatically click the default button on any MessageBox. See http://msdn.microsoft.com/en-us/library/aa940743(v=winembedded.5).aspx for more details.

Strange but true!


Thursday, September 12, 2013

Dial up VPN connections fail following Win 8 to Win 8.1 RTM upgrade

I had a strange problem yesterday. I have several dial-up VPN connections that I use daily. With Windows 8 these were working fine. I upgraded the machine from Win 8 to Win 8.1 with the RTM bits. Following the upgrade none of the dial up VPN connections would work. They all reported Error 720 : A Connection to the remote computer could not be established. Other Windows 8 machines on the same network could connect to identical servers without any problem. In the end I found that rebooting the ADSL router (the one the client machines were connected to) fixed the problem. I've no idea why all the Windows 8 machines could connect but the Windows 8.1 machine refused until the router was restarted. If you come across the same problem it might be worth trying a router reboot. Let me know if it works for you.