Tag Archives: Google

Google, the cloud and WebKit

The cloud

Just in case, you still haven’t understood, the future is in the clouds. The more I use online product, the more I feel it. I’m now typing all my documents into google docs. Ok, I copy/paste them to Word for my retarded friends that live bellow the clouds, but soon I won’t. Even the important things that I have to do on actual files are synced by Dropbox (still on the cloud).

Webkit

Have you noticed that WebKit, the engine behind the Google Chrome browser also powers the Apple’s iOS (iPod Touch, iPhone, iPad), Google’s Android phones, RIM’s BlackBerry, Nokia’s phones and our french Freebox v6. So basically all the current phones and tablets. You can build web apps and make sure they will work with all the current desktop browsers and phones.
But wait, wasn’t it the idea behind the J2ME. And wasn’t it a total failure? Not really, because J2ME is about phone, WebKit web apps are about every connected things (there’s no reason to stop at computers, tablets and phones, advertising space would be much easier to handle with browsers). Porting J2ME to one environment to an other was painful, with a web browser it’s much more simple.

Google Chrome OS

I just saw a facebook friend wall page:

BTW, I applied too.

So Google actually started his Google Chrome computer test program.

There’s just one thing I don’t understand here. The iPad (I’ll buy the next version) is centered on the usage: Your read your mails, play and stay informed on your couch. Android is about making better phones to reduce the gaps between the iPhone and the stupid phone constructors OS. Desktop computers are here, well because we sometimes do have to work.

But what is Google Chrome OS about? Will we be able to use it on our couch? will we be able to work with it? Because it’s clearly centered on the new Chrome Web Apps Store. Is it about consuming or producing content?

If you are wondering how do perform the Chrome apps in the real world: VERY WELL. Take a look the Chrome Web store with the Chrome 9 browser (currently bêta), you can take the last fm music player or test a graphically amazing 3D app., cooliris:

Note:
History of WebKit

Google Latitude History

I thought about this service as soon as Google released the Google Latitude service : “It would be great if they could save data so that we could see where we were at a specific time.” And I very quickly published some code to get my position (you could be tracking me right now with it). I thought they would never release the history saving feature as people would have feared for their privacy and things like that. But they did it.

http://www.google.com/latitude/apps/history

I don’t know if it’s just me but I find it somehow related to what does foursquare in the way that it both help you to connect to your friends and you become rich of the location data you give them. In foursquare you have the possibility to become the mayor of nearly anything. In Google Maps, well, you possess your own tracking data.
Which basically means that the more you track, the more you create content. Couldn’t it be one of the key motivational factors ?

Google knows my mails, my contacts, my web search history, my favorites (using chrome sync), my discussions (on google talk even though I’m progressively switching to Skype), my photos, my credit card number, some friends on orkut and now my position. If you think they’re an evil big brother, you should just create better products, I’ll switch to your instantly.

Google PowerMeter and sample C# .Net API usage

Update 2001-06-25
A lot of people still contact me about this project. I received this mail today, just in case you’re getting interested by the project, you should know that it will die pretty soon:

Dear PowerMeter User,

We first launched Google PowerMeter as a Google.org project to raise awareness about the importance of giving people access to their energy information. Since our launch, there’s been more attention brought to this issue, and we’re excited that PowerMeter has helped demonstrate the importance of access to energy data. However, our efforts have not scaled as quickly as we would have liked, so we have decided to retire PowerMeter.

You will continue to have access to the product until September 16, 2011, after which time you will no longer be able to access your PowerMeter account. We know that having access to your energy information has helped you save energy and money. There are many options available for you from our device and utility partners. Please visit this page to learn more: http://www.google.com/support/powermeter/bin/answer.py?hl=en&answer=1342532

We also understand that having your historical energy data is important to you. We’ve made it easy for you to download your data. To export your PowerMeter data to a CSV (Comma Separated Values) file, log in to your account and go to “Account Settings.” More information can be found here: http://www.google.com/support/powermeter/bin/answer.py?hl=en&answer=164264

We appreciate your understanding and hope that you’ve enjoyed using Google PowerMeter. If you have questions about this announcement, please visit our FAQ pages at http://www.google.com/powermeter/about/faqs.html

Thank you,
Google PowerMeter team

© 2011 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

You’ve received this mandatory service announcement email to update you about important changes to your Google PowerMeter account.

Google PowerMeter offers you to collect your home’s / enterprise’s / specific equipment’s power usage and have some basic analysis on it.

There’s also a Google PowerMeter API so that everyone can build devices able to report their consumption and applications.

I would say one cheap and evolutive way to implement this API would be to use a Z-Wave power meter and have a Z-Wave central controller sent the data to Google servers. It could quickly get interesting because this could make you know the exact consumption of all your lights by calculating the result of the light-on/light-off order on individual lights. And this could even lead to define some max energy consumption scenarios so that you don’t allow more than X watts for all the lights of your house (this is just a idea, I would never put this in my home).

I know this isn’t the next BIG thing. Because everyone knows it’s all about the social right-now. But still, I think this could be the most green project of all time. Because it clearly shows people (or enterprises) how they consume energy and gives the useful analysis to find solutions. And for once it doesn’t try to make you feel guilty about not being green enough, it just brings facts.

By the way, you can have a negative energy consumption (power meter counting backward) in Google PowerMeter. I don’t think this is a bug, it must be for people selling their energy for their solar or wind energy producer equipments. But unfortunately you set the estimated cost of energy but you can’t set its estimated revenue price.

Sample API call

Here is a sample Google PowerMeter API call in C# .Net :
I just changed a little bit of the authentication parameters so that you can’t actually upload data on my account.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
 
/* Equipment was activated with this URL :
 * https://www.google.com/powermeter/device/activate?mfg=WebIngenia&model=TestEquipment1&did=100102030405&cvars=1&dvars=0&rurl=http://test.webingenia.com/powerMeter&snonce=123
 *
 * The resulting request was (available here : http://test.webingenia.com/read/powerMeter#id2473 ) :
 * $_POST = array(
 *		[snonce] => 123
 *		[hash] => _____6c2562aeb7bab4e24afc7beeb18c701c04ba,____8c9f62fa8a137eba7fa35b5f58802fca2e56,____f4db13304c49d36fb81b20cabbe147f8ce34
 *		[token] => ________FhCtzebg_P____8BGMWjtUs
 *		[path] => /user/____4578579014915368/____4578579014915368/variable/WebIngenia.TestEquipment1.100102030405
 * )
 *
 */
 
namespace test {
	class Program {
 
		private static readonly Random _random = new Random();
 
		public const String DeviceHash = // Useless
			"____bf8262aeb7bab4e24afc7beeb18c701c04ba,____8c9f62fa8a137eba7fa35b5f58802fca2e56,____f4db13304c49d36fb81b20cabbe147f8ce34";
 
		public const String DeviceToken = // Needed for authentication
			"________FhCtzebg_P____8BGMWjtUs";
 
		public const String DevicePath = // URL of the device
			"/user/____4578579014915368/_____4578579014915368/variable/WebIngenia.TestEquipment1.100102030405";
 
		public const String DeviceVar = "c1";
 
		public const String FeedUrl = // URL of the Google PowerMeter API
			"https://www.google.com/powermeter/feeds";
 
		public const String EventUrl = // URL where to send the data
			FeedUrl + "/event";
 
		public const int Period = 5000; // 5 to 10 seconds
 
 
		static double MeterValue {
			get {
				return Settings.Default.MeterValue;
			}
			set {
				Settings.Default.MeterValue = value;
				Settings.Default.Save();
			}
		}
 
		static void Send() {
 
			// We increment the counter (by 0 to 1 kWh)
			MeterValue += _random.NextDouble();
 
			Console.WriteLine( "MeterValue : {0}", MeterValue );
 
			// This is what we are going to send
			var strContent = String.Format(
			@"
<feed xmlns=""http://www.w3.org/2005/Atom"" xmlns:meter=""http://schemas.google.com/meter/2008"">
	<entry>
      <category scheme=""http://schemas.google.com/g/2005#kind"" term=""http://schemas.google.com/meter/2008#instMeasurement"" />
      <meter:subject>{0}</meter:subject>
      <meter:occurTime meter:uncertainty=""1.0"">{1}</meter:occurTime>
      <meter:quantity meter:uncertainty=""0.001"" meter:unit=""kW h"">{2}</meter:quantity>
    </entry>
</feed>",
				FeedUrl + DevicePath + "." + DeviceVar,						// Device URL
				DateTime.UtcNow.ToString( "yyyy-MM-dd'T'HH:mm:ss.fffK" ),	// Current UTC date
				MeterValue.ToString( CultureInfo.InvariantCulture )			// Meter value
			);
 
			// We convert it into raw content
			var content = Encoding.UTF8.GetBytes( strContent );
 
			// We create the POST request
			var req = WebRequest.Create( EventUrl );
			req.Headers.Add( "Authorization", "AuthSub token=\"" + DeviceToken + "\"" );
			req.Method = "POST";
			req.ContentLength = content.Length;
			req.ContentType = "application/atom+xml";
 
			try {
				// Opening the request stream means starting the request
				Console.Write( "Requesting..." );
				using ( var requestStream = req.GetRequestStream() ) {
 
					// We send the content
					requestStream.Write( content, 0, content.Length );
 
					// And we end the request by getting the response
					using ( var streamReader = new StreamReader( req.GetResponse().GetResponseStream() ) ) {
						Console.WriteLine( "Result : " + streamReader.ReadToEnd() );
					}
				}
			}
			catch ( WebException e ) { // If a webException occurs (should be 400)
				// We display the error
				var response = e.Response as HttpWebResponse;
				if ( response == null ) // This is not the exception that we want
					throw;
				using ( response ) {
					using ( var responseStream = response.GetResponseStream() ) {
						Console.WriteLine(
							"Error {0} : {1} ",
							response.StatusCode,
							new StreamReader( responseStream ).ReadToEnd()
						);
					}
				}
			}
		}
 
