<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.shad.cc/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>shad.cc</title>
  <link>http://www.shad.cc/</link>
  <atom:link href="http://orig.shad.cc/feed/rss2" rel="self" type="application/rss+xml"/>
  <description>Samuel Alba home page, shad's home page.</description>
  <language>en</language>
  <pubDate>Sat, 07 Aug 2010 17:29:43 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>CirruxCache: Store API documentation</title>
    <link>http://www.shad.cc/post/2010/08/CirruxCache%3A-Store-API-documentation</link>
    <guid isPermaLink="false">urn:md5:b02df688812f020977bc341a2af1a7e7</guid>
    <pubDate>Sat, 07 Aug 2010 19:29:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
            
    <description>    &lt;p&gt;I have just written &lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/StoreAPI&quot;&gt;some documentation about the Store WebService&lt;/a&gt; of &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt;. This little page will help you to upload big files on CirruxCache in the same way than the current admin panel does.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/StoreAPI&quot; title=&quot;http://code.google.com/p/cirruxcache/wiki/StoreAPI&quot;&gt;http://code.google.com/p/cirruxcach...&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Just to remember, the Store WebService has been developed to bypass the 1MB limitation of appengine. It is not possible to dynamically cache objects with a size greater than 1MB, in this case, you need to store explicitly such an object using this WebService. It uses the Blobstore service, so file size cannot exceed 2GB.&lt;/em&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>CirruxCache: Advanced configuration sample</title>
    <link>http://www.shad.cc/post/2010/07/CirruxCache%3A-Advanced-configuration-sample</link>
    <guid isPermaLink="false">urn:md5:12291123a595888ffd8f38b705bd90de</guid>
    <pubDate>Wed, 21 Jul 2010 22:46:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>HTTP</category><category>python</category>    
    <description>    &lt;p&gt;That's it! This whole blog is cached and directly delivered by &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt; (only static files were cached before). My origin server is a tiny &lt;a href=&quot;http://event.asus.com/eeepc/microsites/eeebox/en/index.html&quot;&gt;eeebox&lt;/a&gt; connected through my personal ISP.&lt;br /&gt;
&lt;br /&gt;
So this configuration is a good challenge to offload my tiny web server as much as possible.&lt;br /&gt;
&lt;br /&gt;
I think this is a good opportunity to show an example of a configuration which is a little bit more evolved.&lt;br /&gt;
&lt;br /&gt;
The point is, I cannot set the same cache TTL for the whole website, and actually, I want to cache several websites...&lt;/p&gt;

&lt;pre class=&quot;python python&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# URL mapping&lt;/span&gt;
urls = &lt;span style=&quot;color: black;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
base = &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/_admin/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Admin'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/_store/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Store'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/_cron/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Cron'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'default'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt; = base + &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/debug/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Debug'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Root'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'www.shad.cc'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt; = base + &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/themes/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Blog_Static'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/plugins/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Blog_Static'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/admin/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Blog_Forward'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Blog_Page'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'www.zaphod.eu'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt; = base + &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/pub/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Zaphod_Redirect'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Zaphod'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# still supporting the old config&lt;/span&gt;
&amp;nbsp;
urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'cdn.shad.cc'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt; = base + &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/blog(/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Blog_Static'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Root'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'cdn.zaphod.eu'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt; = base + &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/admin/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Zaphod'&lt;/span&gt;,
                &lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Root'&lt;/span&gt;
                &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# POP definition&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# You can define and configure your Point Of Presence&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Blog_Static&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;cache.&lt;span style=&quot;color: black;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://orig.shad.cc'&lt;/span&gt;
        forceTTL = &lt;span style=&quot;color: #ff4500;&quot;&gt;2592000&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# 1 month&lt;/span&gt;
        ignoreQueryString = &lt;span style=&quot;color: #008000;&quot;&gt;True&lt;/span&gt;
        forwardPost = &lt;span style=&quot;color: #008000;&quot;&gt;False&lt;/span&gt;
        allowFlushFrom = &lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'x.x.x.x'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Blog_Page&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;cache.&lt;span style=&quot;color: black;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://orig.shad.cc'&lt;/span&gt;
        forceTTL = &lt;span style=&quot;color: #ff4500;&quot;&gt;3600&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# 1 hour&lt;/span&gt;
        ignoreQueryString = &lt;span style=&quot;color: #008000;&quot;&gt;True&lt;/span&gt;
        forwardPost = &lt;span style=&quot;color: #008000;&quot;&gt;True&lt;/span&gt;
        allowFlushFrom = &lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'x.x.x.x'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Blog_Forward&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;forward.&lt;span style=&quot;color: black;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://orig.shad.cc'&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Zaphod&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;cache.&lt;span style=&quot;color: black;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://orig.zaphod.eu'&lt;/span&gt;
        forceTTL = &lt;span style=&quot;color: #ff4500;&quot;&gt;2592000&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# 1 month&lt;/span&gt;
        ignoreQueryString = &lt;span style=&quot;color: #008000;&quot;&gt;True&lt;/span&gt;
        forwardPost = &lt;span style=&quot;color: #008000;&quot;&gt;False&lt;/span&gt;
        allowFlushFrom = &lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'x.x.x.x'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Zaphod_Redirect&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;redirect.&lt;span style=&quot;color: black;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://zaphod.eu'&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# !POP&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;I think this configuration is enough readable to avoid any explanation. However, do not hesitate to leave any comments.&lt;br /&gt;
&lt;br /&gt;
Finally, I created &lt;a href=&quot;http://groups.google.com/group/cirruxcache&quot;&gt;a google groups&lt;/a&gt; to centralize all help requests. So if you need help, go to &lt;a href=&quot;http://groups.google.com/group/cirruxcache&quot; title=&quot;http://groups.google.com/group/cirruxcache&quot;&gt;http://groups.google.com/group/cirr...&lt;/a&gt; or send an email to cirruxcache 'at' googlegroups 'dot' com.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>New release: CirruxCache 0.3.1</title>
    <link>http://www.shad.cc/post/2010/07/New-release%3A-CirruxCache-0-3-1</link>
    <guid isPermaLink="false">urn:md5:2fc9c1896a1c3d277c64b7d2ad606b78</guid>
    <pubDate>Sun, 18 Jul 2010 15:21:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>python</category>    
    <description>    &lt;p&gt;I am really glad to announce a new major release of &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This new release includes the following changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A storage webservice: store big files (&amp;lt;= 2GB) on the Blobstore in order to deliver them through CirruxCache. This feature is useful to bypass the 1MB limit on appengine.&lt;/li&gt;
&lt;li&gt;An admin panel that enables users to flush objects, manage big files and see some statistics about the resources used.&lt;/li&gt;
&lt;li&gt;Bugfixes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is really important to note there are few limitations on the panel admin:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;There is no error reporting on the flush panel (it only displays the number of objects trying to be flushed).&lt;/li&gt;
&lt;li&gt;Storage manager displays a &quot;500 Internal Error&quot; when uploading. It only happens when you don't have a billing account (the Blobstore is only available on billing accounts, refer to appengine).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These two limitations will be improved in the next release, and there will be more informations in the statistics panel.&lt;br /&gt;
&lt;br /&gt;
The Storage WebService will be documented really soon, but you can access the admin panel through &quot;http://your.cirruxcache.app/_admin/&quot;&lt;br /&gt;
&lt;br /&gt;
I make the most of this opportunity to announce some changes on &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;the project website&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/Roadmap&quot;&gt;Roadmap page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/Users&quot;&gt;Users list&lt;/a&gt;: this page has just been started, so do not hesitate to notify me to add you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you will enjoy this new release.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Minor release: CirruxCache 0.2.2</title>
    <link>http://www.shad.cc/post/2010/05/Minor-release%3A-CirruxCache-0-2-2</link>
    <guid isPermaLink="false">urn:md5:768e342880feba5bf9511a5193abb6f2</guid>
    <pubDate>Wed, 19 May 2010 17:45:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>python</category><category>webpy</category>    
    <description>    &lt;p&gt;&lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt; 0.2.2 has just been released. It contains some bugfixes (thanks to Devattas to have reported errors on Datastore latency). Webpy has been updated to the last version.&lt;br /&gt;
&lt;br /&gt;
I have also updated the documentation, especially I brought more details on &lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/PoP&quot;&gt;Point of Presence configuration&lt;/a&gt; and usage of &lt;a href=&quot;http://code.google.com/p/cirruxcache/wiki/Cron&quot;&gt;cron tasks for garbage collection&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, some of the users reported me that there is a real problem with the cached object size limit (currently 1MB). I am working on the solution, I will take advantage of the new Blobstore service on AppEngine to store objects. Maybe I will keep the Datastore only for meta-data. This solution will raise the cache object limit to 50MB.&lt;br /&gt;
&lt;br /&gt;
Stay tuned &lt;img src=&quot;/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>CirruxCache 0.2.1 is released</title>
    <link>http://www.shad.cc/post/2010/03/CirruxCache-0-2-1-is-released</link>
    <guid isPermaLink="false">urn:md5:ae870fed3898d7562c63cefceeca5972</guid>
    <pubDate>Thu, 11 Mar 2010 17:20:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>code</category><category>HTTP</category><category>python</category>    
    <description>    &lt;p&gt;I have just released &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;a new version (0.2.1) of CirruxCache&lt;/a&gt;. To remember:&lt;br /&gt;
&lt;br /&gt;
&lt;q&gt;&lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt; provides a software solution to dynamically cache HTTP objects on Google Appengine (using the Datastore and the Memcache services).&lt;/q&gt;&lt;/p&gt;


&lt;p&gt;This new version includes an interesting set of features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;allow object flushing from restricted IP&lt;/li&gt;
&lt;li&gt;configure a PoP (Point of Presence) according to a virtual host&lt;/li&gt;
&lt;li&gt;several behaviors (cache, redirect, forward)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In more details, the last feature is the ability to configure a point of presence to differ from a classical caching mechanism. For example, I may want to configure &quot;/admin/*&quot; on my website to be redirected on the origin without caching.&lt;br /&gt;
&lt;br /&gt;
Of course, this release includes several bugfixes, especially a fix on the &quot;Expires&quot; HTTP header which improves the caching performances.&lt;br /&gt;
&lt;br /&gt;
Do not hesitate to test this new version and to comment any bugs or any suggestions.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Adding virtual host support to webpy</title>
    <link>http://www.shad.cc/post/2010/02/Adding-virtual-host-support-to-webpy</link>
    <guid isPermaLink="false">urn:md5:eeee9253cc20e77ec4ffc287b099de55</guid>
    <pubDate>Fri, 19 Feb 2010 18:11:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>python</category><category>webpy</category>    
    <description>    &lt;p&gt;&lt;a href=&quot;http://webpy.org/&quot;&gt;Webpy&lt;/a&gt; is a tiny web framework. I use it a lot for my web-services applications.&lt;br /&gt;
&lt;br /&gt;
In general, I let my web server (&lt;a href=&quot;http://www.lighttpd.net/&quot;&gt;lighttpd&lt;/a&gt;) to handle virtual hosting. But as you may know, I am working on a CDN solution on top of &lt;a href=&quot;http://code.google.com/appengine/&quot;&gt;Google App Engine&lt;/a&gt;, named &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt;. In that case, while I have absolutely no control on the server configuration, I need to handle virtual hosting from the code.&lt;br /&gt;
&lt;br /&gt;
Webpy maps urls by iterating through a &lt;a href=&quot;http://docs.python.org/library/functions.html#tuple&quot;&gt;tuple&lt;/a&gt;. So my solution is quite simple: wrapping the tuple to override the &lt;a href=&quot;http://docs.python.org/library/stdtypes.html#iterator-types&quot;&gt;__iter__&lt;/a&gt; function according to an environment variable (HTTP_HOST).&lt;br /&gt;
&lt;br /&gt;
Let's take this basic webpy example, without vhosting:&lt;/p&gt;
&lt;pre class=&quot;python&quot;&gt;&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; web
&amp;nbsp;
urls = &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'hello'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; hello&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; GET&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, name&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;not&lt;/span&gt; name:
            name = &lt;span style=&quot;color: #483d8b;&quot;&gt;'World'&lt;/span&gt;
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #483d8b;&quot;&gt;'Hello, %s'&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;%&lt;/span&gt; name
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; __name__ == &lt;span style=&quot;color: #483d8b;&quot;&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:
   app = web.&lt;span style=&quot;color: black;&quot;&gt;application&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;urls, &lt;span style=&quot;color: #008000;&quot;&gt;globals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt; 
   app.&lt;span style=&quot;color: black;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Let's add the VhostMapper class:&lt;/p&gt;

&lt;pre class=&quot;python&quot;&gt;&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; web
&amp;nbsp;
urls = &lt;span style=&quot;color: black;&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span style=&quot;color: #483d8b;&quot;&gt;'default'&lt;/span&gt; : &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'hello'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;,
      &lt;span style=&quot;color: #483d8b;&quot;&gt;'my-vhost.domain.tld'&lt;/span&gt; : &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'/(.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'helloVhost'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: black;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; hello&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; GET&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, name&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;not&lt;/span&gt; name:
            name = &lt;span style=&quot;color: #483d8b;&quot;&gt;'World'&lt;/span&gt;
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #483d8b;&quot;&gt;'Hello, %s !'&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;%&lt;/span&gt; name
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; helloVhost&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; GET&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, name&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #483d8b;&quot;&gt;'Hello %s'&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;%&lt;/span&gt; web.&lt;span style=&quot;color: black;&quot;&gt;ctx&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; VhostMapper&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #0000cd;&quot;&gt;__iter__&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
        url = urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'default'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #483d8b;&quot;&gt;'HTTP_HOST'&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;in&lt;/span&gt; web.&lt;span style=&quot;color: black;&quot;&gt;ctx&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;environ&lt;/span&gt;:
            vhost = web.&lt;span style=&quot;color: black;&quot;&gt;ctx&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
            &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; vhost &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;in&lt;/span&gt; urls:
                url = urls&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;vhost&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
        &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;iter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;url&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; __name__ == &lt;span style=&quot;color: #483d8b;&quot;&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:
   app = web.&lt;span style=&quot;color: black;&quot;&gt;application&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;VhostMapper&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #008000;&quot;&gt;globals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt; 
   app.&lt;span style=&quot;color: black;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Finally, you can use &lt;a href=&quot;http://curl.haxx.se/&quot;&gt;curl&lt;/a&gt; or wget to test your vhosts:&lt;/p&gt;

&lt;pre&gt;
$&amp;gt; curl -H &amp;quot;Host: my-vhost.domain.tld&amp;quot; http://localhost:8080/
&lt;/pre&gt;


&lt;p&gt;It is not so early to announce that the next version of &lt;a href=&quot;http://code.google.com/p/cirruxcache/&quot;&gt;CirruxCache&lt;/a&gt; will handle virtual hosting &lt;img src=&quot;/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
I am sure this simple hack can be easily reproduced to use virtual hosting in some other Rest frameworks.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Exploiter le SIP de sa Freebox</title>
    <link>http://www.shad.cc/post/2010/02/Exploiter-le-SIP-de-sa-Freebox</link>
    <guid isPermaLink="false">urn:md5:6d2008ce46e969e29a4aab156d6bb768</guid>
    <pubDate>Thu, 04 Feb 2010 12:53:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>freebox</category>    
    <description>    &lt;p&gt;J'ai commencé à jouer récemment avec le compte &lt;a href=&quot;http://fr.wikipedia.org/wiki/Session_Initiation_Protocol&quot;&gt;SIP&lt;/a&gt; de ma &lt;a href=&quot;http://www.free.fr/&quot;&gt;Freebox&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Le compte SIP se paramètre via &lt;a href=&quot;http://subscribe.free.fr/login/&quot;&gt;le panel de gestion de Free&lt;/a&gt;, dans l'onglet Téléphonie. Deux options sont possibles:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rediriger les appels vers la Freebox&lt;/li&gt;
&lt;li&gt;Rediriger les appels vers le serveur SIP&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dans le deuxieme cas, il vous faudra un téléphone IP si voulez conserver un téléphone physique connecté à la Freebox. Pour ma part, ayant un téléphone analogique standard, je redirige les appels vers la Freebox. J'utilise donc le serveur SIP uniquement pour passer des appels, et non en recevoir.&lt;br /&gt;
&lt;br /&gt;
Il existe de &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_SIP_software#SIP_clients&quot; hreflang=&quot;en&quot;&gt;nombreux clients SIP&lt;/a&gt;. J'utilise &lt;a href=&quot;http://www.linphone.org/&quot;&gt;Linphone&lt;/a&gt; sur Linux que je trouve léger et stable.&lt;br /&gt;
&lt;br /&gt;
Un point interessant, le serveur SIP est accessible de l'exterieur, autrement dit, vous pouvez appeler en illimités sur des fixes en France et dans certains pays depuis n'importe où en utilisant votre compte SIP Freephonie.&lt;br /&gt;
&lt;br /&gt;
De plus, si vous êtes l'heureux possesseur d'un iPhone (ou tout autre téléphone sur Symbian, Windows Mobile ou Android), il vous suffit d'installer un client SIP (j'utilise &lt;a href=&quot;http://itunes.apple.com/app/isipsimple-simple-basic-sip/id347525679&quot;&gt;iSipSimple&lt;/a&gt; sur iPhone) et de solliciter votre forfait data illimité (ou pas) pour passer vos appels vers les fixes tout en utilisant votre généreux forfait Free.&lt;br /&gt;
&lt;br /&gt;
Attention aux appels vers les mobiles qui ne seraient pas avantageux.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>How to auto-update Chromium on Mac OS X, Linux and other</title>
    <link>http://www.shad.cc/post/2010/01/How-to-auto-update-Chromium-on-Mac-OS-X%2C-Linux-and-other</link>
    <guid isPermaLink="false">urn:md5:efcc1275a764155bed861741979a038c</guid>
    <pubDate>Wed, 06 Jan 2010 12:23:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>chromium</category><category>mac</category><category>system</category>    
    <description>    &lt;p&gt;I want to try to use Chromium as my first web browser. But for the moment, Chromium suffers from a lack of package maintaining though it targets developers.&lt;br /&gt;
&lt;br /&gt;
On my Gentoo Linux, I let portage to handle my Chromium version. But I also use Mac OS X at work, so I have written a little shell script to auto update my Chromium.app.&lt;br /&gt;
&lt;br /&gt;
Put the content of this scripts wherever you want and make it executable ($&amp;gt; chmod 755 chromium_update.sh).&lt;/p&gt;
&lt;pre&gt;
#!/bin/sh
# Chromium update script
# - by shad &amp;lt;shad@zaphod.eu&amp;gt;

# mac | linux | ...
OS=mac
LATEST=$(wget -q -O - http://build.chromium.org/buildbot/snapshots/chromium-rel-${OS}/LATEST)
INSTALL_DIR=/Applications
TMP=&amp;quot;/tmp/update-chrome-$RANDOM&amp;quot;

(
mkdir $TMP ; cd $TMP
echo Download...
wget -q -O chrome.zip http://build.chromium.org/buildbot/snapshots/chromium-rel-${OS}/${LATEST}/chrome-${OS}.zip
if [ $? -ne 0 ] ; then
	echo Cannot update.
	exit 1
fi
echo Unzip...
unzip -qq chrome.zip
echo Copying...
rm -rf &amp;quot;${INSTALL_DIR}/Chromium.app&amp;quot;
mv chrome-$OS/Chromium.app &amp;quot;$INSTALL_DIR&amp;quot;
)

rm -rf $TMP
&lt;/pre&gt;


&lt;p&gt;Then, set a crontab rule to choose the update interval ($&amp;gt; crontab -e). Mine runs every day at 12:00.&lt;/p&gt;
&lt;pre&gt;
# Run Chromium update script every day at 12:00
00 12 * * * /Users/shad/mbin/chromium_update.sh
&lt;/pre&gt;


&lt;p&gt;I hope it will be useful for someone as much as for me.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>CirruxCache: speeds up your HTTP app using Google Appengine as a CDN</title>
    <link>http://www.shad.cc/post/2009/10/30/CirruxCache%3A-speeds-up-your-HTTP-app-using-Google-Appengine-as-a-CDN</link>
    <guid isPermaLink="false">urn:md5:0b2d64b1715b13c339e7e26e91b306b9</guid>
    <pubDate>Fri, 30 Oct 2009 22:05:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>code</category><category>HTTP</category><category>python</category>    
    <description>    &lt;p&gt;It is a great moment, for the first time since I have started to work at &lt;a href=&quot;http://www.zoomorama.com/&quot;&gt;Zoomorama&lt;/a&gt;, I have just released as open-source an important part of our server platform.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.shad.cc/post/Speed-up-HTTP-delivering-using-Google-AppEngine&quot;&gt;I previously explained&lt;/a&gt; how to use Google AppEngine as a Content Delivery Network (CDN). CirruxCache project concretizes this idea. I released the first version based as the one we use in production.&lt;br /&gt;
&lt;br /&gt;
Here is the features it currently supports:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;honor Cache-Control&lt;/li&gt;
&lt;li&gt;cache TTL override&lt;/li&gt;
&lt;li&gt;several POP (Point Of Presence) configuration mapped on custom base-url&lt;/li&gt;
&lt;li&gt;ignore query string&lt;/li&gt;
&lt;li&gt;POST forwarding&lt;/li&gt;
&lt;li&gt;expired entries garbage collection&lt;/li&gt;
&lt;li&gt;extensibility&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;
CirruxCache is not documented at the moment even if you would be able to use it after reading the comments in the app.py file. I'll document this app in the next few days, but if you need more documentation, don't hesitate to contact me.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://cirrux.org/cache/&quot;&gt;The project website.&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Speed up HTTP delivering using Google AppEngine</title>
    <link>http://www.shad.cc/post/Speed-up-HTTP-delivering-using-Google-AppEngine</link>
    <guid isPermaLink="false">urn:md5:706fc8e3831bfc17d58568d14bc46993</guid>
    <pubDate>Thu, 30 Jul 2009 15:16:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>AppEngine</category><category>cirruxcache</category><category>code</category><category>python</category>    
    <description>    &lt;p&gt;&lt;img src=&quot;https://www.google.com/accounts/ah/appengine.jpg&quot; alt=&quot;&quot; /&gt; Google AppEngine provides an high-level cloud service which means that your application will be distributed automatically on top of the Google platform. All of your code will depends on the AppEngine SDK, so it could be risky to develop complex application on it.&lt;br /&gt;
&lt;br /&gt;
I develop a webservice application for content delivering and content publishing at &lt;a href=&quot;http://www.zoomorama.com/&quot;&gt;Zoomorama&lt;/a&gt;. We currently use Akamai CDN as a simple cache layer to improve data delivering accross the world. It is interesting for me to use AppEngine in the same way: without changing anything on my existing code base. I have found some posts on blogs dealing with this AppEngine usage, but they are not focused on dynamic HTTP caching like a real CDN.&lt;br /&gt;
&lt;br /&gt;
Principle is very simple, all HTTP requests on my AppEngine application will be copied to the AppEngine Datastore. Moreover data which are delivered through AppEngine are cached by AppEngine servers. The code below is a tiny proof of concept:&lt;/p&gt;
&lt;pre class=&quot;python&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# HTTP caching on Google App Engine&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# - by shad &amp;lt;shad@zaphod.eu&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; web &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# webpy 0.3x&lt;/span&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;from&lt;/span&gt; google.&lt;span style=&quot;color: black;&quot;&gt;appengine&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;ext&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; db
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;from&lt;/span&gt; google.&lt;span style=&quot;color: black;&quot;&gt;appengine&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;api&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; urlfetch
&amp;nbsp;
origin = &lt;span style=&quot;color: #483d8b;&quot;&gt;'http://my.website.com'&lt;/span&gt;
&amp;nbsp;
urls = &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;
    &lt;span style=&quot;color: #483d8b;&quot;&gt;'(/.*)'&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'Root'&lt;/span&gt;
    &lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Cache&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;db.&lt;span style=&quot;color: black;&quot;&gt;Model&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
  data = db.&lt;span style=&quot;color: black;&quot;&gt;BlobProperty&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;default=&lt;span style=&quot;color: #008000;&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
  headers = db.&lt;span style=&quot;color: black;&quot;&gt;ListProperty&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; Root&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
  &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; GET&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, request&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    cache = &lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;readCache&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;request&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; cache &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;None&lt;/span&gt;:
      cache = &lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;writeCache&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;request&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;for&lt;/span&gt; h &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;in&lt;/span&gt; cache.&lt;span style=&quot;color: black;&quot;&gt;headers&lt;/span&gt;:
      &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;print&lt;/span&gt; h
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; cache.&lt;span style=&quot;color: black;&quot;&gt;data&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; readCache&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, key&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    cache = cache = Cache.&lt;span style=&quot;color: black;&quot;&gt;get_by_key_name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; cache:
      &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; cache
&amp;nbsp;
  &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; writeCache&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;, request&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
    url = origin + request
    response = urlfetch.&lt;span style=&quot;color: black;&quot;&gt;Fetch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;url=url&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; response.&lt;span style=&quot;color: black;&quot;&gt;status_code&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt;= &lt;span style=&quot;color: #ff4500;&quot;&gt;200&lt;/span&gt;:
      &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;raise&lt;/span&gt; web.&lt;span style=&quot;color: black;&quot;&gt;NotFound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    cache = Cache&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;key_name=request&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    cache.&lt;span style=&quot;color: black;&quot;&gt;data&lt;/span&gt; = db.&lt;span style=&quot;color: black;&quot;&gt;Blob&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;response.&lt;span style=&quot;color: black;&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    cache.&lt;span style=&quot;color: black;&quot;&gt;headers&lt;/span&gt; = &lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;for&lt;/span&gt; k, v &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;in&lt;/span&gt; response.&lt;span style=&quot;color: black;&quot;&gt;headers&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;iteritems&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:
      cache.&lt;span style=&quot;color: black;&quot;&gt;headers&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'%s: %s'&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;k, v&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    cache.&lt;span style=&quot;color: black;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; cache
&amp;nbsp;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;if&lt;/span&gt; __name__ == &lt;span style=&quot;color: #483d8b;&quot;&gt;'__main__'&lt;/span&gt;
  app = web.&lt;span style=&quot;color: black;&quot;&gt;application&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;urls, &lt;span style=&quot;color: #008000;&quot;&gt;globals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;
  app.&lt;span style=&quot;color: black;&quot;&gt;cgirun&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;I use webpy to depends on the AppEngine SDK as less as possible.&lt;br /&gt;
&lt;br /&gt;
I have almost finished the production version of this application. I am doing some performance tests. This application is closed source for now. But I am going to release the code source in few weeks.&lt;br /&gt;
&lt;br /&gt;
This version will include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fetch from Memcache (about 10 times faster).&lt;/li&gt;
&lt;li&gt;Headers forwarding.&lt;/li&gt;
&lt;li&gt;Read &quot;Cache-Control&quot; and &quot;Expires&quot; to define a TTL (rfc 2616).&lt;/li&gt;
&lt;li&gt;Multi origins (according to url mount points).&lt;/li&gt;
&lt;li&gt;Other small features (force TTL, ignore query string, etc...).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;
It is important to note that AppEngine does not keep running instances of your application (your CGI is distributed and it is executed on demand). So this application have to start very quickly (no configuration file, no dynamic generation, etc...).&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Generates your C++ bindings easily with SWIG</title>
    <link>http://www.shad.cc/post/Make-your-C-bindings-easily-with-SWIG</link>
    <guid isPermaLink="false">urn:md5:6c0ccf93d3f01a4ec609fa098a63479a</guid>
    <pubDate>Wed, 01 Jul 2009 19:20:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>code</category><category>cpp</category>    
    <description>    &lt;p&gt;Today, I have to develop a client library. This client library aims to allow users to use my storage webservice app more easily. Mainly to avoid them to read my HTTP Rest API documentation.&lt;br /&gt;
&lt;br /&gt;
I want to target the most used languages, and of course, I don't want to develop the same library for each languages. The main reason is that my client library is a draft for the moment, and I want to make changes on the client API over the time.&lt;br /&gt;
&lt;br /&gt;
This library is very high level, so I take only the HTTP core class for the example:&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#ifndef __HTTP_H__&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#define __HTTP_H__&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;string&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;map&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;vector&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;exception&amp;gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;curl/curl.h&amp;gt;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;namespace&lt;/span&gt; HTTP
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; Error &lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;exception&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; _message;
&amp;nbsp;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      Error&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;msg&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt; _message&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;HTTPError: &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        _message.&lt;span style=&quot;color: #00eeff;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;msg&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; what&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _message.&lt;span style=&quot;color: #00eeff;&quot;&gt;c_str&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; ~Error&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;;
&amp;nbsp;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; Response
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;friend&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; Request;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;, std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _headers;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  _version;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  _code;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  _message;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  _body;
&amp;nbsp;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  _parseHeaderLine&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;headerData&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      Response&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;, std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getHeaders&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _headers; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getVersion&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _version; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getCode&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _code; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getMessage&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _message; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;  &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getBody&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _body; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;friend&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;ostream&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;  operator&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;out, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; Response &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;resp&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;, std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;const_iterator&lt;/span&gt; it, ite &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; resp._headers.&lt;span style=&quot;color: #00eeff;&quot;&gt;end&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;it &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; resp._headers.&lt;span style=&quot;color: #00eeff;&quot;&gt;begin&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;; it &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ite; &lt;span style=&quot;color: #000040;&quot;&gt;++&lt;/span&gt;it&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
          out &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; it&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;first &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; it&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;second &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;endl&lt;/span&gt;;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; out;
      &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;;
&amp;nbsp;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; Request
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;      _host;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;int&lt;/span&gt;    _port;
      CURL        &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;_curl;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;struct&lt;/span&gt; curl_slist  &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;_headerList;
      Response      _response;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;ofstream&lt;/span&gt;    _outFile;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;ifstream&lt;/span&gt;    _inFile;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt;      _credentials;
      std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;  _buffer;
&amp;nbsp;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  _request&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;uri&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
      Request&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;host, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;int&lt;/span&gt; port &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;80&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; ~Request&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  setHeader&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;name, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;value&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  setCredentials&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;login, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;passwd&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  get&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;uri, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;outFile &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  post&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;uri, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;data&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  postFile&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;uri, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;inFile&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  setVerbose&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt;  setHost&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;host, &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;int&lt;/span&gt; port &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;80&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt;  writeHeaderCallback&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;ptr, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; size, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; nmemb, &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;stream&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt;  writeCallback&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;ptr, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; size, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; nmemb, &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;stream&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt;  readCallback&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;ptr, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; size, &lt;span style=&quot;color: #0000ff;&quot;&gt;size_t&lt;/span&gt; nmemb, &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;stream&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; Response  &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;getResponse&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; _response; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #339900;&quot;&gt;#endif /* !__HTTP_H__ */&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;SWIG uses interface files to parse and to generate bindings. IMHO, a good thing is to have an only one interface file to add language bindings much easier.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.swig.org/Doc1.3/Introduction.html#Introduction_nn5&quot;&gt;Here is some documentation on SWIG interface syntax.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
First, here is my interface file (http.i):&lt;/p&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;module http
&amp;nbsp;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;include stl.&lt;span style=&quot;color: #00eeff;&quot;&gt;i&lt;/span&gt;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;include exception.&lt;span style=&quot;color: #00eeff;&quot;&gt;i&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;exception
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;try&lt;/span&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        $function
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #00eeff;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&lt;/span&gt;e&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        SWIG_exception&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;SWIG_RuntimeError, e.&lt;span style=&quot;color: #00eeff;&quot;&gt;what&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;...&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        SWIG_exception&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;SWIG_RuntimeError, &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Unknown exception&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;include &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;http.h&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;quot;http.h&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;All C++ code between %{ ... }% tags will be copied during generation. SWIG provides a lot of interface files. Some of them are language-dependant. So I have written a generic exception handler to use the same interface file for all targetted languages.&lt;br /&gt;
&lt;br /&gt;
Finally, I just have to write a shell script to build each languages with the same http.i:&lt;/p&gt;
&lt;pre class=&quot;perl&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/bin/sh&lt;/span&gt;
&amp;nbsp;
CFLAGS_python_Darwin=-I&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;include&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;python2&lt;span style=&quot;color: #cc66cc;&quot;&gt;.5&lt;/span&gt;
LDFLAGS_python_Darwin=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-dynamiclib -lpython2.5 -o _zws.so&amp;quot;&lt;/span&gt;
&amp;nbsp;
CFLAGS_java_Darwin=-I&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;System&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Library&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Frameworks&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;JavaVM.framework&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Headers
LDFLAGS_java_Darwin=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-dynamiclib -o libzws.dylib&amp;quot;&lt;/span&gt;
&amp;nbsp;
CFLAGS_ruby_Darwin=-I&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;System&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Library&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Frameworks&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Ruby.framework&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;Headers
LDFLAGS_ruby_Darwin=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-dynamiclib -lruby -o zws.bundle&amp;quot;&lt;/span&gt;
&amp;nbsp;
CFLAGS_php_Darwin=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$(php-config --includes)&amp;quot;&lt;/span&gt;
LDFLAGS_php_Darwin=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-bundle -o zws.so&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; $&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -lt 1 ] ; then&lt;/span&gt;
    echo Usage $&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; language
    &lt;span style=&quot;color: #000066;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;
fi
&amp;nbsp;
LANG=$&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;
ROOT=$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;dirname $&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
OSNAME=$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;uname -&lt;span style=&quot;color: #000066;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
ARCH=$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;uname -p&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# All the source files&lt;/span&gt;
SRC=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;http.cpp&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;
DIR=$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;LANG&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;_$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;OSNAME&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;_$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;ARCH&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
rm -rf $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;DIR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;/*&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;mkdir&lt;/span&gt; -p $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;ROOT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;DIR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
cd $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;ROOT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;DIR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# This options will be always added to the compilation/linking&lt;/span&gt;
CFLAGS+=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-undefined suppress -flat_namespace&amp;quot;&lt;/span&gt;
LDFLAGS+=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-lcurl&amp;quot;&lt;/span&gt;
&amp;nbsp;
CFLAGS+=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; $(eval echo &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;CFLAGS_${LANG}_${OSNAME})&amp;quot;&lt;/span&gt;
LDFLAGS+=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; $(eval echo &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;LDFLAGS_${LANG}_${OSNAME})&amp;quot;&lt;/span&gt;
&amp;nbsp;
swig -I.&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;src -$&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;LANG&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; -c++ -o wrapper.cpp -outdir . .&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;http.i
g++ $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;CFLAGS&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;SRC&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; wrapper.cpp $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;LDFLAGS&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;./script.sh python to generate python bindings.&lt;/li&gt;
&lt;li&gt;Some of the code below has been modified for the example, the most important thing to understand is the way of use.&lt;/li&gt;
&lt;li&gt;I work on Mac OS X, so you just have to add (CFLAGS|LDFLAGS)_&amp;lt;lang&amp;gt;_&amp;lt;os&amp;gt; for other configs.&lt;/li&gt;
&lt;li&gt;It would be cleaner with a Makefile &lt;img src=&quot;/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers !&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>How to handle SSL certificates smartly in Firefox</title>
    <link>http://www.shad.cc/post/2009/01/21/How-to-smartly-manage-SSL-certificates-in-Firefox</link>
    <guid isPermaLink="false">urn:md5:dcc26c791ed67a4ddd29c03916b7d307</guid>
    <pubDate>Fri, 03 Apr 2009 15:16:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>firefox</category><category>security</category>    
    <description>    &lt;p&gt;SSL certificates validation is often annoying. In most of cases, the certificate is not acceptable by Firefox because it is self-signed by the server. Some of personal blogs does not have their certificate signed by a known authority.&lt;br /&gt;
&lt;br /&gt;
I think Perspectives is a good solution for this problem, which does not concern only Firefox.&lt;br /&gt;
&lt;br /&gt;
According to perspectives website:&lt;br /&gt;
&lt;q&gt;Perspectives is a new approach to help clients securely identify Internet servers in order to avoid &quot;man-in-the-middle&quot; attacks. Perspectives is simple and cheap compared to existing approaches because it automatically builds a robust database of network identities using lightweight network probing by &quot;network notaries&quot; located in multiple vantage points across the Internet.&lt;/q&gt;&lt;br /&gt;
&lt;br /&gt;
Firefox extension: &lt;a href=&quot;http://www.cs.cmu.edu/~perspectives/firefox.html&quot;&gt;http://www.cs.cmu.edu/~perspectives/firefox.html&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>FreeBSD on the ASUS Eee Box using an USB flash drive</title>
    <link>http://www.shad.cc/post/2009/01/18/Freebsd-on-the-ASUS-Eee-Box</link>
    <guid isPermaLink="false">urn:md5:da89ac74860d2f652b6ed5280450d693</guid>
    <pubDate>Sun, 18 Jan 2009 20:28:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>eee</category><category>freebsd</category><category>system</category><category>unix</category>    
    <description>    &lt;p&gt;I wanted my personal server to be closer to me. So I invested few days ago in the Asus Eee Box, thinking it is the best configuration for a light server at home.&lt;br /&gt;
&lt;br /&gt;
I moved this blog and all my services from my dedicated server to my new one.&lt;br /&gt;
&lt;br /&gt;
To setup FreeBSD on this kind of machine, you have two ways to do it:&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/articles/pxe/article.html&quot;&gt;Install FreeBSD using a pxeboot image and a dhcp server.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install FreeBSD using a bootable USB flash drive.&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;
Creating a bootable USB flash drive by using the original ISO image is a bit annoying if you haven't got a FreeBSD station yet. I have been using the &lt;a href=&quot;http://sites.google.com/site/kengell/freebsd-boot-iso-on-usb&quot;&gt;fbsd2img.sh script&lt;/a&gt;,&lt;br /&gt;
&lt;br /&gt;
I share my USB flash drive image: &lt;a href=&quot;http://zaphod.eu/pub/7.1-RELEASE-i386-bootonly.img&quot;&gt;7.1-RELEASE-i386-bootonly.img&lt;/a&gt;.&lt;br /&gt;
To setup the USB flash drive, use &quot;dd&quot; (/dev/XXX is the device of your USB flash drive):&lt;/p&gt;
&lt;pre&gt;
dd if=7.1-RELEASE-i386-bootonly.img of=/dev/XXX bs=1m
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&lt;a href=&quot;http://zaphod.eu/pub/eeebox.jpg&quot;&gt;Here is the result of the server hosting this blog&lt;/a&gt; &lt;img src=&quot;/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Subversion repository corruption: something to try when svnadmin recover does not work.</title>
    <link>http://www.shad.cc/post/2008/07/18/Subversion-repository-corruption%3A-something-to-try-when-svnadmin-recover-does-not-work</link>
    <guid isPermaLink="false">urn:md5:823b2e969766dca3fa81c2311becfe84</guid>
    <pubDate>Fri, 18 Jul 2008 11:04:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>subversion</category>    
    <description>    &lt;p&gt;I had the wrong habit to keep my old projects in a subversion repository. It's not the good way of keeping code safe.&lt;br /&gt;
&lt;br /&gt;
svnadmin recover works when there is no corruption in your repository. If you have an old corrupted repository that you can't recover, you can first try a berkeley db recovery:&lt;/p&gt;
&lt;pre&gt;
cd /var/svn/myrepos
dbX.X_recover
&lt;/pre&gt;

&lt;p&gt;X.X is the berkelay db version of the repository.&lt;br /&gt;
&lt;br /&gt;
If svnadmin recover and db_recover don't work, try the solution below, it worked for me.&lt;br /&gt;
&lt;br /&gt;
You have to know the database version:&lt;/p&gt;
&lt;pre&gt;
REPOS_PATH=&amp;quot;/var/svn/myrepos&amp;quot;
DB_VERSION=&amp;quot;4.3&amp;quot;
cd ${REPOS_PATH}/db
rm log.* __db.*
mv changes changes.old
mv copies copies.old
mv nodes nodes.old
mv representations representations.old
mv revisions revisions.old
mv strings strings.old
mv transactions transactions.old
mv uuids uuids.old
mv lock-tokens lock-tokens.old
mv locks locks.old
db${DB_VERSION}_dump changes.old | db${DB_VERSION}_load changes
db${DB_VERSION}_dump copies.old | db${DB_VERSION}_load copies
db${DB_VERSION}_dump nodes.old | db${DB_VERSION}_load nodes
db${DB_VERSION}_dump representations.old | db${DB_VERSION}_load representations 
db${DB_VERSION}_dump revisions.old | db${DB_VERSION}_load revisions
db${DB_VERSION}_dump strings.old | db${DB_VERSION}_load strings
db${DB_VERSION}_dump transactions.old | db${DB_VERSION}_load transactions
db${DB_VERSION}_dump uuids.old | db${DB_VERSION}_load uuids 
db${DB_VERSION}_dump lock-tokens.old | db${DB_VERSION}_load lock-tokens
db${DB_VERSION}_dump locks.old | db${DB_VERSION}_load locks
svnadmin recover ..
&lt;/pre&gt;

&lt;p&gt;If binaries dbX.X_dump and dbX.X_load does not exist, you have to compile a old version of subversion with the berkeley database corresponding.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Thanks to dmp.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Link: &lt;a href=&quot;http://svn.haxx.se/users/archive-2005-07/0576.shtml&quot;&gt;http://svn.haxx.se/users/archive-2005-07/0576.shtml&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Gmail-Notify improvements and a modified behavior</title>
    <link>http://www.shad.cc/post/2008/07/17/Gmail-Notify</link>
    <guid isPermaLink="false">urn:md5:b43bab1988b9792daa6306104bafb19d</guid>
    <pubDate>Thu, 17 Jul 2008 14:21:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>gmail-notify</category><category>python</category>    
    <description>    &lt;p&gt;&lt;a href=&quot;http://gmail-notify.sourceforge.net/&quot;&gt;Gmail-notify&lt;/a&gt; is a small program written in Python. I use it because it is light and it just do what I want.&lt;br /&gt;
&lt;br /&gt;
I am a regular user of the firefox extension &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/173&quot;&gt;gmail-notifyer&lt;/a&gt; and I was uncomfortable with the Gmail-notify behavior, so I wrote a little patch to make it more like I want.&lt;br /&gt;
&lt;br /&gt;
I also added the possibility to execute a command when a new message arrive. I use it to play a sound (aplay ~/sounds/mail.wav).&lt;br /&gt;
&lt;br /&gt;
I don't know your habits but maybe you could enjoy my modifications. Here is a small description:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A click on the event box close it.&lt;/li&gt;
&lt;li&gt;A click on tray icon open the mailbox.&lt;/li&gt;
&lt;li&gt;Mailbox is now open as HTTPS.&lt;/li&gt;
&lt;li&gt;A command can be executed when a new mail is received (like playing a sound).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;
To use my modifications, &lt;a href=&quot;http://zaphod.eu/pub/gmail-notify-1.6.1.1.patch&quot;&gt;download my patch&lt;/a&gt;, and apply it to gmail-notify-1.6.1.1:&lt;/p&gt;
&lt;pre&gt;
wget http://garr.dl.sourceforge.net/sourceforge/gmail-notify/gmail-notify-1.6.1.1.tar.gz
wget http://zaphod.eu/pub/gmail-notify-1.6.1.1.patch
tar zxvf gmail-notify-1.6.1.1.tar.gz
(cd gmail-notify ; patch -p1 &amp;lt; ../gmail-notify-1.6.1.1.patch)
rm gmail-notify-1.6.1.1.tar.gz
&lt;/pre&gt;

&lt;p&gt;Then run gmail-notify.&lt;/p&gt;
&lt;pre&gt;
gmail-notify/notifier.py
&lt;/pre&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Ushare on Gentoo Linux</title>
    <link>http://www.shad.cc/post/2008/07/09/Ushare-on-Gentoo</link>
    <guid isPermaLink="false">urn:md5:f9c2d884a14caaccb413b1cbabfe8ebe</guid>
    <pubDate>Wed, 09 Jul 2008 00:01:00 +0200</pubDate>
    <dc:creator>shad</dc:creator>
        <category>gentoo</category><category>linux</category><category>ushare</category>    
    <description>    &lt;p&gt;Ushare is a UPnP media server on linux. I use it to browse media files from my Xbox. There is no official gentoo ebuild.&lt;br /&gt;
&lt;br /&gt;
Sunrise Gentoo overlay provides an ebuild for Ushare, it requires some modifications to be used. I noticed some problems:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ushare daemon is configured to run as root. Without being paranoid, I don't want to entrust a root daemon which manipulate my precious media directory.&lt;/li&gt;
&lt;li&gt;Boot script in init.d directory is written for debian, so it does not work at all on Gentoo.&lt;/li&gt;
&lt;li&gt;Default configuration file contains some wrong variable names. So this configuration directives are ignored.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I rewrote the init.d script to work on Gentoo and to launch ushare daemon as nobody user.&lt;br /&gt;
&lt;br /&gt;
To sum up, Ushare can be deployed rapidly as follow:&lt;br /&gt;
1. Checkout Sunrise overlay with layman&lt;/p&gt;
&lt;pre&gt;
emerge -v layman
layman -a sunrise
echo source /usr/portage/local/layman/make.conf &amp;gt;&amp;gt; /etc/make.conf
echo media-video/ushare &amp;gt;&amp;gt; /etc/portage/package.keywords
emerge -v ushare
&lt;/pre&gt;

&lt;p&gt;2. Replace the Ushare boot script /etc/init.d/ushare by my script:&lt;/p&gt;
&lt;pre&gt;
#!/sbin/runscript
#- by shad

DAEMON=&amp;quot;/usr/bin/ushare&amp;quot;
NAME=&amp;quot;ushare&amp;quot;
CONFIGFILE=&amp;quot;/etc/ushare.conf&amp;quot;
OPTS=&amp;quot;-f $CONFIGFILE&amp;quot;
PIDFILE=&amp;quot;/var/run/ushare.pid&amp;quot;
USER=&amp;quot;nobody&amp;quot;

[ -x $DAEMON ] || exit 0

start() {
        ebegin &amp;quot;Starting $NAME&amp;quot;
        start-stop-daemon --start --quiet --background --pidfile $PIDFILE \
                        --make-pidfile --exec /bin/su -- --command &amp;quot;$DAEMON $OPTS&amp;quot; $USER
        eend $?
}

stop() {
        ebegin &amp;quot;Stopping $NAME&amp;quot;
        start-stop-daemon --stop --quiet --pidfile $PIDFILE
        eend $?
}
&lt;/pre&gt;

&lt;p&gt;3. The last thing to check is the name of configuration variables in /etc/ushare.conf. Make sure each variable starts with the &quot;USHARE_&quot; prefix.&lt;br /&gt;
&lt;br /&gt;
Then,&lt;/p&gt;
&lt;pre&gt;
/etc/init.d/ushare start
&lt;/pre&gt;

&lt;p&gt;and watch your favorite movie on your Xbox 360 &lt;img src=&quot;/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Windows Vista: BOOTMGR is missing!</title>
    <link>http://www.shad.cc/post/2008/02/04/Windows-Vista%3A-BOOTMGR-is-missing</link>
    <guid isPermaLink="false">urn:md5:1057203388e0654420db35904b62e5cc</guid>
    <pubDate>Mon, 04 Feb 2008 17:04:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>grub</category><category>system</category><category>windows</category>    
    <description>    &amp;nbsp;&amp;nbsp;&amp;nbsp; I bought an additional hard drive last week to increase my storage capacity and to add a partition to backup data. I decided to move my Windows Vista installation to the second harddrive. Linux and grub are installed on the first one.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vista creates a Boot directory when it setups the MBR. I noticed that Vista does not create this directory when it is installed on the second harddrive, probably because the boot loader is on the first one. So after I restored grub to handle both windows and linux, when I tried to boot Vista, I saw the message &quot;BOOTMGR is missing!&quot;.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The boot directory cannot be seen on Windows systems, I verified its presence on my Linux system with the Windows partition mounted.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I found a little trick to force windows Vista to create boot directory and bootmgr, I configured the bios to disable the first harddrive. Then I repaired the windows Vista installation with the dvd, the repair program created the boot directory and bootmgr program. Finally, I re-enabled the first harddrive.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; It's important to add a small setting to grub configuration to make Windows believe it is launched from the first harddrive. Grub is able to change the bios harddrives order virtually.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;title=Windows Vista&lt;br /&gt;rootnoverify (hd1,0)&lt;br /&gt;map (hd0) (hd1)&lt;br /&gt;map (hd1) (hd0)&lt;br /&gt;chainloader +1&lt;/pre&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Duplicity: simple, efficient and secure backup solution for Unix</title>
    <link>http://www.shad.cc/post/2008/01/24/Duplicity%3A-simple-efficient-and-secure-backup-solution-for-Unix</link>
    <guid isPermaLink="false">urn:md5:fdd117a79afb3cde5baf564a36584145</guid>
    <pubDate>Thu, 24 Jan 2008 19:51:00 +0100</pubDate>
    <dc:creator>shad</dc:creator>
        <category>duplicity</category><category>system</category><category>unix</category>    
    <description>    &lt;p&gt;Backuping data is a real problem. Investing 2 RAID 1 harddrives is a little expensive for a workstation. Duplicity is able to do incremental backups with the rsync algorithm. All backuped data are encrypted with gpg.&lt;br /&gt;
&lt;br /&gt;
All duplicity options are available on &lt;a href=&quot;http://duplicity.nongnu.org/docs.html&quot;&gt;the official website&lt;/a&gt;.
&lt;br /&gt;
&lt;br /&gt;
I wrote a small script for automate backup on my workstation.
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;backup.sh:&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;
#!/bin/sh

ROOT=&amp;quot;/root/backup&amp;quot;
DISTANT=&amp;quot;ssh://user@zaphod.eu//home/user&amp;quot;
PASSPHRASE=&amp;quot;xxxxxxxxxxxx&amp;quot;
KEEP_ARCHIVE=&amp;quot;2M&amp;quot; # 2 Months
FILELIST=&amp;quot;files.lst&amp;quot;

export PASSPHRASE
duplicity       --include-globbing-filelist &amp;quot;${ROOT}/${FILELIST}&amp;quot; \
                --exclude '**' \
                --full-if-older-than &amp;quot;${KEEP_ARCHIVE}&amp;quot; / &amp;quot;${DISTANT}&amp;quot;

duplicity remove-older-than ${KEEP_ARCHIVE} ${DISTANT}
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
Then a small file list specifies what has to be backuped or not.
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;files.lst:&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;
- /home/shad/p0rn
- /home/shad/tmp
+ /etc
+ /home/shad
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
According to duplicity documentation, a line beginning with a '+' specify a directory or a file to include and '-' for exclude. Be aware of list order.
&lt;br /&gt;
&lt;br /&gt;
It remains to add a cron entry for a weekly schedule:&lt;/p&gt;
&lt;pre&gt;
0 0 * * 1 backup.sh | mail -s &amp;quot;Backup Report&amp;quot; root@zaphod.eu
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
Now your worksation is secured, you can restore any files to any date within the backup delay.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Gnump3d: New release is imminent.</title>
    <link>http://www.shad.cc/post/2007/10/24/Gnump3d%3A-New-release-is-imminent</link>
    <guid isPermaLink="false">urn:md5:09d805cf58e38834fefa5bb7774f64c7</guid>
    <pubDate>Wed, 24 Oct 2007 17:30:00 +0000</pubDate>
    <dc:creator>shad</dc:creator>
        <category>gnump3d</category>    
    <description>    &lt;p&gt;Steve Kemp, gnump3d founder and current maintainer is going to release a new version of gnump3d.&lt;br /&gt;
&lt;br /&gt;
This release will introduce some changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Password authentication is completely going away, due to some problems, especially discovery of a new hole which can be verified with netcat:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;GET / HTTP/1.0&lt;br /&gt;-&amp;gt; All looks good. You'll get a 403 header back.&lt;/pre&gt;Now try this malformed request instead:&lt;pre&gt;GET /&lt;br /&gt;-&amp;gt; Password auth bypassed &lt;img src=&quot;/themes/default/smilies/sad.png&quot; alt=&quot;:(&quot; class=&quot;smiley&quot; /&gt;&lt;/pre&gt;
&lt;p&gt;This hole can be explained by the home-made web server implemented.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&quot;Split warning&quot; will be removed when gnump3d is starting (index updating).&lt;/li&gt;
&lt;li&gt;Some other bugs reported by mail will be fixed.&lt;img src=&quot;http://feeds.feedburner.com/%7Er/shadsblog/%7E4/174448695&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>PwrCtl 0.2 released</title>
    <link>http://www.shad.cc/post/2007/07/15/PwrCtl-02-released</link>
    <guid isPermaLink="false">urn:md5:91c371e644a9a5e570219bec7bfa9a7a</guid>
    <pubDate>Sun, 15 Jul 2007 13:39:00 +0000</pubDate>
    <dc:creator>shad</dc:creator>
        <category>Pwrctl</category>    
    <description>    &lt;p&gt;I have just release a new version of PwrCtl (0.2), some new features has been added :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Server notifying over UDP multicast: each server notify its presence on a multicast address to be displayed on the client interface (only available over Wifi, make sure multicast filtering is disable on your router).&lt;/li&gt;
&lt;li&gt;Error handling improved: client is now able to auto-reconnect after a network problem.&lt;/li&gt;
&lt;li&gt;Client session to keep context after reconnection: the client keep a session id, delivered by the server, to get back its context (profile, controller instance...)&lt;/li&gt;
&lt;li&gt;Support of VLC and Windows Media Player for Windows.&lt;/li&gt;
&lt;li&gt;Platform handling on server controller has been fixed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;http://download.zaphod.eu/pwrctl&quot;&gt;You can get it now on download server.&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
All documentation has been updated on &lt;a href=&quot;http://pwrctl.zaphod.eu&quot;&gt;the wiki page&lt;/a&gt;.&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/%7Er/shadsblog/%7E4/133916923&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>