Bug Vanquisher

29 December 2007

The Bug

Filed under: Bugz, Rant vs Vent — Tanveer Badar @ 5:34 AM

It was ages ago to_date(7/2/2007 , ‘MM/DD/YYYY’) since I entered the bug at connect.microsoft.com about OneNote displaying incorrectly in the dialog box of taskbar properties where you can choose which icons to hide in the notification area.

image

Notice the ‘&‘ before New, it should not be there at all.

Here are the details I entered:

Description

When customizing which icons to display in the taskbar and which not, OneNote’s description includes keyboard accelerator format specifier too.

Instead of saying ‘Open New Side Note(Window…)’ it says ‘Open &New Side Note(Window…)’.

Version:

OneNote 2007

How often does this happen?

Always Happens

Have you seen this problem before in this product?

No, this is new to the most recent version

Reproduction Steps

Run OneNote at least once. It’s quick access icon should appear in the notification area.

Right click on task bar and choose customize. (This is only supported on Windows XP onwards.)

Incorrect description as previously said appears.

Expected Results

There should be no format specifier.

And the ridiculous resolution:

The following fields or values changed:
Field Status changed from [Active] to [Resolved]
Field Resolution changed from [Not Set] to [External]

I wonder why it took OneNote team to mark a bug "won’t fix" 5.5 months?

For the added bonus, find as many inconsistencies as you can.

Overall Statistics
19,733 registered users
502 total bugs
458 total suggestions
54 active bugs
2 resolved bugs
446 closed bugs
27 active suggestions
0 resolved suggestions
431 closed suggestions
Previous 7 Days
19 new users
0 new bugs
68 resolved bugs
135 closed bugs
0 new suggestions
124 resolved suggestions
139 closed suggestions

Advertisements

25 December 2007

The Bug in the Bug

Filed under: Bugz, Rant vs Vent, Windows Vista — Tanveer Badar @ 9:20 PM

Yesterday, I installed Windows Vista SP1 on my box. Everything works fine, except three!

Network icon is very shy of showing the actual connectivity of my computer on the internet. It takes two minutes to update from clip_image001 to clip_image001[5]. Not remotely amusing. Thank God, I have my modem sitting right in front of me to have a look at those five LEDs. Such a time saver.

It is possible to boot the system from cold faster than it is able to resume from sleep from cold. The wonders of sleep optimizations.

And this leads to the last issue. It is not possible to submit this report to Microsoft, because the tool included in SP1 is for beta releases of Windows Vista. It fails to update itself, always downloads a copy of the program when run again, saves reports in a format it cannot itself read, is never able to establish a connection to Microsoft servers for report submission, the error it shows in this case redirects to a page which keeps refreshing itself without ever showing anything, shows Longhorn in its UI instead of Vista.

23 December 2007

Catching the Exceptional

Filed under: Computer Theory, Dev inside! — Tanveer Badar @ 4:42 PM

[Warning: None of the code, even the simplest one, may compile. I was just demonstrating a point, code is meta-information to support that.]

Let’s do some coding. You have a simple program to calculate inverse of an integer.

using System;

namespace Program
{
    public class Exceptional
   {
       public static void Main( )
       {
           Func( );
       }

       void ShowInverse( int num )
       {
           Console.WriteLine( 1.0 / ( double )num );
       }

       void Func( )
       {
           Console.WriteLine( "Please enter a number: " );
           try
           {
               int num = int.Parse( Console.ReadLine( ) );
               ShowInverse( num );
           }
           catch( Exception ex )
           {
               Console.WriteLine( ex.Message );
           }
        }
    }
}

I do not claim this program to be the best ever. You will see what I am trying to do. That int.Parse line can fail for any number of reasons. That’s why it is surrounded by a try-catch clause. So, we got rid of formatting errors for the moment. But this leaves one problem wide open. What happens if input is ‘0’? We may need to add another try-catch in ShowInverse. So the revised code for ShowInverse becomes

       void ShowInverse( int num )
       {
           try
           {
               Console.WriteLine( 1.0 / ( double )num );
           }
           catch( Exception ex )
           {
               Console.WriteLine( ex.Message );
           }
       }

This is essentially equivalent to having a nested try-catch block inside the one in Func. You get the idea how we nest try-catch blocks to deal with different syntactic/semantic errors.

Now, let’s get a bit abstract, our Exceptional class has some functions which encapsulate some business logic and call each other inside try-catch clauses. Each of them has DB logging for success, in case of exceptions and in their finally blocks.

using System;

namespace Program
{
   public class Exceptional
   {
       // logging logic all goes inside Logger.Log function, which will take only a string.
       Logger log = new Logger( );

       void Func1( ... )
       {
           try
           {
               log.Log( "Executing Func1" );
               ...
               Func2( ... );
               log.Log( "Ending Func1's try block." );
           }
           catch( Exception ex )
           {
               log.Log( "Error occurred inside Func1 " + ex.Message );
           }
           finally
           {
               log.Log( "Exiting Func1." );
           }
        }

