The Wiert Corner – irregular stream of stuff

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

  • My work

  • 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,308 other followers

Archive for January, 2014

K-Type Independent Type Foundry » Freebies

Posted by jpluimers on 2014/01/31

Yes, I’m a font addict (:

K-Type Independent Type Foundry » Freebies.

Most of their fonts have at least one style that is a Freebie for non-commercial use too, a great way to experiment with some of their fonts: Read the rest of this entry »

Posted in About, Font, LifeHacker, Personal, Power User | Leave a Comment »

Sanibel Island Bike Trail Sections

Posted by jpluimers on 2014/01/30

The bike paths on Sanibel are very well suited for running. Sanibel Island Bike Trail Sections.

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

.NET/C#: refactoring some C# 1 code that uses HashTables as a poor mans property bag (via:Stack Overflow)

Posted by jpluimers on 2014/01/30

A while ago, I was refactoring some C# 1 code that uses HashTables as a poor mans property bag.

The problem was that I felt my code was convoluted, and should be denser, especially avoiding Convert.ChangeType. My code was already much simpler than casting tuples to a superclass.

So I asked this question on StackOverflow: c# – Is there a solution that feels less clumsy than Convert.ChangeType to get the value from a HashTable – Stack Overflow.

User dasblinkenlight showed it could be shortened and explained why (hyperlinks are mine):

Since System.String is sealed, the expression

genericType.IsSubclassOf(stringType)

is the same as

genericType == stringType

Therefore you do not need a call of Convert.ChangeType: you can cast to T by casting to object, like this:

object stringResult; // Note the change of type to "object"
if (haveValue)
    stringResult = ((string)properties[propertyName]).Trim();
else
    stringResult = string.Empty;
result = (T)stringResult; // It is allowed to cast object to generic T

The original .NET 1.1 code had loads of null checks wrapped if/then/else statements to assign default values for null values.
I wanted to get rid of that, and get code like this: 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, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

Amazon Glacier off-site backup Pricing

Posted by jpluimers on 2014/01/30

Wow, I didn’t expect these prices to be so low: Pricing.

I wonder what other providers there are.

–jeroen

Posted in Backup, Power User | Leave a Comment »

1/9998 = 0.0001 0002 0004 0008 0016 0032 0064 0128 0256.. | Hacker News

Posted by jpluimers on 2014/01/30

1/9998 = 0.0001 0002 0004 0008 0016 0032 0064 0128 0256.. | Hacker News.

Posted in Power User | Leave a Comment »

 
%d bloggers like this: