<?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>Collogue &#187; Sugar</title>
	<atom:link href="http://marcopg.org/category/sugar/feed/" rel="self" type="application/rss+xml" />
	<link>http://marcopg.org</link>
	<description></description>
	<lastBuildDate>Sun, 20 May 2012 15:58:44 +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 have cancer</title>
		<link>http://marcopg.org/2012/05/20/i-have-cancer/</link>
		<comments>http://marcopg.org/2012/05/20/i-have-cancer/#comments</comments>
		<pubDate>Sun, 20 May 2012 15:44:13 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=514</guid>
		<description><![CDATA[[This is a copy of the article I posted on my new blog. I mostly wanted it to reach the friends at planet.sugarlabs.org even if it's not quite on topic there.] A couple of months ago I&#8217;ve been diagnosed with myeloma, a kind of blood cancer which is extremely rare in young people. It all [...]]]></description>
			<content:encoded><![CDATA[<p>[This is a copy of the article I posted on my <a href="http://theoria.me">new blog</a>. I mostly wanted it to reach the friends at <a href="http://planet.sugarlabs.org">planet.sugarlabs.org</a> even if it's not quite on topic there.]</p>
<p>A couple of months ago I&#8217;ve been diagnosed with myeloma, a kind of blood cancer which is extremely rare in young people. It all starts from one of the cells in your bone marrow which replicates and takes over the system. Only one of the immunoglobulines you need is produced in excess, while the others disappears almost completely. As a result your immune system weakens and you are vulnerable to infections. Your bones lose their strength and they tend to break easily. Your kidneys are badly affected by the protein produced by the abnormal plasmacells.</p>
<p>It was a long journey to get there. Since a few years something was not quite right with my immune system. I was getting infections for all the winter, they was mild but hard to get rid of, even with antibiotics. Initially I didn&#8217;t get too worried about it, after all I&#8217;ve been getting colds very often since I&#8217;m born and I had moved to London, with its awesome winter weather&#8230; But gradually I started feeling something was really wrong with me, my body as a whole was not the same as before. I got very anxious about having some kind of cancer. There was no rational justification to that fear really, even in retrospect, but something inside me kept insisting that was the case. By the end of last year anxiety about my health was becoming unbearable. I was crying every day in panic for any small change I would notice in my body, unable to really focus on my life or work. In December I got pneumonia, I&#8217;ve been in hospital a few days and then slowly recovered. The tests I had didn&#8217;t turn up with anything abnormal. But I was certain it was going to happen again and in fact in March I was back in hospital with another infection, this time to the throat, I couldn&#8217;t swallow my own saliva and had a really hard time to breath. I recovered quickly but after a few days the results of a blood test showed abnormal protein in my blood. From there the diagnosis was pretty straight forward, I could have made it myself.</p>
<p>My first reaction was fear. Death, I believe, is not so much about your own disappearance but about leaving the people you love behind. You might never see them again. Our brain is extremely flexible, as I had the pleasure to experience during the ever surprising journey of my illness, but never and ever are concepts that are too large for it to deal with.</p>
<p>Then it was rage. If I had any trust in statistics, and I don&#8217;t anymore, it would be pretty much impossible for me to have this kind of cancer. Since a few months we had a beautiful life in London, an amazing daughter, I was happy as I&#8217;d never been before in my life and now cancer&#8230; It just felt too unfair, I was unable to accept it. I didn&#8217;t know what or who to blame but I needed someone, something to blame.</p>
<p>Then finally it was happiness. I felt it the first time while crossing London to go to the airport and fly back to Italy. It was an hard time, I felt I was leaving my beautiful life behind, perhaps to never come back. But it was while going through the images of my lost happiness, sitting near my daughter and watching the city disappear behind me in the dark of the morning. It was probably the silly song coming out of the cab, I can&#8217;t even remember it but at the time felt incredibly sweet. I understood how unfair it was to complain about my fate, whatever it was going to be. Because part of my fate was all the beautiful people, experiences and places I was going to miss. Because, most of all, part of that fate was Emily, the most extraordinary daughter a father could ever desire or conceive.</p>
<p>Anxiety, fear, rage and happiness keeps alternating in my mind. Emotionally it is certainly the most intense moment of my life. And even if it scares me I&#8217;m curious to live it, in its deepness and uniqueness.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2012/05/20/i-have-cancer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building gtk3 sugar on Fedora 16</title>
		<link>http://marcopg.org/2011/11/13/building-gtk3-sugar-on-fedora-16/</link>
		<comments>http://marcopg.org/2011/11/13/building-gtk3-sugar-on-fedora-16/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 14:53:29 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=509</guid>
		<description><![CDATA[I wrote a simple makefile which clones the required modules as git submodules and builds them. It works like this git clone git://github.com/marcopg/sugar-build.git make bootstrap make build make run It&#8217;s pretty quick because it only builds the sugar modules and pygobject (the current version in fedora is not new enough, I&#8217;ll drop that as soon [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a simple makefile which clones the required modules as git submodules and builds them. It works like this</p>
<pre>
git clone git://github.com/marcopg/sugar-build.git

make bootstrap
make build
make run
</pre>
<p>It&#8217;s pretty quick because it only builds the sugar modules and pygobject (the current version in fedora is not new enough, I&#8217;ll drop that as soon as it&#8217;s fixed).</p>
<p>This is not yet how I would like sugar to be built, but I hope it&#8217;s a step in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2011/11/13/building-gtk3-sugar-on-fedora-16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GObject Introspection for node.js</title>
		<link>http://marcopg.org/2011/09/12/gobject-introspection-from-node-js/</link>
		<comments>http://marcopg.org/2011/09/12/gobject-introspection-from-node-js/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 13:27:25 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=504</guid>
		<description><![CDATA[I run across a very interesting project which should make the whole GNOME platform accessible from node.js. That&#8217;s something I was dreaming of when I experimented with HTML activities. Maybe I should pick that experiment up again some time&#8230;]]></description>
			<content:encoded><![CDATA[<p>I run across a very interesting <a href="https://github.com/creationix/node-gir">project</a> which should make the whole GNOME platform accessible from node.js. That&#8217;s something I was dreaming of when I experimented with <a href="http://marcopg.org/2011/06/12/html-activities/">HTML activities</a>. Maybe I should pick that experiment up again some time&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2011/09/12/gobject-introspection-from-node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building sugar from git on F15</title>
		<link>http://marcopg.org/2011/09/06/building-sugar-from-git-on-f15/</link>
		<comments>http://marcopg.org/2011/09/06/building-sugar-from-git-on-f15/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 16:45:12 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=487</guid>
		<description><![CDATA[I wanted to build the sugar shell on F15. I tried sugar-jhbuild and it didn&#8217;t work out of the box, so I thought I&#8217;d just do it manually. It was pretty painful, I&#8217;m sharing it in case someone tries to do the same. First I installed a few dependencies. I was starting from a clean [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to build the sugar shell on F15. I tried sugar-jhbuild and it didn&#8217;t work out of the box, so I thought I&#8217;d just do it manually. It was pretty painful, I&#8217;m sharing it in case someone tries to do the same.</p>
<p>First I installed a few dependencies. I was starting from a clean Fedora 15 livecd install.</p>
<pre>
sudo yum install gcc intltool libtool glib2-devel python-devel \
    pygobject2-devel pygtk2-devel alsa-lib-devel libSM-devel \
    gnome-common icon-naming-utils xcursorgen GConf2-devel \
    hippo-canvas-python python-cjson python-dateutil \
    pygtksourceview gnome-python2-rsvg vte
</pre>
<p>Then I checked out from <a href="http://git.sugarlabs.org">git.sugarlabs.org</a> the following modules:</p>
<pre>
sugar-base
sugar-toolkit
sugar-artwork
sugar-datastore
sugar-shell
</pre>
<p>I built each of them in that order with</p>
<pre>
./autogen.sh --prefix=~/Development/sugar/build
make
make install
</pre>
<p>I manually installed the schemas in the system prefix, I&#8217;m not sure if there is a better solution these days, even with jhbuild.</p>
<pre>
sudo GCONF_CONFIG_SOURCE=xml:merged:/etc/gconf/gconf.xml.defaults \
    gconftool-2 --makefile-install-rule \
    ~/Development/sugar/sugar-shell/data/sugar.schemas
</pre>
<p>I created a script exporting various environment variables and sourced it</p>
<pre>
export PATH=~/Development/sugar/build/bin:$PATH
export PYTHONPATH=~/Development/sugar/build/lib/python2.7/site-packages
export XDG_DATA_DIRS=~/Development/sugar/build/share
export GTK_PATH=~/Development/sugar/build/lib/gtk-2.0
export GTK_DATA_PREFIX=~/Development/sugar/build
</pre>
<p>Running sugar-emulator in GNOME was crashing with weird errors for some reason, but it works from a basic X session with just a gnome-terminal in it. </p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2011/09/06/building-sugar-from-git-on-f15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML activities</title>
		<link>http://marcopg.org/2011/06/12/html-activities/</link>
		<comments>http://marcopg.org/2011/06/12/html-activities/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 13:32:59 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=466</guid>
		<description><![CDATA[One of the limitations with the current Sugar architecture is that GTK isn&#8217;t really a good toolkit to be creative with. I would like to write activities in HTML but still be able to access services like the icon theme, the datastore and the presence service. When I wrote hulahop I had this also in [...]]]></description>
			<content:encoded><![CDATA[<p>One of the limitations with the current Sugar architecture is that GTK isn&#8217;t really a good toolkit to be creative with. I would like to write activities in HTML but still be able to access services like the icon theme, the datastore and the presence service. When I wrote hulahop I had this also in mind.</p>
<p>Years passed and I think we might now have the blocks to build something better. So I made a little experiment. I wrote a toy text editor. A really simple one, it can only save to a single file. But I hope it shows a possible way to tackle the issue. Anyway, code first (but not so much of it, don&#8217;t hold your breath)!</p>
<p>The engine, a web server, based on <a href="http://nodejs.org/">nodejs</a>. It&#8217;s using http but I&#8217;d have probably used web sockets if I could get them to work. We will certainly need bidirectional communication. The example has load and save methods, the idea is that system services are exposed to applications at this level.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> http <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> fs <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> static <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'node-static'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> savedPath <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;/home/marcopg/Development/tmp/saved&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    response.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span>fs.<span style="color: #660066;">readFileSync</span><span style="color: #009900;">&#40;</span>savedPath<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;binary&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> save<span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    data <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    request.<span style="color: #660066;">setEncoding</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;binary&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    request.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>chunk<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        data <span style="color: #339933;">+=</span> chunk<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
    request.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;end&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        fs.<span style="color: #660066;">writeFileSync</span><span style="color: #009900;">&#40;</span>savedPath<span style="color: #339933;">,</span> data<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;binary&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> file <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span><span style="color: #009900;">&#40;</span>static.<span style="color: #660066;">Server</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;./apps&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
http.<span style="color: #660066;">createServer</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #660066;">url</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;/save&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        save<span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #660066;">url</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;/load&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        load<span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        file.<span style="color: #660066;">serve</span><span style="color: #009900;">&#40;</span>request<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">listen</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">8080</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;localhost&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Server running at http://localhost:8080'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then the editor application. Some trivial HTML And bits of javascript to talk to the server. On startup we load the current text by making an XMLHttpRequest to the engine. Similarly, when the &#8220;Save&#8221; button is pressed we send it to the server with a POST request.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;editor.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body</span> <span style="color: #000066;">onLoad</span>=<span style="color: #ff0000;">&quot;load();&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;textArea&quot;</span> <span style="color: #000066;">rows</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">cols</span>=<span style="color: #ff0000;">&quot;50&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/textarea<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">onClick</span>=<span style="color: #ff0000;">&quot;save();&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Save&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> xhr <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    xhr.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    xhr.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    xhr.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>aEvt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>xhr.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> textArea <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;textArea&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            textArea.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">responseText</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> save<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> textArea <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;textArea&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> xhr <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    xhr.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;save&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    xhr.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span>textArea.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Finally a viewer, based on <a href="http://trac.webkit.org/wiki/WebKit2">WebKit2</a>. As you can see their new API is pretty nice, it&#8217;s all C and it&#8217;s supposed to be stable. It should be a lot less painful to maintain than hulahop.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;WebKit2/WebKit2.h&gt;</span>
<span style="color: #339933;">#include &lt;gtk/gtk.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define HOME_URL &quot;http://localhost:8080/editor.html&quot;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    GtkWidget <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
    GtkWidget <span style="color: #339933;">*</span>box<span style="color: #339933;">;</span>
    WKViewRef web_view<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>g_thread_supported<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        g_thread_init<span style="color: #009900;">&#40;</span>NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    gtk_init<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>argc<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>argv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    window <span style="color: #339933;">=</span> gtk_window_new<span style="color: #009900;">&#40;</span>GTK_WINDOW_TOPLEVEL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    box <span style="color: #339933;">=</span> gtk_vbox_new<span style="color: #009900;">&#40;</span>FALSE<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    gtk_container_add<span style="color: #009900;">&#40;</span>GTK_CONTAINER<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> box<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    gtk_widget_show<span style="color: #009900;">&#40;</span>box<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    web_view <span style="color: #339933;">=</span> WKViewCreate<span style="color: #009900;">&#40;</span>WKContextGetSharedProcessContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    gtk_box_pack_start<span style="color: #009900;">&#40;</span>GTK_BOX<span style="color: #009900;">&#40;</span>box<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> GTK_WIDGET<span style="color: #009900;">&#40;</span>web_view<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> TRUE<span style="color: #339933;">,</span> TRUE<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    gtk_widget_show<span style="color: #009900;">&#40;</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>web_view<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    WKPageLoadURL<span style="color: #009900;">&#40;</span>WKViewGetPage<span style="color: #009900;">&#40;</span>web_view<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                  WKURLCreateWithUTF8CString<span style="color: #009900;">&#40;</span>HOME_URL<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    gtk_widget_show<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    gtk_window_fullscreen<span style="color: #009900;">&#40;</span>GTK_WINDOW<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    gtk_main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>A few advantages over the standard activities framework are pretty obvious.</p>
<ul>
<li>You can be as creative as you like by writing the UI in HTML (and related web technologies).</li>
<li>The activity is sandboxed by default, it only has access to the services exposed by the engine.</li>
<li>You could run the same application on other platforms, as long as you have a viewer and an engine for it.</li>
</ul>
<p>As I said this was just an experiment. I&#8217;m not sure I will have time to work on it again, but if I do these are the things I would probably be working on first.</p>
<ul>
<li>Write instructions on how to build and run the thing.</li>
<li>Hack a Sugar HIG compliant UI. I will need to figure out how to share widgets and artwork between applications.</li>
<li>Expose activity metadata in the viewer, so that it actually integrates with the Sugar shell.</li>
<li>Add a datastore interface to the engine in place of the toy load/save methods.</li>
</ul>
<p>The code is in a <a href="https://github.com/marcopg/sugar-web">git repository</a> if you want to play with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2011/06/12/html-activities/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Making it easy to build sugar from source</title>
		<link>http://marcopg.org/2010/08/23/making-it-easy-to-build-sugar-from-source/</link>
		<comments>http://marcopg.org/2010/08/23/making-it-easy-to-build-sugar-from-source/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 10:27:11 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://marcopg.org/?p=458</guid>
		<description><![CDATA[I want sugar to be a lot easier to build from source. It&#8217;s slow and fragile right now and I suspect it&#8217;s one of the basic bottlenecks to contributions. I started by documenting what I would like it to be. I worked on it during the weekend and achieved my first goal. It builds flawlessly [...]]]></description>
			<content:encoded><![CDATA[<p>I want sugar to be a lot easier to build from source. It&#8217;s slow and fragile right now and I suspect it&#8217;s one of the basic bottlenecks to contributions. I started by documenting <a href="http://sugar.marcopg.org/intro.html#build-from-source-code">what I would like it to be</a>.</p>
<p>I worked on it during the weekend and achieved my first goal. It builds flawlessly on a clean Lucid virtual machine. It just required to merge the git modules, the various configure.ac and trivial changes to each module. As you might have guessed this is heavily inspired by Michael Stone <a href="http://dev.laptop.org/git/users/mstone/sugar/tree/">omnibus sugar repository</a>, credits and thanks to him.</p>
<p>Goal for this week, make it actually run <img src='http://marcopg.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2010/08/23/making-it-easy-to-build-sugar-from-source/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Talking vs doing</title>
		<link>http://marcopg.org/2010/08/08/talking-vs-doing/</link>
		<comments>http://marcopg.org/2010/08/08/talking-vs-doing/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 20:37:08 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://www.marcopg.org/2010/08/08/talking-vs-doing/</guid>
		<description><![CDATA[My mail vs code ratio is incredibly bad these days. Next thing I&#8217;m going to do is to to setup a dev environment]]></description>
			<content:encoded><![CDATA[<p>My mail vs code ratio is incredibly bad these days. Next thing I&#8217;m going to do is to to setup a dev environment <img src='http://marcopg.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2010/08/08/talking-vs-doing/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Contributing to Sugar</title>
		<link>http://marcopg.org/2010/07/19/contributing-to-sugar/</link>
		<comments>http://marcopg.org/2010/07/19/contributing-to-sugar/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 22:06:22 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://www.marcopg.org/2010/07/19/contributing-to-sugar/</guid>
		<description><![CDATA[Last week I spent some time reading through the wiki, the development team pages in particular. I was curious to see what it was like from the outside, since I&#8217;ve not been involved with the project for more than one year. I have to admit the experience was bad: * We are missing a technical [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I spent some time reading through the wiki, the development team pages in particular. I was curious to see what it was like from the outside, since I&#8217;ve not been involved with the project for more than one year.</p>
<p>I have to admit the experience was bad:</p>
<p>* We are missing a technical roadmap. We have a schedule for the next release but it&#8217;s not clear what are the goals or even what people are working on.<br />
* We don&#8217;t have clear instructions on how to setup a development or testing environment.<br />
* We have no official documentation about activity development. A proper python SDK would go a long way to facilitate activity contributions, in my opinion.<br />
* Some of our processes are a intimidating. I&#8217;m thinking about patch submission and new features in particular. It might be more a problem with the wording then with the actual processes.</p>
<p>A couple of more general observations:</p>
<p>* Most of the content looks outdated or the templates are just empty, which gives the wrong impression about the liveliness of the project.<br />
* Reading mailing lists and following irc very regularly seems to be essential to contribute. Unfortunately that requires too much time for most people. I understand it a lot better now that I have an unrelated full time job.<br />
* We have too many teams compared to the active contributors. Maybe merging or dropping some of them would help consolidating resources? For example I&#8217;m not convinced core and activity teams should be separated.</p>
<p>I could go on, but these are probably the most important points I wanted to raise. I would like to help addressing these issues, I don&#8217;t have a lot of time to spend on it but perhaps that actually gives me a good perspective!</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2010/07/19/contributing-to-sugar/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Update</title>
		<link>http://marcopg.org/2010/07/08/update/</link>
		<comments>http://marcopg.org/2010/07/08/update/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 00:37:37 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://www.marcopg.org/2010/07/08/update/</guid>
		<description><![CDATA[Woa, I had promised an update more than one year ago&#8230; fail. Well, summarising one year of my life in a blog post is not going to work, so I will stick to the very basics and give another try to post regularly instead! I&#8217;m now living in London and working for litl. I&#8217;m enjoying [...]]]></description>
			<content:encoded><![CDATA[<p>Woa, I had promised an update more than one year ago&#8230; fail. Well, summarising one year of my life in a blog post is not going to work, so I will stick to the very basics and give another try to post regularly instead!</p>
<p>I&#8217;m now living in London and working for <a href="http://litl.com">litl</a>. I&#8217;m enjoying both the city and the new job a lot. I haven&#8217;t been hacking on Sugar for a long time, but I still intend to help out again one of these days! I&#8217;m just really bad at focusing on multiple things and the new job has been absorbing all of my attention so far.</p>
<p>Quick highlights about the last year:</p>
<p>- I&#8217;ve been having more of a social life then usual!<br />
- Getting bored in London seems to be pretty much impossible. People and places are so varied, it&#8217;s like ten different cities in one. And culture is very accessible and alive.<br />
- I&#8217;m reading a lot of books again which is something I had missed since I got a software job. As a side effect I feel english is becoming more and more my primary language, the one I think with.<br />
- I want to go back to university, at least part time. Well, that&#8217;s something I wanted for a while, but now I started making concrete plans about it.</p>
<p>I&#8217;m on a two weeks vacation, for once without a laptop. I felt the need to just rest for a while and it&#8217;s working out very well, my energy is definitely refuelling. I will be in Italy with my family until Saturday and then spend one week in Spain. Looking forward to see the world cup final in Barcelona on Sunday! Go Spain!</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2010/07/08/update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Heartbeat</title>
		<link>http://marcopg.org/2009/04/18/heartbeat/</link>
		<comments>http://marcopg.org/2009/04/18/heartbeat/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 00:49:01 +0000</pubDate>
		<dc:creator>marcopg</dc:creator>
				<category><![CDATA[Sugar]]></category>

		<guid isPermaLink="false">http://www.marcopg.org/?p=339</guid>
		<description><![CDATA[I&#8217;m still alive! I&#8217;ll try to post an update on what I&#8217;m up to these days soon. I have not been able to read my personal email at all in the last couple of months. There was no hope to ever catch up with the backlog, so I just archived all of it. If you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m still alive! I&#8217;ll try to post an update on what I&#8217;m up to these days soon. I have not been able to read my personal email at all in the last couple of months. There was no hope to ever catch up with the backlog, so I just archived all of it. If you sent me mail and still need an answer from me please send it again. Sorry for the inconvenience, I&#8217;ll keep up with it again from now on (after having dropped some of the mailing lists I&#8217;m subscribed to, most likely).</p>
]]></content:encoded>
			<wfw:commentRss>http://marcopg.org/2009/04/18/heartbeat/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