       void Func2( ... )
       {
           try
           {
               log.Log( "Executing Func2" );
               ...
               log.Log( "Ending Func2's try block." );
           }
           catch( Exception ex )
           {
               log.Log( "Error occurred inside Func2 " + ex.Message );
           }
           finally
           {
               log.Log( "Exiting Func2." );
           }
        }
    }
}

We log everything, even the exceptions to a database. Here’s a pop quiz, what happens in the case when original exception was thrown because underlying database is not available? Even in this case, we attempt logging and fail in our catch blocks and throw another exception.

Suppose this happened while Func2 was executing, we catch the first exception and try to log it, another exception is thrown and Func1 attempts to log it and throws yet another exception. There is no one to catch the third exception was will cause what service Exceptional was providing to fail.

Is the answer to the problem is to add yet another try-catch clause inside all existing catch/finally blocks? Definitely no. What if someone else comes along later and sees no logging in catch/finally block! I’ll add that. And we are back to the same problem we were attempting to solve.

Suppose, this code was part of a console application. Eventually, the exception would surface to operating system loader which will notice no one has handled it. For Windows, you can find the details in MSDN about what happens when program throws an unhandled exception, but operating systems follow similar patterns. If everything fails, program is terminated. If this happened in kernel mode, you lose everything.

If you pause to think for a moment, you will see our exceptional handling code forms a hierarchy. We have various levels of handlers from swallowing everything type to log and rethrow to transforming ones. At lower levels, you have all sorts of choices from retrying the operation to keeping things silent to invoking some alternative or compensating functionality.

The one which causes the program to terminate is the most beautiful. It is the root which must withstand the worst of all. It is unique in the way that nothing passes this handler, nothing can ever pass this one. It handles everything where others fail.

20 December 2007

If They Say So

Filed under: Fun — Tanveer Badar @ 4:18 PM

It seems IE8 passed Acid2 test. Big deal! Really. It is over on IE blog and almost every Microsoft blogger is writing about it. The fact is falsely amplified because FF 2.x does not render that page correctly.

So, for the love of FF, I wrote this in the comments of that post

[Update:  Some 90 minutes later, I am writing this again for the love of FF. FF 3 beta 2 does sort of pass Acid2 test. And this is what appears in it]

ff-3-beta-2.jpg

19 December 2007

I Hate foreach

Filed under: Bugz, Dev inside! — Tanveer Badar @ 3:42 PM

There are many reasons. People don’t implement it properly. foreach uses duck typing which does not require one to implement IEnumerable/IEnumerator. But people always go ahead and implement them with "virtual" functions and properties. Consider the performance hit when you are recursively iterating over all the files in a drive.

foreach also requires that collection be not modified during enumeration, yet people still do these kinds of things

foreach( Transaction transaction in transactions )
{

transactions.Remove( transaction );

}

in [it].

[It] is Done

Filed under: Dev inside!, Personal — Tanveer Badar @ 3:33 AM

It is too late for me to be writing anything this late (3:30 A.M.). But, [it] is shipping later today in the afternoon.

What is [it]? It [it] is something I have been working on for the whole year. I’ll talk about [it] later someday. It [It] is repeated and in [ ] because [it] is not the pronoun, it is [it].

[Update: 20/12/2007. [It] did not ship yesterday due to some issues with [them]. And I feel sorry for those who hate nested [ ]. Yep, I just did that again. [:)] ]

Minus Zero Really Matters!

Filed under: Bugz, Funnier — Tanveer Badar @ 3:29 AM

Don’t believe me? Have a look at this.

15 December 2007

++Family.Count

Filed under: Personal — Tanveer Badar @ 7:36 PM

Introducing Ali, my youngest nephew! Just 1 day, 9 hour and 57 minutes old at the time of posting.

IMG0160A

IMG0161A

IMG0162A

8 December 2007

BigInt For .Net Framework

Filed under: Dev inside!, Tips — Tanveer Badar @ 11:43 PM

Is it there or is not?

The answer was true for beta 1 build of netfx 3.5. It is true if you can manage to run under full trust for beta2 and RTM versions, because then, you can use reflection to create an instance of BigInteger and invoke members.

image

This value type supports +, -, –, ++, /, ==, >=, >, !=, <, <=, %, *, -, + as supported arithmetic operators.

For functions, it has Abs, Add, Compare, CompareTo (overloaded), Divide, DivRem, GreatestCommonDivisor, ModPow, Multiply, Negate, Parse (overloaded), Pow, Remainder, Subtract, ToByteArray (overloaded), ToString (overloaded) and TryParse (overloaded) to offer. Note, Add, Divide, Multiply, Negate, Remainder and Subtract actually implement functionality for corresponding operators.

There are also a host of convert-from and convert-to operators, performing conversions to and from all built-in numeric data types.

Oh The Tone!

Filed under: Fun, Rant vs Vent — Tanveer Badar @ 10:22 PM

IE blogs opened the flood gates few days ago by letting out that IE 8 (or whatever!) is being planned.

You may want to look at the comments, as the original post is dwarfed by totally funny comments.

Older Posts »

Create a free website or blog at WordPress.com.