Month: November 2010

  • Solution for my resizing resolution issue on Windows XP

    Some time ago I had to deal with a very strange issue on my Windows XP installation on my laptop. Everytime my computer turned the display back on after rebooting, hibernate or even standby it changed its resolution to 1024×768 pixels. This was really weird because the native resolution of my display is 1920×1200 pixels and so the resizing was very disturbing.

    I’m having a Nvidia Quadro FX 770M chipset but searches on the internet indicated that this issue also applied to other chipsets and were likely more of a deeper and complicated driver issue where some setting somehow flipped and caused this behavior.

    There were a lot of descriptions and suggestions how to get rid of this issue (including re-installing the driver) but none of them worked for me. Finally I came across this posting in the Nvidia forums which offered a procedure to resolve this issue. I did not try the full procedure at first but took a shorter route (with less reboots) and this already resolved the problem for me:

    1. reboot/hibernate/standby&resume to reach 1024×768 (low resolution) state
    2. do NOT change resolution or open the Windows display panel but open the NVIDIA Control Panel via the icon in the Systray
    3. go to "Display->Change resolution" and change to the correct resolution there, apply

    It is important to NOT enter the Windows display control panel for changing the resolution, even if the Nvidia control panel is entered afterwards from there. Nevertheless, after this procedure the native resolution persisted on my notebook even after reboots/resumes.

  • Windows XP explorer changed behaviour on SP3

    Yes, I know, Windows XP is already almost at the end of its life and there isn’t much more to add to it. But since I got a new notebook at work to try out and I’m currently in the process of fitting it to my needs, which also involves installing an alternate shell, I’m writing down a small finding for which I found no additional information on the rest of the internet.

    The behavior of the "/e" parameter for the Windows Explorer (explorer.exe) has changed between Service Pack 2 and Service Pack 3. This change only has an effect, if there is an alternate Windows shell active. Until SP2 if there is no explorer.exe process running, a call to "explorer.exe /e" starts the shell and tries to open the folder "/e" which obviously leads to an error (and a started Windows shell). If there IS a running "explorer.exe" process found, a call to "explorer.exe /e" opens the file manager window. With SP3 the "/e" is interpreted in a consistent manner and the explorer starts in the File Manager mode regardless if there is already an "explorer.exe" running or not.

    So if you’re running an alternate shell, want to wire the Windows+E keyboard shortcut to the file manager (or file explorer) using "explorer.exe /e" and experience the Windows Shell starting over your shell with an error, make sure that you install the Service Pack 3 (which you should anyway, regardless of your shell).

  • Java Tip #10: The instanceof-operator is null-safe

    Another quick-shot Java Tip. Keeping it simple because I don’t have much time currently. It’s one of the lesser-known facts of the instanceof-operator and I’ve seen it’s applicability in some sources but YMMV.


    ##Advice Use the Java operator instanceof for implicit null-checks. Sometimes there is the need to check for both (eg. in equals()-methods), non-null and a certain class. Instead of checking for each condition seperately one can use just the instanceof operator, which handles a null-pointer in the same manner as a non-matching class.

    ##Code-Example

    Before

    ...
    if (field != null) {
        if (field instanceof SomeClass) {
            ...
        }
    }
    ...

    After

    ...
    if (field instanceof SomeClass) {
        ...
    }
    ...

    ##Benefit Small readability gain.

    ##Remarks This seems to be one of the lesser known facts about Java there can be a small confusion with other participants on the same code who interpret this to an aparently missing null-check. But this comes as no danger when the other person just re-adds the null-check, there should be no bad effect on the logic. Maybe just spread this knowledge to your participants somehow 😉