<?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>yken.org &#187; Internet</title>
	<atom:link href="http://yken.org/tag/internet/feed/" rel="self" type="application/rss+xml" />
	<link>http://yken.org</link>
	<description>...it depends</description>
	<lastBuildDate>Sun, 07 Mar 2010 17:47:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to get a real-time stock quote using Google API</title>
		<link>http://yken.org/2009/01/05/how-to-get-a-real-time-stock-quote-using-google-api/</link>
		<comments>http://yken.org/2009/01/05/how-to-get-a-real-time-stock-quote-using-google-api/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 22:39:28 +0000</pubDate>
		<dc:creator>ikendra</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[stocks]]></category>

		<guid isPermaLink="false">http://yken.org/2009/01/05/how-to-get-a-real-time-stock-quote-using-google-api/</guid>
		<description><![CDATA[After resolving the problem with authentication, I continued playing around with Google Finance API, using HTTP and XML. The API offers some nice functionality to retrieve user portfolio content, but it doesn&#8217;t take long to realize that there is no support for retrieving (real-time) stock quotes, probably for some good reason like licensing. But then, [...]]]></description>
			<content:encoded><![CDATA[<p>After resolving <a href="http://yken.org/2008/12/29/troubleshooting-401-with-googlelogin-authorization-header/">the problem with authentication</a>, I continued playing around with <a href="http://code.google.com/apis/finance/developers_guide_protocol.html">Google Finance API</a>, using HTTP and XML. The API offers some nice functionality to retrieve user portfolio content, but it doesn&#8217;t take long to realize that there is no support for retrieving (real-time) stock quotes, probably for some good reason like licensing. But then, there is a way of getting real-time stock quotes on your Google Spreadsheet using the GoogleFinance() formula. Can this fact get us closer to retrieving real-time stock quotes using Google Data API?</p>
<p><span id="more-71"></span><br />
Yes it can. It is relatively straightforward to write a simple program to retrieve real-time stock quote using just <a href="http://code.google.com/apis/spreadsheets/docs/2.0/developers_guide_protocol.html">Google Spreadsheet Data API</a>. Below is a simple proof-of-concept script which does the job. To make it work, create a new Spreadsheet on Google Docs and int the cell A1 fill in a formula for your favorite stock quote, something like:</p>
<pre>
=GoogleFinance("GOOG")
</pre>
<p>You will see the price in your spreadsheet:</p>
<p><img src="http://yken.org/wp-content/firefox-google-spreadsheet-sample.jpg" alt="Firefox Google Spreadsheet Sample" /></p>
<p>The script to retrieve the quote:</p>
<pre>
#!/bin/bash

wget -O ClientLogin.txt --no-check-certificate --post-file=post.txt \
"https://www.google.com/accounts/ClientLogin" &gt;/dev/null 2&gt;&amp;1

TOKEN=`cat ClientLogin.txt | grep Auth \
| sed "s#Auth=##" | xargs echo -n`

wget -O Spreadsheets.txt --header="Authorization: GoogleLogin auth=${TOKEN}" \
--header="GData-Version: 2" \
http://spreadsheets.google.com/feeds/spreadsheets/private/full &gt;/dev/null 2&gt;&amp;1

WORKSHEET=`cat Spreadsheets.txt | \
sed "s#\(.*\)src=\([']*\)\([^']*\)\([']\)\(.*\)#\3#"`

wget -O Worksheet.txt --header="Authorization: GoogleLogin auth=${TOKEN}" \
--header="GData-Version: 2" ${WORKSHEET} &gt;/dev/null 2&gt;&amp;1

cat Worksheet.txt | sed 's#\&gt;#\&gt;\
#g' &gt;WorksheetFormatted.txt

CELLSFEED=`cat WorksheetFormatted.txt | grep cellsfeed | \
sed "s#\(.*\)href=\([']*\)\([^']*\)\([']\)\(.*\)#\3#"`

wget -O Cells.txt --header="Authorization: GoogleLogin auth=${TOKEN}" \
--header="GData-Version: 2" ${CELLSFEED} &gt;/dev/null 2&gt;&amp;1

cat Cells.txt | sed 's#\&gt;#\&gt;\
#g' &gt;CellsFormatted.txt

REALTIMEQUOTE=`cat CellsFormatted.txt | grep numericValue | \
sed "s#\(.*\)numericValue=\([']*\)\([^']*\)\([']\)\(.*\)#\3#"`

echo "Quote = ${REALTIMEQUOTE}"
</pre>
<p>where post.txt is something like:</p>
<pre>
POST /accounts/ClientLogin HTTP/1.0
Content-type: application/x-www-form-urlencoded

accountType=HOSTED_OR_GOOGLE&amp;Email=__EMAIL__&amp;Passwd=__PASSWD__
&amp;service=finance&amp;source=yken.org-GoogleStockQuote-0.1
</pre>
<p><!--more--><br />
A few notes on the script:</p>
<ul>
<li>Replace __EMAIL__ and __PASSWD__ in post.txt with your Google credentials</li>
<li>This will only work when you have just one spreadsheet on your Google Docs</li>
<li>The script does not parse the XML replies, it just gets the values it needs using brute force (as it is just a proof of concept).</li>
<li>Three requests (four with login) just to get a quote is definitely over the top. The Google API allows batch operations, too.</li>
<li>I tried this on Max OS X 10.5 only</li>
</ul>
<p><!--more--><br />
To make the script actually useful, it would be good to modify it to take some parameters, for instance at least the desired stock symbol and then to use that stock symbol to write the =GoogleFinance() formula to A1. Google Data API allows it. This way, the script could be used for retrieving any quote (available on Google Finance), not only just the hardcoded one. Also, there are many <a href="http://code.google.com/apis/gdata/clientlibs.html">Google Data API Client Libraries</a> available, allowing to rewrite this script into something proper. I will try both and will post the result here.</p>
<p>Important note: all stock data obtained by the above script can be used for personal informational purposes only, see the <a href="http://www.google.com/intl/en/help/stock_disclaimer.html">Google disclaimer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://yken.org/2009/01/05/how-to-get-a-real-time-stock-quote-using-google-api/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Troubleshooting 401 with GoogleLogin Authorization header</title>
		<link>http://yken.org/2008/12/29/troubleshooting-401-with-googlelogin-authorization-header/</link>
		<comments>http://yken.org/2008/12/29/troubleshooting-401-with-googlelogin-authorization-header/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 13:54:32 +0000</pubDate>
		<dc:creator>ikendra</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://yken.org/2008/12/29/troubleshooting-401-with-googlelogin-authorization-header/</guid>
		<description><![CDATA[I was writing a small script to retrieve some data from Google Finance using the relevant Google Data API. I&#8217;m writing a stand-alone, desktop application and have therefore used the ClientLogin username and password authentication. The login worked fine, I was receiving HTTP status 200 and the appropriate response with the authentication token. Yet any [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing a small script to retrieve some data from <a href="http://finance.google.com/">Google Finance</a> using the relevant Google Data API. I&#8217;m writing a stand-alone, desktop application and have therefore used the ClientLogin username and password authentication. The login worked fine, I was receiving HTTP status 200 and the appropriate response with the authentication token. Yet any subsequent attempt to use the Data API (to insance to retrieve the portfolio data) failed with HTTP 401 Token Invalid error.</p>
<p><span id="more-70"></span><br />
It turned out hat the cause of getting the 401 error was in the way I set up the Authorization header sent with my requests. Unlike with AuthSub Authorization header used for web applications, the token value for ClientLogin authentication must not be enclosed in (double-)quotes. This is a mistake easy to make when switching from AuthSub to ClientLogin, resulting in HTTP status 401 reply for any Data API request. Remove the quotes around the token and the Data API request will work fine.<br />
<!--more--><br />
A small sample:</p>
<pre>
#!/bin/bash

if [ -e ClientLogin ]
then
&nbsp;&nbsp;rm ClientLogin
fi

wget --no-check-certificate --post-file=post.txt \
https://www.google.com/accounts/ClientLogin

TOKEN=`cat ClientLogin | grep Auth | \
sed "s#Auth=##" | xargs echo -n`

wget --header="Authorization: GoogleLogin auth=${TOKEN}" \
http://finance.google.com/finance/feeds/default/portfolios</span>
</pre>
<p>where post.txt is something like:</p>
<pre>
POST /accounts/ClientLogin HTTP/1.0
Content-type: application/x-www-form-urlencoded

accountType=HOSTED_OR_GOOGLE&amp;Email=__EMAIL__&amp;Passwd=__PASSWD__
&amp;service=finance&amp;source=yken.org-learningGoogleAPI-0.1</span>
</pre>
<p>Replace __EMAIL__ and __PASSWD__ with appropriate value. When the script is finished, you will have the relevant portfolio information saved in the &#8220;portfolio&#8221; file.</p>
]]></content:encoded>
			<wfw:commentRss>http://yken.org/2008/12/29/troubleshooting-401-with-googlelogin-authorization-header/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Satellite Imagery of Slovakia updated on Google Earth</title>
		<link>http://yken.org/2008/08/18/satellite-imagery-of-slovakia-updated-on-google-earth/</link>
		<comments>http://yken.org/2008/08/18/satellite-imagery-of-slovakia-updated-on-google-earth/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 21:19:25 +0000</pubDate>
		<dc:creator>ikendra</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://yken.org/2008/08/18/satellite-imagery-of-slovakia-updated-on-google-earth/</guid>
		<description><![CDATA[Updated. Satellite imagery of Slovak Republic and some other Central European (CE) countries on Google Earth (and Google Maps) got an update recently.

Detailed satellite imagery of Slovak Republic on Google Earth was very limited until recently. Only the country&#8217;s capital Bratislava and a few more other regions were covered with detailed photographs, dated to summer [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Updated</strong>. Satellite imagery of Slovak Republic and some other Central European (CE) countries on Google Earth (and Google Maps) got an update recently.</p>
<p><span id="more-65"></span><br />
Detailed satellite imagery of Slovak Republic on Google Earth was very limited until recently. Only the country&#8217;s capital Bratislava and a few more other regions were covered with detailed photographs, dated to summer of year 2005 or earlier. For detailed satellite imagery of the entire country, users would turn to <a href="http://mapy.atlas.sk" title="maps" target="_blank">maps</a> on ATLAS.sk, a project which aspires to be a leader in localization services in Slovakia.</p>
<p>This has changed recently as detailed coverage of the entire country was added on Google Earth and Google Maps, although not in such great detail as observed on previously existing detailed photographs. Previously existing detailed imagery remained the same, with no update.</p>
<p>A quick comparison of satellite imagery on Google Earth and ATLAS reveals that while ATLAS offers much more detailed imagery (50 cm / px), the imagery on Google is more recent. I zoomed in on a site where the largest highway crossing in the country is being build, west of city of PreĹˇov. ATLAS photograph (top) reveals an untouched, old crossroad, while the image on Google already shows signs of work, which began in April 2008 (below). Geographic coordinates: 48Â°59&#8242;53.24&#8243;N, 1Â°12&#8242;11.29&#8243;E</p>
<p><!--more--></p>
<p><img src="http://yken.org/wp-content/vydumanec-atlas.jpg" alt="Vydumanec - krizovatka" class="imgbottom" /></p>
<p><img src="http://yken.org/wp-content/vydumanec-google.jpg" alt="Vydumanec - krizovatka - Google" class="imgbottom" /></p>
<p><!--more--></p>
<p><strong>Update, 5 Oct 2008:</strong> It appears that for entire region of Slovakia, Google switched to Eurosense/Geodis imagery data, the same as used by ATLAS. This blog post is hereby not valid anymore.</p>
<p><strong>Update, 19 Oct 2008:</strong> Recently, ATLAS made available the updated Eurosense/Geodis imagery for Bratislava, dated to April 2007, the same resolution.</p>
]]></content:encoded>
			<wfw:commentRss>http://yken.org/2008/08/18/satellite-imagery-of-slovakia-updated-on-google-earth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slovakia updated on Google Maps</title>
		<link>http://yken.org/2007/05/17/slovakia-updated-on-google-maps/</link>
		<comments>http://yken.org/2007/05/17/slovakia-updated-on-google-maps/#comments</comments>
		<pubDate>Thu, 17 May 2007 20:43:22 +0000</pubDate>
		<dc:creator>ikendra</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Slovakia]]></category>
		<category><![CDATA[TomTom]]></category>

		<guid isPermaLink="false">http://yken.org/2007/05/17/slovakia-updated-on-google-maps/</guid>
		<description><![CDATA[&#8220;In the vast universe of Google users, a small cadre of aficionados exists who closely track every move of the search industry leader and act as a kind of editorial board and echo chamber for all things Google&#8221; wrote David Vise in his book &#8220;The Google Story&#8220;. I came across that statement while reading the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;In the vast universe of Google users, a small cadre of aficionados exists who closely track every move of the search industry leader and act as a kind of editorial board and echo chamber for all things Google&#8221; wrote David Vise in his book &#8220;<a href="http://www.thegooglestory.com/">The Google Story</a>&#8220;. I came across that statement while reading the book yesterday.</p>
<p><span id="more-23"></span></p>
<p>Not that I would follow &#8220;the search industry leader&#8221; steps too closely, yet one thing I was happy to notice recently: PreĹˇov, the Eastern Slovakian town where I was born, got updated on Google Maps and so was whole of Slovakia and some other CEE countries. It appears that Google had published the 2007.1 TeleAtlas data with the detailed street coverage available for some new CEE regions, some advanced details (such as POIs) are however still missing.</p>
<p><!--more--></p>
<p>I compared the Google Maps version with the most recent version of proprietary CEE Maps available for TomTom devices (version 6.75) &#8211; both Google and TomTom maps of Slovakia are the same, apparently based on 2007.1 TeleAtlas data (including all the mistakes). Google Earth has the same update, the countdown now started for the detailed satellite images coverage&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://yken.org/2007/05/17/slovakia-updated-on-google-maps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
