Monday, January 30, 2006

Re: Google China

I think Diana Hsieh puts it very eloquently here.

I wish Google had taken a stand and said no to the Chinese Government, but ultimately its their company and they have a right to do what they wish with their search results.

Dinesh.

Friday, January 27, 2006

Google China

Found this article (on yahoo ;-) - Google's Action Makes A Mockery Of Its Values.

You must have heard about Google sensoring their search results to meet China's demands. What dyou think? Once a company goes public, it takes on many more responsibilities. Although an admirable motto - Do No Evil - it was always going to be hard to stick to that when you have to satisfy shareholders. Growth in revenues and profits becomes your number one goal. That is automatically seen as 'evil'. Which is another interesting point... you think a super successful company can ever be seen in a favorable light?

Thursday, January 26, 2006

Re: Another greasemonkey script....

A few minor changes... Instead of an alert, a message is displayed at the top left of the screen for 5 seconds. In the code, the literal "constants" are moved outside of the for loop. The check for presence of both reference and code is moved inside the loop.


// ==UserScript==
// @name Google Analytics Detector
// @namespace http://codeword.blogspot.com
// @description Detects if a page uses Google Analytics
// @include *
// ==/UserScript==

var URL = "http://www.google-analytics.com/urchin.js";
var TRACKER = "urchinTracker()";

var scripts = document.getElementsByTagName( "script" );

var refPresent = false, codePresent = false, log = false;

for ( var i = 0; i < scripts.length; ++i ) {
var script = scripts[ i ];

// Check reference if not already found
if ( !refPresent ) {
var ref = script.src;

if ( ref != null ) {
refPresent = ( ref.search( URL ) != -1 );

if( log )
GM_log( "Tested ref: " + ref + " Result: " + refPresent );
}
}

// Check code if not already found
if ( !codePresent ) {
var code = script.innerHTML;

if ( code != null ) {
codePresent = ( code.search( TRACKER ) != -1 );

if( log )
GM_log( "Tested code: " + code + " Result: " + codePresent );
}
}

if ( refPresent && codePresent ) {
var logo = document.createElement("div");
logo.id = "logo";
logo.innerHTML = '<div style="position: absolute; left: 0px; top: 0px;' +
'border-bottom: 1px solid #000000; margin-bottom: 5px; ' +
'font-size: small; background-color: #000000; z-index: 100;' +
'color: #ffffff; width:200px; opacity: .75;"><p style="margin: 2px 0 1px 0;"> ' +
'<b>Google Analytics enabled</b>' +
'</p></div>';

document.body.insertBefore( logo, document.body.firstChild );

window.setTimeout(
function() {
var logo = document.getElementById( "logo" );
if ( logo ) {
logo.parentNode.removeChild( logo );
}
}
, 5000 );
return;
}
}

Re: Another greasemonkey script....

Here's the first attempt...

// ==UserScript==
// @name Google Analytics Detector
// @namespace http://codeword.blogspot.com
// @description Detects if a page uses Google Analytics
// @include *
// ==/UserScript==

var scripts = document.getElementsByTagName( "script" );

var refPresent = false, codePresent = false;

for ( var i = 0; i < scripts.length; ++i ) {
var script = scripts[ i ];

// Check reference if not already found
if ( !refPresent ) {
var ref = script.src;

if ( ref != null ) {
var URL = "http://www.google-analytics.com/urchin.js";

refPresent = ( ref.search( URL ) != -1 );

GM_log( "Tested ref: " + ref + " Result: " + refPresent );
}
}

// Check code if not already found
if ( !codePresent ) {
var code = script.innerHTML;

if ( code != null ) {
var ACCT = "_uacct";
var TRACKER = "urchinTracker()";

codePresent = ( ( code.search( ACCT ) != -1 ) && ( code.search( TRACKER ) != -1 ) );

GM_log( "Tested code: " + code + " Result: " + codePresent );
}
}
}

if ( refPresent && codePresent ) {
alert( "This smart bastard is using Google Analytics" );
}


Save as analyticsDetector.user.js, open in Firefox and then "Install This User Script..."

Couple things... Besides the code snippet Rahul posted, there is also an external js file that is referenced (http://www.google-analytics.com/urchin.js). I check that both code as well as reference are present. Also in the code, I think "_udn" is optional. It's there on slashdot, but not on codeword, so I don't check for that. Didn't test this very much. Just on codeword, slashdot (detected) and yahoo, microsoft (undetected).

Any improvements?

Wednesday, January 25, 2006

Introduction to Great Design

Joel Spolsky is at it again. He's started a series of articles on design. This one was a bit of deja vu for me. On the flight from Bangalore to Bombay, they made the announcement to switch off all electronic devices. So off goes my cell phone. After landing, I starred at the phone for a minute before giving up and asking Rahul how to turn it on. After reading Joel's article I don't feel like as big a dumbass. How long before we see an Apple cell phone?

Also check This is Broken - "A project to make businesses more aware of their customer experience, and how to fix it". It's a nice site with daily postings on design mistakes seen everywhere.

Tuesday, January 24, 2006

Another greasemonkey script....

I submitted the following as a greasemonkey script (http://userscripts.org) idea proposal

<idea>

Quite a few sites use the Google Analytics service. Sites insert javascript code like -

<script type="text/javascript">
_uacct = "UA-32013-5";
_udn = "slashdot.org";
urchinTracker();
</script>

(The above code is from slashdot ).

A script could be written which shows a simple notification whenever a site visited ; contains Google Analytics javascript.

</idea>

Any takers??

Monday, January 23, 2006

Some free books....

I'm trying to read a bit on Lisp. This interest was spurred by an essay and a podcast by Paul Graham. Dunno how far i'll go... but trying to get a feel of other languages as well.... Also try reading some of his essays.

Basically I got a few books at http://www.freetechbooks.com. You guys could also get something on your topic.

Wednesday, January 18, 2006

Book Reviews

Trying to gauge how good a book before you buy it can be a pretty hard task! Money doesn't exactly grow on trees ;o) One site I have found useful and insanely accurate in terms of their book reviews is www.accu.org. This is primarily a C++ site but they also give reviews for C# and Java.

Before buying any book, I usually run a search through there to see how its rated.

Dinesh.

Modern C++ Design

I would really recommend you to try out "Modern C++ Design by Andrei
Alexandrescu". It is a fantastic book delving deep into C++ Template
Techniques. Its not something a novice can read, but yet if you are
comfortable with C++ templates, then you should definitely give it a
shot!

He opens your eyes to a lot of interesting techniques and in the process
also unravels "Loki", the library (written by him) which implements all
of the techniques!

Policy class, local classes, typelists - the list just goes on, its all
there!! He shows what you can do with even the most simple template
classes viz :-


template<bool>
struct CompileTimeChecker
{
CompileTimeChecker(...) {}
};

template<> struct CompileTimeChecker<false> {};

This relatively simple struct can achieve compile time assertions for
you!

Read it! Its worth it!

Dinesh.

Monday, January 09, 2006

Use that extra bit of vegetable oil at home

This is really one of the most hilarious things I've ever seen -
http://www.tomshardware.com/2006/01/09/strip_out_the_fans/

Keep it cool ;o)

Dinesh.