<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: google code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 16 May 2008 18:35:04 GMT</pubDate>
    <description>DZone Snippets: google code</description>
    <item>
      <title>google / urchin analytics</title>
      <link>http://snippets.dzone.com/posts/show/5194</link>
      <description>what up with this style of google analytics implementation?&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;body onload="_uacct='UA-XXXXXX-X';urchinTracker();init();"&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 02 Mar 2008 22:55:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5194</guid>
      <author>jm3 (john manoogian III)</author>
    </item>
    <item>
      <title>Add a Google custom search facility to your website</title>
      <link>http://snippets.dzone.com/posts/show/4951</link>
      <description>This HTML page displays a basic search page similar to http://www.google.com/ however this search page will only search for results from http://snippets.dzone.com.  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;abc&lt;/title&gt;&lt;br /&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset: UTF-8" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;    &lt;form action="http://www.google.com/search"&gt;&lt;br /&gt;      &lt;div&gt;&lt;input name="query" type="hidden" value="site:snippets.dzone.com"&gt;&lt;/input&gt;&lt;/div&gt;&lt;br /&gt;      &lt;div&gt;&lt;input maxlength="2048" name="q" size="55" title="Google Search" value="" &gt;&lt;/input&gt;&lt;/div&gt;&lt;br /&gt;      &lt;div&gt;&lt;input name="btnG" type="submit" value="Google Search"&gt;&lt;/input&gt;&lt;/div&gt;&lt;br /&gt;    &lt;/form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I stumbled across the hidden query field while I was looking for ways to perform custom search without the need for JavaScript. If you are interested in Google's official custom search engine on your site go to http://www.google.com/cse&lt;br /&gt;&lt;br /&gt;* update 8-Jan-08 2:01pm *&lt;br /&gt;Here's a more advanced example from someone's blog titled 'Fine-tuning Custom Google Search' http://snipr.com/1wppb [blogs.salon.com]&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;FORM method=GET action=http://www.google.com/custom&gt;;&lt;br /&gt;&lt;A HREF=http://www.google.com/search&gt;;&lt;br /&gt;&lt;IMG SRC=http://www.google.com/logos/Logo_40wht.gif border=0 ALT=Google align=middle&gt;&lt;/A&gt; &lt;INPUT TYPE=text name=q size="10" maxlength=255 value=""&gt;&lt;br /&gt;&lt;INPUT type=submit name=sa VALUE="Just Goog It!"&gt;&lt;br /&gt;&lt;INPUT type=hidden name=cof VALUE="GIMP:darkblue;LW:380;ALC:red;L:http://blogs.salon.com/0001111/images/rfbanner.jpg;GFNT:lightblue;LC:red;LH:100;AH:left;VLC:gray;S:http://blogs.salon.com/0001111/;GALT:blue;AWFID:ba6ecf243ae3d16f;"&gt;&lt;br /&gt;&lt;br /&gt;&gt;span class="small"&gt;&lt;br /&gt;&lt;input type=radio name=sitesearch value="blogs.salon.com" checked&gt;Search blogs.salon.com&lt;br /&gt;&lt;input type=radio name=sitesearch value=""&gt;Search the Web&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/FORM&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 06 Jan 2008 13:48:50 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4951</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Google Analytics</title>
      <link>http://snippets.dzone.com/posts/show/4933</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://www.google-analytics.com/urchin.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;_uacct = "MY-KEY";&lt;br /&gt;urchinTracker();&lt;br /&gt;--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;src:&lt;/a&gt;&lt;a href="http://www.tai-do.com/"&gt;ab-d&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sun, 30 Dec 2007 15:10:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4933</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>jQuery Maps Interface - Easily create Google or Yahoo maps</title>
      <link>http://snippets.dzone.com/posts/show/4361</link>
      <description>/* jQuery Maps (jmaps) - A jQuery plugin for Google Maps API&lt;br /&gt; * Author: Tane Piper (digitalspaghetti@gmail.com) &lt;br /&gt; * With special thanks Dave Cardwell (who helped on getting the first version of this plugin to work).&lt;br /&gt; * Website: http://code.google.com/p/gmapp/&lt;br /&gt; * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php&lt;br /&gt; * This plugin is not affiliated with Google or Yahoo.  &lt;br /&gt; * For Google Maps API and T&amp;C see http://www.google.com/apis/maps/&lt;br /&gt; * For Yahoo! Maps API and T&amp;C see http://developer.yahoo.com/maps/&lt;br /&gt; * &lt;br /&gt; * === Changelog ===&lt;br /&gt; * Version 1.3&lt;br /&gt; * Added support for creating Yahoo! Maps, can create Map, Satallite or Hybrid.  Check out available options below&lt;br /&gt; * Added support for creating points on Yahoo! maps.&lt;br /&gt; * Added support for creating Polylines on Yahoo! maps.&lt;br /&gt; * Added support for GeoRSS files on both Yahoo! and Google maps, as well as existing KML support for Google, method&lt;br /&gt; * name was changed from .addKml to .addRss&lt;br /&gt; * Moved directions search out of main namespace, now function that is called from within plugin by providing fields&lt;br /&gt; * &lt;br /&gt; * Version 1.2 (25/07/2007)&lt;br /&gt; * Moved GClientGeocoder into searchAddress method&lt;br /&gt; * Fixed bug in searchAddress method regarding getPoint().&lt;br /&gt; * &lt;br /&gt; * Version 1.1 (16/07/2007)&lt;br /&gt; * Changed name to remove Google from main name - namespace now .jmap.&lt;br /&gt; * Added additional options:&lt;br /&gt; * 	+ Add map dragging enable/disable.&lt;br /&gt; *	+ Add scroll wheel zooming.&lt;br /&gt; *	+ Add smooth continuous zooming (on certain browsers).&lt;br /&gt; *	+ Added clean unloading of Google objects.&lt;br /&gt; * Added .addPoly method.  Allows the creation of polylines on the map.&lt;br /&gt; * Added .addKml support for rendering KML Files.&lt;br /&gt; * Added .directions Driving Direction support.&lt;br /&gt; * &lt;br /&gt; * Version 1.0 (13/07/2007)&lt;br /&gt; * Initial version.&lt;br /&gt; * Creates Google Map.&lt;br /&gt; * Add points to map.&lt;br /&gt; * Takes address or postcode, Geocodes and centers map.  Also creates a draggable marker.&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;(function($) {&lt;br /&gt;	/* function searchAddress(jmap, address, settings)&lt;br /&gt;	 * This function is an internal plugin method that returns a GLatLng that can be passed&lt;br /&gt;	 * to a Google map.&lt;br /&gt;	 */&lt;br /&gt;	function searchAddress(jmap, address, settings) {&lt;br /&gt;		&lt;br /&gt;		if (jmap._mapType) {&lt;br /&gt;			alert('Yahoo Maps Geocoding not yet supported');&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		if (jmap.i.Au) {&lt;br /&gt;			GGeocoder = new GClientGeocoder();&lt;br /&gt;			GGeocoder.getLatLng(address, function(point){&lt;br /&gt;				if (!point) {&lt;br /&gt;					alert(address + " not found");&lt;br /&gt;				} else {&lt;br /&gt;					jmap.setCenter(point,settings.zoom);&lt;br /&gt;					var marker = new GMarker(point, {draggable: true});&lt;br /&gt;					jmap.addOverlay(marker);&lt;br /&gt;					pointlocation = marker.getPoint();&lt;br /&gt;					marker.openInfoWindowHtml("Latitude: " + pointlocation.lat() + "&lt;br /&gt;Longitude: " + pointlocation.lng());&lt;br /&gt;					GEvent.addListener(marker, "dragend", function(){&lt;br /&gt;						mylocation = marker.getPoint();&lt;br /&gt;						marker.openInfoWindowHtml("Latitude: " + pointlocation.lat() + "&lt;br /&gt;Longitude: " + pointlocation.lng());			&lt;br /&gt;					});&lt;br /&gt;				}&lt;br /&gt;			});&lt;br /&gt;		}	&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	/* directions: function(map,query, panel)&lt;br /&gt;	 * Takes a Direction query and returns directions for map.  Optional panel for text information&lt;br /&gt;	 */&lt;br /&gt;	function searchDirections(jmap,query,panel) {&lt;br /&gt;		// Yahoo Maps&lt;br /&gt;		if (jmap._mapType) {&lt;br /&gt;			alert('Yahoo Directions support not yet added')	;&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		// Google Maps&lt;br /&gt;		if (jmap.i.Au) {&lt;br /&gt;			var dirpanel = document.getElementById(panel);&lt;br /&gt;			directions = new GDirections(jmap, dirpanel);&lt;br /&gt;			directions.load(query);&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	$.fn.extend({&lt;br /&gt;	/* jmap: function(settings)&lt;br /&gt;	 * The constructor method&lt;br /&gt;	 * Example: $().jmap();&lt;br /&gt;	 */&lt;br /&gt;	jmap: function(settings) {&lt;br /&gt;		var version = "1.3";&lt;br /&gt;		/* Default Settings*/	&lt;br /&gt;		var settings = jQuery.extend({&lt;br /&gt;			provider: "google",		// can be "google" or "yahoo"&lt;br /&gt;			maptype: "hybrid",		// can be "map", "sat" or "hybrid"&lt;br /&gt;			center: [55.958858,-3.162302],	// G + Y&lt;br /&gt;			zoom: 12,				// G + Y&lt;br /&gt;			controlsize: "small",	// G + Y&lt;br /&gt;			showtype: true,			// G + Y&lt;br /&gt;			showzoom: true,			// Y&lt;br /&gt;			showpan: true,			// Y&lt;br /&gt;			showoverview: true,		// G&lt;br /&gt;			showscale: true,		// Y&lt;br /&gt;			dragging: true,			// G + Y&lt;br /&gt;			scrollzoom: true,		// G + Y&lt;br /&gt;			smoothzoom: true,		// G&lt;br /&gt;			searchfield: "#Address",&lt;br /&gt;			searchbutton: "#findaddress",&lt;br /&gt;			directionsto: "#to",&lt;br /&gt;			directionsfrom: "#from",&lt;br /&gt;			directionsfind: "#getDirections",&lt;br /&gt;			directionspanel: "myDirections"&lt;br /&gt;		},settings);&lt;br /&gt;		&lt;br /&gt;		return this.each(function(){&lt;br /&gt;			switch(settings.provider)&lt;br /&gt;			{&lt;br /&gt;				case "yahoo":&lt;br /&gt;					var jmap = this.jMap = new YMap(this);&lt;br /&gt;					switch(settings.maptype) {&lt;br /&gt;						case "map":&lt;br /&gt;							var loadmap = YAHOO_MAP_REG;&lt;br /&gt;							break;&lt;br /&gt;						case "sat":&lt;br /&gt;							var loadmap = YAHOO_MAP_SAT;&lt;br /&gt;							break;&lt;br /&gt;						default:&lt;br /&gt;							var loadmap = YAHOO_MAP_HYB;&lt;br /&gt;							break;&lt;br /&gt;					}&lt;br /&gt;					jmap.setMapType(loadmap);&lt;br /&gt;					jmap.drawZoomAndCenter(new YGeoPoint(settings.center[0],settings.center[1]), settings.zoom);&lt;br /&gt;					if (settings.showtype == true){&lt;br /&gt;						jmap.addTypeControl();	// Type of map Control&lt;br /&gt;					}&lt;br /&gt;					if (settings.showzoom == true &amp;&amp; settings.controlsize == "small" ){&lt;br /&gt;						jmap.addZoomShort();	// Small zoom control&lt;br /&gt;					}&lt;br /&gt;					if (settings.showzoom == true &amp;&amp; settings.controlsize == "large" ){&lt;br /&gt;						jmap.addZoomLong();		// Large zoom control&lt;br /&gt;					}&lt;br /&gt;					if (settings.showpan == true) {&lt;br /&gt;						jmap.addPanControl();	// Pan control&lt;br /&gt;					}&lt;br /&gt;					if (settings.showscale == false) {&lt;br /&gt;						/* On by default */&lt;br /&gt;						jmap.removeZoomScale();	// Show scale bars&lt;br /&gt;					}&lt;br /&gt;					if (settings.dragging == false) {&lt;br /&gt;						/* On by default */&lt;br /&gt;						jmap.disableDragMap();	// Is map draggable?&lt;br /&gt;					}&lt;br /&gt;					if (settings.scrollzoom == false) {&lt;br /&gt;						/* On by default */&lt;br /&gt;						jmap.disableKeyControls(); // Mousewheel and Keyboard control&lt;br /&gt;					}&lt;br /&gt;					break;&lt;br /&gt;					&lt;br /&gt;				case "mslive":&lt;br /&gt;					alert('Microsoft Live Maps are currently not supported but planned for version 1.4')&lt;br /&gt;					break;&lt;br /&gt;					&lt;br /&gt;				default:	&lt;br /&gt;					var jmap = this.jMap = new GMap2(this);&lt;br /&gt;					switch(settings.maptype) {&lt;br /&gt;						case "map":&lt;br /&gt;							var loadmap = G_NORMAL_MAP;&lt;br /&gt;							break;&lt;br /&gt;						case "sat":&lt;br /&gt;							var loadmap = G_SATELLITE_MAP;&lt;br /&gt;							break;&lt;br /&gt;						default:&lt;br /&gt;							var loadmap = G_HYBRID_MAP;&lt;br /&gt;							break;&lt;br /&gt;					}&lt;br /&gt;					jmap.setCenter(new GLatLng(settings.center[0],settings.center[1]),settings.zoom,loadmap);&lt;br /&gt;					switch(settings.controlsize)&lt;br /&gt;					{&lt;br /&gt;						case "small":&lt;br /&gt;							jmap.addControl(new GSmallMapControl());&lt;br /&gt;							break;&lt;br /&gt;						case "large":&lt;br /&gt;							jmap.addControl(new GLargeMapControl());&lt;br /&gt;							break;&lt;br /&gt;						case "none":&lt;br /&gt;							break;&lt;br /&gt;						default:&lt;br /&gt;							jmap.addControl(new GSmallMapControl());&lt;br /&gt;					}&lt;br /&gt;					if (settings.showtype == true){&lt;br /&gt;						jmap.addControl(new GMapTypeControl());&lt;br /&gt;					}&lt;br /&gt;					if (settings.showoverview == true){&lt;br /&gt;						jmap.addControl(new GOverviewMapControl());&lt;br /&gt;					}&lt;br /&gt;					if (settings.scrollzoom == true) {&lt;br /&gt;						/* Off by default */&lt;br /&gt;						jmap.enableScrollWheelZoom();&lt;br /&gt;					}&lt;br /&gt;					if (settings.smoothzoom == true) {&lt;br /&gt;						/* Off by default*/&lt;br /&gt;						jmap.enableContinuousZoom();&lt;br /&gt;					}&lt;br /&gt;					if (settings.dragging == false) {&lt;br /&gt;						/* On by default */&lt;br /&gt;						jmap.disableDragging();&lt;br /&gt;					}&lt;br /&gt;			}	&lt;br /&gt;			/* Seach for the lat &amp; lng of our address*/&lt;br /&gt;			jQuery(settings.searchbutton).bind('click', function(){&lt;br /&gt;				searchAddress(jmap, jQuery(settings.searchfield).attr('value'), settings);&lt;br /&gt;			});&lt;br /&gt;			/* Search for Directions */&lt;br /&gt;			jQuery(settings.directionsfind).bind("click", function(){&lt;br /&gt;				var from = $(settings.directionsfrom).attr('value');&lt;br /&gt;				var to = $(settings.directionsto).attr('value');&lt;br /&gt;				searchDirections(jmap, "from: " + from + " to: " + to, settings.directionspanel);	&lt;br /&gt;				$(settings.directionsfrom).attr('value', to);&lt;br /&gt;				$(settings.directionsto).attr('value', '');&lt;br /&gt;				return false;&lt;br /&gt;			});&lt;br /&gt;			/* On document unload, clean unload Google API*/&lt;br /&gt;			jQuery(document).unload(function(){ GUnload(); });&lt;br /&gt;		});&lt;br /&gt;		},&lt;br /&gt;	/* myMap: function()&lt;br /&gt;	 * Returns a map object from the API, so it's available to the user&lt;br /&gt;	 * Example: $().myMap().setCenter(...) for Google;&lt;br /&gt;	 * Example: $().myMap().drawZoomAndCenter(...) for Yahoo;&lt;br /&gt;	 */&lt;br /&gt;	myMap: function() {&lt;br /&gt;		return this[0].jMap;	&lt;br /&gt;	},&lt;br /&gt;	/* addPoint: function()&lt;br /&gt;	 * Returns a marker to be overlayed on the Google map&lt;br /&gt;	 * Example: $().addPoint(...);&lt;br /&gt;	 */&lt;br /&gt;	addPoint: function(pointlat, pointlng, pointhtml, isdraggable, removable) {&lt;br /&gt;		var jmap = this[0].jMap;&lt;br /&gt;		// Yahoo Maps&lt;br /&gt;		if (jmap._mapType) {			&lt;br /&gt;			var marker = new YMarker(new YGeoPoint(pointlat, pointlng));	// Create the Yahoo marker type&lt;br /&gt;			YEvent.Capture(marker, EventsList.MouseClick, function(){		// Add mouseclick to open HTML&lt;br /&gt;				marker.openSmartWindow(pointhtml);&lt;br /&gt;			});&lt;br /&gt;			// Below code does not work as expected&lt;br /&gt;			/*if (removable == true) {&lt;br /&gt;				YEvent.Capture(marker, EventsList.MouseDoubleClick, function(){&lt;br /&gt;					jmap.removeOverlay(marker);&lt;br /&gt;				});&lt;br /&gt;			}*/&lt;br /&gt;			jmap.addOverlay(marker);	// Add marker to map&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		// Google Maps	&lt;br /&gt;		if (jmap.i.Au) {&lt;br /&gt;			var marker = new GMarker(new GLatLng(pointlat,pointlng), { draggable: isdraggable } );&lt;br /&gt;			GEvent.addListener(marker, "click", function(){&lt;br /&gt;				marker.openInfoWindowHtml(pointhtml);&lt;br /&gt;			});&lt;br /&gt;			if (removable == true) {&lt;br /&gt;				GEvent.addListener(marker, "dblclick", function(){&lt;br /&gt;					return jmap.removeOverlay(marker);&lt;br /&gt;				});&lt;br /&gt;			}&lt;br /&gt;			return jmap.addOverlay(marker);&lt;br /&gt;		}&lt;br /&gt;	},&lt;br /&gt;	/* addPoly: function(poly)&lt;br /&gt;	 * Takes an array of GLatLng points, converts it to a vector Polyline to display on the map&lt;br /&gt;	 * Example: $().addPoly(...);&lt;br /&gt;	 */&lt;br /&gt;	addPoly: function (poly, colour, width, alpha) {&lt;br /&gt;		var jmap = this[0].jMap;&lt;br /&gt;		// Yahoo Maps&lt;br /&gt;		if (jmap._mapType) {&lt;br /&gt;			return	jmap.addOverlay(poly, colour, width, alpha);&lt;br /&gt;		}&lt;br /&gt;		// Google Maps&lt;br /&gt;		if (jmap.i.Au) {&lt;br /&gt;			return jmap.addOverlay(poly);&lt;br /&gt;		}&lt;br /&gt;	},&lt;br /&gt;	/* addRss: function()&lt;br /&gt;	 * Takes a KML file and renders it to the map.&lt;br /&gt;	 * Example: $().addPoint(...);&lt;br /&gt;	 */&lt;br /&gt;	addRss: function (rssfile) {&lt;br /&gt;		var jmap = this[0].jMap;&lt;br /&gt;		// Yahoo Maps&lt;br /&gt;		if (jmap._mapType) {&lt;br /&gt;			var geoXml = new YGeoRSS(rssfile);&lt;br /&gt;			return jmap.addOverlay(geoXml);&lt;br /&gt;		}&lt;br /&gt;		// Google Maps&lt;br /&gt;		if (jmap.i.Au) {&lt;br /&gt;			var geoXml = new GGeoXml(rssfile);&lt;br /&gt;			return jmap.addOverlay(geoXml);&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;});&lt;br /&gt;})(jQuery);&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 27 Jul 2007 11:52:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4361</guid>
      <author>digitalspaghetti (Tane Piper)</author>
    </item>
    <item>
      <title>Google translate bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/4264</link>
      <description>Here's perhaps the most powerful bookmarklet I've ever created ...&lt;br /&gt;This one translates the current web page from your current browser session into another language!&lt;br /&gt;&lt;br /&gt;Syntax from the address bar in your FF or Opera browser:&lt;br /&gt;&lt;code&gt;&lt;br /&gt; tr &lt;FROM&gt;|&lt;TO&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;code&gt;&lt;br /&gt; tr en|de&lt;br /&gt; tr en|fr&lt;br /&gt; tr en|pt&lt;br /&gt; tr de|en&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here's the bookmarklet code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&amp;langpair=%s&amp;hl=EN&amp;ie=UTF-8&amp;oe=UTF-8&amp;prev=%2Flanguage_tools'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;FF instructions:&lt;br /&gt;Copy/paste the code in a new bookmark. Then, in the new bookmark properties, edit the keyword/shortcut field and insert 'tr'. That's it!&lt;br /&gt;&lt;br /&gt;Opera instructions:&lt;br /&gt;Copy the bookmarklet code. Then, in tools--&gt;preferences--&gt;search--&gt;add--&gt;details, paste the code in the address field, fill in a name for in the name field, and write 'tr' in the keyword field. Then save all. That's it!</description>
      <pubDate>Thu, 05 Jul 2007 17:25:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4264</guid>
      <author>griflet (guillaume riflet)</author>
    </item>
    <item>
      <title>Scraping Google Search Results with Hpricot</title>
      <link>http://snippets.dzone.com/posts/show/4133</link>
      <description>// snagged from http://g-module.rubyforge.org/&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'rubygems'&lt;br /&gt;require 'cgi'&lt;br /&gt;require 'open-uri'&lt;br /&gt;require 'hpricot'&lt;br /&gt;&lt;br /&gt;q = %w{meine kleine suchanfrage}.map { |w| CGI.escape(w) }.join("+")&lt;br /&gt;url = "http://www.google.com/search?q=#{q}"&lt;br /&gt;doc = Hpricot(open(url).read)&lt;br /&gt;lucky_url = (doc/"div[@class='g'] a").first["href"]&lt;br /&gt;system 'open #{lucky_url}'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 13 Jun 2007 00:29:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4133</guid>
      <author>sikelianos (Zeke Sikelianos)</author>
    </item>
    <item>
      <title>How to send IM jabber message to google chat using python and xmppy</title>
      <link>http://snippets.dzone.com/posts/show/3986</link>
      <description>// From http://www.franklinmint.fm/blog/archives/000603.html&lt;br /&gt;// This works with version xmpppy-0.4.0.win32.exe from http://xmpppy.sourceforge.net/&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import sys,xmpp&lt;br /&gt;&lt;br /&gt;# Google Talk constants&lt;br /&gt;FROM_GMAIL_ID = "user@gmail.com"&lt;br /&gt;GMAIL_PASS = "password"&lt;br /&gt;GTALK_SERVER = "talk.google.com"&lt;br /&gt;TO_GMAIL_ID = "user@gmail.com"&lt;br /&gt;&lt;br /&gt;jid=xmpp.protocol.JID(FROM_GMAIL_ID)&lt;br /&gt;cl=xmpp.Client(jid.getDomain(),debug=[])&lt;br /&gt;if not cl.connect((GTALK_SERVER,5222)):&lt;br /&gt;    raise IOError('Can not connect to server.')&lt;br /&gt;if not cl.auth(jid.getNode(),GMAIL_PASS):&lt;br /&gt;    raise IOError('Can not auth with server.')&lt;br /&gt;&lt;br /&gt;cl.send( xmpp.Message( "someone@gmail.com" ,"Hi" ) )&lt;br /&gt;cl.disconnect()&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 10 May 2007 21:55:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3986</guid>
      <author>mellerbeck (Michael Ellerbeck)</author>
    </item>
    <item>
      <title>Get Google maps informations (distance and time, French version)</title>
      <link>http://snippets.dzone.com/posts/show/3964</link>
      <description>Here a little script to get time and distance between two towns with google maps. You can change "voiture" by your langage word "car", or anything else.&lt;br /&gt;&lt;br /&gt;this is a command line version : # ruby myscript.rb "Lyon" "Paris"&lt;br /&gt;You can easily change it for a Ruby on Rails project :)&lt;br /&gt;Maybie we can upgrade this script using regexp.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require "open-uri"&lt;br /&gt;require "cgi"&lt;br /&gt;&lt;br /&gt;# Command line arguments ... &lt;br /&gt;$*.each {|argu| argu.gsub!("\"","")}&lt;br /&gt;# Defaults towns&lt;br /&gt;src = "Lyon"&lt;br /&gt;dest = "Paris"&lt;br /&gt;# If we have fill two aguments ...&lt;br /&gt;if $*.size == 2 then&lt;br /&gt;        src = $*[0]&lt;br /&gt;        dest = $*[1]&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;html = ""&lt;br /&gt;url = "http://maps.google.com/maps?f=d&amp;hl=fr&amp;saddr=" + CGI.escape(src) + "&amp;daddr="+ CGI.escape(dest)&lt;br /&gt;# Read the html page&lt;br /&gt;open(url) {|f|&lt;br /&gt;        f.each_line {|line| html += line}&lt;br /&gt;}&lt;br /&gt;pos1 = html.index("voiture") # French version&lt;br /&gt;pos2 = html.index("&lt;/td&gt;",pos1) unless pos1 == nil&lt;br /&gt;pos1 = html.index("&gt;",pos2+6)+1 unless pos2 == nil&lt;br /&gt;pos2 = html.index("&lt;/td&gt;",pos2+1) -1 unless pos2 == nil&lt;br /&gt;ret = ""&lt;br /&gt;if pos1 != nil and pos2 != nil&lt;br /&gt;        ret = html[pos1..pos2].gsub!("&amp;#160;", " ")&lt;br /&gt;else&lt;br /&gt;        ret = "0"&lt;br /&gt;end&lt;br /&gt;html = nil&lt;br /&gt;p ret&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 08 May 2007 14:03:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3964</guid>
      <author>sooli (BONNAURE)</author>
    </item>
    <item>
      <title>IP Location on Google Maps</title>
      <link>http://snippets.dzone.com/posts/show/3814</link>
      <description>/*&lt;br /&gt;Example of usage:&lt;br /&gt;$ ./lip.rb snippets.dzone.com&lt;br /&gt;. Hostname: snippets.dzone.com&lt;br /&gt;. Country Code: US&lt;br /&gt;. Country Name: United States&lt;br /&gt;. Region: CA&lt;br /&gt;. Region Name: California&lt;br /&gt;. City: Los Angeles&lt;br /&gt;. Postal Code: 90017&lt;br /&gt;. Latitude: 34.0530&lt;br /&gt;. Longitude: -118.2642&lt;br /&gt;. ISP: CoreExpress&lt;br /&gt;. Organization: CoreExpress&lt;br /&gt;. Metro Code: 803&lt;br /&gt;. Area Code: 213&lt;br /&gt;. Google Maps URL: http://maps.google.com/maps?q=34.0530,+-118.2642&amp;iwloc=A&amp;hl=en&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby -w&lt;br /&gt;&lt;br /&gt;if ARGV.empty?&lt;br /&gt;  puts &lt;&lt;-T&lt;br /&gt;Locate IP by haqu&lt;br /&gt;usage: ./lip.rb ip|domain ...&lt;br /&gt;  T&lt;br /&gt;  exit&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;require 'net/http'&lt;br /&gt;require 'uri'&lt;br /&gt;&lt;br /&gt;uri = URI.parse('http://www.maxmind.com/app/locate_ip')&lt;br /&gt;res = Net::HTTP.post_form(uri,&lt;br /&gt;  { 'ips' =&gt; ARGV.join(' '),&lt;br /&gt;    'type' =&gt; '', 'u' =&gt; '', 'p' =&gt; ''&lt;br /&gt;  } )&lt;br /&gt;fstr = res.body&lt;br /&gt;&lt;br /&gt;fstr.gsub!("Edition Results&lt;\/span&gt;&lt;p&gt;","CHECKPOINT")&lt;br /&gt;fstr =~ /CHECKPOINT(.+?)&lt;\/table&gt;/m&lt;br /&gt;fields = $1.grep(/&lt;(th|td)&gt;/)&lt;br /&gt;fields.each do |f|&lt;br /&gt;  f.strip!&lt;br /&gt;  f.gsub!(/&lt;[^&gt;]+&gt;/,"")&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;(0...13).each do |i|&lt;br /&gt;  puts ". #{fields[i]}: #{fields[i+13]}"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;maplink = "http://maps.google.com/maps?q=#{fields[20]},+#{fields[21]}&amp;iwloc=A&amp;hl=en"&lt;br /&gt;puts ". Google Maps URL: #{maplink}"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 14 Apr 2007 13:33:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3814</guid>
      <author>haqu (Sergey)</author>
    </item>
    <item>
      <title>Google PageRank Ruby Checker</title>
      <link>http://snippets.dzone.com/posts/show/3284</link>
      <description>&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt;# -*- coding: utf-8 -*-&lt;br /&gt;# $Id: google-pr.rb,v b205c14e4ef5 2007-01-15 13:53 +0300 $&lt;br /&gt;# (C) 2006-2007 under terms of LGPL v2.1 &lt;br /&gt;# by Vsevolod S. Balashov &lt;vsevolod@balashov.name&gt;&lt;br /&gt;# based on 3rd party code snippets (see comments)&lt;br /&gt;&lt;br /&gt;require 'uri'&lt;br /&gt;require 'open-uri'&lt;br /&gt;&lt;br /&gt;module SEO&lt;br /&gt;&lt;br /&gt;  # http://blog.outer-court.com/archive/2004_06_27_index.html#108834386239051706&lt;br /&gt;  class GooglePR&lt;br /&gt;&lt;br /&gt;    def initialize(uri)&lt;br /&gt;      @uri = uri&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    M=0x100000000 # modulo for unsigned int 32bit(4byte)&lt;br /&gt;&lt;br /&gt;    def m1(a,b,c,d)&lt;br /&gt;      (((a+(M-b)+(M-c))%M)^(d%M))%M # mix/power mod&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def i2c(i)&lt;br /&gt;      [i&amp;0xff, i&gt;&gt;8&amp;0xff, i&gt;&gt;16&amp;0xff, i&gt;&gt;24&amp;0xff]&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def c2i(s,k=0)&lt;br /&gt;      ((s[k+3].to_i*0x100+s[k+2].to_i)*0x100+s[k+1].to_i)*0x100+s[k].to_i&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def mix(a,b,c)&lt;br /&gt;      a = a%M; b = b%M; c = c%M&lt;br /&gt;      a = m1(a,b,c, c &gt;&gt; 13); b = m1(b,c,a, a &lt;&lt;  8); c = m1(c,a,b, b &gt;&gt; 13)&lt;br /&gt;      a = m1(a,b,c, c &gt;&gt; 12); b = m1(b,c,a, a &lt;&lt; 16); c = m1(c,a,b, b &gt;&gt;  5)&lt;br /&gt;      a = m1(a,b,c, c &gt;&gt;  3); b = m1(b,c,a, a &lt;&lt; 10); c = m1(c,a,b, b &gt;&gt; 15)&lt;br /&gt;      [a, b, c]&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def old_cn(iurl = 'info:' + @uri)&lt;br /&gt;      a = 0x9E3779B9; b = 0x9E3779B9; c = 0xE6359A60&lt;br /&gt;      len = iurl.size &lt;br /&gt;      k = 0&lt;br /&gt;      while (len &gt;= k + 12) do&lt;br /&gt;        a += c2i(iurl,k); b += c2i(iurl,k+4); c += c2i(iurl,k+8)&lt;br /&gt;        a, b, c = mix(a, b, c)&lt;br /&gt;        k = k + 12&lt;br /&gt;      end&lt;br /&gt;      a += c2i(iurl,k); b += c2i(iurl,k+4); c += (c2i(iurl,k+8) &lt;&lt; 8) + len&lt;br /&gt;      a,b,c = mix(a,b,c)&lt;br /&gt;      return c&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def cn&lt;br /&gt;      ch = old_cn&lt;br /&gt;      ch = ((ch/7) &lt;&lt; 2) | ((ch-(ch/13).floor*13)&amp;7)&lt;br /&gt;      new_url = []&lt;br /&gt;      20.times { i2c(ch).each { |i| new_url &lt;&lt; i }; ch -= 9 }&lt;br /&gt;      ('6' + old_cn(new_url).to_s).to_i&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def request_uri&lt;br /&gt;      # http://www.bigbold.com/snippets/posts/show/1260 + _ -&gt; %5F&lt;br /&gt;      "http://toolbarqueries.google.com/search?client=navclient-auto&amp;hl=en&amp;ch=#{cn}&amp;ie=UTF-8&amp;oe=UTF-8&amp;features=Rank&amp;q=info:#{URI.escape(@uri, /[^-.!~*'()a-zA-Z\d]/)}"&lt;br /&gt;    end&lt;br /&gt; &lt;br /&gt;    def page_rank(uri = @uri)&lt;br /&gt;      @uri = uri if uri != @uri&lt;br /&gt;      open(request_uri) { |f| return $1.to_i if f.string =~ /Rank_1:\d:(\d+)/ }&lt;br /&gt;      nil&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    private :m1, :i2c, :c2i, :mix, :old_cn&lt;br /&gt;    attr_accessor :uri&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;if __FILE__ == $0 and 1 == ARGV.size&lt;br /&gt;  puts SEO::GooglePR.new(ARGV[0]).page_rank&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 15 Jan 2007 15:59:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3284</guid>
      <author>sevkin (Vsevolod Balashov)</author>
    </item>
  </channel>
</rss>
