The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,676 other followers

Archive for the ‘.NET CF’ Category

Unless you write an installer with the right manifest, don’t include Installer, Update, Upgrade, Setup, … in your EXE name

Posted by jpluimers on 2015/09/28

I’ve seen this question coming up a few times, and bumped into this at a client recently: the UAC dialog coming up when debugging a 32-bit executable.

This is caused (more details below) by Installer Detection Technology introduced in Windows Vista (with UAC) and tightened in more modern Windows versions.

The solution is to either:

  • not include Installer, Patch, Update, Upgrade, Setup, … in your EXE name
  • provide a correct manifest to your EXE (getting this right can be hard)
  • don’t use x86 as platform target

For software you don’t have source code for, you can alter the manifest with a requestedExecutionLevel elementFixing the way Vista Auto-detects Installers – Ben’s Writing.

A few links on Installer Detection Technology in Windows:

Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, RemObjects C#, Software Development | 1 Comment »

.NET uses banker’s rounding as default as it follows IEEE 754 (via: Stack Overflow)

Posted by jpluimers on 2014/05/08

It is almost 3 years that Ostemar wrote an interesting answer on Stack Overflow to the question

Why does .NET use banker’s rounding as default? – Stack Overflow.

Few people (even many programmers don’t!) know about rounding and how it can influence software, let alone what bankers rounding does so lets set a few things straight first.

Rounding matters. Depending on the kinds of software you write, it matters a little, or a lot.

For instance, in these categories, it can matter an awful lot:

  • Financial applications
  • Statistical applications

Bankers rounding means rounding half even. Which means that #.5 will round to the even number closest to #.

In bankers rounding, 1.5 rounds to 2, 3.5 to 4 as does 4.5, -1.5 rounds to -2, -3.5 to -4 as does -4.5.

This is called “unbiased” because for reasonable distributions of y values, the expected (average) value of the rounded numbers is the same as that of the original numbers.

This is contrary to what the majority of people are accustomed to: Round half away from zero is taught in most countries (even for the Dutch, despite the alias “Dutch Rounding” for round half to even).

Round half away from zero rounds 1.5 rounds to 2, 3.5 to 4 and 4.5 to 5. Negative numbers round like this: -1.5 rounds to -2, -3.5 to -4 as does -4.5 to -5.

This is only free of overall bias if the original numbers are positive or negative with equal probability.

In short, .NET uses bankers rounding because it follows the IEEE 754 rounding rules.

This was his answer: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | 3 Comments »

When two types are not the same: Assembly Load Contexts Subtleties (via: All Your Base Are Belong To Us)

Posted by jpluimers on 2014/01/09

Reading c# – Type.IsSubclassOf does not behave as expected – Stack Overflow, I found this very interesting link via Assembly Load Contexts Subtleties at Sasha Goldshtein’s blog (I love the name of the blog: All Your Base Are Belong To Us).

He explains the reasons for the error message

System.InvalidCastException: Unable to cast object of type ‘Plugin.MyPlugin’ to type ‘Plugin.MyPlugin’.

Actually his blog entry is an abstract of a 200+ page thesis on  that is also recommended reading: Flexible Dynamic Linkin for .NET (by Anders Aaltonen, Alex Buckley and Susan Eisenbach).

–jeroen

via:

Posted in .NET, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C#, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

.NET/C#: Igor Ostrovsky wrote a few great MSDN magazine articles helping you write better threading code

Posted by jpluimers on 2013/09/17

Igor Ostrovsky wrote a few very nice MSDN magazine articles. Not all of them have ended up in the list at MSDN magazine, so here is a more complete list:

Though the articles show the majority of sample code in C#, the actual topics are of great interest to any developer writing .NET code or interfacing to it.

Some keywords in his articles: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Delphi, Development, F#, LINQ, PLINQ, Prism, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

.NET/C# assemblies and namespaces

Posted by jpluimers on 2013/07/23

Ever since I started .NET programming after .NET Beta 1 Arrived in 2001, I found that many people struggle with the relation between assemblies and namespaces.

So I was glad that I posted this answer about 2.5 years ago on StackOverflow. Below is the slightly edited form:

People are easily confused by the namespace/assembly thing, as it decouples the concept of where your code is physically located (the assembly) and how you reference it:

  • logically reference is by using the namespace
  • physical reference is by referencing the assembly

I usually explain the relation using the word contribute:

  1. An assembly can contribute to multiple namespaces.
    For instance, the System.Data.dll assembly contributes to namespaces like System.Data (e.g. the class System.Data.DataTable) and Microsoft.SqlServer.Server (e.g. the class Microsoft.SqlServer.Server.SqlContext).
  2. Multiple assemblies can contribute to a single namespace.
    For instance both the System.Data.dll assembly and the System.Xml.dll assembly contribute to the System.Xml namespace.
    Which means that if you use the System.Xml.XmlDataDocument class from your project, you need to reference the System.Data.dll assembly.
    And if you use the System.Xml.XmlDocument class, you need to reference the System.Xml.dll from your project.

(the above examples are .NET 4.0, but likely hold for previous .NET versions as well).

Danny Thorpe explained the concept of namespace and internal really well, so I won’t go into detail about those.

Ever since I started .NET courses 10 years ago, I draw a table explaining assemblies and namespaces like this:

Assemblies contributing to namespaces
Assembly Namespaces it contributes to
System.Data Microsoft.SQLServer.Server System.Xml
↑ Example classes
System.Data.dll DataTable SqlContext XmlDataDocument
System.Xml.dll XmlDocument

–jeroen

via: C# assemblies, whats in an assembly? – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

 
%d bloggers like this: