<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I discover, you enjoy.
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-8928855-1");
pageTracker._trackPageview();
} catch(err) {}</description><title>pyrho's web</title><generator>Tumblr (3.0; @pyrho)</generator><link>http://pyrho.tumblr.com/</link><item><title>Dropship - Torrents for dropbox</title><description>&lt;a href="http://forwardfeed.pl/index.php/2011/04/24/dropship-successor-to-torrents-eng/"&gt;Dropship - Torrents for dropbox&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/4924993884</link><guid>http://pyrho.tumblr.com/post/4924993884</guid><pubDate>Mon, 25 Apr 2011 08:14:45 -0400</pubDate></item><item><title>Ad targeting by RapLeaf</title><description>&lt;a href="http://s.wsj.net/public/resources/documents/st_RAPLEAF_20101018.html"&gt;Ad targeting by RapLeaf&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/1399066870</link><guid>http://pyrho.tumblr.com/post/1399066870</guid><pubDate>Mon, 25 Oct 2010 12:30:54 -0400</pubDate></item><item><title>Amazing video</title><description>&lt;a href="http://www.fubiz.net/2010/10/24/todor-petru/"&gt;Amazing video&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/1396770494</link><guid>http://pyrho.tumblr.com/post/1396770494</guid><pubDate>Mon, 25 Oct 2010 04:24:33 -0400</pubDate></item><item><title>Serving images with CairoPlot and Django</title><description>&lt;p&gt;I&amp;#8217;ve been experiencing with &lt;a href="http://www.djangoproject.com/" target="_blank"&gt;Django&lt;/a&gt; lately, and I must say it&amp;#8217;s amazing. I&amp;#8217;m quite new to the &lt;a href="http://en.wikipedia.org/wiki/Scaffold_(programming)" target="_blank"&gt;scaffolding&lt;/a&gt; frameworks world, so I can&amp;#8217;t really says how it compares to it&amp;#8217;s brother &lt;a href="http://rubyonrails.org/" target="_blank"&gt;Ruby On Rails&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But one thing is for sure, I think there&amp;#8217;s a new version of RoR or ruby out, and all the tutorials I found were outdated, and finding help/ressources seemed so much easier for django than RoR.&lt;/p&gt;

&lt;p&gt;Enough with the intro, I&amp;#8217;m doing a little project in Django to edit data using a spearsheet (something similar to google docs). You can choose the rows and column via an interface, and a spreadsheet is generated allowing to edit the value of a couple {Row,Col}.&lt;/p&gt;

&lt;p&gt;And I wanted to generate charts of the data contained in the spreadsheet, I stumbled upon &lt;a href="http://cairoplot.sourceforge.net/tutorials.html" target="_blank"&gt;CairoPlot&lt;/a&gt;, which is a nice and simple little library that allows you to generate charts in python using cairo. (See &lt;a href="http://lonelyspooky.com/2008/09/24/cairoplot-the-better-way-to-plot-amazing-graphics/" target="_blank"&gt;this blog post&lt;/a&gt; for examples, the site and more generally the internet has &lt;em&gt;no&lt;/em&gt; information on cairoPlot sadly).&lt;/p&gt;

&lt;p&gt;So I a hube n00b, but I finally succeeded in serving dynamic charts using CairoPlot in Django. And I thought I&amp;#8217;ll share my experience since I had to hack into the library&amp;#8217;s code to use it properly.&lt;/p&gt;

&lt;p&gt;CairoPlot allows you with a simple line to generate a chart &amp;#8230;. but to a file. I wanted to generate a dynamic image for my django template, not a file.&lt;/p&gt;

&lt;p&gt;My template looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; &amp;lt;img src="/generateChart"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And my /generateChart view is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; def gen_chart(request):
   heigth = 600
   width = 400

   data = {"OK" : 50, "KO" : 20, "Easy fix": 30}
   background = cairo.LinearGradient(300, 0, 300, 400)
   background.add_color_stop_rgb(0,0,0.4,0)
   background.add_color_stop_rgb(1.0,0,0.1,0)
   surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, heigth, width)
   context = cairo.Context(surface)

   colors = [ (50.0/255, 205.0/255, 50.0/255),
           (255.0/255, 0/255, 0/255),
           (210.0/255, 105.0/255, 30.0/255) ]


   pp = CairoPlot.PiePlot(surface, data, heigth, width, background = None, gradient = True, shadow = True, series_colors = colors )
   pp.render()

   response = HttpResponse(mimetype="image/png")

   pp.surface.write_to_png(response)

   return response
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The key here is not to call the regulare CairoPlot.pie_plot() function, which tries to save the image directly, but to call the PiePlot constructor with a cairo.ImageSurface as the first argument, get the created object, get it&amp;#8217;s surface and call write_to_png(response) on it. And most importantly, create the correct HttpReponse object and write the png to the response object.&lt;/p&gt;

&lt;p&gt;This must be very confusing, but I wrote this very quickly :P&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/1284834101</link><guid>http://pyrho.tumblr.com/post/1284834101</guid><pubDate>Sun, 10 Oct 2010 13:52:44 -0400</pubDate><category>django cairoplot</category></item><item><title>Video</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/UC14Yqt3MWY?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://pyrho.tumblr.com/post/1019585216</link><guid>http://pyrho.tumblr.com/post/1019585216</guid><pubDate>Fri, 27 Aug 2010 08:53:22 -0400</pubDate></item><item><title>Artificial knowledge?</title><description>&lt;a href="http://www.technologyreview.in/web/25728/"&gt;Artificial knowledge?&lt;/a&gt;: &lt;p&gt;This is great news for the internet ! Wikipedia has the widest  human knowledge database available freely online, and making it easily understandable to computers opens the way for a form of artificial knowledge! Finally the semantic web has arrived.&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/780333250</link><guid>http://pyrho.tumblr.com/post/780333250</guid><pubDate>Wed, 07 Jul 2010 04:18:06 -0400</pubDate></item><item><title>credits to kornestik for the idea (:</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_l1aitsGy311qzcdu1o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;credits to kornestik for the idea (:&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/541097445</link><guid>http://pyrho.tumblr.com/post/541097445</guid><pubDate>Thu, 22 Apr 2010 14:17:51 -0400</pubDate></item><item><title>How stereo (or not) vinyls work !</title><description>&lt;a href="http://www.vinylrecorder.com/stereo.html"&gt;How stereo (or not) vinyls work !&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/443161479</link><guid>http://pyrho.tumblr.com/post/443161479</guid><pubDate>Fri, 12 Mar 2010 06:25:51 -0500</pubDate></item><item><title>Just awesome !</title><description>&lt;iframe width="400" height="225" src="http://www.youtube.com/embed/qybUFnY7Y8w?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Just awesome !&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/422747442</link><guid>http://pyrho.tumblr.com/post/422747442</guid><pubDate>Tue, 02 Mar 2010 17:26:21 -0500</pubDate></item><item><title>Old: Legend Of Zelda Dance-Fest Commercial</title><description>&lt;a href="http://www.geekologie.com/2010/02/old_zelda_dancefest_commercial.php"&gt;Old: Legend Of Zelda Dance-Fest Commercial&lt;/a&gt;: &lt;p&gt;&lt;object width="450" height="369"&gt;&lt;param name="movie" value="http://www.youtube.com/v/fmqab710cSg&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/fmqab710cSg&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="450" height="369"&gt;&lt;/embed&gt;&lt;/object&gt; I remember seeing this video (the original &lt;a href="http://www.geekologie.com/2010/02/retro_thursday_japanese_star_w.php" target="_blank"&gt;Japanese commercial&lt;/a&gt; for The Legend of Zelda: &lt;a href="http://www.geekologie.com/2009/01/somebody_please_make_me_one_a.php" target="_blank"&gt;A Link to the Past&lt;/a&gt;) a long time ago, and you’re probably gonna &lt;a href="http://www.geekologie.com/2009/09/i_like_big_letters_woman_fired.php" target="_blank"&gt;yell &lt;/a&gt;at me because you…&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/418480110</link><guid>http://pyrho.tumblr.com/post/418480110</guid><pubDate>Sun, 28 Feb 2010 17:58:59 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kybm78WECF1qzcdu1o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://pyrho.tumblr.com/post/407944026</link><guid>http://pyrho.tumblr.com/post/407944026</guid><pubDate>Tue, 23 Feb 2010 19:47:32 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_ky34ujlCzg1qzcdu1o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://pyrho.tumblr.com/post/398380525</link><guid>http://pyrho.tumblr.com/post/398380525</guid><pubDate>Fri, 19 Feb 2010 05:51:54 -0500</pubDate></item><item><title>Connect any site to Google Buzz (:</title><description>&lt;a href="http://email.about.com/od/gmailtips/qt/Connect_Any_Site_and_RSS_Feed_to_Google_Buzz.htm"&gt;Connect any site to Google Buzz (:&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/383514062</link><guid>http://pyrho.tumblr.com/post/383514062</guid><pubDate>Thu, 11 Feb 2010 05:03:02 -0500</pubDate><category>google</category></item><item><title>A great article on Google vs China</title><description>&lt;a href="http://neutralground.blogg.se/2010/january/draft-jan-25-2010.html"&gt;A great article on Google vs China&lt;/a&gt;</description><link>http://pyrho.tumblr.com/post/357912020</link><guid>http://pyrho.tumblr.com/post/357912020</guid><pubDate>Thu, 28 Jan 2010 09:01:21 -0500</pubDate></item><item><title>Diet Candy Fail</title><description>&lt;a href="http://feedproxy.google.com/~r/failblog/~3/WkSb3g6bsAM/"&gt;Diet Candy Fail&lt;/a&gt;: &lt;p&gt;epic fail pictures - Diet Candy Fail, aids, video, diet, candy, commercial, weight loss&lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=failblog.org&amp;blog=2441444&amp;post=31881&amp;subd=failblog&amp;ref=&amp;feed=1"/&gt;&lt;br clear="both" style="clear: both;"/&gt;&lt;br clear="both" style="clear: both;"/&gt;&lt;a href="http://ads.pheedo.com/click.phdo?s=1c5980c596d8b72efea933afb26fa68f&amp;p=1" target="_blank"&gt;&lt;img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=1c5980c596d8b72efea933afb26fa68f&amp;p=1"/&gt;&lt;/a&gt;
&lt;img alt="" height="0" width="0" border="0" style="display:none" src="http://a.rfihub.com/eus.gif?eui=2222"/&gt;&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/310261812</link><guid>http://pyrho.tumblr.com/post/310261812</guid><pubDate>Thu, 31 Dec 2009 16:44:30 -0500</pubDate></item><item><title>Google and Multivac</title><description>&lt;a href="http://blogoscoped.com/archive/2009-12-29-n29.html"&gt;Google and Multivac&lt;/a&gt;: &lt;p&gt;Neil Fraser &lt;a href="http://neil.fraser.name/news/2009/12/29/" target="_blank"&gt;compares Multivac, a giant all-knowing computer from an Isaac Asimov short story, with Google&lt;/a&gt;. “An army of civil servants fed it data constantly and another army correlated and…&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/306435396</link><guid>http://pyrho.tumblr.com/post/306435396</guid><pubDate>Tue, 29 Dec 2009 12:22:06 -0500</pubDate></item><item><title>How Fanboys View Other Operating Systems</title><description>&lt;a href="http://www.geekologie.com/2009/12/how_fanboys_view_other_operati.php"&gt;How Fanboys View Other Operating Systems&lt;/a&gt;: &lt;p&gt;&lt;span class="mt-enclosure mt-enclosure-image" style="display: inline;"&gt;&lt;img alt="fanboys.jpg" src="http://www.geekologie.com/2009/12/26/fanboys.jpg" width="450" height="329" class="mt-image-none" style=""/&gt;&lt;/span&gt; This is a little graphic depicting how &lt;a href="http://www.geekologie.com/2008/07/fanboy_makes_merriamwebster_di.php" target="_blank"&gt;fanboys&lt;/a&gt; view their &lt;a href="http://www.geekologie.com/2009/11/kid_sings_windows_7_song_at_ta.php" target="_blank"&gt;operating system&lt;/a&gt; compared to others. I thought it was pretty cute, especially the little &lt;a href="http://www.geekologie.com/2009/12/modern_heroes_man_takes_imac_i.php" target="_blank"&gt;Mac&lt;/a&gt; boy. Also, who else feels like…&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/302198585</link><guid>http://pyrho.tumblr.com/post/302198585</guid><pubDate>Sat, 26 Dec 2009 23:42:18 -0500</pubDate></item><item><title>8bit awesomeness</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/wM31lsU0Gpc?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;8bit awesomeness&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/295857454</link><guid>http://pyrho.tumblr.com/post/295857454</guid><pubDate>Tue, 22 Dec 2009 19:37:05 -0500</pubDate></item><item><title>Just got the colored keys for my HHKB :D. So 1337….

Some...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kv2nvmti001qzcdu1o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Just got the colored keys for my HHKB :D. So 1337….&lt;/p&gt;

&lt;p&gt;Some more photos of my crazy ass setup &lt;a href="http://www.flickr.com/photos/45810907@N05/sets/72157622927951621/" target="_blank"&gt;here&lt;/a&gt;&lt;/p&gt;</description><link>http://pyrho.tumblr.com/post/295568215</link><guid>http://pyrho.tumblr.com/post/295568215</guid><pubDate>Tue, 22 Dec 2009 16:04:34 -0500</pubDate><category>hhkb</category></item><item><title>M. Hortefeux, refusez le prix de "l'antiracisme" de l'UPJF</title><description>&lt;a href="http://www.rue89.com/2009/12/21/m-hortefeux-refusez-le-prix-de-lantiracisme-de-lupjf-130864"&gt;M. Hortefeux, refusez le prix de "l'antiracisme" de l'UPJF&lt;/a&gt;: &lt;div class="tribunecpjf"&gt;
&lt;p&gt;Monsieur le Ministre, &lt;/p&gt;
&lt;p&gt;Supposez que vous appreniez par vos services que depuis plusieurs mois, une association notoirement connue publie sans relâche sur son site Internet des articles qui…&lt;/p&gt;&lt;/div&gt;</description><link>http://pyrho.tumblr.com/post/295227766</link><guid>http://pyrho.tumblr.com/post/295227766</guid><pubDate>Tue, 22 Dec 2009 11:27:51 -0500</pubDate></item></channel></rss>

