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

Archive for February, 2014

Google Cast bug tracker (via: google-cast-sdk – Google Cast SDK – Google Project Hosting)

Posted by jpluimers on 2014/02/11

The bug tracker for Chromecast / Google Cast is at Issues – google-cast-sdk – Google Cast SDK – Google Project Hosting.

–jeroen

via: google-cast-sdk – Google Cast SDK – Google Project Hosting.

Posted in Chromecast, Development, Google, Power User, Software Development | Leave a Comment »

.NET/C#: DBNull explained

Posted by jpluimers on 2014/02/11

The DBNull type is a very special type in .NET. It represents null values in databases, which are slightly different than null values in .NET.

The biggest confusion that people have with it is that it won’t convert to anything. Which means that you see a lot of questions like “System.InvalidCastException: Conversion from type ‘DBNull’ to type” “is not valid”.

You’d think the full name would be System.Data.DBNull, it is actually named System.DBNull. The reason is that various other functionality of the System namespace depend on it, for instance the System.Convert class.

DBNull was already present in .NET 1.x, so it predates nullable types that were introduced in C# 2 / .NET 2.

A null value on the database side will result in a DBNull instance.

If you want to explicitly pass a null value to a database, you use a DBNull.Value, which is a singleton.

Why DBNull

There is a very interestin question/answer series on StackOverflow about this: via .net – What is the point of DBNull? – Stack Overflow.

There are a few good arguments both for and against DBNull.

But the baseline is that DBNull predates the introduction in the .NET framework of genuine nullable types. Both their behaviour is slightly different, so DBNull had to stay.

Which means you have to deal with it every now and then.

Invalid casts

A bit more background on the invalid casts.

It is thrown like this:

            throw new InvalidCastException(Environment.GetResourceString("InvalidCast_DBNull"));

from

Convert.DefaultToType();

which is called from the DBNull method

    object IConvertible.ToType(Type type, IFormatProvider provider);

All other IConvertible methods are implementated like

bool IConvertible.ToBoolean(IFormatProvider provider)
{
    throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
}

So these all throw the same exception:

    bool IConvertible.ToBoolean(IFormatProvider provider);
    byte IConvertible.ToByte(IFormatProvider provider);
    char IConvertible.ToChar(IFormatProvider provider);
    DateTime IConvertible.ToDateTime(IFormatProvider provider);
    decimal IConvertible.ToDecimal(IFormatProvider provider);
    double IConvertible.ToDouble(IFormatProvider provider);
    short IConvertible.ToInt16(IFormatProvider provider);
    int IConvertible.ToInt32(IFormatProvider provider);
    long IConvertible.ToInt64(IFormatProvider provider);
    sbyte IConvertible.ToSByte(IFormatProvider provider);
    float IConvertible.ToSingle(IFormatProvider provider);
    ushort IConvertible.ToUInt16(IFormatProvider provider);
    uint IConvertible.ToUInt32(IFormatProvider provider);
    ulong IConvertible.ToUInt64(IFormatProvider provider);

–jeroen

via:

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 »

GU5.3/GX5.3 Base Bulb Identification (via: YouTube)

Posted by jpluimers on 2014/02/10

GU/GX5.3 Base Bulb Identification – YouTube.

Multifaceted reflector – Wikipedia, the free encyclopedia.

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

Fixing Inverted Caps Lock on VMWare Fusion, Parallels, or Remote Desktop (RDP/MSTSC)

Posted by jpluimers on 2014/02/10

Every now and then my Mac RDP program will suddenly turn on the CAPS LOCK on the connected Windows terminal.

