<?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>Planet OpenShine</title>
	<atom:link href="http://blogs.openshine.com/planet/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.openshine.com/planet</link>
	<description>All OpenShine blogs in just one place</description>
	<lastBuildDate>Thu, 13 Oct 2011 14:51:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>I’ll miss you Dennis Ritchie</title>
		<link>http://blogs.openshine.com/rmajadas/2011/10/13/i%E2%80%99ll-miss-you-dennis-ritchie/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/10/13/i%E2%80%99ll-miss-you-dennis-ritchie/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 14:51:04 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
		
		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=59</guid>
		<description><![CDATA[Wow It&#8217;s a terrible month for the hackers of the world. Dennis Ritchie creator of C and Unix is dead.
He wrote THE book  : &#8220;C Programming Language&#8221;. I fell in love with C with this book.
I&#8217;ll miss you Dennis !!  
]]></description>
			<content:encoded><![CDATA[<p>Wow It&#8217;s a terrible month for the hackers of the world. Dennis Ritchie creator of C and Unix is dead.</p>
<p>He wrote <a href="http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628/ref=sr_1_1?ie=UTF8&amp;qid=1318516671&amp;sr=8-1">THE book </a> : &#8220;C Programming Language&#8221;. I fell in love with C with this book.</p>
<p>I&#8217;ll miss you Dennis !! <img src='http://blogs.openshine.com/rmajadas/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/10/13/i%e2%80%99ll-miss-you-dennis-ritchie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I’ll miss you Steve Jobs</title>
		<link>http://blogs.openshine.com/rmajadas/2011/10/06/ill-miss-you-steve-jobs/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/10/06/ill-miss-you-steve-jobs/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 08:32:39 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
		
		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=54</guid>
		<description><![CDATA[Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important. [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.</p>
<p>- Steve P. Jobs, Stanford, 2005</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/10/06/ill-miss-you-steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I’m going to Desktop Summit</title>
		<link>http://blogs.openshine.com/rmajadas/2011/08/02/im-going-to-desktop-summit/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/08/02/im-going-to-desktop-summit/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 10:43:24 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
		
		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=52</guid>
		<description><![CDATA[
See you in a few days in Berlin ! Happy hacking !
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.openshine.com/rmajadas/files/2011/05/DS2011banner.png"><img class="aligncenter size-medium wp-image-51" title="DS2011banner" src="http://blogs.openshine.com/rmajadas/files/2011/05/DS2011banner-300x99.png" alt="" width="300" height="99" /></a></p>
<p>See you in a few days in Berlin ! Happy hacking !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/08/02/im-going-to-desktop-summit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenShine git workflow</title>
		<link>http://blogs.openshine.com/rmajadas/2011/05/25/openshine-git-workflow/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/05/25/openshine-git-workflow/#comments</comments>
		<pubDate>Wed, 25 May 2011 16:54:58 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[openshine]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=36</guid>
		<description><![CDATA[﻿﻿Today i would like to explain to you about the git workflow that we follow at OpenShine. As you know, git is a wonderful distributed version control system developed by the linux kernel team. This tool is used by many Free software projects as for example : gnome.org freedesktop.org kernel.org . For a year , [...]]]></description>
			<content:encoded><![CDATA[<p>﻿﻿Today i would like to explain to you about the git workflow that we follow at OpenShine. As you know, <a href="http://en.wikipedia.org/wiki/Git_(software)" >git</a> is a wonderful distributed version control system developed by the linux kernel team. This tool is used by many Free software projects as for example : <a href="http://www.gnome.org">gnome.org</a> <a href="http://www.freedesktop.org">freedesktop.org</a> <a href="http://www.kernel.org">kernel.org</a> .</p>
<p>For a year , maybe more, we&#8217;ve been using git for our projects. The experience has been good, but in the beginning was a little bit complicated. The main problem was the git learning curve. If you has been using svn or cvs, the change to git is a little bit complicated because there are new concepts to learn about how to work with different repositories . So ﻿we thought it would be necessary to create a workflow for make easier our work.</p>
<p>I started reading documents, articles, books about git and git workflows. There are a lot of information about it , so I took ideas from here and there  and i draw it with inkscape. ﻿While we work, we discussed the workflow and fixed it if necessary. And the final result was this (now released under CC-BY-SA  ;) )</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.png" alt="OpenShine git workflow" width="600" /></p>
<p>Available in <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.png" >png</a>, <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.pdf">pdf</a>, <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.svg">svg</a> formats. And you can fork it in this <a href="http://github.com/openshine/osworkflows" >repository</a> .</p>
<p>The diagram has two parts, left side shows the git workflow and the right side is the explanation of the workflow steps. In the initial situation, we&#8217;ve a repository (osproject at openshine) that we want to add a feature or fix a bug.</p>
<p>So the workflow is as follow :</p>
<ol>
<li>﻿﻿﻿Fork a project in github, and this fork will be stored in your github account. To &#8220;fork&#8221; a project in github means to create a clone of this project.</li>
<li>Clone the project fork, that you create in the 1st step, in your computer.﻿It’s really useful adding the upstream repository as remote (the repository from you forked in the 1st step).</li>
<li>Keep updated your repository from upstream whenever possible.</li>
<li>Create a branch with the feature&#8217;s name or the bug id and description. Something like add-new-configuration-window or main-window-error-57 &#8230;</li>
<li>Develop &amp; commit, develop &amp; commit &#8230;..</li>
<li>Check if your branch is updated from upstream.</li>
<li>Feature complete !!</li>
<li>If you want to push all your commits check 8th step in the diagram</li>
<li>If you want to push all your commits but in a single commit, check 9th step in the diagram</li>
<li>Now you&#8217;ve you branch in your github account. The last step is ask to the upstream developer if you can merge your branch in upstream. So, press &#8220;Pull request&#8221; button. When your changes will be accepted by the upstream maintainer you can remove your branch stored in your github repository with &#8220;git push origin :branch-name&#8221;.</li>
</ol>
<p>The Maintainer workflow is about how to merge branches from the point of view of upstream. But in the new version of github is not necessary in most of cases because you have a &#8220;Merge&#8221; button.</p>
<p>And finally &#8230; some useful links :</p>
<ul>
<li><a href="http://git-scm.com/">GIT homepage</a></li>
<li><a href="http://git-scm.com/documentation">GIT documentation</a></li>
<li><a href="http://github.com/">github</a> : public git service</li>
<li><a href="http://gitorious.org/">gitorious</a> : public git service and opensourced server.</li>
<li><a href="http://github.com/openshine">OpenShine github organization</a></li>
<li>OpenShine git workflow : <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.png" >png</a>, <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.pdf">pdf</a>, <a href="http://www.openshine.com/m/osweb/workflows/git/v1.0/git.svg">svg</a></li>
<li>OpenShine workflows <a href="http://github.com/openshine/osworkflows">repository</a></li>
</ul>
<div id="gt-res-content">
<div dir="ltr">I hope you liked it and you find it useful <img src='http://blogs.openshine.com/rmajadas/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</div>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/05/25/openshine-git-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing Twitter’s User Timeline with Python</title>
		<link>http://blogs.openshine.com/pvieytes/2011/05/18/parsing-twitter-user-timeline-with-python/</link>
		<comments>http://blogs.openshine.com/pvieytes/2011/05/18/parsing-twitter-user-timeline-with-python/#comments</comments>
		<pubDate>Wed, 18 May 2011 07:20:46 +0000</pubDate>
		<dc:creator>pvieytes</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/pvieytes/?p=51</guid>
		<description><![CDATA[Usually, when you want to include the tweets on a web, it is common to embed a javascript code to show it. Twitter offers a very useful widget for this purpose. http://twitter.com/about/resources/widgets/ This is the best way to show the user timeline without worries. You just copy and paste some javascript code, but sometimes you need [...]]]></description>
			<content:encoded><![CDATA[<p>Usually, when you want to include the tweets on a web, it is common to embed a javascript code to show it. Twitter offers a very useful widget for this purpose. <a href="http://twitter.com/about/resources/widgets/">http://twitter.com/about/resources/widgets/</a></p>
<p>This is the best way to show the user timeline without worries. You just copy and paste some javascript code, but sometimes you need more flexibility and copy and paste javascript widget it&#8217;s not enough.</p>
<p>In this post you&#8217;ll find a way to parse the Twitter&#8217;s user timeline from a json file with Python. There are a lot of ways to do that, here&#8217;s mine.</p>
<p>This is not a Python wrapper arround the twitter api, if you are looking for something like that, please visit <a href="http://code.google.com/p/python-twitter/">http://code.google.com/p/python-twitter/</a></p>
<h2>Getting the Twitter&#8217;s user time</h2>
<p>To download the last tweets, I use the<a href="http://dev.twitter.com/doc/get/statuses/user_timeline"> GET statuses/user_timeline</a> function that returns a json file. I&#8217;ve created a function to download the json file and  parse it. I&#8217;ve also created a Tweet class to store the tweet info.</p>
<p>The <em>&#8220;read_tweets()&#8221;</em> function parse the json file and store the tweet info in a list of Tweet instances. The Tweet class also provide some methods to store info easly.</p>
<h2>Let&#8217;s see the code.</h2>
<div id="gist-978125" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kn">import</span> <span class="nn">Tweet</span></div><div class='line' id='LC2'><span class="kn">import</span> <span class="nn">simplejson</span></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">urllib2</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'><span class="k">def</span> <span class="nf">read_tweets</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">num_tweets</span><span class="p">):</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweets</span> <span class="o">=</span> <span class="p">[]</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://api.twitter.com/1/statuses/user_timeline.json?</span><span class="se">\</span></div><div class='line' id='LC9'><span class="s">           screen_name=</span><span class="si">%s</span><span class="s">&amp;count=</span><span class="si">%s</span><span class="s">&amp;include_rts=true&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">num_tweets</span><span class="p">)</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">file</span> <span class="o">=</span> <span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>        </div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">content</span> <span class="o">=</span> <span class="nb">file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>        </div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">json</span> <span class="o">=</span> <span class="n">simplejson</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">content</span><span class="p">)</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="n">js_tweet</span> <span class="ow">in</span> <span class="n">json</span><span class="p">:</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span> <span class="o">=</span> <span class="n">Tweet</span><span class="p">()</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;id&#39;</span><span class="p">]</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;user&#39;</span><span class="p">][</span><span class="s">&#39;screen_name&#39;</span><span class="p">]</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">try</span><span class="p">:</span></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">retweet_user</span> <span class="o">=</span> <span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;retweeted_status&#39;</span><span class="p">][</span><span class="s">&#39;user&#39;</span><span class="p">][</span><span class="s">&#39;screen_name&#39;</span><span class="p">]</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">retweeted</span> <span class="o">=</span> <span class="bp">True</span></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">except</span><span class="p">:</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">retweeted</span> <span class="o">=</span> <span class="bp">False</span>   </div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">set_date</span><span class="p">(</span><span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;created_at&#39;</span><span class="p">])</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c">#tweet.id, tweet.username must exist</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">set_tweet_url</span><span class="p">()</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c">#convert plain text to html text</span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;text&#39;</span><span class="p">])</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c">#tweet.id, tweet.username must exist</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">set_profile_url</span><span class="p">()</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="n">tweet</span><span class="o">.</span><span class="n">retweeted</span><span class="p">:</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">user_avatar_url</span> <span class="o">=</span> <span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;retweeted_status&#39;</span><span class="p">][</span><span class="s">&#39;user&#39;</span><span class="p">][</span><span class="s">&#39;profile_image_url&#39;</span><span class="p">]</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span><span class="p">:</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet</span><span class="o">.</span><span class="n">user_avatar_url</span> <span class="o">=</span> <span class="n">js_tweet</span><span class="p">[</span><span class="s">&#39;user&#39;</span><span class="p">][</span><span class="s">&#39;profile_image_url&#39;</span><span class="p">]</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweets</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">tweet</span><span class="p">)</span>    </div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="n">tweets</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/978125/71896710bf8db1ea8dc7c9693029ccd63778bfcf/read_tweets.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/978125#file_read_tweets.py" style="float:right;margin-right:10px;color:#666">read_tweets.py</a>
            <a href="https://gist.github.com/978125">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>In <em>&#8220;read_tweets()&#8221;</em> I use urllib2 to read the file and simplejson to parse it. To store the info I use the Tweet Class methods.</p>
<div id="gist-978125" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kn">import</span> <span class="nn">time</span></div><div class='line' id='LC2'><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">re</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'><span class="k">class</span> <span class="nc">Tweet</span><span class="p">():</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Store the tweet info</span></div><div class='line' id='LC8'><span class="sd">    &quot;&quot;&quot;</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">id</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">username</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">url</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">user_avatar_url</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">tweet_url</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">profile_url</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">html_text</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">retweeted</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">retweet_user</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">date</span> <span class="o">=</span> <span class="bp">None</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">set_date</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">date_str</span><span class="p">):</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Convert string to datetime</span></div><div class='line' id='LC22'><span class="sd">        &quot;&quot;&quot;</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">time_struct</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="n">date_str</span><span class="p">,</span> <span class="s">&quot;%a %b </span><span class="si">%d</span><span class="s"> %H:%M:%S +0000 %Y&quot;</span><span class="p">)</span><span class="c">#Tue Apr 26 08:57:55 +0000 2011</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">date</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">fromtimestamp</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">mktime</span><span class="p">(</span><span class="n">time_struct</span><span class="p">))</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">set_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plain_text</span><span class="p">):</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;convert plain text into html text with http, user and hashtag links</span></div><div class='line' id='LC29'><span class="sd">        &quot;&quot;&quot;</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">re_http</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r&quot;(http://[^ ]+)&quot;</span><span class="p">)</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">html_text</span> <span class="o">=</span> <span class="n">re_http</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s">r&#39;\1&#39;</span><span class="p">,</span> <span class="n">plain_text</span><span class="p">)</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">re_https</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r&quot;(https://[^ ]+)&quot;</span><span class="p">)</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">html_text</span> <span class="o">=</span> <span class="n">re_https</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s">r&#39;\1&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="p">)</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">re_user</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r&#39;@[0-9a-zA-Z+_]*&#39;</span><span class="p">,</span><span class="n">re</span><span class="o">.</span><span class="n">IGNORECASE</span><span class="p">)</span>        </div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="n">iterator</span> <span class="ow">in</span> <span class="n">re_user</span><span class="o">.</span><span class="n">finditer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="p">):</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">a_username</span> <span class="o">=</span> <span class="n">iterator</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">username</span> <span class="o">=</span> <span class="n">a_username</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;@&#39;</span><span class="p">,</span><span class="s">&#39;&#39;</span><span class="p">)</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">link</span> <span class="o">=</span> <span class="s">&#39;&#39;</span> <span class="o">+</span> <span class="n">a_username</span> <span class="o">+</span> <span class="s">&#39;&#39;</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">html_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">a_username</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC45'>&nbsp;</div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">re_hash</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r&#39;#[0-9a-zA-Z+_]*&#39;</span><span class="p">,</span><span class="n">re</span><span class="o">.</span><span class="n">IGNORECASE</span><span class="p">)</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="n">iterator</span> <span class="ow">in</span> <span class="n">re_hash</span><span class="o">.</span><span class="n">finditer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="p">):</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">h_tag</span> <span class="o">=</span> <span class="n">iterator</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">link_tag</span> <span class="o">=</span> <span class="n">h_tag</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;#&#39;</span><span class="p">,</span><span class="s">&#39;%23&#39;</span><span class="p">)</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">link</span> <span class="o">=</span> <span class="s">&#39;&#39;</span> <span class="o">+</span> <span class="n">h_tag</span> <span class="o">+</span> <span class="s">&#39;&#39;</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">html_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">h_tag</span> <span class="o">+</span> <span class="s">&quot; &quot;</span><span class="p">,</span> <span class="n">link</span> <span class="o">+</span> <span class="s">&quot; &quot;</span><span class="p">)</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c">#check last tag</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">offset</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="p">)</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">h_tag</span><span class="p">)</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">h_tag</span><span class="p">,</span> <span class="n">offset</span><span class="p">)</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="n">index</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">html_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">html_text</span><span class="p">[:</span><span class="n">index</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">link</span></div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC58'><br/></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">set_profile_url</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Create the url profile</span></div><div class='line' id='LC61'><span class="sd">        &quot;&quot;&quot;</span></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">retweeted</span><span class="p">:</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">profile_url</span> <span class="o">=</span> <span class="s">&quot;http://www.twitter.com/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">retweet_user</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span><span class="p">:</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">profile_url</span> <span class="o">=</span> <span class="s">&quot;http://www.twitter.com/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">username</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">set_tweet_url</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Create the url of the tweet</span></div><div class='line' id='LC69'><span class="sd">        &quot;&quot;&quot;</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">tweet_url</span> <span class="o">=</span> <span class="s">&quot;http://www.twitter.com/</span><span class="si">%s</span><span class="s">/status/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">username</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/978125/5952c7a75e1ba62236d79ae5848a11cf9da3e3aa/tweet.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/978125#file_tweet.py" style="float:right;margin-right:10px;color:#666">tweet.py</a>
            <a href="https://gist.github.com/978125">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The most important Tweet class method is <em>&#8220;set_text()&#8221;</em>. It converts plain text into html code with http, user and hashtag links. I use python regular expressions to find, http://xxx, https://xxx, #xxx and @xxx and replace it for a valid Twitter link.</p>
<h2>Django advice</h2>
<p>If you gonna use this code with Django, please, let me give you some advice.</p>
<p><em>&#8220;read_tweets()&#8221;</em> download a json file every time you call it so please don&#8217;t use it in a view. It&#8217;ll delay the view too much. The tweets must be stored with <em>&#8220;read_tweets()&#8221;</em> and the view must read this stored tweets. You can store the tweets in a lot ways. I use a <em>&#8220;manage.py&#8221;</em> script added to cron to stored it in memcache, but It&#8217;s your choice.</p>
<p>If you gonna show the html code stored en Tweet.html_text in a Django template don&#8217;t forget use the safe tag.</p>
<pre class="brush: python; title: ;">{{ tweet.html_text|safe }}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/pvieytes/2011/05/18/parsing-twitter-user-timeline-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing extensions for the new Gnome Shell</title>
		<link>http://blogs.openshine.com/cgtapia/2011/05/16/writing-extensions-to-the-new-gnome-shell/</link>
		<comments>http://blogs.openshine.com/cgtapia/2011/05/16/writing-extensions-to-the-new-gnome-shell/#comments</comments>
		<pubDate>Mon, 16 May 2011 08:53:46 +0000</pubDate>
		<dc:creator>César García Tapia</dc:creator>
				<category><![CDATA[extensions]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[gnome-shell]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/cgtapia/?p=28</guid>
		<description><![CDATA[One of the features that includes the new Gnome Shell is the ability to create  extensions. Those are plugins to add new functionalities to the Shell, or alter the default ones. It&#8217;s a natural evolution of the former panel applets, but far more powerful, since you can create almost anything you can imagine, not only [...]]]></description>
			<content:encoded><![CDATA[<p>One of the features that includes the new Gnome Shell is the ability to create  <a title="Gnome Shell Extensions" href="http://live.gnome.org/GnomeShell/Extensions" >extensions</a>. Those are plugins to add new functionalities to the Shell, or alter the default ones. It&#8217;s a natural evolution of the former panel applets, but far more powerful, since you can create almost anything you can imagine, not only these little apps for the panel.</p>
<p>The first thing you must know is that everything related to Shell is Javascript and CSS. Yeah, Javascript. Everybody knows Javascript, so it&#8217;s a great starting point. All we have to do to create a Shell extension is write down a JS file, create a CSS stylesheet, and it&#8217;s done. Easy, isn&#8217;t it?</p>
<p>Gnome Shell is a big thing, so explaining all you can do with the extensions isn&#8217;t the point of this post. For the moment, we&#8217;ll just play with the upper panel, but it&#8217;s possible to expand the Shell in many many ways. For example, you can add new sections in the Activities menu (by default only Windows and Applications are shown), add new search engines (besides the Google and Wikipedia ones), add new items in the user menu (A Shutdown menu entry, and not only the Suspend one!), and tons of other stuff. Just think about what would be great to have in the Shell, and go for it.</p>
<h1>HOW TO CREATE AN EXTENSION?</h1>
<p>Although it&#8217;s not mandatory to use it (you can write your extension completely from scratch), Gnome 3 includes a bash comand to help us to create new extensions: gnome-shell-extension-tool. We&#8217;ll use it to create the draft of our extension:</p>
<p><code>$ gnome-shell-extension-tool --create-extension</code></p>
<p>The command will ask us for some basic metadata:</p>
<ul>
<li>Name: A name for the extension.</li>
<li>Description: A more detailed explanation for the extension functionality.</li>
<li>Uuid: An unique identifier for the extension. It must be in a email address format, say foo@bar.com. By example, if your extension is named WorldDomination, and you work in DevilCorp Inc, a good Uuid should be world_domination@extensions.devilcorp.com.</li>
</ul>
<p>Once you&#8217;ve filled that steps, the command will create some files in this path:</p>
<p><code>$HOME/.local/share/gnome-shell/extensions/world_domination@extensions.devilcorp.com/</code></p>
<p>Now we can edit that files to do what we want.</p>
<h1>HOW TO LOAD THE EXTENSION?</h1>
<p>When a user starts a Gnome session, the Shell will load all the extensions located in the following places:</p>
<ul>
<li><code>~/.local/share/gnome-shell/extensions</code></li>
<li><code>/usr/share/gnome-shell/extensions</code></li>
<li><code>/usr/local/share/gnome-shell/extensions</code></li>
</ul>
<p>But if we are developing an extension, it&#8217;s boring and time-wasting to log out and in every time we want to reload the shell. Instead of that, we can reload just the Shell, in a very easy way: Enter Alt+F2 and write &#8220;r&#8221; (reload).</p>
<h1>OK, SHOW ME THE CODE!</h1>
<p>If we&#8217;ve created the extension with gnome-shell-extension-tool, we can edit the extension.js file it has created:</p>
<p><code>$HOME/.local/share/gnome-shell/extensions/world.domination@extensions.devilcorp.com/extension.js</code></p>
<p>It contains a very simple extension that shows a &#8220;Hello world&#8221; message when clicking in the top bar:</p>
<pre class="brush: jscript; title: ;">// Sample extension code, makes clicking on the panel show a message

const St = imports.gi.St;
const Mainloop = imports.mainloop;

const Main = imports.ui.main;

function _showHello() {
    let text = new St.Label({ style_class: 'helloworld-label', text: &quot;Hello, world!&quot; });
    let monitor = global.get_primary_monitor();
    global.stage.add_actor(text);
    text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));
    Mainloop.timeout_add(3000, function () { text.destroy(); });
}

// Put your extension initialization code here
function main() {
    Main.panel.actor.reactive = true;
    Main.panel.actor.connect('button-release-event', _showHello);
}</pre>
<p>When we reload the Shell and click the panel, we can see this:</p>
<p><a href="http://blogs.openshine.com/cgtapia/files/2011/05/1.png"><img class="alignnone size-full wp-image-29" title="Our first gnome shell extension" src="http://blogs.openshine.com/cgtapia/files/2011/05/1.png" alt="Our first gnome shell extension" width="560" height="420" /></a></p>
<p>When Gnome Shell loads the extension, it searches the main() function. In the above code, we make the panel to be responsive to events (<code>Main.panel.actor.reactive = true;</code>) and connect the panel&#8217;s event &#8216;<code>button-release-event</code>&#8216; to execute the funcion _showHello() when the user clicks the panel.</p>
<p>Let&#8217;s see step by step what _showHello does:</p>
<p><code>let text = new St.Label({ style_class: 'helloworld-label', text: "Hello, world!" });</code></p>
<p>Here we create a label, with the text &#8220;Hello, world!&#8221;, and set it to use the CSS class &#8216;helloworld-label&#8217;. That class is defined in the &#8216;stylesheet.css&#8217; file, and we can modify it if we want.</p>
<p><code>let monitor = global.get_primary_monitor();<br />
global.stage.add_actor(text);<br />
text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));</code></p>
<p>Now we set the label position in the center of the main screen (we specify the main screen because we can have two or more monitors in our computer).</p>
<p><code>Mainloop.timeout_add(3000, function () { text.destroy(); });</code></p>
<p>Three seconds after the label is shown, we destroy it, so it will dissapear.</p>
<h1>HOW CAN WE ADD ELEMENTS TO THE PANEL?</h1>
<p>Let&#8217;s modify the extension to add a button to the panel. When the user clicks the button, the &#8220;Hello World&#8221; message will be shown.</p>
<pre class="brush: jscript; title: ;">const St = imports.gi.St;
const Mainloop = imports.mainloop;
const Lang = imports.lang;
const Main = imports.ui.main;

function PanelButton() {
    this._init();
}

PanelButton.prototype = {
    _init: function() {
        this.actor = new St.Button();
        this._label = new St.Label({ text: &quot;HelloWorld Button&quot; });
        this.actor.set_child(this._label);
        Main.panel._centerBox.add(this.actor, { y_fill: true });

        this.actor.connect('clicked', Lang.bind(this, _showHello));
    },

    _onDestroy: function() {}
};

function _showHello() {
    let text = new St.Label({ style_class: 'helloworld-label', text: &quot;Hello, world!&quot; });
    let monitor = global.get_primary_monitor();
    global.stage.add_actor(text);
    text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));
    Mainloop.timeout_add(3000, function () { text.destroy(); });
}

// Put your extension initialization code here
function main() {
    let _panelButton = new PanelButton();
}</pre>
<p>The button will be placed in the center of the panel, at the right side of the Calendar button. This is what will be shown when we load the extension and click the new button:</p>
<p><a href="http://blogs.openshine.com/cgtapia/files/2011/05/2.png"><img class="alignnone size-full wp-image-48" title="Adding a button to the extension" src="http://blogs.openshine.com/cgtapia/files/2011/05/2.png" alt="Adding a button to the extension" width="512" height="384" /></a></p>
<p>The _showHello() function remains the same. We&#8217;ve only changed the code to execute that function when we click on the button, instead of the panel.</p>
<h1>HOW CAN I LEARN MORE?</h1>
<p>It&#8217;s a really good question. Up to now, Gnome Shell has very few official documentation. But, as usual, you always can read some code, and search the Internet. In the <a href="http://git.gnome.org" >Gnome&#8217;s GIT</a> you can find a module called <a href="http://git.gnome.org/browse/gnome-shell-extensions/" >gnome-shell-extensions</a>. These are some functional extensions, where you can learn how things work. It&#8217;s a good starting point. Read the <a href="http://git.gnome.org/browse/gnome-shell-extensions/tree/README" >README</a> to get a description on what each extension does. But this lack of documentation isn&#8217;t going to be forever. I&#8217;m sure that soon there will be good documentation, as in every part of the Gnome desktop. Be aware of news in developer.gnome.org</p>
<p>The posibilities with Gnome Shell extensions are huge. Hurry up and create some of them!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/cgtapia/2011/05/16/writing-extensions-to-the-new-gnome-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello everybody!!</title>
		<link>http://blogs.openshine.com/pvieytes/2011/04/18/hello-everybody/</link>
		<comments>http://blogs.openshine.com/pvieytes/2011/04/18/hello-everybody/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 09:54:48 +0000</pubDate>
		<dc:creator>pvieytes</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/pvieytes/?p=17</guid>
		<description><![CDATA[this is a personal blog in a professional environment. I&#8217;m a software enginner at Openshine so I&#8217;m going to write about software. I&#8217;ll write about the stuff I&#8217;m using in my job and other interesting software issues. By now, I&#8217;m focus in web development with Django framework so the most posts will be influed by [...]]]></description>
			<content:encoded><![CDATA[<p>this is a personal blog in a professional environment. I&#8217;m a software enginner at Openshine so I&#8217;m going to write about software. I&#8217;ll write about the stuff I&#8217;m using in my job and other interesting software issues. By now, I&#8217;m focus in web development with Django framework so the most posts will be influed by python, django and web development, but other software themes will appear, mostly about open source.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/pvieytes/2011/04/18/hello-everybody/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Primeras impresiones de Gnome 3.0</title>
		<link>http://blogs.openshine.com/cgtapia/2011/04/13/primeras-impresiones-de-gnome-3-0/</link>
		<comments>http://blogs.openshine.com/cgtapia/2011/04/13/primeras-impresiones-de-gnome-3-0/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 09:37:58 +0000</pubDate>
		<dc:creator>César García Tapia</dc:creator>
				<category><![CDATA[Gnome]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[spanish]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/cgtapia/?p=8</guid>
		<description><![CDATA[La salida de Gnome 3.0 ha sido esperada con impaciencia durante tres años por todos los que usamos software libre en nuestros entornos personales y profesionales. Y por fin ya está aquí. Ha supuesto un rediseño de prácticamente toda la plataforma, desde la renovación de las librerías de desarrollo hasta el cambio radical del aspecto [...]]]></description>
			<content:encoded><![CDATA[<p>La salida de Gnome 3.0 ha sido esperada con impaciencia durante tres años por todos los que usamos software libre en nuestros entornos personales y profesionales. Y por fin ya está aquí. Ha supuesto un rediseño de prácticamente toda la plataforma, desde la renovación de las librerías de desarrollo hasta el cambio radical del aspecto del escritorio. Llevo usándolo unos días, y el cambio en la experiencia de usuario es realmente enorme. Me gustaría hacer aquí algunos comentarios con mis primeras impresiones.</p>
<p style="text-align: center"><a href="http://blogs.openshine.com/cgtapia/files/2011/04/gnome3logo.jpg"><img class="size-full wp-image-10  aligncenter" src="http://blogs.openshine.com/cgtapia/files/2011/04/gnome3logo.jpg" alt="Gnome 3 logo" width="300" height="300" /></a></p>
<p><strong>Colega, ¿dónde están mis applets?</strong></p>
<p>La primera sensación que tuve, tras unos cuantos minutos explorando el nuevo escritorio, es que en Gnome se han dado cuenta de que su misión es pasar desapercibido para el usuario mientras éste no lo necesite. No hay apenas barras, salvo una pequeña banda negra con la fecha y hora y poco más, los applets han desaparecido, la zona de notificaciones es mucho menos intrusiva que la de Gnome2&#8230; El escritorio llevado a su mínima expresión.</p>
<p>En general, estoy de acuerdo con la decisión de que así sea. Por supuesto, echo de menos algunos applets que solía usar, como le pasará a todo el mundo que lleve tiempo usando Gnome. Sin embargo, <a href="https://live.gnome.org/GnomeShell/Extensions">el sistema de extensiones de Gnome Shell</a> permite crear nuevas utilidades para el escritorio. El sistema de desarrollo para estas extensiones es javascript y CSS, ambos viejos conocidos para prácticamente cualquier programador, por lo que espero que sea cuestión de tiempo que empecemos a ver sorprendentes nuevos usos del Shell.</p>
<p><strong>Gestión de ventanas</strong></p>
<p>El nuevo sistema para visualizar las ventanas que tenemos abiertas también es un cambio importante respecto a versiones anteriores. Como ya no existe la lista de ventanas en la barra de tareas, cuando estamos trabajando con una aplicación no podemos saber cuántas ventanas tenemos abiertas. Para ello tenemos que ir a la &#8220;Vista de Actividades&#8221;, donde tenemos algo parecido al Exposé de MacOSX, aunque más evolucionado. Quizá sea más espectacular que útil, pero si no nos convence seguimos tenemos el clásico Alt+Tab, que sigue funcionando igual que siempre.</p>
<p><a href="http://blogs.openshine.com/cgtapia/files/2011/04/expose.png"><img class="aligncenter size-full wp-image-17" src="http://blogs.openshine.com/cgtapia/files/2011/04/expose.png" alt="expose screenshot" width="800" height="499" /></a></p>
<p>La nueva barra de título de las ventanas, sin los botones de minimizar/maximizar también ha sido una decisión polémica. Yo personalmente estoy de acuerdo con ella. Siempre he utilizado la minimización con una única finalidad: acceder al escritorio. Con Gnome3 ya no hay escritorio al que acceder, por lo que realmente, en mi caso al menos, dejan de tener utilidad (Aunque quizá para el futuro sí que convenga tener una forma de acceder al escritorio de manera rápida . Es probable que vayan apareciendo extensiones que le vuelvan a dar una utilidad).</p>
<p style="text-align: center"><a href="http://blogs.openshine.com/cgtapia/files/2011/04/nominimize.png"><img class="size-full wp-image-12 aligncenter" src="http://blogs.openshine.com/cgtapia/files/2011/04/nominimize.png" alt="Nueva barra de título" width="506" height="125" /></a></p>
<p><strong>Aplicaciones</strong></p>
<p>Y llegamos al sitio donde, lamentable, no estoy del todo de acuerdo con las decisiones tomadas en Gnome3: La Vista de Actividades. Supongo que la idea en esta vista es tener un único sitio al que acceder para hacer cualquier cosa. El problema es que, normalmente, cuando se tiene mucha funcionalidad acumulada en un mismo sitio suele ser más complicado encontrar lo que andas buscando.</p>
<p>El ejemplo más obvio es el menú de aplicaciones. Para ver la lista de aplicaciones ahora hay que hacer dos clicks (Actividades -&gt; Aplicaciones). Y lo que obtenemos es un listado completo de todas las aplicaciones que tenemos instaladas. Si queremos ver, por ejemplo, los juegos, necesitaremos otro click adicional. Poco práctico para quien no tiene perfectamente claro qué tiene instalado. Además, si quieres lanzar más de una aplicación a la vez (algo bastante habitual al iniciar sesión), tendrás que acceder varias veces seguidas a la Vista de Actividades. Es un poco incómodo si lo tienes que hacer todos los días al empezar tu jornada.</p>
<p>Otro punto en el que creo que se han pasado de simplificación es en la Configuración del Sistema. Exceptuando el fondo de pantalla, no se puede personalizar el escritorio en ningún aspecto: Ni cambiar el tema de GTK, ni cambiar los tipos de fuentes, ni elegir el salvapantallas&#8230; ¿Será algo permanente, o simplemente una omisión temporal para poder cumplir con los plazos de publicación?</p>
<p><strong>¡Viva Gnome!</strong></p>
<p>Realmente, me ha costado trabajo dar con las tres o cuatro cosas que no me han gustado de Gnome3. El trabajo realizado por las cientos de personas implicadas ha sido prácticamente impecable. En general, la nota que le doy sería un sobresaliente bajo, pero estoy absolutamente convencido de que será un sobresaliente completo en muy poco tiempo.</p>
<p>Me queda explorar las novedades de Gnome3 para los desarrolladores: la nueva introspección de GObject, las novedades de GTK+ 3.0, etcétera. Pero lo haré en otro post más adelante.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/cgtapia/2011/04/13/primeras-impresiones-de-gnome-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gnome 3 is here !!</title>
		<link>http://blogs.openshine.com/rmajadas/2011/04/07/gnome-3-is-here/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/04/07/gnome-3-is-here/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 12:23:14 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
				<category><![CDATA[Gnome]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=21</guid>
		<description><![CDATA[Gnome 3 is here and it&#8217;s awesome !!!
﻿I really feel proud of belonging to this community. Thanks to all hackers, translators, QA people, sysadmins, webmasters, release team members, marketing team members, foundation members &#8230;. Thanks for...]]></description>
			<content:encoded><![CDATA[<p>Gnome 3 is here and it&#8217;s awesome !!!</p>
<p>﻿I really feel proud of belonging to this community. Thanks to all hackers, translators, QA people, sysadmins, webmasters, release team members, marketing team members, foundation members &#8230;. Thanks for Gnome 3 !!</p>
<p><a title="Help promote GNOME 3!" href="https://live.gnome.org/ThreePointZero/Promote"><img src="http://www.gnome.org/wp-content/uploads/2011/04/iamgnome.png" border="0" alt="I am GNOME" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/04/07/gnome-3-is-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just thinking about software</title>
		<link>http://blogs.openshine.com/rmajadas/2011/03/26/just-thinking-about-software/</link>
		<comments>http://blogs.openshine.com/rmajadas/2011/03/26/just-thinking-about-software/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 17:25:39 +0000</pubDate>
		<dc:creator>roberto.majadas</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blogs.openshine.com/rmajadas/?p=13</guid>
		<description><![CDATA[After years trying to start a serious blog about software and my thoughts about it &#8230; I&#8217;ve decided today is the day. This morning i was thinking about it while i was reading news and drinking coffee. Sometimes it&#8217;s boring to write because you have to do it. So i&#8217;ve decided to write on this [...]]]></description>
			<content:encoded><![CDATA[<p>After years trying to start a serious blog about software and my thoughts about it &#8230; I&#8217;ve decided today is the day.</p>
<p>This morning i was thinking about it while i was reading news and drinking coffee. Sometimes it&#8217;s boring to write because you have to do it. So i&#8217;ve decided to write on this blog just for fun. And &#8230; what is fun for me ? it was my next thought . Hmmm funny question, isn&#8217;t it ?. Software obviously. But, in what way ?. I mean, which is the goal of this blog? . So i started to think about it, more and more, and finally ﻿my thoughts led me to another question : When in my daily life is fun talk about software and in what way? The answer was easy : when i talk with other hackers (and friends) about software and technology (usually while drinking beer) and when i try to explain things about software to people that they want to learn. So that&#8217;s it, that&#8217;s i was looking for! . I need to write the blog post in the same way as i talk with my friends or teach to other people.</p>
<p>So here i am, just thinking about software.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.openshine.com/rmajadas/2011/03/26/just-thinking-about-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

