<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Florent Clairambault &#187; Google</title>
	<atom:link href="http://florent.clairambault.fr/tag/google/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Wed, 28 Jul 2010 20:31:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Dear Google Analytics</title>
		<link>http://florent.clairambault.fr/dear-google-analytics?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=dear-google-analytics</link>
		<comments>http://florent.clairambault.fr/dear-google-analytics#comments</comments>
		<pubDate>Mon, 19 Jul 2010 20:17:50 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2945</guid>
		<description><![CDATA[Dear Google Analytics, or dear blog readers (if any). I just read the google analytics stats of a site and noticed a totally new source of traffic: &#8220;Other&#8221;. What do you think it could be ? Somehow it reminded me this blog post of a graphic designer (who seems quite talented and very creative) :]]></description>
			<content:encoded><![CDATA[<p><a href="http://i.mivi.fr/03c30a41cb4aa110c0b59eb5b4d56ff48c3df5ae.png"><img src="http://i.mivi.fr/03c30a41cb4aa110c0b59eb5b4d56ff48c3df5ae.x.300.png" style="position: relative; float: right; margin-left: 10px" /></a><br />
Dear Google Analytics, or dear blog readers (if any). I just read the google analytics stats of a site and noticed a totally new source of traffic: &#8220;Other&#8221;. What do you think it could be ?</p>
<p>Somehow it reminded me <a href="http://www.27bslash6.com/p2p2.html">this blog post</a> of a graphic designer (who seems quite talented and very creative) :<br />
<img src="http://i.mivi.fr/a05b20452c193fc2b51ad6ca34d5ba406e008605.gif" /><br />
<img src="http://i.mivi.fr/063b38062899965b810d0a36b3d74b7f09003358.gif" /><br />
<img src="http://i.mivi.fr/b680f0e8ac824709989b6e5ec5721b51e6ac25a9.gif" /></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/dear-google-analytics/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Latitude History</title>
		<link>http://florent.clairambault.fr/google-latitude-history?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=google-latitude-history</link>
		<comments>http://florent.clairambault.fr/google-latitude-history#comments</comments>
		<pubDate>Sat, 17 Jul 2010 08:00:21 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Latitude]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2928</guid>
		<description><![CDATA[I thought about this service as soon as Google released the Google Latitude service : &#8220;It would be great if they could save data so that we could see where we were at a specific time.&#8221; And I very quickly published some code to get my position (you could be tracking me right now with [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i.mivi.fr/87862c736fd9fcbeaeaa0ecfbc54732e1f670fac.png" style="position: relative; float: right; margin-left: 10px" />I thought about this service as soon as Google released the Google Latitude service : &#8220;It would be great if they could save data so that we could see where we were at a specific time.&#8221; And I very quickly published <a href="http://florent.clairambault.fr/access-your-google-latitude-position-from-a-net-app">some code to get my position</a> (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.</p>
<p><a href="http://www.google.com/latitude/apps/history">http://www.google.com/latitude/apps/history</a></p>
<p>I don&#8217;t know if it&#8217;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.<br />
Which basically means that the more you track, the more you create content. Couldn&#8217;t it be one of the key motivational factors ?</p>
<p>Google knows my mails, my contacts, my web search history, my favorites (using chrome sync), my discussions (on google talk even though I&#8217;m progressively switching to Skype), my photos, my credit card number, some friends on orkut and now my position. If you think they&#8217;re an evil big brother, you should just create better products, I&#8217;ll switch to your instantly.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/google-latitude-history/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google PowerMeter and sample C# .Net API usage</title>
		<link>http://florent.clairambault.fr/google-powermeter-and-sample-c-net-api-usage?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=google-powermeter-and-sample-c-net-api-usage</link>
		<comments>http://florent.clairambault.fr/google-powermeter-and-sample-c-net-api-usage#comments</comments>
		<pubDate>Sat, 29 May 2010 17:00:18 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Power]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[Z-wave]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2723</guid>
		<description><![CDATA[Google PowerMeter offers you to collect your home&#8217;s / enterprise&#8217;s / specific equipment&#8217;s power usage and have some basic analysis on it. There&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i.mivi.fr/acdeb2ba6ad51309f5d9f6eafbe3ad7566f30afa.x.300.jpg" style="position: relative; float: right; margin-left: 10px" /></p>
<p><a href="http://www.google.com/powermeter/about/about.html">Google PowerMeter</a> offers you to collect your home&#8217;s / enterprise&#8217;s / specific equipment&#8217;s power usage and have some basic analysis on it.</p>
<p>There&#8217;s also a <a href="http://code.google.com/intl/ro-RO/apis/powermeter/">Google PowerMeter API</a> so that everyone can build devices able to report their consumption and applications.</p>
<p>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&#8217;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).</p>
<p>I know this isn&#8217;t the next BIG thing. Because everyone knows it&#8217;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&#8217;t try to make you feel guilty about not being green enough, it just brings facts.</p>
<p>By the way, you can have a negative energy consumption (power meter counting backward) in Google PowerMeter. I don&#8217;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&#8217;t set its estimated revenue price.</p>
<h3>Sample API call</h3>
<p>Here is a sample Google PowerMeter API call in C# .Net :<br />
<em>I just changed a little bit of the authentication parameters so that you can&#8217;t actually upload data on my account.</em></p>

<div class="wp_codebox"><table><tr id="p27232"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p2723code2"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Globalization</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Net</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">/* Equipment was activated with this URL :
 * https://www.google.com/powermeter/device/activate?mfg=WebIngenia&amp;model=TestEquipment1&amp;did=100102030405&amp;cvars=1&amp;dvars=0&amp;rurl=http://test.webingenia.com/powerMeter&amp;snonce=123
 *
 * The resulting request was (available here : http://test.webingenia.com/read/powerMeter#id2473 ) :
 * $_POST = array(
 *		[snonce] =&gt; 123
 *		[hash] =&gt; _____6c2562aeb7bab4e24afc7beeb18c701c04ba,____8c9f62fa8a137eba7fa35b5f58802fca2e56,____f4db13304c49d36fb81b20cabbe147f8ce34
 *		[token] =&gt; ________FhCtzebg_P____8BGMWjtUs
 *		[path] =&gt; /user/____4578579014915368/____4578579014915368/variable/WebIngenia.TestEquipment1.100102030405
 * )
 *
 */</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> test <span style="color: #008000;">&#123;</span>
	<span style="color: #6666cc; font-weight: bold;">class</span> Program <span style="color: #008000;">&#123;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> Random _random <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Random<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> DeviceHash <span style="color: #008000;">=</span> <span style="color: #008080; font-style: italic;">// Useless</span>
			<span style="color: #666666;">&quot;____bf8262aeb7bab4e24afc7beeb18c701c04ba,____8c9f62fa8a137eba7fa35b5f58802fca2e56,____f4db13304c49d36fb81b20cabbe147f8ce34&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> DeviceToken <span style="color: #008000;">=</span> <span style="color: #008080; font-style: italic;">// Needed for authentication</span>
			<span style="color: #666666;">&quot;________FhCtzebg_P____8BGMWjtUs&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> DevicePath <span style="color: #008000;">=</span> <span style="color: #008080; font-style: italic;">// URL of the device</span>
			<span style="color: #666666;">&quot;/user/____4578579014915368/_____4578579014915368/variable/WebIngenia.TestEquipment1.100102030405&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> DeviceVar <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;c1&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> FeedUrl <span style="color: #008000;">=</span> <span style="color: #008080; font-style: italic;">// URL of the Google PowerMeter API</span>
			<span style="color: #666666;">&quot;https://www.google.com/powermeter/feeds&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">String</span> EventUrl <span style="color: #008000;">=</span> <span style="color: #008080; font-style: italic;">// URL where to send the data</span>
			FeedUrl <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;/event&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> Period <span style="color: #008000;">=</span> <span style="color: #FF0000;">5000</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// 5 to 10 seconds</span>
&nbsp;
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">double</span> MeterValue <span style="color: #008000;">&#123;</span>
			get <span style="color: #008000;">&#123;</span>
				<span style="color: #0600FF; font-weight: bold;">return</span> Settings<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">.</span><span style="color: #0000FF;">MeterValue</span><span style="color: #008000;">;</span>
			<span style="color: #008000;">&#125;</span>
			set <span style="color: #008000;">&#123;</span>
				Settings<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">.</span><span style="color: #0000FF;">MeterValue</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
				Settings<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Save</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Send<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We increment the counter (by 0 to 1 kWh)</span>
			MeterValue <span style="color: #008000;">+=</span> _random<span style="color: #008000;">.</span><span style="color: #0000FF;">NextDouble</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;MeterValue : {0}&quot;</span>, MeterValue <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// This is what we are going to send</span>
			var strContent <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span>
			<span style="color: #666666;">@&quot;
&lt;feed xmlns=&quot;</span><span style="color: #666666;">&quot;http://www.w3.org/2005/Atom&quot;</span><span style="color: #666666;">&quot; xmlns:meter=&quot;</span><span style="color: #666666;">&quot;http://schemas.google.com/meter/2008&quot;</span><span style="color: #666666;">&quot;&gt;
	&lt;entry&gt;
      &lt;category scheme=&quot;</span><span style="color: #666666;">&quot;http://schemas.google.com/g/2005#kind&quot;</span><span style="color: #666666;">&quot; term=&quot;</span><span style="color: #666666;">&quot;http://schemas.google.com/meter/2008#instMeasurement&quot;</span><span style="color: #666666;">&quot; /&gt;
      &lt;meter:subject&gt;{0}&lt;/meter:subject&gt;
      &lt;meter:occurTime meter:uncertainty=&quot;</span><span style="color: #666666;">&quot;1.0&quot;</span><span style="color: #666666;">&quot;&gt;{1}&lt;/meter:occurTime&gt;
      &lt;meter:quantity meter:uncertainty=&quot;</span><span style="color: #666666;">&quot;0.001&quot;</span><span style="color: #666666;">&quot; meter:unit=&quot;</span><span style="color: #666666;">&quot;kW h&quot;</span><span style="color: #666666;">&quot;&gt;{2}&lt;/meter:quantity&gt;
    &lt;/entry&gt;
&lt;/feed&gt;&quot;</span>,
				FeedUrl <span style="color: #008000;">+</span> DevicePath <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> DeviceVar,						<span style="color: #008080; font-style: italic;">// Device URL</span>
				DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">UtcNow</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;yyyy-MM-dd'T'HH:mm:ss.fffK&quot;</span> <span style="color: #008000;">&#41;</span>,	<span style="color: #008080; font-style: italic;">// Current UTC date</span>
				MeterValue<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span> CultureInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">InvariantCulture</span> <span style="color: #008000;">&#41;</span>			<span style="color: #008080; font-style: italic;">// Meter value</span>
			<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We convert it into raw content</span>
			var content <span style="color: #008000;">=</span> Encoding<span style="color: #008000;">.</span><span style="color: #0000FF;">UTF8</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span> strContent <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We create the POST request</span>
			var req <span style="color: #008000;">=</span> WebRequest<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span><span style="color: #008000;">&#40;</span> EventUrl <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			req<span style="color: #008000;">.</span><span style="color: #0000FF;">Headers</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Authorization&quot;</span>, <span style="color: #666666;">&quot;AuthSub token=<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #008000;">+</span> DeviceToken <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			req<span style="color: #008000;">.</span><span style="color: #0000FF;">Method</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;POST&quot;</span><span style="color: #008000;">;</span>
			req<span style="color: #008000;">.</span><span style="color: #0000FF;">ContentLength</span> <span style="color: #008000;">=</span> content<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span>
			req<span style="color: #008000;">.</span><span style="color: #0000FF;">ContentType</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;application/atom+xml&quot;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">try</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #008080; font-style: italic;">// Opening the request stream means starting the request</span>
				Console<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Requesting...&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span> var requestStream <span style="color: #008000;">=</span> req<span style="color: #008000;">.</span><span style="color: #0000FF;">GetRequestStream</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
					<span style="color: #008080; font-style: italic;">// We send the content</span>
					requestStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span> content, <span style="color: #FF0000;">0</span>, content<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
					<span style="color: #008080; font-style: italic;">// And we end the request by getting the response</span>
					<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span> var streamReader <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #008000;">&#40;</span> req<span style="color: #008000;">.</span><span style="color: #0000FF;">GetResponse</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetResponseStream</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
						Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Result : &quot;</span> <span style="color: #008000;">+</span> streamReader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadToEnd</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
					<span style="color: #008000;">&#125;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
			<span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span> WebException e <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008080; font-style: italic;">// If a webException occurs (should be 400)</span>
				<span style="color: #008080; font-style: italic;">// We display the error</span>
				var response <span style="color: #008000;">=</span> e<span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span> <span style="color: #0600FF; font-weight: bold;">as</span> HttpWebResponse<span style="color: #008000;">;</span>
				<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span> response <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">// This is not the exception that we want</span>
					<span style="color: #0600FF; font-weight: bold;">throw</span><span style="color: #008000;">;</span>
				<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span> response <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
					<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span> var responseStream <span style="color: #008000;">=</span> response<span style="color: #008000;">.</span><span style="color: #0000FF;">GetResponseStream</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
						Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>
							<span style="color: #666666;">&quot;Error {0} : {1} &quot;</span>,
							response<span style="color: #008000;">.</span><span style="color: #0000FF;">StatusCode</span>,
							<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #008000;">&#40;</span> responseStream <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ReadToEnd</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
						<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
					<span style="color: #008000;">&#125;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span> <span style="color: #0600FF; font-weight: bold;">true</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0600FF; font-weight: bold;">try</span> <span style="color: #008000;">&#123;</span>
					Send<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
				<span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span> Exception ex <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
					Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Exception : &quot;</span> <span style="color: #008000;">+</span> ex <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
				Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span> Period <span style="color: #008000;">+</span> _random<span style="color: #008000;">.</span><span style="color: #0000FF;">Next</span><span style="color: #008000;">&#40;</span> Period <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">// This code was generated by Visual Studio (but I prefer to put it here rather than having to publish the VS project)</span>
		<span style="color: #008080;">#region Auto-generated</span>
		<span style="color: #008000;">&#91;</span><span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Runtime</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CompilerServices</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CompilerGeneratedAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
		<span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">CodeDom</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Compiler</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">GeneratedCodeAttribute</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator&quot;</span>, <span style="color: #666666;">&quot;9.0.0.0&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
		<span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #0600FF; font-weight: bold;">sealed</span> <span style="color: #6666cc; font-weight: bold;">class</span> Settings<span style="color: #008000;">:</span><span style="color: #000000;">System.<span style="color: #0000FF;">Configuration</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">ApplicationSettingsBase</span> <span style="color: #008000;">&#123;</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> Settings defaultInstance <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span>Settings<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#40;</span> Synchronized<span style="color: #008000;">&#40;</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Settings<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> Settings <span style="color: #0600FF; font-weight: bold;">Default</span> <span style="color: #008000;">&#123;</span>
				get <span style="color: #008000;">&#123;</span>
					<span style="color: #0600FF; font-weight: bold;">return</span> defaultInstance<span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Configuration</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">UserScopedSettingAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
			<span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">DebuggerNonUserCodeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
			<span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Configuration</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">DefaultSettingValueAttribute</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;3000&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
			<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">double</span> MeterValue <span style="color: #008000;">&#123;</span>
				get <span style="color: #008000;">&#123;</span>
					<span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">double</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#40;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;MeterValue&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
				set <span style="color: #008000;">&#123;</span>
					<span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;MeterValue&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #008080;">#endregion</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>I didn&#8217;t let it running too much time but still you can see that it works :<br />
<a href="http://i.mivi.fr/dd6f0441bdec29e66f68ff07a5530c52237ff66e.png"><img src="http://i.mivi.fr/dd6f0441bdec29e66f68ff07a5530c52237ff66e.x.800.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/google-powermeter-and-sample-c-net-api-usage/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I love Google Buzz</title>
		<link>http://florent.clairambault.fr/i-love-google-buzz?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=i-love-google-buzz</link>
		<comments>http://florent.clairambault.fr/i-love-google-buzz#comments</comments>
		<pubDate>Mon, 15 Feb 2010 20:00:22 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Buzz]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2358</guid>
		<description><![CDATA[I have played with Google Buzz on the web and on Google Maps 4.0. I&#8217;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&#8217;s soo much data they allow us to access and build around everything. Not related [...]]]></description>
			<content:encoded><![CDATA[<p>I have played with Google Buzz on the web and on Google Maps 4.0. I&#8217;ve always been a huge fan of location based services, Google Maps w/Buzz is the ultimate one. </p>
<p>I like the world Google is building for us. There&#8217;s soo much data they allow us to access and build around everything.</p>
<p><del datetime="2010-02-15T01:22:45+00:00"><br />
Not related in anyway note : but well as nobody&#8217;s reading (even my girlfriend, isn&#8217;t that sad), I guess I can say useless things : I discovered the perfect &#8220;computer guy&#8221;&#8216;s girlfriend : Leah Culver. She is <a href="http://images.google.com/images?q=leah+culver">pretty</a>, <a href="http://www.crunchbase.com/person/leah-culver">smart</a>, <a href="http://blog.leahculver.com/about.html">loves to code</a> and she even likes <a href="http://leahculver.com/leah.png">hamburgers</a>. And she doesn&#8217;t seem disturbed by <a href="http://leahculver.com/images/google-street-view-jetta.png">crappy cars</a>.<br />
There must be something wrong with this girl, maybe she&#8217;s a <a href="http://en.wikipedia.org/wiki/The_Succubus">succubus from hell</a>.<br />
I reached my quota of useless links.</del></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/i-love-google-buzz/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Chrome Browser &amp; OS</title>
		<link>http://florent.clairambault.fr/google-chrome-browser-and-os?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=google-chrome-browser-and-os</link>
		<comments>http://florent.clairambault.fr/google-chrome-browser-and-os#comments</comments>
		<pubDate>Wed, 09 Dec 2009 20:00:17 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[AdThrwart]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[Google Chrome OS]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2135</guid>
		<description><![CDATA[The browser I&#8217;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&#8217;s entirely [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The browser</strong><br />
I&#8217;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 <a href="https://chrome.google.com/extensions/detail/cfhdojbkjhnklbpkdaibdccddilifddb">AdThwart</a> which blocks ads and <a href="https://chrome.google.com/extensions/detail/mihcahmgecmbnbcchbopgniflfhgnkff">Gmail Checker</a> which displays the number of received mails.<br />
<a href="http://code.google.com/chrome/extensions/getstarted.html">Making some chrome extensions</a> seems to be really easy, it&#8217;s entirely based on javascript.<br />
The other very interesting thing is the developper tools. They are very close to <a href="http://getfirebug.com/">Firebug</a>, it&#8217;s now really easy to debug JS and CSS within Chrome.<br />
The browser also bookmarks synchronizing using the google account. But I&#8217;m not sure everybody will love this (big brother blah blah blah).</p>
<div style="text-align: center">
Firebug like developper tools interface :<br /><img src="http://i.mivi.fr/112a36cc8cee7241bbf260f997fc606ba8841c74.x.500.png" />
</div>
<p><strong>The OS</strong><br />
It surely starts fast but as, in this beta version, it&#8217;s just a browser it&#8217;s not really interesting. I hope they will add a lot of stuff around it.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/google-chrome-browser-and-os/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Innovation</title>
		<link>http://florent.clairambault.fr/innovation?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=innovation</link>
		<comments>http://florent.clairambault.fr/innovation#comments</comments>
		<pubDate>Mon, 20 Jul 2009 07:10:15 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[agile methodology]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Innovation]]></category>
		<category><![CDATA[software development methodology]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1085</guid>
		<description><![CDATA[Google innovation chick, Marissa Mayer, says in her stanford show : Innovation &#8211; Not instant perfection. Launch early and often get to the market. Share everything you can &#8211; Information is KEY and powerful. You&#8217;re brilliant, we&#8217;re hiring &#8211; Hire generalists than can speak to all areas of your organization. Specialists create silos. A license [...]]]></description>
			<content:encoded><![CDATA[<p>Google innovation chick, Marissa Mayer, says in <a href="http://ecorner.stanford.edu/authorMaterialInfo.html?mid=1524">her stanford show</a> :</p>
<div style="padding: 10px; background-color: #eef; border: 1px solid #bbf">
<ul>
<li><strong>Innovation</strong> &#8211; Not instant perfection. Launch early and often get to the market.</li>
<li><strong>Share everything you can</strong> &#8211; Information is KEY and powerful.</li>
<li><strong>You&#8217;re brilliant, we&#8217;re hiring</strong> &#8211; Hire generalists than can speak to all areas of your organization. Specialists create silos.</li>
<li><strong>A license to pursue your dreams</strong> &#8211; Give people a choice us to where they would like to invest their time and thinking.</li>
<li><strong>Ideas come from everywhere</strong> &#8211; The power of many wins.</li>
<li><strong>Don&#8217;t politic</strong> &#8211; Use data. Consensus of data wins not power or hierarchy.</li>
<li><strong>Creavity loves constraint</strong> &#8211; Stay in the sandbox and focus on direction/output.</li>
<li><strong>Users and usage are key</strong> &#8211; Money will follow.</li>
<li><strong>Don&#8217;t kill projects</strong> &#8211; Morph them. Adjust or tweak and more on.</li>
</ul>
</div>
<p>I really like what she says even if I don&#8217;t feel very concerned by the two last points.</p>
<p>For me one of the most interesting thing is the 20% time to work on personal projects. It&#8217;s the proof that google trusts their employee to make good use of their time.</p>
<div style="text-align: center">
<embed id='single' width='500' height='395' flashvars='config=http://ecorner.stanford.edu/embeded_config.xml%3Fmid%3D1527%26lang=en' src='http://ecorner.stanford.edu/swf/player-ec.swf' type='application/x-shockwave-flash'></embed>
</div>
<p>This came from a friend&#8217;s powerpoint with the title &#8220;Google applies agile methodology&#8221;. Well, I&#8217;m really skeptical about that. I think it&#8217;s much wider than that. People do not need to apply any specific methodology if they&#8217;re smart and willing to do their work. They&#8217;ll get organized by themselves.</p>
<p>By the way, you should look at the <a href="http://ecorner.stanford.edu/">other Stanford videos</a>. They are really great. It&#8217;s not especially for &#8220;entrepreneurs&#8221; but for anyone willing to learm from other people experiences.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/innovation/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Access your Google Latitude position from PHP</title>
		<link>http://florent.clairambault.fr/access-your-google-latitude-position-from-php?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=access-your-google-latitude-position-from-php</link>
		<comments>http://florent.clairambault.fr/access-your-google-latitude-position-from-php#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:45:06 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Latitude]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1233</guid>
		<description><![CDATA[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 &#60;?PHP header&#40;'Content-Type: text/plain'&#41;; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>The code to access your Google Latitude position is even simpler in PHP than it is <a href="http://florent.clairambault.fr/access-your-google-latitude-position-from-a-net-app">in .Net</a> :</p>

<div class="wp_codebox"><table><tr id="p12334"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p1233code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?PHP</span>
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type: text/plain'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$userId</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'5616045291659744796'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/is_numeric"><span style="color: #990000;">is_numeric</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$userId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'This isn\'t a valid user id.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.google.com/latitude/apps/badge/api?user='</span><span style="color: #339933;">.</span><span style="color: #000088;">$userId</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;type=json'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// We get the content</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$url</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// We convert the JSON to an object</span>
<span style="color: #000088;">$json</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/json_decode"><span style="color: #990000;">json_decode</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$content</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$coord</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$json</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">features</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">geometry</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">coordinates</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeStamp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$json</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">features</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">properties</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeStamp</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$coord</span> <span style="color: #009900;">&#41;</span> 
	<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'This user doesn\'t exist.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'d/m/Y H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$timeStamp</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lat</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$coord</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lon</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$coord</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$date</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' : '</span><span style="color: #339933;">.</span><span style="color: #000088;">$lat</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' x '</span><span style="color: #339933;">.</span><span style="color: #000088;">$lon</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This program is <a href="http://florent.clairambault.fr/demo/google-latitude.php">available for testing here</a>. It requires PHP 5.2.0 to run the <a href="http://us.php.net/manual/en/function.json-decode.php">json_decode</a> method.</p>
<p>I think this is the power of PHP, you can make some powerful code in no time. The drawback is that it&#8217;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&#8217;s much easier and safer to debug and maintain complex .Net programs than complex PHP programs.</p>
<p>By the way, you can generate your google badge userid that you can then use for the API <a href="https://www.google.com/latitude/apps/badge">here</a>. <i>(thank you Neavilag for this comment)</i></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/access-your-google-latitude-position-from-php/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Access your Google Latitude position from a .Net app</title>
		<link>http://florent.clairambault.fr/access-your-google-latitude-position-from-a-net-app?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=access-your-google-latitude-position-from-a-net-app</link>
		<comments>http://florent.clairambault.fr/access-your-google-latitude-position-from-a-net-app#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:32:41 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Latitude]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1213</guid>
		<description><![CDATA[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&#8217;m really found of all these ways we now have to make anything communicate with anything. You can build interfaces from any system to [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>I&#8217;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.</p>
<p>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 <a href="http://www.google.com/latitude/apps/badge">enable your KML/JSON feed</a>.<br />
It requires .Net 3.5&#8242;s System.Web.Extensions</p>

<div class="wp_codebox"><table><tr id="p12136"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p1213code6"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.Script.Serialization</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Net</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> LatitudeReader <span style="color: #008000;">&#123;</span>
	<span style="color: #6666cc; font-weight: bold;">class</span> Program <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
			Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;What is your user id ?&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			var userId <span style="color: #008000;">=</span> Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadLine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span> userId <span style="color: #008000;">==</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span> <span style="color: #008000;">&#41;</span>
				userId <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;5616045291659744796&quot;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Url of the JSON Latitude feed</span>
			var url <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;http://www.google.com/latitude/apps/badge/api?user={0}&amp;type=json&quot;</span>, userId <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We download the file</span>
			var ms <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> MemoryStream<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			Download<span style="color: #008000;">&#40;</span> url, ms <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// JSON in text format</span>
			var textContent <span style="color: #008000;">=</span> UTF8Encoding<span style="color: #008000;">.</span><span style="color: #0000FF;">UTF8</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetString</span><span style="color: #008000;">&#40;</span> ms<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We convert the JSON text file to an object</span>
			<span style="color: #008080; font-style: italic;">// It returns </span>
			var jss <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> JavaScriptSerializer<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			var jsonContent <span style="color: #008000;">=</span> jss<span style="color: #008000;">.</span><span style="color: #0000FF;">DeserializeObject</span><span style="color: #008000;">&#40;</span> textContent <span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">as</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">String</span>, <span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&gt;;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We get the data</span>
			var features <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span> jsonContent<span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;features&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">&#91;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;;</span>
			var geometry <span style="color: #008000;">=</span> features<span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;geometry&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;;</span>
			var coordinates <span style="color: #008000;">=</span> geometry<span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;coordinates&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
			var lon <span style="color: #008000;">=</span> coordinates<span style="color: #008000;">&#91;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> <span style="color: #6666cc; font-weight: bold;">decimal</span><span style="color: #008000;">?;</span>
			var lat <span style="color: #008000;">=</span> coordinates<span style="color: #008000;">&#91;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> <span style="color: #6666cc; font-weight: bold;">decimal</span><span style="color: #008000;">?;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// And then the timestamp</span>
			var properties <span style="color: #008000;">=</span> features<span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;properties&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;;</span>
			var date <span style="color: #008000;">=</span> ConvertFromUnixTimestamp<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">double</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&#41;</span> properties<span style="color: #008000;">&#91;</span> <span style="color: #666666;">&quot;timeStamp&quot;</span> <span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// We convert the UTC date to local time</span>
			date <span style="color: #008000;">=</span> date<span style="color: #008000;">.</span><span style="color: #0000FF;">ToLocalTime</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;{0} : {1} x {2}&quot;</span>, date, lat, lon <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> DateTime ConvertFromUnixTimestamp<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">double</span> timestamp <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			DateTime origin <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DateTime<span style="color: #008000;">&#40;</span> <span style="color: #FF0000;">1970</span>, <span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF; font-weight: bold;">return</span> origin<span style="color: #008000;">.</span><span style="color: #0000FF;">AddSeconds</span><span style="color: #008000;">&#40;</span> timestamp <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> BUFFER_SIZE <span style="color: #008000;">=</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Download<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">string</span> url, Stream writeStream <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			var request <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>HttpWebRequest<span style="color: #008000;">&#41;</span> WebRequest<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span><span style="color: #008000;">&#40;</span> url <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			var response <span style="color: #008000;">=</span> request<span style="color: #008000;">.</span><span style="color: #0000FF;">GetResponse</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			var readStream <span style="color: #008000;">=</span> response<span style="color: #008000;">.</span><span style="color: #0000FF;">GetResponseStream</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			var data <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">Byte</span><span style="color: #008000;">&#91;</span> BUFFER_SIZE <span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #6666cc; font-weight: bold;">int</span> n<span style="color: #008000;">;</span>
			<span style="color: #0600FF; font-weight: bold;">do</span> <span style="color: #008000;">&#123;</span>
				n <span style="color: #008000;">=</span> readStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Read</span><span style="color: #008000;">&#40;</span> data, <span style="color: #FF0000;">0</span>, BUFFER_SIZE <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				writeStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span> data, <span style="color: #FF0000;">0</span>, n <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #008000;">&#125;</span> <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span> n <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			writeStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Flush</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			readStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>The only references you need are : System and System.Web.Extensions</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/access-your-google-latitude-position-from-a-net-app/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.678 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-29 16:42:02 -->