		static void Main() {
			while ( true ) {
				try {
					Send();
				}
				catch ( Exception ex ) {
					Console.WriteLine( "Exception : " + ex );
				}
				Thread.Sleep( Period + _random.Next( Period ) );
			}
		}
 
		// This code was generated by Visual Studio (but I prefer to put it here rather than having to publish the VS project)
		#region Auto-generated
		[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
		[System.CodeDom.Compiler.GeneratedCodeAttribute( "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0" )]
		internal sealed class Settings:System.Configuration.ApplicationSettingsBase {
 
			private static Settings defaultInstance = ( (Settings) ( Synchronized( new Settings() ) ) );
 
			public static Settings Default {
				get {
					return defaultInstance;
				}
			}
 
			[System.Configuration.UserScopedSettingAttribute()]
			[System.Diagnostics.DebuggerNonUserCodeAttribute()]
			[System.Configuration.DefaultSettingValueAttribute( "3000" )]
			public double MeterValue {
				get {
					return ( (double) ( this[ "MeterValue" ] ) );
				}
				set {
					this[ "MeterValue" ] = value;
				}
			}
		}
		#endregion
	}
}

I didn’t let it running too much time but still you can see that it works :

I love Google Buzz

I have played with Google Buzz on the web and on Google Maps 4.0 viagra en belgique. I’ve always been a huge fan of location based services, Google Maps w/Buzz is the ultimate one.

I like the world Google is building for us. There’s soo much data they allow us to access and build around everything.


Not related in anyway note : but well as nobody’s reading (even my girlfriend, isn’t that sad), I guess I can say useless things : I discovered the perfect “computer guy”‘s girlfriend : Leah Culver. She is pretty, smart, loves to code and she even likes hamburgers. And she doesn’t seem disturbed by crappy cars.
There must be something wrong with this girl, maybe she’s a succubus from hell.
I reached my quota of useless links.

Google Chrome Browser & OS

The browser
I’ve always been on the Bêta version of Google Chrome. And the current bêta (soon to be stable I guess) now supports plugins, the most interesting ones are AdThwart which blocks ads and Gmail Checker which displays the number of received mails.
Making some chrome extensions seems to be really easy, it’s entirely based on javascript.
The other very interesting thing is the developper tools. They are very close to Firebug, it’s now really easy to debug JS and CSS within Chrome.
The browser also bookmarks synchronizing using the google account. But I’m not sure everybody will love this (big brother blah blah blah).

Firebug like developper tools interface :

The OS
It surely starts fast but as, in this beta version, it’s just a browser it’s not really interesting. I hope they will add a lot of stuff around it.

Innovation

Google innovation chick, Marissa Mayer, says in her stanford show :

