Archive for July, 2007

Old Doordarshan Advertisements

You from India? Then this is going to be nostalgic. Following is a collection of old advertisements which used to come in our one and only national channel [im talking about late 80’s man!] Doordarshan. 

Talk about the latest pulsar 220cc leading the cc race for Bajaj….but not long before there was a time when good old Bajaj Chetek was the king…Do you remember the then Bajaj ad?…the one which gave an national integrity message….check it out below; for sure will pull up a smile on your  face…

 

And our very old Cadbury’s dairy milk ad…comes on guys now don’t say you forgot this cutie’s skirt….

This was a real horror…..you have spent lot of time forwarding this ad in your cassette player……..it’s the never ending Vicco turmeric ad….   This is very special for me. As a kid I loved this animated cartoon singing and playing around .The Public interest animated ad  Ek Anek ‘.  

And here is the all time famous national integration ad ‘Mile Sur Mera Tumhara‘. It’s a class apart still now.

UPDATE:-

Giant Robot :)

Mile sur mera tumhara

Print out all odd number from 1 to 100 using a for loop!

The very first thought likely to hit will be that of taking mod 2(%2) of numbers from 1 to 100 in a loop and checking whether it yield an remainder or not. But there is even better a way to deal with it.

                 for( unsigned int i = 1; i < = 100; i++ )
                        if( i & 0×00000001 )
                                 cout << i<<” “;

The catch is, only odd number’s binary representation ends with ‘1’.Check the below table

Dec Hex Bin
000 00 00000000
001 01 00000001
002 02 00000010
003 03 00000011
004 04 00000100
005 05 00000101
006 06 00000110
007 07 00000111
008 08 00001000
009 09 00001001
010 0A 00001010
011 0B 00001011
012 0C 00001100
013 0D 00001101
014 0E 00001110
015 0F 00001111

A search engine marketers life

Here in the below video Robert Scoble talks to Jeff Figueiredo, one of the senior search engine marketers at PointIt. Search-Engine-Marketers??? Yup, they are the one who buys millions of keywords from search engine giants Google-MSN-Yahoo for their billion dollar clients. Haven’t you noticed the Google ads coming up along with your Google search results? Who buys these search keywords for their company ads? Check out this new breed of advertisers chasing the keywords you type in your search boxes and the billions they hook up. Hear from him why Microsoft and yahoo struggle in competition with Google at search advertising arena. And he sum up saying….“There’s more dollars in play and Google is getting more of those dollars.”……sounds cooooooooooooooool.

Inside the Googleplex

A short 5 min video inside Google’s Mountainview office. Inspiring as always; this is a good watch. 

 

Some ambiguous virtual function calls ~ Part1

In this article I will be discussing one funny virtual function call.Consider the below code snippet:-

class V
{
      public:
      virtual void f() { }   //Virtual function
};
 
class A : virtual public V
{
      void f() { }           //NON Virtual function
};
 
class B : virtual public V
{
      void f() { }           //NON Virtual function
};
 
class D : public A, public B
{ };
 
int main()
{
  D d;
  V* vptr = &d;
  vptr->f();// which f(), A::f() or B::f()?    
}

 

When you try to compile the above code snippet you will get the following error dumps.

error C2250: ‘D’ : ambiguous inheritance of ‘A::A::f’
error C2250: ‘D’ : ambiguous inheritance of ‘B::B::f’

Let’s analyze this scenario a bit deeper. What I have done is I created a derived class (D) that inherits from two non virtual bases (A,B) that are derived from a virtual base class(V).

     V
    / \
  /     \
A        B
   \     /
     \ /
      D

In short its forms a deadly beautiful diamond with Class V at the top which has a Virtual function f() with two branches formed by class A and B. Both of these classes overrides the virtual function f().Do note that in class A and B the over ridden virtual functions are non virtual. Now Class D inherits class A and B. The issue is when f() is called by an object of D will it call the F() implemented by B(D::B::f)or the one implemented by C(D::C::f).Moral of the story - Never try this :D !

Related Reading:-

Small DAM virus outbreak

You think people are conscious enough to delete spam mails; at least not dump enough to open one and execute a suspicious attachment inside a spam. Check out the following video on F-Secure’s WorldMap Live showing an outbreak early this year, of malware named Small.DAM(a Trojan which comes as attachments in spam emails) which loads a malicious service named “wincom32″  in turn creating backdoors for other malicious activities

This shows how many people are still ready to click on suspicious attachments in emails!

Template specialization

Template specialization

Templates are a great way of generic programming.Generalized set of functions/classes can be used from the STL or you can go create one for yourself.But in every genral situations there might be exceptional or special situatiions in which u want a specialized reaction,not the usual one.To sight an example conside creating a template class string.A class which encapsulate an (char,unicode etc) array with whole spectrum of functions to manupulate it.But consider the situation in which you are going to store arabic string in the same :).Dont forget arabs read/write from right-to-left and imagin a situation in which our dear arab says insert at position 0 like String::Append(0,arb) will it insert at the left ya right.So in situations like this we need specialized templates which accompanies the main template to deal with special situations like this.

Let see how this string template will loook like withe the specialization for arabic languages

template<class E>
class String
{
Public:
   E GetAt( int nIndex ) const  {    //General:for languages written from right to left }
   void SetAt( int nIndex, E ch ){     …    }
 .
 . 
};

template<>
class String<Arabic>
{
Public:
  Arabic GetAt( int nIndex ) const   {   //Special case:for languages written from left to right}
  void SetAt( int nIndex, Arabic ch ){     …           }
 .
 . 
};

Do note the empty ‘<>’ after keyword ‘template’ and in the next line <Arabic> tag  affixed with class name String.

Reference to Pointers

Have you ever come across declarations like int* &var. I guess you last spotted it in one of your framework function definition. This little code is called a reference to a pointer. To understand what it means all you need to know is what exactly is the difference between a ‘reference’ and ‘pointer’. For that purpose this example of reference to a variable will help

void swap(int& i, int& j)
  {
       int tmp = i;
       i = j;
       j = tmp;
  }
 
 int main()
  {
       int x, y;
      

       swap(x,y);
      

  }

Here i and j are aliases for main’s x and y respectively. In other words, i is x — not a pointer to x, nor a copy of x, but x itself. Anything you do to i gets done to x, and vice versa. In case of pointers it’s a separate ‘pointer variable’ which points to ‘our variable’. If u change the pointer variable value noting happens to the variable it points to. So as Marshall Cline says ‘please do not think of a reference as a funny looking pointer to an object’ 

Now you know what exactly a reference is; just think of a reference to a pointer. Its simply is the reference for the pointer variable;just a new name for our old pointer.

Bill Gates no longer the “world’s richest man”

After 13 years of dominance Bill Gates is no longer the world’s richest man, having been surpassed by Mexican telecommunications giant Carlos Slim, according to an estimate by a Mexican financial publication. Bill Gates who’s estimated currently at $59.2 billion, has been surpassed by Slim as his telecommunication company, American Movil, whose shares recently surged in price by 27%, boosting his net worth to $67.8 billion.But is he good enough to give Bill Gates a tough run in this billion$ race? I don’t think so….shares bloom then fades. 


 

July 2007
S M T W T F S
« Jun   Aug »
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

Blog Stats

  • 29,660 hits

Last 100 Visitors

Map IP Address

Map IP Address