Bug Vanquisher

24 May 2008

Moving the Ground from Underneath Your Feet

Filed under: Bugz, Dev inside! — Tanveer Badar @ 7:08 PM

Run check disk while doing something important. :) The drive should disappear from everyone’s view as check disk opens it under exclusive RW access.

This brings us to some things, some tests I would like to run on many applications. Typical happens as I write this.

1- Visual Studio setup just hangs. *

2- Firefox crashes upon close when running from that drive. *

3- Tortoise SVN background process will crash. **

4- Opening any MS Office program will invoke windows installer instead (expected). If office was installed on that drive.

5- OneNote’s background keystroke monitor will crash. **

There are lots of things programs access file system for.

1- Custom logging: Not essential enough to actually crash the application. I would love to see some example program doing exactly that.

2- User data: Nothing should ever crash for this. Instead prompt for an alternate location.

3- On demand functionality: User invoked something. You need to load code/resources/configuration from a disk not available. What will you do? Crashing is very gross.

4- Configuration data: This can happen anytime. Don’t tell me you don’t keep a default copy of your required, must-have, 24/7 available, configuration ready at hand in resource form. Embedded right into your executable images.

Advertisements

C++ – The Power of Templates

Filed under: C++ — Tanveer Badar @ 5:52 PM

Do you read Ian Griffiths? If not, please start reading. Belongs in the group of smart people (by my classification).

But smarties don’t know everything either, nor do I. However, there is one thing Ian gets wrong in one of his articles. He specifically writes,

The fact that there is no implied type becomes even more striking when you consider some more interesting Python examples. Because Python performs its type checks even later than C++, you have even more flexibility:

def speak(speaker, mood):
    if mood == "verbose":
        speaker.WaxLyrical()
    elif mood == "shy":
        speaker.Whisper()
    else:
        speaker.Talk()

yada yada yada…

Note that in C++ we’d see a different result here. Python defers its type checking until the point at which you try to use a member. In a C++ template, the check is done when the template is instantiated. So C++ would actually require all three methods to be present, despite the fact that only one will be used for any given execution of the speak method. So in C++ the constraints a template can impose on its parameter are less dynamic than in Python.

However, the part about "C++ would actually require all three methods to be present" is wrong assertion. It is entirely possible to have the same behavior like Python in C++. Never, ever, underestimate the power of compile time Turing-complete templates available. :)

The code given below requires only one function at a time. My only humble request is to compile it on a sane compiler (implicitly exclude MSVC 7 and earlier).

#ifdef _MSC_VER && _MSC_VER <= 1300

#error Can’t you read English. THIS STUFF REQUIRES MSVC 8 OR HIGHER!!!

#endif

struct A { void whisper( ) { } };

struct B { void shriek( ) { } };

struct C { void snarl( ) { } };

template< typename T > struct invoker

{

    static void invoke( T )

    {

    }

};

template< > struct invoker< A >

{

    static void invoke( A obj )

    {

        obj.whisper( );

    }

};

template< > struct invoker< B >

{

    static void invoke( B obj )

    {

        obj.shriek( );

    }

};

template< > struct invoker< C >

{

    static void invoke( C obj )

    {

        obj.snarl( );

    }

};

template< typename T > void f( T obj )

{

    invoker< T >::invoke( obj );

}

void g( )

{

    f( A( ) );

}

Hopefully, a little more C++ will bring peace and harmony in the world :). One can only hope.

Flat Perspective

Filed under: Rant vs Vent, Things in life — Tanveer Badar @ 5:10 PM

Not mine, about some stupid movies.

As a rule of thumb if the thing you are watching (in other words, wasting time) does not have a flat perspective, something like spherical projection or, even more obtusely, oblong, then, its simply not worth the time.

There will be no story, just stupid flash backs (strong analogy to ‘Lost’). And it will end so suddenly, you’ll scratch your head longer than the time it took you to watch it figuring out what just happened.

23 May 2008

Who said Mac was horrible

Filed under: Rant vs Vent — Tanveer Badar @ 11:58 AM

Apparently, you don’t have to walk to a Mac to see those abominations like bitmap graphics, fixed DPIs and no anti-aliasing. You can have these in Windows if you get to work on Eclipse.

image  Yummy vector graphics at 6x zoom.

image Super anti-aliased edges

10 May 2008

Posted through Cell Phone’s Modem

Filed under: Fun, Personal — Tanveer Badar @ 10:58 PM

That’s all. :)

3 May 2008

Previous Versions

Filed under: Windows Vista — Tanveer Badar @ 10:17 PM

They don’t exist in Windows Vista Enterprise Edition, or do they? For me they do and this is how.

Woes and Worries

Filed under: Bugz, Rant vs Vent, Windows Vista — Tanveer Badar @ 5:52 PM

I wonder why people cry of the sucky video drivers pushed out by NVidia. The monsters Intel rolls out for their D946 GZ chipsets must be on par. I have had more GPU resets from them than power failures!

Even new yahoo messenger causes the graphics stack to crash weirdly.

[Update-After five minutes]

Here’s the most charming, updated EULA of the driver I downloaded.

This file should be replaced by the current license file when built.

 

I mean what they are playing at?

2 May 2008

Male vs. Female

Filed under: Funnier — Tanveer Badar @ 12:30 AM
[Notice: If you are not male, proceed with caution.]

A new sign in the Bank Lobby reads:
‘Please note that this Bank is installing new Drive-through ATM machines enabling customers to withdraw cash without leaving their vehicles.
Customers using this new facility are requested to use the procedures outlined below when accessing their accounts.
After months of careful research, MALE & FEMALE Procedures have been developed. Please follow the Appropriate steps for your gender.’
*******************************
MALE PROCEDURE:
1. Drive up to the cash machine.
2. Put down your car window.
3. Insert card into machine and enter PIN.
4. Enter amount of cash required and withdraw.
5. Retrieve card, cash and receipt.
6. Put window up.
7. Drive off.
*******************************
FEMALE PROCEDURE:
1. Drive up to cash machine.
2. Reverse and back up the required amount to align car window with the machine.
3. Set parking brake, put the window down.
4. Find handbag, remove all contents on to passenger seat to locate card.
5. Tell person on cell phone you will call them back and hang up.
6. Attempt to insert card into machine.
7. Open car door to allow easier access to machine due to its excessive distance from the car.
8. Insert card.
9. Re-insert card the right way.
10. Dig through handbag to find diary with your PIN written on the inside back page.
11. Enter PIN.
12. Press cancel and re-enter correct PIN.
13. Enter amount of cash required.
14. Check makeup in rear view mirror.
15. Retrieve cash and receipt.
16. Empty handbag again to locate wallet and place cash inside.
17. Write debit amount in check register and place receipt in back of checkbook.
18. Re-check makeup.
19. Drive forward 2 feet.
20. Reverse back to cash machine.
21. Retrieve card.
22. Re-empty hand bag, locate card holder, and place card into the slot provided!
23. Give dirty look to irate male driver waiting behind you.
24. Restart stalled engine and pull off.
25. Redial person on cell phone.
26. Drive for 2 to 3 miles.
27. Release Parking Brake.

1 May 2008

Storm or Strom?

Filed under: Funnier — Tanveer Badar @ 11:23 PM

EarthStorm’s (probably a sucky movie because I don’t like William Baldwin) name is written EarthStrom on HBO. :)

P.S. I should add "sarcastic" to the categories, soon. :) :)

Create a free website or blog at WordPress.com.