Posts Tagged google

Viacom vs. google

Well, actually, I just want to test video embedding. This clip is pretty
funny anyway.

Tags:

The Chariman of Google

They must forget to google search “Chariman Schmidt”.
See also “Look up Chariman”.

This video about “googleTube” is fun too.

Tags: ,

Code Snippet for Converting Longitude and Latitude to Google Image Tiles URI

This function in javascript returns the X and Y used to fetch google map tiles by giving the longitude and latitude.

function getXYfromLatLon(lat, lon, zoomLevel) {
  var lon = 180.0 + lon;
  var x = Math.floor( (lon / 360.0) * 131072 ); /* 2^17 = 131072 */
  x >>= zoomLevel;

  var lat = lat / 180.0 * 3.1415926
  var y = Math.PI - 0.5 * Math.log((1+Math.sin(lat))/(1-Math.sin(lat)))
  y = Math.floor( (y / 2 / Math.PI) * 131072 );
  y >>= zoomLevel;
  return new Array(x,y);
}

This function returns the string used to fetch the satellite image tiles by give the X and Y from the getXYfromLatLon().

function getImageTileStrFromXY(x, y, zoomLevel) {
    var quarter2letter = new Array("q","r","t","s");
    var rtnStr = "t"
    for (i=16-zoomLevel; i>=0; i--) {
        var quarter =
        (x & (1 < < i)) >> i | ( ((y & (1 < < i)) >> i) < < 1 );
        rtnStr += quarter2letter[quarter];
    }
    return rtnStr;
}

Simple usage:

<script language="javascript">
var lon = -122;
var lat = 37;
var zl =3;

var XY = getXYfromLatLon(lat, lon, zl);
document.getElementById('img1').src=
"http://mt0.google.com/mt?v=w2.61&x="+XY[0]+"&y="+XY[1]+"&zoom="+zl;

var tileStr = getImageTileStrFromXY(XY[0], XY[1], zl);
document.getElementById('img2').src=
"http://kh0.google.com/kh?&v=20&t="+tileStr;
</script>

Tags: , , ,

More on google map image tiles

Lat (-90 ~ 90):
Lon (-180 ~ 180):
Zoom (0-17):


bless all mighty google
bless all mighty google

This is another google map hack. I will write some details about this in the furture. In the mean time, you can also check this out. If you are interested in my source code for this hack, you probably know how to get it anyway.

Tags: ,

Block web ad

We are living in a world where ads are everywhere. With powerful servers, web advertisement is ubiquitous. Unfortunately, I think they are too intrusive most of time. So, it is generally a good idea to disable the online ads. For a free solution, there are several common techniques. First, figure the ad servers’ IP, and use /etc/hosts to send the ad request call into void. Second, use a userContent.css to filter out ads. For example, if you don’t like the Google ads. You can put the following lines in your /etc/hosts (for OS X or other unix).

127.0.0.1   pagead.googlesyndication.com
127.0.0.1   pagead2.googlesyndication.com
127.0.0.1   domains.googlesyndication.com
127.0.0.1   googlesyndication.com
127.0.0.1   www.google-analytics.com
127.0.0.1   partner.googleadservices.com

For OS X, you will need to use the Terminal.app to run the command lookupd -flushcache to re-flush the DNS cache.

Now, with this setup, I am free from all mighty Google ads. You can do the same to block other ad providers. Combined with the userContent.css, I have regain the nice web browsing experience without the interferences from ads.

I also find out that the Safari plugin SafariBlock can block images and flash ads in a convenient way. Moreover, it can also block specific javascripts although you might have to type the URL pointing to the javascript in SafariBlock’s preferences by yourself. For example, you can block the annoying in-text pop-out type ads from Intellitext by putting a new rule in the SafariBlock preferences to block out the URL ‘http://*.intellitxt.com/*.js’. This will block all javascript from Intellitext without disabling javascript totally.

Tags: ,

Do No Evil? Huh?

Taiwan is not a province of China, at least, not a province of “The Peoples’ Republic of China” now. The PROC government as the China government you know today never governs Taiwan for one second. It is a lie. While the current status of Taiwan might be a complicated issue (1) (2) (3) mostly because of this propaganda by the Chinese government, but the truth is “Taiwan is NOT a province of China (PROC)” currently.

Google, let me remind you your motto “Do No Evil”. Please believe in your motto, even you want some pie of the big profit in China.

200510041104

Tags: , ,