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 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 »

delphi – With a class operator is an implicit typecast to itself allowed? – Stack Overflow

Posted by jpluimers on 2014/01/29

In the series “interesting stuff you can do with Implicit operators”: delphi – With a class operator is an implicit typecast to itself allowed? – Stack Overflow.

Be careful though, as Implicit assignment will allow more code paths to the compiler than you expect at first sight (:

–jeroen

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Leave a Comment »

.NET/C#: fun with enums and aliases part 2

Posted by jpluimers on 2014/01/29

In the .NET/C#: fun with enums and aliases part 1 you saw that an enumerated type can specify an underlying type.

The underlying type is limited to a strict set of built-in C# types: , so you cannot use a CTS type for it.

So you might think that you can only define enumeration values by integer constant like this:

namespace BeSharp
{
    enum TwoState
    {
        False = 0,
        True = 1,
    }
    enum ThreeState
    {
        False = 0,
        True = 1,
        Unknown = -1,
    }
}

Well, you can do it like this too, since Operations between different enum types are allowed in another enum declaration: 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 »

Clean Up And Shrink VMWare Fusion Virtual Machines With Ease | The Webernets

Posted by jpluimers on 2014/01/29

While getting a Retina MacBook Pro screen replacement, I upgraded from VMware Fusion 4 to VMware Fusion 6 and found out it is really easy to Clean Up And Shrink VMWare Fusion Virtual Machines With Ease | The Webernets.

That saved me bout 100 gigabyte across in total.

Sometimes tiny things not much advertised make an upgrade worthwhile.

Note that as usual some restrictions apply (like not having snapshots, having a backup, and the machines needing to be in the “shut down state), but it went really really smooth (probably the SSD helps a lot here).

–jeroen

Posted in Apple, Fusion, Mac, MacBook, MacBook Retina, MacBook-Pro, Power User, VMware | Leave a Comment »

Google Play stores: Tides Near Me and Tide Chart FREE (+TidesnearMe1 ; app.hanitaro.com) do not install outside the USA.

Posted by jpluimers on 2014/01/29

What worked to get Google Voice on my USA cell phone with a European Google account, didn’t work for the top “Tidal” listings Tides Near Me and Tide Charts FREE (I didn’t bother checking any payed hanitaro app).

Apparently truckloads of developers think it is wise to limit their application to a certain geographic region, excluding all tourists as potential customers.

Fine: I installed “Florida Tide Times” and it works well, especially the built-in map makes it really easy to use.

I wanted this because we were staying at Sanibel Island (Florida) and wanted to do some low-tide shelling (some love shelling) as that’s the best time to find many and inspect both the living creatures, and collect dead shells.

Lesson: make your app available as widely as possible or you will miss customers.

Back to Google Voice

If you have a USA phone number, you can apply for a free Google Voice number that can make free USA phone calls (and a lot more) from either the Google Voice app, or voice.google.com in your internet browser with intuitive shortcut key support, the Chrome plugin or even from GMail using the https://mail.google.com/mail/?voice URL. Read the rest of this entry »

Posted in Google, Google Apps, GoogleVoice, Nexus 4, Power User | Leave a Comment »

.NET/C#: an alias is not the same as a synonym: int versus Int32, etc (fun with enums and aliases part 1)

Posted by jpluimers on 2014/01/28

I was amongst the C# programmers that believe the below table of C# integral types is an alias table. But it is not: it is a synonym table.

C# type .NET Framework Type/
Common Type System
byte System.Byte
sbyte System.SByte
short System.Int16
ushort System.UInt16
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64

You can use the common type system types as coding standard, or prefer the C# types. There are arguments for both.

I am still in the first group: prefer CTS types. They make changing between .NET languages a lot easier (C# and VB.NET are not the only .NET based CLI languages I use).

And indeed almost everywhere you can exchange the .NET Framework Type and the C# type without changing meaning.

There are two exceptions Read the rest of this entry »

Posted in .NET, C#, Delphi, Development, Jon Skeet, Software Development | 1 Comment »