Go to content Go to navigation Go to search

Use VPC fullscreen on your large screen
· 2009-02-27 13:35 by Thijs Kroesbergen for Brokenwire.NET

I haven’t tried this for myself yet, but as you can read in the description hotfix number 958162 will let you use VPC 2007 SP1 full-screen on your large kick-ass monitor. The maximum resolution for a virtual machine now is 2048x1920 instead of the old 1600x1200. This feature has been on high demand for ages!

Besides the maximum resolution several performance and stability fixes have been made in the virtual machine networking.

To install this hotfix you’ll need to run msiexec.exe  from an elevated command prompt. Just double click won’t work.

To install this update, save the .msp file locally. If you are running Windows Vista, Windows Vista Service Pack 1, or Windows Server 2008, run the update from an elevated command prompt. To do this, use the following command syntax:

msiexec /p path of .msp file

If you are running an earlier version of Windows, double-click the downloaded .msp file to start the installation process. Then, follow the installation instructions.

Direct download links:

32 bits
64 bits

Via [Joy of Setup]

Permalink -

Timer.Elapsed event – The Silent Killer
· 2009-02-26 12:54 by Thijs Kroesbergen for Brokenwire.NET

Yesterday we ran into some issue where exceptions would disappear into a black hole. We had some code running within the Elapsed event of a System.Timers.Timer which seemed to crash without us being able to catch the exception in our global “unhandled exception” exception handler. It looked like we had a Ninja in our code somewhere, deadly and accurate.

So we finally figured out what was happening and I’ll explain it to you here.

To start with the code to reproduce this looks like this:
An example project can be downloaded here: SilentKiller.zip

static void Main(string[] args)
{
    Console.WriteLine("Starting...");
    AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
    System.Timers.Timer aTimer;
    aTimer = new Timer(1000);
    aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
    aTimer.Enabled = true;
    Console.WriteLine("Press the Enter key to exit the program.");
    Console.ReadLine();
}

private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
    Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime);
    Console.WriteLine("Ninja attack!");
    throw new ApplicationException("Ninja!");
    Console.WriteLine("You didn't see this one coming");
}

private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    Exception ex = (Exception)e.ExceptionObject;
    Console.WriteLine("Caught an exception: " + ex.Message);
}

The problem here is that you’d expect the OnUnhandledException method to fire, but this doesn’t happen. It seems like the exception is silenced within the timer! It took us quite a while to find that out. But actually the MSDN documentation is accurate about this, and my colleague Paul was the first to catch this line:

In the .NET Framework version 2.0 and earlier, the Timer component catches and suppresses all exceptions thrown by event handlers for the Elapsed event. This behavior is subject to change in future releases of the .NET Framework.

So it’s not a bug, it’s a feature!

And when you peek inside the System.dll assembly from the .Net framework you’ll see the following code for the handling of the Elapsed event

private void MyTimerCallback(object state)
{
    if (state == this.cookie)
    {
        if (!this.autoReset)
        {
            this.enabled = false;
        }
        FILE_TIME lpSystemTimeAsFileTime = new FILE_TIME();
        GetSystemTimeAsFileTime(ref lpSystemTimeAsFileTime);
        ElapsedEventArgs e = new ElapsedEventArgs(lpSystemTimeAsFileTime.ftTimeLow, lpSystemTimeAsFileTime.ftTimeHigh);
        try
        {
            ElapsedEventHandler onIntervalElapsed = this.onIntervalElapsed;
            if (onIntervalElapsed != null)
            {
                if ((this.SynchronizingObject != null) && this.SynchronizingObject.InvokeRequired)
                {
                    this.SynchronizingObject.BeginInvoke(onIntervalElapsed, new object[] { this, e });
                }
                else
                {
                    onIntervalElapsed(this, e);
                }
            }
        }
        catch
        {
        }
    }
}

Now I wonder who had the guts to break the rule “Never (ever) use an empty catch”! And why did they do this?!

(This would be a nice question for a Microsoft exam ;). How many of you knew about this?)

Permalink -

Super-easy access to the Sysinternals tools
· 2009-02-18 11:54 by Thijs Kroesbergen for Brokenwire.NET

Leon Meijer blogged about the "new" way to access the sysinternals tools back in May 2008.

Today I found out another cool trick. You can not only use the  http://live.sysinternals.com/ "Open Directory" server to download the tools, you can also do the following: (Start, run, type:)

\\live.sysinternals.com\Tools

And presto! You now have access to a network share with easy and up-to-date access to the tools!

You can also map a drive letter to this share if you want to, just type:

net use * \\live.sysinternals.com\Tools

If you consider yourself an "IT-Professional" and you haven't seen or heard of any of the Sysinternals tools, shame on you! (But hey, it's never too late to learn, so go check them out!)

(This trick depends on the Windows ability to access a WebDAV share as a regular network share, so this won't work on systems where the client bit (the WebDAV mini-redirector) isn't installed (such as my Windows Server 2003)). On Windows Vista this works straight out of the box.
Another reason for some of you to leave the "antique" versions of windows behind and move on?

Permalink -

Today is special
· 2009-02-13 10:19 by Thijs Kroesbergen for Brokenwire.NET

Why? Because today is Friday 13th? Yes, and did you know there is a larger chance that the 13th of the month is a Friday? Now that's creepy.

But today is special in another way:

Today is the day on which Unix time will hit 1234567890, this will happen tonight at precisely 23:31:30h UTC.

Unix time (POSIX time) represents the number of seconds since the "epoch" which is defined as on 00:00h, January 1st 1970. The 1000000000 mark already passed by on 01:46:40h 2001-09-09 UTC.

Many people take advantage of this well-balanced number to throw 1234567890 parties. (And why not, any reason is a terrific reason to party!)

Working in an Microsoft SQL Server world you may wonder why 1-1-1753 is the smallest date in the regular datetime datatype. Some very good reading about that can be found in The ultimate guide to the datetime datatypes.

Although watching these numbers rise is great fun, there is a new Y2k problem looming ahead. on January 19th 2038 at 03:14:08h UTC the world as we know it will end. Because at that exact moment the number of seconds will exceed the value a 32-bit signed integer can hold (2^31). If that doesn't end the world there is another chance on February 7th, 2106 at 06:28:16h UTC, when the POSIX time will reach 2^32. But using a positive-only integer to store the timestamp would be stupid because then we would loose the possibility to store date before 1970, so we're doomed anyway. The only chance of survival we have is to start storing the timestamp in signed 64-bit integers, because that will extend the problem for... uh... some 300 million years. (Don't worry too much, most modern operating systems store the timestamp in an 64-bits unsigned integer already)

So, what will you do to celebrate this great moment in history? I'll probably be watching TV, and not playing any games.

Permalink -

Oh no!
· 2009-02-03 22:25 by Thijs Kroesbergen for Brokenwire.NET

kb907534 Sigh...

Permalink -

Kill the *beep*
· 2009-01-16 10:12 by Thijs Kroesbergen for Brokenwire.NET

The PC Speaker on my laptop also plays through the headphones, on maximum volume. So if you are listening to music the beep plays incredibly loud and straight into your ears.

To kill the beep run the following commands from an command prompt (with administrative privileges)

net stop beep

sc config beep started= disabled

I tried this on both Vista and Server 2003. A nice way to test if this worked for you: in the command prompt type:

echo ^G

(echo and ctrl+G) then Enter. With the beep on this destroys your ears, with the beep of you won't hear a thing.

Happy listening!

Permalink -

Previous Next