<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5225422880870266037</id><updated>2011-07-08T01:48:01.517-07:00</updated><category term='Coding'/><category term='Impressions'/><category term='Python'/><category term='Diary'/><category term='Database'/><category term='Linux'/><category term='Build Systems'/><category term='German'/><category term='Link'/><category term='Ubuntu'/><category term='Pympler'/><category term='postgres database'/><category term='Politics'/><title type='text'>Ghostwritten Insomnia</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-2409026286464191392</id><published>2011-01-19T10:35:00.000-08:00</published><updated>2011-01-19T10:42:50.577-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgres database'/><title type='text'>Postgres deadlock debugging</title><content type='html'>Found a nice SQL query for debugging deadlocks hidden deep in the postgres docs:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;select&lt;br /&gt;  pg_stat_activity.datname,&lt;br /&gt;  pg_class.relname,&lt;br /&gt;  pg_locks.transactionid, &lt;br /&gt;  pg_locks.mode,&lt;br /&gt;  pg_locks.granted,&lt;br /&gt;  pg_stat_activity.usename,&lt;br /&gt;  substr(pg_stat_activity.current_query,1,40) as current_query, &lt;br /&gt;  pg_stat_activity.query_start, &lt;br /&gt;  age(now(),pg_stat_activity.query_start) as "age", &lt;br /&gt;  pg_stat_activity.procpid &lt;br /&gt;from pg_stat_activity,pg_locks &lt;br /&gt;left outer join pg_class on (pg_locks.relation = pg_class.oid)  &lt;br /&gt;where pg_locks.pid=pg_stat_activity.procpid order by query_start;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-2409026286464191392?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/2409026286464191392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2011/01/postgres-deadlock-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/2409026286464191392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/2409026286464191392'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2011/01/postgres-deadlock-debugging.html' title='Postgres deadlock debugging'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-5426829161355625685</id><published>2010-08-10T10:07:00.000-07:00</published><updated>2010-08-12T10:09:51.199-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Cyberpunk coding fonts - monofur on Linux</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7uWNPBnAcls/TGGMpIBg8CI/AAAAAAAAACU/hUBZKgn3pxY/s1600/monofur.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 121px;" src="http://4.bp.blogspot.com/_7uWNPBnAcls/TGGMpIBg8CI/AAAAAAAAACU/hUBZKgn3pxY/s400/monofur.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5503834857779818530" /&gt;&lt;/a&gt;&lt;br /&gt;If you ever grow weary of Inconsolata, try &lt;a href="http://eurofurence.net/monofur.html"&gt;monofur&lt;/a&gt;. Adding Truetype fonts to Linux is a piece of cake with &lt;span style="font-weight:bold;"&gt;fontypython&lt;/span&gt;. Just install it via Synaptic or apt-get.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-5426829161355625685?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/5426829161355625685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/08/cyberpunk-coding-fonts-monofur-on-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/5426829161355625685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/5426829161355625685'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/08/cyberpunk-coding-fonts-monofur-on-linux.html' title='Cyberpunk coding fonts - monofur on Linux'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7uWNPBnAcls/TGGMpIBg8CI/AAAAAAAAACU/hUBZKgn3pxY/s72-c/monofur.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-7703009916166103485</id><published>2010-08-08T05:15:00.001-07:00</published><updated>2010-08-08T05:23:58.104-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Impressions'/><title type='text'>Danmark</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7uWNPBnAcls/TF6gJ2z95oI/AAAAAAAAACM/RPdPxb1GN04/s1600/danmark.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://1.bp.blogspot.com/_7uWNPBnAcls/TF6gJ2z95oI/AAAAAAAAACM/RPdPxb1GN04/s400/danmark.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5503011885886072450" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-7703009916166103485?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/7703009916166103485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/08/danmark.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7703009916166103485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7703009916166103485'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/08/danmark.html' title='Danmark'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7uWNPBnAcls/TF6gJ2z95oI/AAAAAAAAACM/RPdPxb1GN04/s72-c/danmark.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-1543107335515581053</id><published>2010-05-11T14:29:00.000-07:00</published><updated>2010-05-11T14:39:31.987-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Impressions'/><title type='text'>La Joconde</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7uWNPBnAcls/S-nOgiqfN1I/AAAAAAAAACE/F2EhpucGcyI/s1600/monalisa.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://1.bp.blogspot.com/_7uWNPBnAcls/S-nOgiqfN1I/AAAAAAAAACE/F2EhpucGcyI/s400/monalisa.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5470130280874325842" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-1543107335515581053?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/1543107335515581053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/05/la-joconde.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1543107335515581053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1543107335515581053'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/05/la-joconde.html' title='La Joconde'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7uWNPBnAcls/S-nOgiqfN1I/AAAAAAAAACE/F2EhpucGcyI/s72-c/monalisa.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-3023906814252411380</id><published>2010-05-05T10:25:00.000-07:00</published><updated>2010-05-05T10:27:40.556-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Link'/><title type='text'>How to compile Vim on Linux</title><content type='html'>&lt;a href="http://users.skynet.be/antoine.mechelynck/vim/compunix.htm"&gt;http://users.skynet.be/antoine.mechelynck/vim/compunix.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-3023906814252411380?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/3023906814252411380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/05/how-to-compile-vim-on-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/3023906814252411380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/3023906814252411380'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/05/how-to-compile-vim-on-linux.html' title='How to compile Vim on Linux'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-9082642494414852197</id><published>2010-04-17T11:20:00.000-07:00</published><updated>2010-04-17T11:22:49.648-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='German'/><category scheme='http://www.blogger.com/atom/ns#' term='Politics'/><title type='text'>Klartext</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/9YUDvAnoM7I&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/9YUDvAnoM7I&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-9082642494414852197?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/9082642494414852197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/04/klartext.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/9082642494414852197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/9082642494414852197'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/04/klartext.html' title='Klartext'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-5308486906235510259</id><published>2010-04-16T05:44:00.000-07:00</published><updated>2010-04-16T05:47:36.426-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><title type='text'>SQL for removing invalid foreign keys and typecasting in Postgres</title><content type='html'>&lt;code&gt;&lt;br /&gt;DELETE FROM session_data WHERE session_data.name = 'user_id' &lt;br /&gt;AND NOT EXISTS &lt;br /&gt;(SELECT * FROM users WHERE CAST(session_data.value AS integer) = users.id);&lt;br /&gt;&lt;/cod&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-5308486906235510259?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/5308486906235510259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/04/sql-for-removing-invalid-foreign-keys.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/5308486906235510259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/5308486906235510259'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/04/sql-for-removing-invalid-foreign-keys.html' title='SQL for removing invalid foreign keys and typecasting in Postgres'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-6399776288729678396</id><published>2010-01-08T06:08:00.001-08:00</published><updated>2010-01-08T06:34:51.742-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Debugging nosetests with ipdb</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_7uWNPBnAcls/S0dCA_hSmPI/AAAAAAAAAB4/qfr_Zi0kDD8/s1600-h/ipdb.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 192px;" src="http://3.bp.blogspot.com/_7uWNPBnAcls/S0dCA_hSmPI/AAAAAAAAAB4/qfr_Zi0kDD8/s400/ipdb.png" border="0" alt="screenshot" id="BLOGGER_PHOTO_ID_5424376861009549554" /&gt;&lt;/a&gt;&lt;br /&gt;Ever wanted to debug Python with tab completion and syntax highlighting? Then you'll love ipdb:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;sudo easy_install ipdb&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The only thing you have to do is use &lt;a href="http://pypi.python.org/pypi/ipdb"&gt;ipdb&lt;/a&gt; instead of pdb:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;import ipdb; ipdb.set_trace()&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;With a little &lt;a href="http://groups.google.com/group/nose-users/browse_thread/thread/dc1acb90ad92a503/dc5d413637caf2e4"&gt;trick&lt;/a&gt; it will even work with &lt;a href="http://somethingaboutorange.com/mrl/projects/nose/0.11.1/"&gt;nosetests&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;import sys; sys.stdout = sys.__stdout__; import ipdb; ipdb.set_trace()&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-6399776288729678396?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/6399776288729678396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/01/debugging-nosetests-with-ipdb.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/6399776288729678396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/6399776288729678396'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2010/01/debugging-nosetests-with-ipdb.html' title='Debugging nosetests with ipdb'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7uWNPBnAcls/S0dCA_hSmPI/AAAAAAAAAB4/qfr_Zi0kDD8/s72-c/ipdb.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-7314597268031024597</id><published>2009-09-14T16:04:00.000-07:00</published><updated>2009-09-14T16:09:47.242-07:00</updated><title type='text'>Wanda's Wisdom</title><content type='html'>&lt;blockquote&gt;You may be gone tomorrow, but that doesn't mean that you weren't here today.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-7314597268031024597?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/7314597268031024597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/wandas-wisdom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7314597268031024597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7314597268031024597'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/wandas-wisdom.html' title='Wanda&apos;s Wisdom'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-808005118248405715</id><published>2009-09-07T08:29:00.000-07:00</published><updated>2009-09-07T11:11:34.437-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pympler'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Break the Cycle: Local Class Definitions</title><content type='html'>In the process of analyzing the memory behavior of your Python application, you will sooner or later stumble across reference cycles. It is always a good idea to avoid creating reference cycles, though &lt;a href="http://www.scons.org/wiki/LudwigHaehne/ReferenceCycles"&gt;not every cycle is worth breaking&lt;/a&gt; (using weak methods avoided some reference cycles but increased the invocation cost).&lt;br /&gt;&lt;br /&gt;Debugging reference cycles can be simplified by creating a graphical representation of the reference graph, e.g. using graphviz. Marius Gedminas provides a set of &lt;a href="http://mg.pov.lt/blog/hunting-python-memleaks"&gt;tools to facilitate building graphs&lt;/a&gt; at his homepage. Similar facilities exist in &lt;a href="http://code.google.com/p/pympler/"&gt;Pympler&lt;/a&gt;. The latter improved considerably since the official 0.1 release so be sure to grab the version from the svn trunk.&lt;br /&gt;&lt;br /&gt;When you know what objects are involved in cyclic dependencies you will want to know why these occurred in the first place, which is not always trivial to figure out. While working on the integration of &lt;a href="http://bottle.paws.de/page/start"&gt;Bottle&lt;/a&gt; (which is really great BTW) in Pympler, I stumbled across an interesting case:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;import gc&lt;br /&gt;gc.disable()&lt;br /&gt;&lt;br /&gt;def f():&lt;br /&gt;    class Foo(object):&lt;br /&gt;        pass&lt;br /&gt;f()&lt;br /&gt;&lt;br /&gt;from pympler.gui.garbage import GarbageGraph&lt;br /&gt;GarbageGraph(reduce=True).render('cycle1.png', format='png')&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This snippet creates the following reference cycle (click on the image to enlarge):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7uWNPBnAcls/SqU4eO91ZaI/AAAAAAAAABI/F2fps_exECE/s1600-h/cycle1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 97px;" src="http://1.bp.blogspot.com/_7uWNPBnAcls/SqU4eO91ZaI/AAAAAAAAABI/F2fps_exECE/s400/cycle1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5378767422028604834" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Apparently, defining a class in the local scope of a function or method creates a reference cycle. Lifting the class definition to the module level avoids the reference cycle. It is even more interesting that class objects create reference cycles by design when they go out of scope:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;&gt;&gt;&gt; import gc&lt;br /&gt;&gt;&gt;&gt; gc.disable()&lt;br /&gt;&gt;&gt;&gt; class Foo(object):&lt;br /&gt;...   pass&lt;br /&gt;&gt;&gt;&gt; del Foo&lt;br /&gt;&gt;&gt;&gt; gc.collect()&lt;br /&gt;6&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So what? Well, it is evidently beneficial to define classes in modules or other classes, and not in functions or methods.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-808005118248405715?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/808005118248405715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/break-cycle-local-class-declarations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/808005118248405715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/808005118248405715'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/break-cycle-local-class-declarations.html' title='Break the Cycle: Local Class Definitions'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7uWNPBnAcls/SqU4eO91ZaI/AAAAAAAAABI/F2fps_exECE/s72-c/cycle1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-8121597896947806922</id><published>2009-09-01T03:54:00.000-07:00</published><updated>2009-09-01T04:31:53.288-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Substitute assert statements with unittest methods using vim</title><content type='html'>In the Python community, it's not generally agreed upon whether to use the &lt;span style="font-style:italic;"&gt;assert&lt;/span&gt; statement or the &lt;span style="font-style:italic;"&gt;assert*&lt;/span&gt; methods from the unittest module. As some commentators pointed out in a &lt;a href="http://www.peterbe.com/plog/to-assert-or-assertEqual"&gt;recent discussion&lt;/a&gt;, there are (a few) good reasons to prefer the assertion methods, e.g. better error messages.&lt;br /&gt;&lt;br /&gt;Here are some vim substitution commands that make the transition from assert statements to the appropriate methods easier:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;:%s/assert \(.\+\) == \(.\+\)/self.assertEqual(\1, \2)/gc&lt;br /&gt;:%s/assert \(.\+\) != \(.\+\)/self.assertNotEqual(\1, \2)/gc&lt;br /&gt;:%s/assert \(.\+\)/self.assert_(\1)/gc&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-8121597896947806922?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/8121597896947806922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/substitute-assert-statements-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/8121597896947806922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/8121597896947806922'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/09/substitute-assert-statements-with.html' title='Substitute assert statements with unittest methods using vim'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-2605431882136155447</id><published>2009-08-19T12:07:00.000-07:00</published><updated>2009-08-19T12:35:38.874-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Convert Images to A4 PDF</title><content type='html'>Converting raster images to PDF in a printable format can be achieved using the &lt;a href="http://www.imagemagick.org/script/index.php"&gt;ImageMagick&lt;/a&gt; &lt;span style="font-style:italic;"&gt;convert&lt;/span&gt; utility with the &lt;span style="font-style:italic;"&gt;page&lt;/span&gt; parameter:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;convert -page a4 *.png images.pdf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The converter, however, not quite does what I expected. Images are resized to fill the A4 page but the aspect ratio is preserved and no margin is added. This actually leads to different sized pages for images with different ratios (which is common for scanned documents for example). &lt;br /&gt;&lt;br /&gt;In order to create equal-sized PDF pages from a bunch of images, a margin or border needs to be added to the images. Doing this manually is a cumbersome process. Therefore, I've written a little Python script which adds a (white) border to the individual images to enforce an aspect ratio compatible with A4 pages. The script creates a PDF file from a bunch of image files with uniform A4 page size:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;import sys&lt;br /&gt;from subprocess import Popen, PIPE&lt;br /&gt;&lt;br /&gt;PAGE_WIDTH = 210.0&lt;br /&gt;PAGE_HEIGHT = 297.0&lt;br /&gt;&lt;br /&gt;files = [arg for arg in sys.argv[1:-1]]&lt;br /&gt;output = sys.argv[-1]&lt;br /&gt;tmp = ["a4%s" % f for f in files]&lt;br /&gt;for f,t in zip(files, tmp):&lt;br /&gt;    p = Popen(["identify", f], stdout=PIPE)&lt;br /&gt;    dim = p.communicate()[0].split()[2]&lt;br /&gt;    w,h = [float(d) for d in dim.split('x')]&lt;br /&gt;    bw,bh = 0,0&lt;br /&gt;    if w/h &lt; PAGE_WIDTH/PAGE_HEIGHT:&lt;br /&gt;        nw = PAGE_WIDTH * h / PAGE_HEIGHT&lt;br /&gt;        bw = int((nw - w) / 2)&lt;br /&gt;    else:&lt;br /&gt;        nh = PAGE_HEIGHT * w / PAGE_WIDTH&lt;br /&gt;        bh = int((nh - h) / 2)&lt;br /&gt;    Popen(["convert", "-border", "%dx%d" % (bw,bh), &lt;br /&gt;        "-bordercolor", "white", f, t]).communicate() &lt;br /&gt;Popen(["convert", "-page", "a4"] + tmp + [output]).communicate()&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Save the script to &lt;span style="font-style:italic;"&gt;img2a4pdf.py&lt;/span&gt; and invoke it like that:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;python img2a4pdf.py *.png output.pdf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Maybe someone will find it useful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-2605431882136155447?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/2605431882136155447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/08/convert-images-to-a4-pdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/2605431882136155447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/2605431882136155447'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/08/convert-images-to-a4-pdf.html' title='Convert Images to A4 PDF'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-4901744268071627535</id><published>2009-07-22T12:06:00.000-07:00</published><updated>2009-07-22T14:24:02.449-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='German'/><category scheme='http://www.blogger.com/atom/ns#' term='Link'/><title type='text'>Der neueste Kick</title><content type='html'>Mal wieder eine &lt;a href="http://www.tagesthemen.com/wirtschaft/aignermilchbauern102.html"&gt;Meldung auf Tagesschau.de&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"Es ist offensichtlich, dass unsere Milchbauern gerade leiden", sagte sie. &lt;span style="font-weight:bold;"&gt;"Es geht um echte Menschen und nicht um Statistiken auf einem Blatt Papier."&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Etwas weiter unten dann:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Der deutsche Bauernverband hatte das Schlachten von Kühen als eine Möglichkeit gesehen, um das Überangebot an Milch auf dem europäischen Markt zu bereinigen: &lt;span style="font-weight: bold;"&gt;Wenn anderthalb Millionen Tiere getötet würden, könnte das den Kick geben&lt;/span&gt;, um aus dem tiefen Tal wieder herauszukommen.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Mit etwas Glück kommt vielleicht bald die Milch im Kaffee nach dem Steak vom selben Tier. Prost Mahlzeit!&lt;br /&gt;&lt;br /&gt;Immerhin, das Fleisch von anderthalb Millionen geschlachteten Rindern reicht in Deutschland &lt;a href="http://www.bmelv-statistik.de/fileadmin/sites/016_Archiv_andere/EntwicklungRinder-Schweineproduktion_GD.pdf"&gt;keine sechs Monate&lt;/a&gt;. Wer wäre da nicht gern Vegetarier.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-4901744268071627535?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/4901744268071627535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/der-neueste-kick.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4901744268071627535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4901744268071627535'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/der-neueste-kick.html' title='Der neueste Kick'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-1391788930281510345</id><published>2009-07-19T10:17:00.000-07:00</published><updated>2009-07-19T10:33:38.816-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Inkscape PDF Export</title><content type='html'>&lt;a href="http://www.inkscape.org"&gt;Inkscape&lt;/a&gt; is nice vector drawing program, especially for illustrating Latex documents. In the past, I've always exported to eps first and then converted the docs to PDF using epstopdf. This way, the bounding box is confined to the actual region of interest.&lt;br /&gt;&lt;br /&gt;Unfortunately, transparency information is lost in the process. What works, though, is to fit the page to the selection just before directly exporting to PDF. Go to &lt;span style="font-style: italic;"&gt;File &gt; Document Properties&lt;/span&gt; and press &lt;span style="font-style: italic;"&gt;Fit page to selection&lt;/span&gt; on the Page tab.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-1391788930281510345?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/1391788930281510345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/inkscape-pdf-export.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1391788930281510345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1391788930281510345'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/inkscape-pdf-export.html' title='Inkscape PDF Export'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-7185202347407637219</id><published>2009-07-17T11:04:00.000-07:00</published><updated>2009-07-17T11:37:35.183-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Diary'/><title type='text'>Almost done</title><content type='html'>At last, I've completed my final thesis. Seven exciting years as a student passed almost too quickly.  In a week from now, it'll all be over. Finally, time for traveling, working on &lt;a href="http://code.google.com/p/pympler"&gt;Pympler&lt;/a&gt; and &lt;a href="http://www.scons.org"&gt;SCons&lt;/a&gt;, getting an interesting job.&lt;br /&gt;&lt;br /&gt;In the process of finding a new home, our old server will probably be disconnected before very long.  Therefore, it is time to find a new haven for ideas, thoughts and casual code snippets.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-7185202347407637219?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/7185202347407637219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/almost-done.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7185202347407637219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7185202347407637219'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/almost-done.html' title='Almost done'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-7193037014451758723</id><published>2008-08-31T14:39:00.000-07:00</published><updated>2009-07-17T14:49:15.607-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Build Systems'/><title type='text'>Empirical Comparison of SCons and GNU Make</title><content type='html'>A course work of mine, entitled &lt;a href="http://genode-labs.com/publications/scons-vs-make-2008.pdf/view"&gt;Empirical Comparison of SCons and GNU Make&lt;/a&gt;, is now hosted at the &lt;a href="http://genode-labs.com/"&gt;company site&lt;/a&gt; of my tutors. Thanks guys!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-7193037014451758723?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/7193037014451758723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/empirical-comparison-of-scons-and-gnu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7193037014451758723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/7193037014451758723'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2009/07/empirical-comparison-of-scons-and-gnu.html' title='Empirical Comparison of SCons and GNU Make'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-8168341987802384876</id><published>2008-08-13T14:02:00.000-07:00</published><updated>2009-07-19T12:36:21.423-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Impressions'/><title type='text'>Sverige</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7uWNPBnAcls/SmDniaXGoWI/AAAAAAAAAAw/8Sr-um8Sqy0/s1600-h/schweden0808199.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 267px;" src="http://2.bp.blogspot.com/_7uWNPBnAcls/SmDniaXGoWI/AAAAAAAAAAw/8Sr-um8Sqy0/s400/schweden0808199.jpg" alt="" id="BLOGGER_PHOTO_ID_5359538134948684130" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-8168341987802384876?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/8168341987802384876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/08/sweden.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/8168341987802384876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/8168341987802384876'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/08/sweden.html' title='Sverige'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7uWNPBnAcls/SmDniaXGoWI/AAAAAAAAAAw/8Sr-um8Sqy0/s72-c/schweden0808199.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-4864126334945610038</id><published>2008-04-10T12:22:00.000-07:00</published><updated>2009-07-19T12:29:48.429-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Upgrade to Hardy Heron vs Trac and sqlite</title><content type='html'>Today I tried something which I don't really expected to work. After a direct upgrade from Dapper to Hardy, Trac stopped working:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"file is encrypted or is not a database"&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;There's a version conflict between the Trac database and the accessing sqlite version. The best solution I found while searching the web, was to &lt;a href="http://www.mail-archive.com/trac-users@googlegroups.com/msg07128.html"&gt;convert the databases manually&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;sudo -s&lt;br /&gt;apt-get install sqlite&lt;br /&gt;cd /var/&lt;em&gt;your-trac-project&lt;/em&gt;/db&lt;br /&gt;cp trac.db trac.db.orig&lt;br /&gt;sqlite trac.db .dump &gt; trac.sql&lt;br /&gt;rm trac.db&lt;br /&gt;sqlite3 trac.db ".read trac.sql"&lt;br /&gt;chown www-data:www-data *&lt;br /&gt;trac-admin .. upgrade&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After that, Trac worked again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-4864126334945610038?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/4864126334945610038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/04/upgrade-to-hardy-heron-vs-trac-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4864126334945610038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4864126334945610038'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/04/upgrade-to-hardy-heron-vs-trac-and.html' title='Upgrade to Hardy Heron vs Trac and sqlite'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-1272961926527811779</id><published>2008-03-01T12:17:00.000-08:00</published><updated>2009-07-19T12:16:17.267-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='Build Systems'/><title type='text'>Automatic make dependencies without sed</title><content type='html'>I'm currently working with plain GNU Make based projects and - again - I tried to find a nice way to automatically track dependencies and finally found a nice solution when skimming over the g++ manpage. There is a lot of black art flowing around, e.g. this gem is from the &lt;a href="http://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html#Automatic-Prerequisites"&gt;GNU Make manual&lt;/a&gt;:&lt;br /&gt;&lt;pre class="prettyprint"&gt;%.d: %.c&lt;br /&gt;   @set -e; rm -f $@; \&lt;br /&gt;    $(CC) -M $(CPPFLAGS) $&lt; &gt; $@.$$$$; \&lt;br /&gt;    sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' &lt; $@.$$$$ &gt; $@; \&lt;br /&gt;    rm -f $@.$$$$&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not for the faint of heart, also the thing done by sed is quite trivial. If all you have to support is gcc (portability is overrated!), there's a much more simple way to achieve the same (and more):&lt;br /&gt;&lt;pre class="prettyprint"&gt;%.o: %.c&lt;br /&gt;   $(CC) -MMD -MP -MT '$*.d' -c $(CFLAGS) $&lt; -o $@&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-1272961926527811779?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/1272961926527811779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/03/automatic-make-dependencies-without-sed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1272961926527811779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/1272961926527811779'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/03/automatic-make-dependencies-without-sed.html' title='Automatic make dependencies without sed'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-4275243226093838021</id><published>2007-09-15T14:26:00.000-07:00</published><updated>2009-07-19T12:33:22.255-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Impressions'/><title type='text'>Hrvatska</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7uWNPBnAcls/SmDs3jq_NdI/AAAAAAAAAA4/Y0GeaoDohTY/s1600-h/croatia.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 267px;" src="http://4.bp.blogspot.com/_7uWNPBnAcls/SmDs3jq_NdI/AAAAAAAAAA4/Y0GeaoDohTY/s400/croatia.JPG" alt="" id="BLOGGER_PHOTO_ID_5359543995783394770" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-4275243226093838021?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/4275243226093838021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/09/croatia.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4275243226093838021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/4275243226093838021'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2008/09/croatia.html' title='Hrvatska'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDs3jq_NdI/AAAAAAAAAA4/Y0GeaoDohTY/s72-c/croatia.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5225422880870266037.post-223316105695650160</id><published>2007-08-05T10:47:00.000-07:00</published><updated>2009-07-19T10:50:27.674-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Impressions'/><title type='text'>Norge</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_7uWNPBnAcls/SmNccXPIGOI/AAAAAAAAABA/eEqkQtcmfMM/s1600-h/norge.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 300px; height: 400px;" src="http://3.bp.blogspot.com/_7uWNPBnAcls/SmNccXPIGOI/AAAAAAAAABA/eEqkQtcmfMM/s400/norge.jpg" alt="" id="BLOGGER_PHOTO_ID_5360229623844575458" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5225422880870266037-223316105695650160?l=ghostwritten-insomnia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ghostwritten-insomnia.blogspot.com/feeds/223316105695650160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2007/08/norge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/223316105695650160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5225422880870266037/posts/default/223316105695650160'/><link rel='alternate' type='text/html' href='http://ghostwritten-insomnia.blogspot.com/2007/08/norge.html' title='Norge'/><author><name>Pankrat</name><uri>http://www.blogger.com/profile/09329360337544127170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_7uWNPBnAcls/SmDJYL9xDJI/AAAAAAAAAAM/i_KFZu1wf4E/S220/schweden0808.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7uWNPBnAcls/SmNccXPIGOI/AAAAAAAAABA/eEqkQtcmfMM/s72-c/norge.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
