<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Base-Art - Utils</title><link href="https://base-art.net/" rel="alternate"></link><link href="https://base-art.net/feeds/tag-utils.atom.xml" rel="self"></link><id>https://base-art.net/</id><updated>2005-08-10T10:26:43+02:00</updated><entry><title>SubveRSSed 1.0</title><link href="https://base-art.net/Articles/46/" rel="alternate"></link><published>2005-04-26T12:52:22+02:00</published><updated>2005-08-10T10:26:43+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2005-04-26:/Articles/46/</id><summary type="html">&lt;p&gt;I previously introduced a Subversion &lt;a class="reference external" href="http://base-art.net/wk/Article/18.html"&gt;post-commit hook&lt;/a&gt; to generate &lt;span class="caps"&gt;RSS&lt;/span&gt; feeds based on commits. But the generated feeds were not that smart. &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/subversion/subverssed.py"&gt;SubveRSSed&lt;/a&gt; 1.0 now handle &lt;span class="caps"&gt;RSS&lt;/span&gt; 1.0 feeds ! The next step will probably be&amp;nbsp;Atom.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update (05/08/10)&lt;/strong&gt; : SubveRSSed 1.1 has a great speed improvement …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I previously introduced a Subversion &lt;a class="reference external" href="http://base-art.net/wk/Article/18.html"&gt;post-commit hook&lt;/a&gt; to generate &lt;span class="caps"&gt;RSS&lt;/span&gt; feeds based on commits. But the generated feeds were not that smart. &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/subversion/subverssed.py"&gt;SubveRSSed&lt;/a&gt; 1.0 now handle &lt;span class="caps"&gt;RSS&lt;/span&gt; 1.0 feeds ! The next step will probably be&amp;nbsp;Atom.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update (05/08/10)&lt;/strong&gt; : SubveRSSed 1.1 has a great speed improvement since i dropped the &amp;#8220;full &lt;span class="caps"&gt;RSS&lt;/span&gt; feed&amp;#8221;&amp;nbsp;support.&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>Cheetah templates overriding</title><link href="https://base-art.net/Articles/44/" rel="alternate"></link><published>2005-03-22T09:01:25+01:00</published><updated>2005-05-30T22:04:27+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2005-03-22:/Articles/44/</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="http://cheetahtemplate.org/"&gt;Cheetah&lt;/a&gt; is a very good templating language, especially because it&amp;#8217;s
the one (correct me if i&amp;#8217;m wrong) to apply the Object-Oriented model
to Documents. It can seem a bit weird at the beginning but when you get
used to it, you can&amp;#8217;t live without it&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;So, i …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a class="reference external" href="http://cheetahtemplate.org/"&gt;Cheetah&lt;/a&gt; is a very good templating language, especially because it&amp;#8217;s
the one (correct me if i&amp;#8217;m wrong) to apply the Object-Oriented model
to Documents. It can seem a bit weird at the beginning but when you get
used to it, you can&amp;#8217;t live without it&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;So, i was looking for a good way to overload template parts without
pain, here is how (couldn&amp;#8217;t find the trick on Cheetah&amp;nbsp;doc):&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;Assume you have a template &lt;tt class="docutils literal"&gt;Package/Page.tmpl&lt;/tt&gt; like&amp;nbsp;that:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
#def footer
  This is my foot !
#end def
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Create a &lt;tt class="docutils literal"&gt;Page_custom.tmpl&lt;/tt&gt; template:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
#extends Package.Page

#def footer
  $Page.footer($self) Where's my mind ? (dixit the Pixies)
#end def
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;You need to put a &lt;tt class="docutils literal"&gt;self&lt;/tt&gt; variable in the template&amp;#8217;s searchList
which is the Cheetah template instance itself&amp;nbsp;:-)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I don&amp;#8217;t think that trick will work if you don&amp;#8217;t compile your templates
to Python&amp;nbsp;code.&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>EFL tools in Python ?</title><link href="https://base-art.net/Articles/42/" rel="alternate"></link><published>2005-03-10T11:17:16+01:00</published><updated>2005-05-30T22:04:49+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2005-03-10:/Articles/42/</id><content type="html">&lt;p&gt;Just noticed an &lt;a class="reference external" href="http://code-monkey.de/code/anEdjeCompilerInRuby.html"&gt;edje compiler in Ruby&lt;/a&gt;. That&amp;#8217;d be fun to design graphical E17 stuff in Python too&amp;nbsp;:-)&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>Inserting legend in images using PIL</title><link href="https://base-art.net/Articles/30/" rel="alternate"></link><published>2005-02-09T10:37:00+01:00</published><updated>2005-05-30T22:06:18+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2005-02-09:/Articles/30/</id><summary type="html">&lt;p&gt;I wanted to insert legends directly in images instead of displaying them below respective images. ImageMagick can do that (Text directive) but it&amp;#8217;s not smart enough to make the legend &lt;em&gt;always&lt;/em&gt; visible, even in dark images (if the legend color is black). So i used this &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/misc/annotateImage.py"&gt;script&lt;/a&gt; to accomplish …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I wanted to insert legends directly in images instead of displaying them below respective images. ImageMagick can do that (Text directive) but it&amp;#8217;s not smart enough to make the legend &lt;em&gt;always&lt;/em&gt; visible, even in dark images (if the legend color is black). So i used this &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/misc/annotateImage.py"&gt;script&lt;/a&gt; to accomplish that task. Legend is inserted at the bottom of the image, in a little black bordered box. Advice: use &lt;a class="reference external" href="http://effbot.org/pil/pilfonts.zip"&gt;pilfonts&lt;/a&gt; because default font is a bit small&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;Here is a sample&amp;nbsp;output:&lt;/p&gt;
&lt;img alt="" class="align-center" src="http://base-art.net/static/sample.png" /&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>progressCopy</title><link href="https://base-art.net/Articles/26/" rel="alternate"></link><published>2004-12-19T18:07:54+01:00</published><updated>2005-05-30T22:07:13+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2004-12-19:/Articles/26/</id><summary type="html">&lt;p&gt;I use to deal with large files under the console (copying iso images, videos) but cp doesn&amp;#8217;t display much informations. Few days ago i read &lt;a class="reference external" href="http://www.mechanicalcat.net/richard/log/Python/Progress_display"&gt;a post from Richard Jones&lt;/a&gt; who wrote a very nice iterator aimed to display &lt;span class="caps"&gt;ETA&lt;/span&gt; informations about tasks on the console. So, here comes …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I use to deal with large files under the console (copying iso images, videos) but cp doesn&amp;#8217;t display much informations. Few days ago i read &lt;a class="reference external" href="http://www.mechanicalcat.net/richard/log/Python/Progress_display"&gt;a post from Richard Jones&lt;/a&gt; who wrote a very nice iterator aimed to display &lt;span class="caps"&gt;ETA&lt;/span&gt; informations about tasks on the console. So, here comes &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/misc/progressCopy.py"&gt;progressCopy.py&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Though it&amp;#8217;s not as powerfull as &lt;span class="caps"&gt;GNU&lt;/span&gt; &lt;span class="caps"&gt;CP&lt;/span&gt;, it performs everyday tasks like copying, moving files or directories around with &lt;span class="caps"&gt;ETA&lt;/span&gt; informations :) Enjoy the console&amp;nbsp;!&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>Database replicata</title><link href="https://base-art.net/Articles/20/" rel="alternate"></link><published>2004-10-06T12:40:29+02:00</published><updated>2005-05-30T22:08:56+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2004-10-06:/Articles/20/</id><summary type="html">&lt;p&gt;I&amp;#8217;m having few issues with the db (sqlite powered) behind this blog. So it&amp;#8217;s necessary to migrate it to another &lt;span class="caps"&gt;DBMS&lt;/span&gt; (like PostgreSQL). The problem is that SQLite is a bit too light :) Fortunately, &lt;a class="reference external" href="http://base-art.net/wk/Article/4.html"&gt;Alinea&lt;/a&gt; is using &lt;a class="reference external" href="http://sqlobject.org"&gt;SQLObject&lt;/a&gt; to manage its database. So migration is trivial and can …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m having few issues with the db (sqlite powered) behind this blog. So it&amp;#8217;s necessary to migrate it to another &lt;span class="caps"&gt;DBMS&lt;/span&gt; (like PostgreSQL). The problem is that SQLite is a bit too light :) Fortunately, &lt;a class="reference external" href="http://base-art.net/wk/Article/4.html"&gt;Alinea&lt;/a&gt; is using &lt;a class="reference external" href="http://sqlobject.org"&gt;SQLObject&lt;/a&gt; to manage its database. So migration is trivial and can be done using a little &lt;a class="reference external" href="http://svn.pythonfr.org/public/alinea/tools/DBCo.py"&gt;script&lt;/a&gt; which takes two db URIs and handle the data replication from a db to&amp;nbsp;another.&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>Bringing RSS to SVN</title><link href="https://base-art.net/Articles/18/" rel="alternate"></link><published>2004-09-17T09:05:01+02:00</published><updated>2005-05-30T22:09:27+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2004-09-17:/Articles/18/</id><summary type="html">&lt;p&gt;About one week ago, Aaron Brady posted a svnstatus.py script which
displays an &lt;span class="caps"&gt;SVN&lt;/span&gt; repository version history in an &lt;span class="caps"&gt;HTML&lt;/span&gt; document. I
liked it and wanted to use it as a post-commit hook script for the
&lt;a class="reference external" href="http://xmlobject.base-art.net"&gt;XMLObject&lt;/a&gt; &lt;span class="caps"&gt;SVN&lt;/span&gt; repository. But svnstatus is not optimal at all. If you
want …&lt;/p&gt;</summary><content type="html">&lt;p&gt;About one week ago, Aaron Brady posted a svnstatus.py script which
displays an &lt;span class="caps"&gt;SVN&lt;/span&gt; repository version history in an &lt;span class="caps"&gt;HTML&lt;/span&gt; document. I
liked it and wanted to use it as a post-commit hook script for the
&lt;a class="reference external" href="http://xmlobject.base-art.net"&gt;XMLObject&lt;/a&gt; &lt;span class="caps"&gt;SVN&lt;/span&gt; repository. But svnstatus is not optimal at all. If you
want to periodically build a static &lt;span class="caps"&gt;HTML&lt;/span&gt; file it&amp;#8217;s ok. The problem, if
you want to use it in post-commit hook is that it rebuilds the file
for each commit, which turns to be really &lt;span class="caps"&gt;CPU&lt;/span&gt;&amp;nbsp;hungry.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s why i wrote &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/subversion/subverssed.py"&gt;SubveRSSed.py&lt;/a&gt;. SubveRSSed incrementally builds an
&lt;span class="caps"&gt;RSS&lt;/span&gt; feed containing the commit history of a &lt;span class="caps"&gt;SVN&lt;/span&gt; Repository. Then an
&lt;span class="caps"&gt;HTML&lt;/span&gt; document is built based upon the &lt;span class="caps"&gt;RSS&lt;/span&gt; feed. This approach has many&amp;nbsp;advantages:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;post-commit hook friendly&amp;nbsp;:)&lt;/li&gt;
&lt;li&gt;the &lt;span class="caps"&gt;RSS&lt;/span&gt; can be made available for aggregators and people can monitor
the activity/vitality of a&amp;nbsp;repository&lt;/li&gt;
&lt;li&gt;the history can still be consulted via the &lt;span class="caps"&gt;HTML&lt;/span&gt; document, if you
don&amp;#8217;t like aggregators nor &lt;span class="caps"&gt;RSS&lt;/span&gt;&amp;nbsp;;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But there is one issue thought, the &lt;span class="caps"&gt;RSS&lt;/span&gt; accumulates all revisions, so it can grow enormously. I think i&amp;#8217;ll make 2 feeds, one complete and one with the 20 latest revisions .. So SubverRSSed will evolve, may be in the &lt;a class="reference external" href="http://svn.pythonfr.org/"&gt;PythonFR&lt;/a&gt; &lt;span class="caps"&gt;SVN&lt;/span&gt; repository&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;BTW&lt;/span&gt;, many thanks to Aaron for svnstatus from which SubveRSSed used
some functions and embedded &lt;span class="caps"&gt;CSS&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update&lt;/strong&gt;: the script now handles 2 &lt;span class="caps"&gt;RSS&lt;/span&gt; feeds as described above&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update2&lt;/strong&gt; :  check out SubveRSSed at this &lt;a class="reference external" href="http://svn.pythonfr.org/public/pythonfr/utils/subversion/subverssed.py"&gt;url&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update3(2005/05/05)&lt;/strong&gt; : There&amp;#8217;s a more recent &lt;a class="reference external" href="http://base-art.net/Articles/46/"&gt;post&lt;/a&gt; about this&amp;nbsp;script.&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry><entry><title>When IMAP lags with big folders</title><link href="https://base-art.net/Articles/3/" rel="alternate"></link><published>2004-04-17T20:50:12+02:00</published><updated>2005-05-30T22:03:36+02:00</updated><author><name>Philippe Normand</name></author><id>tag:base-art.net,2004-04-17:/Articles/3/</id><summary type="html">&lt;p&gt;I&amp;#8217;m using mutt to read my mail through IMAP4_SSL&amp;#8230; But currently it lacks of a cache system, so dealing with big folders (~2000) is quite hard for&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s why I hacked an archive utility script to better fit with my needs. The original one is &lt;a class="reference external" href="http://gray.mine.nu/maildirarchive/mdirarchive-0.1.py"&gt;here&lt;/a&gt;. The …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m using mutt to read my mail through IMAP4_SSL&amp;#8230; But currently it lacks of a cache system, so dealing with big folders (~2000) is quite hard for&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s why I hacked an archive utility script to better fit with my needs. The original one is &lt;a class="reference external" href="http://gray.mine.nu/maildirarchive/mdirarchive-0.1.py"&gt;here&lt;/a&gt;. The purpose is to move old mails on subtrees of the folder we want to archive, sorted by&amp;nbsp;month.&lt;/p&gt;
&lt;p&gt;I mainly added an option relating mail dates comparisons. So now there are two possibilities&amp;nbsp;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;believe &lt;span class="caps"&gt;IMAP&lt;/span&gt; dates (appearing as timestamps in beginning of mail filenames) (default&amp;nbsp;behavior)&lt;/li&gt;
&lt;li&gt;believe &lt;cite&gt;Date:&lt;/cite&gt; Mail header (-m&amp;nbsp;option)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use-case&amp;nbsp;:)&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ ./mdirarchive.py -m respyre
$ tree ~/Maildir/.respyre* -L 1
/home/phil/Maildir/.respyre
|-- courierimapacl
|-- courierimapkeywords
|-- courierimapuiddb
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-06
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-09
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-10
|-- cur
|-- new
`-- tmp
&lt;/pre&gt;
&lt;p&gt;There is now a subfolder per month. Check script online help for more&amp;nbsp;options.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="/static/mdirarchive.py"&gt;Download&lt;/a&gt;&lt;/p&gt;
</content><category term="misc"></category><category term="Python"></category><category term="Utils"></category></entry></feed>