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




    More Photos
  • Pages

  • All categories

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

    Join 1,776 other followers

Archive for November, 2011

Duh moment: in C#, the integer zero (0) is compatible with all enums

Posted by jpluimers on 2011/11/30

Even if you have used something for over a decade, you can learn about it :)

I was refactoring bits of code where someone clearly didn’t understand the benefits of enumerations, similar to this very contrived example:

using System;

namespace Demo
    // explicit equivalence of: 
    // public enum TrafficLight { Red, Yellow, Green };
    public enum TrafficLight { Red = 0, Yellow = 1, Green = 2 };

    public class Program
        public static void Main()
            // old code:

        public static bool IntIsRedTrafficLight(int trafficLight)
            return (trafficLight == (int)TrafficLight.Red);

The code was using way too many casts, and my goal was something as simple as this: Read the rest of this entry »

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

yyyy-mm-dd for vba – Parse data and time string to Access Date value – Stack Overflow

Posted by jpluimers on 2011/11/29

A co worker at a client had trouble importing textual date strings into Microsoft access.

Since many databases like yyyy-mm-dd as a universal import date format, I suggested trying that and searching for some backing on the Internet.

Indeed this StackOverflow answer confirmed my gues.


Via: vba – Parse data and time string to Access Date value – Stack Overflow.

Posted in Access, Database Development, Development, Software Development | Leave a Comment »

Andrew Worcester • Kill Skype Home (KSH) – Get rid of that annoying “Skype Home” popup

Posted by jpluimers on 2011/11/28

Lifehacker tool of the day: KillShypeHome Kills the annoying Skype Home page that pops up on Skype start, and every now and when you are in the middle of something.

After starting KillSkypeHome, make sure you configure its tray icon as follows:

  1. Minimize Skype on Start
  2. Start with Windows
  3. Persistent Mode
    (this keeps KillSkypeHome running after minimizing Skype the first time, just in case Skype Home tries to popup again, which Skype does at inconvenient moments).


Via: Andrew Worcester • Kill Skype Home (KSH) – Get rid of that annoying “Skype Home” popup.

Posted in LifeHacker, Power User | Leave a Comment »

Windows: killing the Zone.Identifier NTFS alternate data stream from a file to prevent security warning popup

Posted by jpluimers on 2011/11/25

The Zone.Identifier NTFS alternate data stream (ADS) is appended to Internet downloads by browsers, and inserted by most decompressors when expanding such downloads.

NTFS alternate data streams are a perfect way to hide data, support Mac OS data forks (which used them to support resource fork meta data tagging long before NTFS alternate data streams were introduced), or to append meta-data to files.

It is a known ADS used to show a security warning when you run executable content that has been downloaded.
That warning can be annoying, or hang your application which it is started from a service, so further below is a batch file that kills the stream.

You cannot use type for displaying NTFS alternate data streams, but redirection through more or using notepad is fine.

This shows the Zone.Identifier NTFS alternate data stream for a single file:

more < %1:Zone.Identifier

When you want to see the ADS of many files, then just use NirSoft’s AlternateDateStreams utility.

You should only kill an Zone.Identifier NTFS alternate data stream when you have verified that the downloaded executable content (which nowadays is much more than just an executable) is verified to be safe.

An easy way to kill any NTFS alternate data stream is to copy it to a FAT32 device and back: FAT does not support alternate data streams. Drawback: it modifies the timestamp of your file as FAT has a smaller time resolution than NTFS has.

This batch file kills  the Zone.Identifier NTFS alternate data stream using the SysInternals streams tool:

@echo off
  if !%1!==!! goto :end
  :: use caret before pipe to hide the pipe from the outermost command in the batch file
  for /f "usebackq tokens=1" %%d in (`streams.exe %1 ^| find "Zone.Identifier:$DATA"`) do (
    goto :kill
  goto :end
  streams -d %1

and this batch file lists the Zone.Identifier NTFS alternate data streams:

@echo off
  if !%1!==!! goto :end
  :: use caret before pipe to hide the pipe from the outermost command in the batch file
  for /f "usebackq tokens=1" %%d in (`streams.exe %1 ^| find "Zone.Identifier:$DATA"`) do (
    goto :list
  goto :end
  streams.exe %1 | find ":"

Note that the $DATA in the above batch files is not part of the NTFS alternate data stream name, but explains what kind of data is in the stream.
I have not found other types yet, but if you do, please leave a comment (preferably with a link).


Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows, Windows 7, Windows Vista, Windows XP | 2 Comments »

Matrix library by Michael Rabatscher with many features and x86/x64 optimizations

Posted by jpluimers on 2011/11/24

This one is on my Delphi research list for sure:

a matrix library including some advanced operations like singular value or LU decomposition, pseudo inversion and others as well as a large set of assembler hand optimized matrix primitive functions. The assembler version are available for x64 code as well by the way. Quite a few of these matrix primitives are also available as multi threaded versions.  All functions are encapsulated in an easy to handle matrix class or interface.The library is released under the apache licence meaning that it may also be integrated into commercial products.

So it has lots of features, and optimizations. When browsing the source code, there are also some tests, I presume there will be more in the future.

The library has both a web site with download and a Google Code respository with source browsing.


via: Matrix Library by Michael Rabatscher.

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

%d bloggers like this: