More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  Bug VanquisherProfileFriendsBlogMore Tools Explore the Spaces community
Thanks for visiting!

Bug Vanquisher

July, 2008

What Spring Had!

And I thought ASP.Net didn't have it. And yes, I am talking about this Spring. And the feature in question in Spring's DWR or direct web remoting.

A feature similar in functionality exists in WCF 3.5 incarnation, namely, "AJAX Integration and JSON Support". This also allows an ASP.Net AJAX (or w/e it is called these days) client side to call a WCF service endpoint.

June, 2008

Catch the Mistakes

Hot off facebook's profile home...

What are the reasons that prevent you from reading Urdu Magazine? Pakistan Sponsored Poll

Create a Poll »

I don't like the magazine

I can't read Urdu

I prefer reading in English

I live outside Saudi Arabia/I never heard of it

I don't like to read at all

Now, this is SO horribly wrong.

1- Urdu is/was never spoken in KSA. Even the immigrants don't make up much.

2- There is no positive option.

3- It is impossible to answer for a blind person.

4- Not wanting to read is no one particular language's fault, perhaps the individual is real dumb, stupid moron. For all we know.

June, 2008

Prophecy

It will happen at mid-night.....

 

 

 

 

I'll be 24 in just an hour.

May, 2008

C++ - The Power of Templates

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

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.

May, 2008

Who said Mac was horrible

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

May, 2008

Previous Versions

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

Woes and Worries

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?

May, 2008

Male vs. Female

[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.

May, 2008

Storm or Strom?

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. :) :)

April, 2008

Threat Levels

[Disclaimer: No intended offense to any English, French, Italian, German, Belgian, Spanish or Aussie reader who happens to come across this post.]

The English are feeling the pinch in relation to recent terrorist threats and have raised their security level from "Miffed" to "Peeved." Soon, though, security levels may be raised yet again to "Irritated" or even "A Bit Cross." Londoners have not been "A Bit Cross" since the blitz in 1940 when tea supplies all but ran out. Terrorists themselves have been re-categorized from "Tiresome" to "A Bloody Nuisance." The last time the British issued a "Bloody Nuisance" warning level was during the great fire of 1666.

Also, the French government announced yesterday that it has raised its terror alert level from "Run" to "Hide." The only two higher levels in France are "Surrender" and "Collaborate." The rise was precipitated by a recent fire that destroyed France's white flag factory, effectively paralyzing the country's military capability.

It's not only the English and French that are on a heightened level of alert. Italy has increased the alert level from "Shout Loudly and Excitedly" to "Elaborate Military Posturing." Two more levels remain: "Ineffective Combat Operations" and "Change Sides."

The Germans also increased their alert state from "Disdainful Arrogance" to "Dress in Uniform and Sing Marching Songs." They also have two higher levels: "Invade a Neighbor" and "Lose."

Belgians, on the other hand, are all on holiday as usual, and the only threat they are worried about is NATO pulling out of Brussels.

The Spanish are all excited to see their new submarines ready to deploy. These beautifully designed subs have glass bottoms so the new Spanish navy can get a really good look at the old Spanish navy.

The Australian's level has increased from "What the f#ck?" to "Who the f#ck?". The next level for Australia will be "Well, f#ck me" all the way up to "Enough is a f#ckin nuff".

April, 2008

Horribilus Totalus

I can't properly write anything from Live Writer if I have IE8 installed. For some weird reason, mshtml.dll seems to decide that an AV is in order at some random instant whenever playing with tables or particularly (read pretty) formatted text.

April, 2008

The Myth Called Overloading

There is no such thing as function overloading in this world! Period. Whatever you see in HLLs is the compiler lulling you into the false sense that function overloading exists. Cases in point:

1- C++: Most major compilers (at least from Microsoft) use name mangling. Here is dump of four constructors on std::bad_cast from msvcrt.dll

Mangled mode

Pretty mode

??0bad_cast@@AAE@PBQBD@Z bad_cast::bad_cast(char const * const *)
??0bad_cast@@QAE@ABQBD@Z bad_cast::bad_cast(char const * const & )
??0bad_cast@@QAE@ABV0@@Z bad_cast::bad_cast(class bad_cast const &)
??0bad_cast@@QAE@PBD@Z bad_cast::bad_cast(char const *)

2- CLR:Everything compiles down to IL, whether you like it or not. And here's IL for typical function calls:

call class System.ServiceModel.Channels.Message System.ServiceModel.Channels.Message::CreateMessage( class [System.Runtime.Serialization]System.Xml.XmlDictionaryReader, int32, class System.ServiceModel.Channels.MessageVersion)

from System.ServiceModel.Channels.Message.

That's it, you get the whole nine yards. Return type + fully qualified function name + fully qualified parameter types. It does not matter whether you use call, callvirt or calli. If its a call, its going to use everything fully qualified.

3- You may want to argue about operator overloading. But that's just syntactic sugar. Here is >> from std::basic_istream.

Mangled mode


Pretty mode

class std::basic_istream <wchar_t,struct std::char_traits<wchar_t> > & std::operator>> <float,wchar_t,struct std::char_traits<wchar_t> > (class std::basic_istream <wchar_t,struct std::char_traits<wchar_t> > & ,class std::complex<float> &)
??$?5M_WU?$char_traits@_W@ std@@@std@@YAAEAV?$basic_istream @_WU?$char_traits@_W@std@@@0@ AEAV10@AEAV?$complex@M@0@@Z

4- In CLR, the case is even simpler. You get op_Add straight away, then, its off to fully qualified function calls in IL. End of story.

It does not exist. Anywhere. Ever.

April, 2008

Stick Your Leg [Here]

LINQ and SQL Server: Good or Bad Addition to the Database World?

While SQL Server 2008 has introduced many new features and improved many existing ones, one of the newer database features that has recently started taking the development world by storm is Language Integrated Query or LINQ. There are many different varieties of LINQ, including: LINQ to XML, LINQ to Entities, LINQ over Dataset (VB and C#), and LINQ to SQL.

This is what you get when someone who is no programmer tries to stick their leg into matters no one in their ancestors ever understood.

By the looks, it seems that T-SQL itself natively supports LINQ. :)

April, 2008

It is coming

int array [ ] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 };
std::vector< float > v( query::as_query( array , array + 12 ).select( 5.3f ).to_array( ) );
std::copy( v.begin( ) , v.end( ) , std::ostream_iterator< double >( std::cout , " " ) );
std::cin.get( );

The first revision is here!

Compare the above to this. Almost all the clutter is gone.

exit( 0 );

I upgraded [it]s project to VS 2008 format, only three days before the semi-official end (on Wednesday, if I remember correctly) of development. Only to find that VS 2008 does not play too well with only 1 GB memory.

April, 2008

Analyze This!

Consider this little piece of ****. I mean piece of code. :)

template< typename U , typename T > U convert( T t )
{
    return t;
}

template< typename T , typename projection , > class blah_blah_blah
{
public:
    // details we really shouldn't see

    projection& operator * ( )
    {
        return convert< projection >( *current );
    }
};

If you decide to do

blah_blah_blah< float , double > x = get_blahblahblah( );
*x;

The second statement will fail with some cryptic error message. The real problem is the return type of operator * and the statement return t; in convert. The implicit conversion from T to projection (which is to say, promotion from float to double) loses the l-value[dness] of *current. And since a reference requires l-value upon return, it fails to compile.

Given the constraint the convert< projection > was absolutely necessary, and upon further thought, that projection& was not a requirement, a fix was born.

projection operator * ( )
{
    return convert< projection >( *current );
}

Who Says Harry Potter Is Worse?

There are thing far, far more worst than Harry Potter in the mortal world, mere mortals.

I am talking about 'The Davinci Code'. If Harry Potter movies were off the plot, The Davinci Code seems like the producer(s) and director(s) never read the wretched novel themselves.

By the looks, they had just the remotest idea of what was supposed to be in the novel and how they should produce the movie, which they then off shored to some sit-together, under-paid, road-killed Indian company. I half expected some cheap song to spring to front at the end.

Thank God I only spent 15 minutes watching the twisted end game. It is much better than the 90 minutes spent on 'Jarhead', where I couldn't decide the entire time whether I should continue watching it or not. That was the first for me in living history where I didn't make up my mind this long.

April, 2008

'The' Source Code

If you haven't heard that .Net framework source code is available while debugging under Visual Studio 2008 Professional (may be standard too?) or higher, I suggest you crawl out of the rock you are living under so far.

Specific details about how to set up your environment to enable source level debugging in FX assemblies is here. And it works too. :)

However, what amazes me is that the build tree is even more cryptic than ROTOR. Take a look at the monstrous path to AppDomain.cs.

F:\NetFX Symbols\src\source\FX1434\1.0\DEVDIV\depot\DevDiv\releases\whidbey\REDBITS\ndp\clr\src\BCL\System\AppDomain.cs\7

Yes, the actual .cs file is under <blah blah blah>\AppDomain.cs\7 directory.

[Update: about one hour later]

1- Go to definition does not use this particular source server for whatever reason. Bug filed here.

2- Downloaded source code is not persisted for whatever reason. Suggestion filed here.

March, 2008

The Stupidest Thing I Have Ever Heard

Mind it I hear a lot of stupid things too.

Thank you for your interest in obtaining updates from our site.
To use this site, you must be running Microsoft Internet Explorer 5 or later.
To upgrade to the latest version of the browser, go to the Internet Explorer Downloads website.
If you prefer to use a different web browser, you can obtain updates from the Microsoft Download Center or you can stay up to date with the latest critical and security updates by using Automatic Updates. To turn on Automatic Updates:

  1. Click Start, and then click Control Panel.
  2. Depending on which Control Panel view you use, Classic or Category, do one of the following:
    • Click System, and then click the Automatic Updates tab.
    • Click Performance and Maintenance, click System, and then click the Automatic Updates tab.
  3. Click the option that you want. Make sure Automatic Updates is not turned off.

Problem: IE8 Beta 1. ;)

Of course, I'll be reporting Windows Update as broken.

PS: Apparently, I can't even report Windows Update as broken on Windows XP. It won't let me. ;(

March, 2008

Singularity, finally

The word is: "Singularity is finally out".

Get it from here.

Why The Hell Are You Still Here!

Configuring Updates: Stage 3 of 3 - 100% Complete

Uninstalling Service Pack: Stage 2 of 3 - 100% Complete

Uninstalling Service Pack: Stage 3 of 3 - 100% Complete

Everything 100% complete, yet still on computer screen!

View more entries