It happens on different OS X versions, and different Windows versions. I haven’t figured out the steps to reproduce yet. I will amend this post when I have (:

I also have it occasionally fail when I RDP from a physical Windows system to another Windows system, but far less than from Mac OS X.

You work around it using the On Screen Keyboard tool in Windows like Josh Adams explains:

  • launch the On-screen Keyboard application (generally this can be done by choosing Start ==> All Programs ==> Accessories ==> Accessibility ==> On-screen Keyboard; as noted by DrFooMod2 in a comment below, you can also bring up the On-screen Keyboard by typing “osk” without the quotes in the Windows Run… box) and
  • toggle Caps Lock by clicking on the virtual “lock” button in the application.
  • The On-screen Keyboard application shows–and can change–the state of Caps Lock

The easiest way to start the On Screen Keyboard is to create a shortcut to this:

%windir%\system32\osk.exe

–jeroen

via: Josh Adams’s Blog: Fixing Inverted Caps Lock on VMWare Fusion, Parallels, or Remote Desktop.

Posted in Apple, Keyboards and Keyboard Shortcuts, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, Power User, Remote Desktop Protocol/MSTSC/Terminal Services, Windows | 1 Comment »

Android: manually install Google Play Services 4.2.39 so AllCast and others can stream to Chromecast

Posted by jpluimers on 2014/02/09

Over the years, Google Play Services has started to play a much bigger role, arguably more important than the Android version (also making it impossible to fork Android: Neither Microsoft, Nokia, nor anyone else should fork Android. It’s unforkable. | Ars Technica).

This shows again with the publication of the new Google cast SDK with public Chromecast support release last weak (I think the SDK name being broader than Googlecast means there will be much more to come in the feature).

Though most current Android users are still at version 4.1.32 of the Google Play Services, Google is rolling out a 4.2.39 version to enable that SDK. After it has rolled out to enough devices, then the Play Services library version 15 part of the SDK will be released for Android as well (which will complement the existing support for the iOS and Chrome platforms).

The odd thing: it looks like *some* developers already have this SDK, as AllCast already has been updated and it does not work with Google Play Services 4.1.32, but it does work with Google Play Services version 4.2.39. Below I show you how I tested this, and how to manually upgrade your Android device to use Google Play Services 4.2.39. Read the rest of this entry »

Posted in Android, Android Devices, Chrome, Chromecast, Development, Google, iOS Development, Mobile Development, Nexus 4, Power User, Software Development | 1 Comment »

Jonas Bandi – Google+ – Blogged: Not happy with Agile, but why?

Posted by jpluimers on 2014/02/09

Yesterday there was this interesting post from Jonas Bandi – Google+ – Blogged: Not happy with Agile, but why?.

The content of his post is the opposite the title suggests: most developers love Agile, but it often is highly incompatible of management in bigger companies.

Well balanced post, much worth reading it.

–jeroen

Posted in Agile, Development, Software Development | Leave a Comment »

Thomas Kang – Google+ – I found these conversions some time back on the web and was…

Posted by jpluimers on 2014/02/07

I almost wetted my pants:

common conversions

–jeroen

via: Thomas Kang – Google+ – I found these conversions some time back on the web and was….

Posted in Comics | Leave a Comment »

Create a Bootable USB Key Thumb Drive in Windows Vista/7 with the Command Line

Posted by jpluimers on 2014/02/07

Open a command prompt with administrator rights and enter the following sequence of commands:

  • diskpart
  • list disk
  • select disk {number}
  • clean
  • create partition primary
  • select partition 1
  • active
  • format fs=fat32 quick
  • assign
  • exit

Which was for experimenting with a few of the entries in Top 5 Free Rescue Discs for Your Sys Admin Toolkit and Kaspersky Rescue Disk 10.

I think I like Download Hiren’s BootCD 15.2 | HBCD Fan & Discussion Platform most.

Another way to get it on a USB stick is through Launching Hiren’s BootCD from USB Flash Drive | HBCD Fan & Discussion Platform.

Wiping out the HPA and DCO stays difficult though: linux – Harddrive – wipe out “hidden areas” like HPA and DCO also after malware infection – Super User.

–jeroen

via: Create a Bootable USB Key Thumb Drive in Windows Vista/7 with the Command Line and Best Free Rootkit Scanner and Remover and Five free portable rootkit removers – TechRepublic and Utility Spotlight: Scan for Malware Outside of Windows | TechNet Magazine and What Is a Host Protected Area?.

Posted in Power User, Windows, Windows 7, Windows 8 | Leave a Comment »

KnowRoaming | Reduce Roaming Fees

Posted by jpluimers on 2014/02/06

Interesting: reducing phone costs when abroad. KnowRoaming | Reduce Roaming Fees.

Posted in LifeHacker, Power User | Leave a Comment »

Voorkom hoge belkosten met Fritz!Box: zet remote access en MyFritz! uit; misbruik telefonie aan de gang

Posted by jpluimers on 2014/02/06

Zelf ben ik klant bij xs4all, maar het komt ook bij andere Nederlandse en buitenlandse (met name Duitse) gebruikers van Fritz!Box apparatuur voor: ineens enorm hoge belkosten.

Gelukkig was bij mij alles goed ingesteld, en had ik geen MyFritz! actief, dus (nog?) geen misbruik hier.

Onderstaande heb ik gepost op de Tweakers.net site. Een deel is generiek, en een deel specifiek voor xs4all: Read the rest of this entry »

Posted in Power User | Leave a Comment »