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,862 other subscribers

Archive for March, 2011

online: Create a GUID

Posted by jpluimers on 2011/03/10

Don’t you love this kind of sites:

Create a GUID at createguid.com

–jeroen

via Create a GUID.

Posted in .NET, Delphi, Development, Software Development | 14 Comments »

c# – PRISM + MEF — How to specify which export to use? – Stack Overflow

Posted by jpluimers on 2011/03/10

When you export different implementations of the same interface, importing the right one requires a “named contract“.

Like Danny Thorpe wrote: “Ah, named contracts. I had forgotten about that!”, indeed the first answer is nice!

–jeroen

via c# – PRISM + MEF — How to specify which export to use? – Stack Overflow.

Posted in .NET, Development, MEF, Software Development | Leave a Comment »

C# generics: Constraints on Type Parameters

Posted by jpluimers on 2011/03/10

I usually forget the exact details on C# constraints when using generics.

One of the especially irritating things is that you cannot apply all the constraints you want.

Some built-in language features are covered by special types in the .NET framework class library, for instance enums.

Which means that code like this will not compile:

        // Error	1	Constraint cannot be special class 'System.Enum'
        public static T StringToEnum(string name) where T : System.Enum
        {
            return (T)Enum.Parse(typeof(T), name);
        }

You need to replace it with the code below, which uses the fact that an enum is a ValueType (hence the struct constraint) implementing the interfaces IComparable, IFormattable and IConvertible constraints: Read the rest of this entry »

Posted in .NET, C#, C# 2.0, Development, Software Development | Leave a Comment »

How to: Back Up a Team Foundation Server

Posted by jpluimers on 2011/03/09

A client tried to backup their TFS server with individual database backups.

You can’t properly restore those backups, because the underlying databases are correlated. The only way to backup them is using maintenance plans like the How to: Back Up a Team Foundation Server link shows.

–jeroen

via: How to: Back Up a Team Foundation Server.

Posted in Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »

Cool tool: .NET Version Detector

Posted by jpluimers on 2011/03/09

Cool tool from ASoft.NET Version Detector.

.NET Version Detector is a native application, which means it isn’t dependent on any version of .NET to run.

.NET Version Detector is a handy tool for vendors of .NET applications also.

Knowing which versions a user has installed and where they are located on the hard drive.

ASoft allows for a vendor to bundle .NET Version Detector with its application (for free!) so that it is easier to get some generic and exact information on the frameworks.

But before doing so, contact ASoft first!

–jeroen

via: .NET Version Detector.

Posted in .NET, Development, Power User, Software Development | Leave a Comment »

Why is the result of RoundTo(87.285, -2) => 87.28 – Stack Overflow

Posted by jpluimers on 2011/03/08

Programmers on all sorts of platforms get this wrong all the time (I admit having done this in bad ways myself too).

In short: Don’t expect floating point values in a computer to be represented as decimals.

Rob Kennedy wrote a very nice answer on this:

The exact value 87.285 is not representable as a floating-point value in Delphi. A page on my Web site shows what that value really is, as Extended, Double, and Single:

87.285 = + 87.28500 00000 00000 00333 06690 73875 46962 12708 95004 27246 09375

87.285 = + 87.28499 99999 99996 58939 48683 51519 10781 86035 15625

87.285 = + 87.28500 36621 09375

And David Heffernan points to the best link you can get on this topic:

The classic reference on floating point is What Every Computer Scientist Should Know About Floating-Point Arithmetic.

For currency based calculations, if indeed this is, you should use a base 10 number type rather than base 2 floating point. In Delphi that means `Currency`.

–jeroen

via delphi – Why is the result of RoundTo(87.285, -2) => 87.28 – Stack Overflow.

Posted in .NET, Algorithms, C#, Delphi, Development, Floating point handling, Software Development | 14 Comments »

If you use MonoTouch for iOS, be sure to update the iOS SDK (it doens’t auto update)

Posted by jpluimers on 2011/03/08

If you don’t update the Apple iOS SDK (which doesn’t auto update), then the Apple Store will reject your MonoTouch apps.

A big thank you to Peter van Ooijen for figuring this out

–jeroen

via: The appstore, iOs versions and Monotouch (4.0 won’t do) | Visual Studio Feeds.

Posted in .NET, Development, MonoTouch, Software Development | Leave a Comment »

Amazon.com: DVI + Audio (SPDIF & Toslink) to HDMI Converter Adapter: Electronics

Posted by jpluimers on 2011/03/07

Since modern TVs don’t do DVI any more, only HDMI, and you need to combine your (digital!, HDMI does not do analog) audio:

device that combines digital video (DVI) and digital audio into HDMI

Edit: this is the same device as this one: http://cableorganizer.com/quest/hdi-6160.html; Amazon is a LOT cheaper!

–jeroen

via Amazon.com: DVI + Audio (SPDIF & Toslink) to HDMI Converter Adapter: Electronics.

Posted in Power User | Leave a Comment »

supportformum.philips.com registration mail sender #fail – unknown sender domain

Posted by jpluimers on 2011/03/07

Sometimes you wonder when companies that have been on the Internet since ages start to adhere at basic rules.

This time it is the Philips SMTP server sending mail from their support forum confirming your new forum registration:


Mar 7 13:21:31 snap sm-mta-rx[13129]: p27CL8xw013129: ruleset=check_mail, arg1=, relay=gw-nam6.philips.com [161.88.253.62], reject=553 5.1.8 ... Domain of sender address pccprd1@pce-1012web107.pce-1012web107 does not exist
Mar 7 13:21:31 snap sm-mta-rx[13129]: p27CL8xw013129: from=, size=3273, class=0, nrcpts=0, bodytype=8BITMIME, proto=ESMTP, daemon=MTA-RX, relay=gw-nam6.philips.com [161.88.253.62]

When sending mail through SMTP, please use a valid sender domain!

–jeroen

Posted in Opinions | Leave a Comment »

Mac Buyer’s Guide: Know When to Buy Your Apple products

Posted by jpluimers on 2011/03/07

When (or when not) to buy a new Mac, iPhone, iPad or iPod.

Purely based on rumours and statistics.

–jeroen

via: Mac Buyer’s Guide: Know When to Buy Your Mac, iPod or iPhone.

Posted in Apple, iPad, Power User | Leave a Comment »