  • Innovation – Not instant perfection. Launch early and often get to the market.
  • Share everything you can – Information is KEY and powerful.
  • You’re brilliant, we’re hiring – Hire generalists than can speak to all areas of your organization. Specialists create silos.
  • A license to pursue your dreams – Give people a choice us to where they would like to invest their time and thinking.
  • Ideas come from everywhere – The power of many wins.
  • Don’t politic – Use data. Consensus of data wins not power or hierarchy.
  • Creavity loves constraint – Stay in the sandbox and focus on direction/output.
  • Users and usage are key – Money will follow.
  • Don’t kill projects – Morph them. Adjust or tweak and more on.

I really like what she says even if I don’t feel very concerned by the two last points.

For me one of the most interesting thing is the 20% time to work on personal projects. It’s the proof that google trusts their employee to make good use of their time.

This came from a friend’s powerpoint with the title “Google applies agile methodology”. Well, I’m really skeptical about that. I think it’s much wider than that. People do not need to apply any specific methodology if they’re smart and willing to do their work. They’ll get organized by themselves.

By the way, you should look at the other Stanford videos. They are really great. It’s not especially for “entrepreneurs” but for anyone willing to learm from other people experiences.

Access your Google Latitude position from PHP

The code to access your Google Latitude position is even simpler in PHP than it is in .Net :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?PHP
header('Content-Type: text/plain');
 
$userId = '5616045291659744796';
 
if ( $_GET['user'] ) {
	if ( is_numeric( $_GET['user'] ) )
		$userId = $_GET['user'];
	else
		exit('This isn\'t a valid user id.');
}
 
$url = 'http://www.google.com/latitude/apps/badge/api?user='.$userId.'&type=json';
 
// We get the content
$content = file_get_contents( $url );
 
// We convert the JSON to an object
$json = json_decode( $content );
 
$coord = $json->features[0]->geometry->coordinates;
$timeStamp = $json->features[0]->properties->timeStamp;
 
if ( ! $coord ) 
	exit('This user doesn\'t exist.');
 
$date = date( 'd/m/Y H:i:s', $timeStamp );
$lat = $coord[1];
$lon = $coord[0];
 
echo $date.' : '.$lat.' x '.$lon;
?>

This program is available for testing here. It requires PHP 5.2.0 to run the json_decode method.

I think this is the power of PHP, you can make some powerful code in no time. The drawback is that it’s really slow, and it becomes even slower if you begin to use heavy objects (and objects are often heavy). And I personally think it’s much easier and safer to debug and maintain complex .Net programs than complex PHP programs.

By the way, you can generate your google badge userid that you can then use for the API here. (thank you Neavilag for this comment)

Access your Google Latitude position from a .Net app

When I saw that Google Latitude now enables you to access your data by a JSON feed, I decided to make it communicate with a little GPS tracking project of mine.

I’m really found of all these ways we now have to make anything communicate with anything. You can build interfaces from any system to any other system really easily.

This code enables you to automatically get your GPS position (or the position of a friend) from your JSON Latitude feed. To be able to do that, you have to enable your KML/JSON feed.
It requires .Net 3.5’s System.Web.Extensions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Script.Serialization;
using System.Net;
using System.IO;
 
namespace LatitudeReader {
	class Program {
		static void Main() {
 
			Console.WriteLine( "What is your user id ?" );
 
			var userId = Console.ReadLine();
 
			if ( userId == String.Empty )
				userId = "5616045291659744796";
 
			// Url of the JSON Latitude feed
			var url = String.Format( "http://www.google.com/latitude/apps/badge/api?user={0}&type=json", userId );
 
			// We download the file
			var ms = new MemoryStream();
			Download( url, ms );
 
			// JSON in text format
			var textContent = UTF8Encoding.UTF8.GetString( ms.ToArray() );
 
			// We convert the JSON text file to an object
			// It returns 
			var jss = new JavaScriptSerializer();
			var jsonContent = jss.DeserializeObject( textContent ) as Dictionary<String, Object>;
 
			// We get the data
			var features = ( jsonContent[ "features" ] as object[] )[ 0 ] as Dictionary<string, object>;
			var geometry = features[ "geometry" ] as Dictionary<string, object>;
			var coordinates = geometry[ "coordinates" ] as object[];
			var lon = coordinates[ 0 ] as decimal?;
			var lat = coordinates[ 1 ] as decimal?;
 
			// And then the timestamp
			var properties = features[ "properties" ] as Dictionary<string, object>;
			var date = ConvertFromUnixTimestamp( (double) (int) properties[ "timeStamp" ] );
 
			// We convert the UTC date to local time
			date = date.ToLocalTime();
 
			Console.WriteLine( "{0} : {1} x {2}", date, lat, lon );
		}
 
		public static DateTime ConvertFromUnixTimestamp( double timestamp ) {
			DateTime origin = new DateTime( 1970, 1, 1, 0, 0, 0, 0 );
			return origin.AddSeconds( timestamp );
		}
 
		private const int BUFFER_SIZE = 1024;
 
		private static void Download( string url, Stream writeStream ) {
			var request = (HttpWebRequest) WebRequest.Create( url );
			var response = request.GetResponse();
 
			var readStream = response.GetResponseStream();
 
			var data = new Byte[ BUFFER_SIZE ];
 
			int n;
			do {
				n = readStream.Read( data, 0, BUFFER_SIZE );
				writeStream.Write( data, 0, n );
			} while ( n > 0 );
 
			writeStream.Flush();
			readStream.Close();
		}
	}
}

The only references you need are : System and System.Web.Extensions