Skip to content
June 3, 2010 / raJkumar S

Chrome Tips

Access History, Downloads, Extension and Bookmark right from your Bookmarks bar in Chrome. Below are the steps to add download page.

  1. Use Ctrl + J to open download page in Chrome or open chrome://downloads/,
  2. Click star icon on the address bar and add the bookmark to bookmarks bar,
  3. Make the bookmarks bar visible using Ctrl+Shift+B or “Wrench icon –> Always show bookmarks bar” (make the bar visible in case the bar is invisible),
  4. For History and Extension page use chrome://history/   chrome://extensions/ ,
  5. For Bookmarks Manager open the bookmarks manager using “Wrench –> Bookmarks Manager” , though the address bar is empty you can bookmark the page using STAR icon on address bar to Bookmarks Bar folder as show in image above. Note: Latest builds from Chrome show bookmarks in a tab page, if you get a dialog of bookmarks manager wait for the feature to be released in stable or grab the beta.

Make the address bar (omni bar) little more intelligent by importing and syncing delicious bookmarks to Chrome bookmarks.

  1. Install delicious chrome extension from delicious.com .
  2. ” Enable syncing of bookmarks”  in Delicious extension option menu.

Turn web into your personal music player with Extension FM

Get infinitely long web pages with AutoPagerize

May 27, 2010 / raJkumar S

The usual but unusual arithmetic conversion.

Its been a year since one of my colleague encountered this usual but unusual arithmetic conversion. Just go through the below c++ code.

	    main(){
		 int a_variable = 2010;
		 if (true == a_variable ){
			cout<<"I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing.";
		 }
	    }

Do you see the quote as output? If you think you will, continue reading.

The condition true == a_variable will be true only when a_variable is 1.
Stroustrup explains why the expression true == a_variables return true only when a_variable is ‘1’ by the rule “the usual arithmetic conversion”,the rule says the overall aim is to produce a result of the “largest operand type”: if a binary operator has a floating-point/long operand, all other operands are converted to floating-point/long and the operation is applied.
For any operands that are smaller than an int (say char, bool) is first converted in to an int before the operation is applied. So in our case true being a bool it is first converted to int i.e., 1 then compared with a_variable. So the expression return true only if and only if a_variable is 1.

But if you want true == a_variable true for all non zero values, do a explicit conversion of a_variable to bool i.e., bool(a_variable).

           main(){
			 int a_variable = 2010;
			 if (true == bool(a_variable) ){
				cout<<"I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing.";
			 }
			}

Don’t get alarmed that c++ does things unexpected but pay attention to the compiler warnings.
warning C4805: ‘==’ : unsafe mix of type ‘bool’ and type ‘int’ in operation

Further reading
What the stackoverflow says about it
Integral Promotion