<?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-5101636558333041736</id><updated>2011-10-02T16:02:20.256+02:00</updated><category term='linux'/><category term='math'/><category term='asynchia'/><category term='rpc'/><category term='photography'/><category term='unittest'/><category term='security'/><category term='politics'/><category term='programming'/><category term='dvcs'/><category term='scm'/><category term='graphics'/><category term='games'/><category term='gnu'/><category term='shred'/><category term='dbus'/><category term='general'/><category term='gui'/><category term='regex'/><category term='bitbucket'/><category term='audio'/><category term='encryption'/><category term='pyqt'/><category term='android'/><category term='Dusting the Sandbox'/><category term='git'/><category term='python'/><category term='ssl'/><category term='parallel'/><category term='network'/><category term='mozilla'/><category term='qt'/><category term='mercurial'/><category term='hardware'/><category term='svn'/><category term='pypentago'/><category term='screencast'/><title type='text'>The Segfault Trap</title><subtitle type='html'>Searching the Answer to Life, the Universe and Everything.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2668325843210593309</id><published>2011-04-11T01:33:00.004+02:00</published><updated>2011-04-11T01:38:02.586+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>burrahobbit</title><content type='html'>burrahobbit, a project offering persistent data-structures seen in Clojure in Python, has just had its first release! See &lt;a href="http://segfaulthunter.github.com/burrahobbit/"&gt;http://segfaulthunter.github.com/burrahobbit/&lt;/a&gt; for details. It's based on the pdict.py script in my sandbox but now differs considerably from it by having a comprehensive test-suite and a lot of new features (including but not limited to sets and the binary operators). I highly appreciate any feedback, be it in the form a comment under this post, a bug report or feature request in the GitHub issue tracker or an email sent to my address which can be found in the box to the right.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2668325843210593309?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2668325843210593309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2668325843210593309&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2668325843210593309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2668325843210593309'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2011/04/burrahobbit.html' title='burrahobbit'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7551384555175324439</id><published>2011-03-13T02:47:00.003+01:00</published><updated>2011-03-13T02:56:13.972+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>PersistentTreeMap in Python</title><content type='html'>&lt;div class="section" id="abstract"&gt; &lt;h1&gt;Abstract&lt;/h1&gt; &lt;p&gt;Hereinafter I will discuss an implementation of a PersistentTreeMap in Python. PersistentTreeMaps are a language feature of the Clojure programming language and the implementation thus presented ports this feature to Python. It is implemented in pure Python code and is thus not feasible for very large sets of data (it is doubtful that persistent datastructures are feasible at all for very large sets of data).&lt;/p&gt; &lt;/div&gt; &lt;div class="section" id="a-word-about-persistence"&gt; &lt;h1&gt;A word about persistence&lt;/h1&gt; &lt;p&gt;So what's all the fuss about persistence about, anyway? A persistent datastructure is an immutable datastructure that (the clue is in the following clause) allows for the user to create many copies; the key to doing this is to make the copies cheap by sharing most of the data between the original and the copy.&lt;/p&gt; &lt;p&gt;Persistent data-structures are of enormous value in multi-threaded programming because data-structures can be assumed not to change their value, this assuring that no other thread may interfere with one's calculation.&lt;/p&gt; &lt;/div&gt; &lt;div class="section" id="persistence-in-python"&gt; &lt;h1&gt;Persistence in Python&lt;/h1&gt; &lt;p&gt;The only thing that may actually change is the state of the key or value objects stored in the mapping (in fact, the key object should not be mutable as it must implement __hash__ and therefore should not be mutable).&lt;/p&gt; &lt;p&gt;As Python objects are essentially references, the data-structure has no power to prevent data stored in it from being changed (which it need not, because the cheap-copy of the datastructure actually &lt;em&gt;points&lt;/em&gt; to the same object and thus is not changed). Thus, looking up a member always returns the same object, but that object's value may have changed with time; this is a restriction inherent to Python.&lt;/p&gt; &lt;/div&gt; &lt;div class="section" id="concept-of-persistent-hashtreemaps"&gt; &lt;h1&gt;Concept of persistent HashTreeMaps&lt;/h1&gt; &lt;p&gt;A tree structure consists of nodes which have at most as many children as the arity of the tree is; a node without any children is referred to as a leaf of the tree.&lt;/p&gt; &lt;p&gt;A binary tree (i.e. a tree in which each node that is not a leafnode has two children) will serve as an example to convey the concept of a HashTreeMap; a binary tree has several advantages for explanation purposes, most importantly the conciseness of its graphical illustration. Moreover, hashes of objects are assumed to be 3 bits long in this example, which is a quite unrealistic length in the real-world. An implementation with better performance characteristica and premisses that stand in the real-world will be explored afterwards.&lt;/p&gt; &lt;p&gt;There are three types of leaf-nodes: The AssocNode which stores a key to value association, a HashCollisionNode which contains a list of AssocNodes with colliding hashes (hashes which are equal while they key is not) and the NULLNODE which is a dummy node for dead-end leaves. Because there is no state associated to it, only one instance of NULLNODE is required and only this instance may be used for performance reasons.&lt;/p&gt; &lt;p&gt;Before continuing in our example, I need to elaborate the interface each node must export:&lt;/p&gt; &lt;blockquote&gt; &lt;ul class="simple"&gt; &lt;li&gt;assoc(hsh, shift, node)&lt;/li&gt; &lt;li&gt;without(hsh, shift, key)&lt;/li&gt; &lt;li&gt;get(hsh, shift, key)&lt;/li&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;p&gt;assoc returns a &lt;em&gt;new tree&lt;/em&gt; with the mapping contained in the &lt;cite&gt;AssocNode&lt;/cite&gt; &lt;cite&gt;node&lt;/cite&gt; added (please ignore the additional arguments for the time being, their merits will be discussed later). without returns a &lt;em&gt;new tree&lt;/em&gt; with the mapping with the key removed, it will throw a KeyError if the key is not present. get will return the value associated to key or, if no such association exists, raise a KeyError.&lt;/p&gt; &lt;p&gt;When a HashTreeMap is created, the tree only contains one node, being the NULLNODE. Let the key of the association we want to create be &amp;quot;hello&amp;quot;, its hash 0b010 and the value &amp;quot;world&amp;quot;. The hash of the key is passed to assoc as &lt;cite&gt;hsh&lt;/cite&gt;, an AssocNode containing the association as node and 0 as shift. &lt;cite&gt;shift&lt;/cite&gt; refers to the level of the tree the node whose assoc (or without or get for that matter). The new tree returned now contains the association of &amp;quot;hello&amp;quot; to &amp;quot;world&amp;quot;, the old tree is left ontouched.&lt;/p&gt; &lt;p&gt;The insertion of the second association is a bit more tricky. Suppose you want to add an assocation from the key &amp;quot;spam&amp;quot; with the hash 0b001 to the value &amp;quot;eggs&amp;quot;. We now need to create a branching point at the 0&lt;sup&gt;th&lt;/sup&gt; level of the tree. The 0&lt;sup&gt;th&lt;/sup&gt; branch points to the AssocNode containing the association from &amp;quot;hello&amp;quot; to &amp;quot;world&amp;quot;, whereas the other one points to the one associating &amp;quot;spam&amp;quot; with &amp;quot;eggs&amp;quot;. To understand this, consider the lowest bit of the hash the index of the branch to take at the first branching point.&lt;/p&gt; &lt;div class="figure"&gt; &lt;img alt="Two AssocNodes." src="http://i.imgur.com/XracU.png" /&gt; &lt;/div&gt; &lt;p&gt;Now let us consider one more association. Let the key be &amp;quot;foo&amp;quot;, its hash 0b011 and the value &amp;quot;bar&amp;quot;. The AssocNode that is the leaf of the 1-branch of the branching point on the 0&lt;sup&gt;th&lt;/sup&gt; level now needs to be replaced by another branching point that contains the AssocNode for &amp;quot;hello&amp;quot; on the 0-branch and the AssocNode for &amp;quot;foo&amp;quot; on the 1-branch.&lt;/p&gt; &lt;div class="figure"&gt; &lt;img alt="Three AssocNodes." src="http://i.imgur.com/GItKc.png" /&gt; &lt;/div&gt; &lt;p&gt;Lookup is really straightforward. The tree is walked until a leaf is reached, taking the branch represented by the value of the respective bit at every branching point; this means, the branch to be taken on the 0&lt;sup&gt;th&lt;/sup&gt; level is decided by the 0&lt;sup&gt;th&lt;/sup&gt; bit, the branch to be taken on the first level by the next bit, and so forth, until a leaf is eventually reached. If the leaf is a AssocNode, it is checked whether its key equals the one requested, if it is so, the value is returned, otherwise a KeyError is thrown. If the leaf node is a HashCollisionMode, the key of every of the colliding AssocNodes is checked against the requested key, and, if one of them matches, its value returned; if the leaf is a NullNode (which is only possible for empty trees with a binary tree), a KeyError is raised.&lt;/p&gt; &lt;div class="figure"&gt; &lt;img alt="Lookup." src="http://i.imgur.com/yIvwa.png" /&gt; &lt;/div&gt; &lt;p&gt;Removing an item (done by calling the &lt;cite&gt;without&lt;/cite&gt; method) is done by walking the tree to the item that needs to be removed, and then replacing that with a NullNode (additionally removing any branching points rendered redundant by removing the item).&lt;/p&gt; &lt;p&gt;In the next post, I will elaborate the implementation of a tree maps that is feasible for real-life scenarios by being implemented as a 32-ary tree.&lt;/p&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7551384555175324439?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7551384555175324439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7551384555175324439&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7551384555175324439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7551384555175324439'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2011/03/persistenttreemap-in-python.html' title='PersistentTreeMap in Python'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7751658058269412946</id><published>2011-01-15T00:34:00.004+01:00</published><updated>2011-01-15T00:47:37.626+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shred'/><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><title type='text'>info shred</title><content type='html'>&lt;blockquote style="font-style: italic;"&gt;The best way to remove something irretrievably is to &lt;span style="font-weight: bold;"&gt;destroy the media it's on with acid, melt it down, or the like.&lt;/span&gt;  For cheap removable media like floppy disks, this is the preferred method. However, hard drives are expensive and &lt;span style="font-weight: bold;"&gt;hard to melt&lt;/span&gt;, so the `shred' utility tries to achieve a similar effect non-destructively.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Emphasis mine. The GNU folks have a strange kind of humour.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7751658058269412946?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7751658058269412946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7751658058269412946&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7751658058269412946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7751658058269412946'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2011/01/info-shred.html' title='info shred'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8254700994499716842</id><published>2011-01-01T22:50:00.002+01:00</published><updated>2011-01-01T22:52:38.070+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'>Mozilla data disclosure 2</title><content type='html'>I have received a response with a link to a &lt;a href="http://blog.mozilla.com/security/2010/12/27/addons-mozilla-org-disclosure/"&gt;blog post concerning the incident&lt;/a&gt;, which says.&lt;br /&gt;&lt;blockquote&gt;The database included 44,000 inactive accounts using older, md5-based password hashes.  We erased all the md5-passwords, rendering the accounts disabled. All current addons.mozilla.org accounts use a more secure SHA-512 password hash with per-user salts. SHA-512 and per user salts has been the standard storage method of password hashes for all active users since April 9th, 2009.&lt;br /&gt;&lt;br /&gt;It is important to note that current addons.mozilla.org users and accounts are not at risk. Additionally, this incident did not impact any of Mozilla’s infrastructure.  This information was also sent to impacted users by email on December 27th&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8254700994499716842?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8254700994499716842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8254700994499716842&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8254700994499716842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8254700994499716842'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2011/01/mozilla-data-disclosure_01.html' title='Mozilla data disclosure 2'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6980235902142092294</id><published>2011-01-01T18:20:00.003+01:00</published><updated>2011-01-01T18:47:28.171+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'>Mozilla data disclosure</title><content type='html'>Hello and happy New Year everyone!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have just scanned my mailbox for new emails, and one of them particularly caught my attention: Its title was “Important notice about your addons.moz&lt;wbr&gt;illa.org account”. To be honest, I did not remember I even had an account there, but because they claimed it were important, I read it. Reading it proved to be worthwhile and here are the most important passages of the text:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;“Subject: Important notice about your addons.mozilla.org account&lt;br /&gt;The purpose of this email is to notify you about a possible disclosure of your information which occurred on December 17th. […] On this date, we were informed by a 3rd party who discovered a file with individual user records on a public portion of one of our servers. […] This file was placed on this server by mistake and was a partial representation of the users database from addons.mozilla.org. &lt;b&gt;The file included email addresses, first and last names, and an md5 hash representation of your password.&lt;/b&gt;”&lt;/blockquote&gt;So effectively they are telling you that they hashed your full name, your email address and the MD5 hash of your password because someone put a file into public that did not belong there. What really puzzled me was not the fact that this awkward incident happened, but rather the wording of the emphasised sentence: It said nothing about whether salting was used to additionally protect the password; is it possible that a company like Mozilla does not consider the user passwords to be sensitive enough to add the additional security layer of salting?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But it is not all bad, they disabled the accounts where data was possibly leaked, investigated on the issue and promise not to let it happen again. The last sentence of the sentence also promises that they may add salting, if they do not already do it.&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;“The reason we are disclosing this event is because we have removed your existing password from the addons site and are asking you to reset it by going back to the addons site and clicking forgot password. We are also asking you to change your password on other sites in which you use the same password. Since we have effectively erased your password, you don't need to do anything if you do not want to use your account.  It is disabled until you perform the password recovery. We have identified the process which allowed this file to be posted publicly and have taken steps to prevent this in the future. &lt;b&gt;We are also evaluating other processes to ensure your information is safe and secure.&lt;/b&gt;”&lt;/blockquote&gt;So, curious on whether salting is used at Mozilla's, I decided to contact the address they supplied for questions with the following email.&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;Subject: Protection of user data&lt;/blockquote&gt;&lt;blockquote&gt;Dear sir or madam!&lt;br /&gt;&lt;br /&gt;The email your corporation has sent on 28.12.2010 concerning possible disclosure of user data on addons.mozilla.org has left me with the question of whether the user passwords stored in your database are salted or not. I consider salting of user passwords to be of utmost importance, as it significantly reduces the risk of disclosing&lt;br /&gt;passwords by preventing the attacker to use a rainbow attack. The wording that elaborated which data has been leaked in the abovementioned email (“The file included email addresses, first and last names, and an md5 hash representation of your password.”) has left me with the impression that you do not salt user passwords and thus I would really appreciate if you could give me definite&lt;br /&gt;information about the matter.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Florian Mayer&lt;br /&gt;PS: I will make available publicly the information contained in the response to this email unless explicitly stated otherwise, as I firmly believe people have a right to know how the data they give away is secured and think the principles of openness repeatedly expressed by your corporation require the same.&lt;/blockquote&gt;To be continued …&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6980235902142092294?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6980235902142092294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6980235902142092294&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6980235902142092294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6980235902142092294'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2011/01/mozilla-data-disclosure.html' title='Mozilla data disclosure'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1421700976709462831</id><published>2010-12-20T01:41:00.004+01:00</published><updated>2010-12-20T19:25:54.609+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='dbus'/><title type='text'>man dbus-daemon</title><content type='html'>Wonderful. This shows only the most motivated and competent people work on dbus:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;“Complex globs like "foo.bar.*" aren't allowed for now because they'd be &lt;span style="font-weight: bold;"&gt;work to implement&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;maybe encourage&lt;/span&gt; sloppy security anyway.”&lt;/span&gt;&lt;br /&gt;— man dbus-daemon&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Emphasis mine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1421700976709462831?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1421700976709462831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1421700976709462831&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1421700976709462831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1421700976709462831'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/12/man-dbus-daemon.html' title='man dbus-daemon'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7220360228785633310</id><published>2010-11-24T11:38:00.003+01:00</published><updated>2010-11-24T11:43:47.900+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Fedora</title><content type='html'>Apparently the Fedora Live-CD does not like my Intel Fake RAID (I need to use one because I need Windows-compatibility) whereas the 3.3 GB full-install DVD does. This inconvenience has caused me to question my decision of replacing my Ubuntu system with Fedora, as it does not seem as if it were the sophisticated system I have been looking for either.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7220360228785633310?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7220360228785633310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7220360228785633310&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7220360228785633310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7220360228785633310'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/11/fedora.html' title='Fedora'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-133192772653740995</id><published>2010-11-24T10:45:00.008+01:00</published><updated>2011-07-09T13:51:54.597+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gui'/><category scheme='http://www.blogger.com/atom/ns#' term='rpc'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>GUIs, RPC and everything</title><content type='html'>The idea has been in my head for quite some time; but before explaining it please give me some time to explain the circumstances. By recently having bought a smartphone that enables me to write instant messages and using a laptop when away from home, my instant messaging data are now split apart – believe it or not – to four locations: my Linux installation and my Windows installation at home, the laptop and the smartphone. This is especially a problem because you risk losing context if the communication is not actually instant but the location is switched between sending a message and receiving its reply. Plus, the rather unstable connection to the Internet of both the laptop and the smartphone make for great disconnect-connect spams for everyone that has me on their contact list.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So what's the groundbreaking idea and what does the blah about multiple devices have to do with it? The idea is to create an instant messenger where the program logic and the view (i. e. the UI) are only loosely connected via sockets. Whenever I've talked to someone regarding the idea, I was told that X.org already supports to access remote windows; this may be true, but proposing this as a solution is evidence of lack of understanding of the original problem: the problem is not how to share the UI of a program between computers, but how to synchronize multiple UIs so that they have the same state. The difference may sound subtle, but is extremely important. Different systems require different UIs, and thus it is not the right solution to share the &lt;i&gt;view&lt;/i&gt; but one should rather share the &lt;i&gt;state&lt;/i&gt; of the program in question. My approach is to save all RPC calls done on the server and resend them if a new client connects; this may sound extremely inefficient, but RPC calls that are redundant are not sent if the server marks them as closed. Moreover calls can be labelled as children of other calls and are automatically deleted from the server if the parent is (e. g. if the IM has RPC calls for opening a window, all RPC calls that make text appear therein would be children of the opening call and are thus not resent if the window is already closed).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I hope that more and more programs take on the approach proposed here to conform with the changes the computer industry has been going through leading to a vast range of different devices with radically different requirements to the UI. Decoupling the UI and the logic of native applications is also the next logical step in the direction of cloud-computing (the problems thereof will be not be elaborated as this is a completely different topic and would go beyond the scope of this post).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Work on an IM that uses the techniques elaborated in this post has been started by me today. I will first solve the meta-problem of syncing multiple remote UIs, and afterwards will write an instance messenger on top of it (probably using telepathy as multi IM library).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-133192772653740995?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/133192772653740995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=133192772653740995&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/133192772653740995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/133192772653740995'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/11/guis-rpc-and-everything.html' title='GUIs, RPC and everything'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2444959197383917570</id><published>2010-11-16T14:41:00.008+01:00</published><updated>2010-11-22T20:00:57.808+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>multiprocessing and Windows</title><content type='html'>I had to find out today that multiprocessing does not like to run staticmethods in processes on Windows. It seems it is impossible to pickle staticmethods, for some reason or another:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;multiprocessing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Foo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;object&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;br /&gt;&lt;span class="nd"&gt;   @staticmethod&lt;/span&gt;&lt;br /&gt;&lt;span class="k"&gt;   def&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;br /&gt;       &lt;span class="k"&gt;pass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;object&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;br /&gt;&lt;span class="k"&gt;   def&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;br /&gt;       &lt;span class="k"&gt;pass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;'__main__'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;br /&gt;   &lt;span class="n"&gt;bar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Bar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;br /&gt;   &lt;span class="c"&gt;# Works.&lt;/span&gt;&lt;br /&gt;   &lt;span class="n"&gt;multiprocessing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;bar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;br /&gt;   &lt;span class="n"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;br /&gt;   &lt;span class="c"&gt;# Fails.&lt;/span&gt;&lt;br /&gt;   &lt;span class="n"&gt;multiprocessing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;foo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The corresponding error is&lt;br /&gt;&lt;pre&gt;pickle.PicklingError: Can't pickle &lt;function&gt;: it's not the same object as __main__.foo&lt;/function&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2444959197383917570?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2444959197383917570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2444959197383917570&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2444959197383917570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2444959197383917570'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/11/multiprocessing-and-windows.html' title='multiprocessing and Windows'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1885433992261025123</id><published>2010-10-29T13:46:00.017+02:00</published><updated>2010-11-10T00:07:04.716+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dusting the Sandbox'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Dusting the Sandbox #2: Mocking oldstyle lookup on newstyle classes.</title><content type='html'>&lt;p style="font-style: italic;"&gt;“Dusting the Sandbox” is a series of blogposts where I pick scripts or modules of my sandbox and explain the process of creation and my motives behind it. The Sandbox can be found at &lt;a href="http://github.com/segfaulthunter/sandbox"&gt;Github&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;With Python 2.7 being the last non-bugfix release in the 2.x branch of Python, attention is expected to gradually shift to the new 3.x branch. Albeit onloved by a part of the developer community, the discontinuation of implementing new features into the 2.x branch is the most effective way of forcing developers to begin to embrace the new backwards-incompatible version. The one major issue with Python 3.x is that many old, large libraries do not want or cannot, due to lack of workpower, port their code to support the latest release.&lt;br /&gt;&lt;br /&gt;If there are any faithful readers of my blog, and you are one of them, you may just experience a déjà vu. Yes - I have already written a post with roughly the same content as above, but: this time, I present a solution that I think is more clever.&lt;br /&gt;&lt;br /&gt;These facts have inspired me to once again think of a way to get the old lookup behaviour with Python 3.x, where there are no more oldstyle classes. The piece of code I provided you with in my earlier post led to some runtime overhead for each call of a magic method, whereas this, radically different, approach only implies overhead each time __setattr__ is called (but it does cause a bit higher memory usage). Please again bear in mind that it is not recommended to use the code provided here in production code.&lt;br /&gt;&lt;br /&gt;It all started with someone showing me a snippet that did some thing, which I do not remember, but it certainly was clever thing, by replacing the __class__ member of an instance. I instantly thought that I may exploit this to fake old-style behaviour by creating a new class programmatically each time the application developer overrides a magic method. By creating a new class, the new method is in the class struct and thus is consistently accessed, be it from directly Python code or from C code that accesses it in said struct.&lt;br /&gt;&lt;br /&gt;The trick is to create a new class using type and replacing the current __class__ member of the instance each time __setattr__ is called with a magic name. The new class is created by the following code, with attr being the function a magic function is being overridden with.&lt;br /&gt;&lt;pre&gt;# Licensed under the terms of the X11-License.&lt;br /&gt;d = dict(self.__class__.__dict__)&lt;br /&gt;d.update({name: staticmethod(attr)})&lt;br /&gt;ncls = type(&lt;br /&gt; self.__class__.__name__ + 'Magic', self.__class__.__bases__, d&lt;br /&gt;)&lt;/pre&gt;&lt;br /&gt;The static method is necessary because when replacing a method of an instance, the new function is not bound to the object, contrary to a normal function in a class construction that is automatically bound to the object unless it's a staticmethod; it does also work with attributes, because staticmethod makes the argument passed to it the respective instance-member. The next logical step is to write a function determining whether a method is magic or not, it turned out to be the following (explanation about the forbidden set are given in the next paragraph):&lt;br /&gt;&lt;pre&gt;# Licensed under the terms of the X11-License.&lt;br /&gt;forbidden = set(('__setattr__', '__class__'))&lt;br /&gt;&lt;br /&gt;def is_magic(name):&lt;br /&gt;    return (&lt;br /&gt;        name not in forbidden and name.startswith('__') and name.endswith('__')&lt;br /&gt;    )&lt;/pre&gt;&lt;br /&gt;The mechanism needing to replace __setattr__, it needs to be treated specially. The same is true for __class__ because that would have us hit infinite recursion (plus __class__ is no method anyway and thus needs not be wrapped).&lt;br /&gt;&lt;br /&gt;Now all we need to do is handle the case when we do &lt;span style="font-style:italic;"&gt;not&lt;/span&gt; handle a "magic" case. If __setattr__ was replaced earlier, use the member of the instance, if it is not, use the __setattr__ method provided by the parent class.&lt;br /&gt;&lt;pre&gt;# Licensed under the terms of the X11-License.&lt;br /&gt;import inspect&lt;br /&gt;if (not inspect.ismethod(self.__setattr__) or&lt;br /&gt;    self.__setattr__.im_func != oldstyle):&lt;br /&gt;    # Costum setattr is stored in the instance so that this method is&lt;br /&gt;    # never overriden. Hence __setattr__ is not part of the global&lt;br /&gt;    # magic set.&lt;br /&gt;    self.__setattr__(name, attr)&lt;br /&gt;else:&lt;br /&gt;    super(self.__class__, self).__setattr__(self, name, attr)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we combine these two cases (the one where we treat a magic member and the one where we do not) into one function and end up with the final code. Old style behaviour is applied to a class by overriding the __setattr__ method with the oldstyle function provided below.&lt;br /&gt;&lt;pre&gt;# Licensed under the terms of the X11-License.&lt;br /&gt;import inspect&lt;br /&gt;&lt;br /&gt;forbidden = set(('__setattr__', '__class__'))&lt;br /&gt;&lt;br /&gt;def is_magic(name):&lt;br /&gt;    return (&lt;br /&gt;        name not in forbidden and name.startswith('__') and name.endswith('__')&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def oldstyle(self, name, attr):&lt;br /&gt;    if is_magic(name):&lt;br /&gt;        d = dict(self.__class__.__dict__)&lt;br /&gt;        d.update({name: staticmethod(attr)})&lt;br /&gt;        ncls = type(&lt;br /&gt;            self.__class__.__name__ + 'Magic', self.__class__.__bases__, d)&lt;br /&gt;        &lt;br /&gt;        self.__class__ = ncls&lt;br /&gt;    else:&lt;br /&gt;        &lt;br /&gt;        if (not inspect.ismethod(self.__setattr__) or&lt;br /&gt;            self.__setattr__.im_func != oldstyle):&lt;br /&gt;            # Costum setattr is stored in the instance so that this method is&lt;br /&gt;            # never overriden. Hence __setattr__ is not part of the global&lt;br /&gt;            # magic set.&lt;br /&gt;            self.__setattr__(name, attr)&lt;br /&gt;        else:&lt;br /&gt;            super(self.__class__, self).__setattr__(self, name, attr)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we can easily verify that it works by comparing the behaviour of a normal new-style class and of one with oldstyle as setattr member. Therefore, we create  really simple class that allows us to verify whether the member has been replaced or not.&lt;br /&gt;&lt;pre&gt;class A(object):&lt;br /&gt;    __setattr__ = oldstyle&lt;br /&gt;    &lt;br /&gt;    def __int__(self):&lt;br /&gt;        return 2&lt;/pre&gt;&lt;br /&gt;Then we create an instance thereof, convert it to an integer by using the builtin int, replace the member to return any other number and then verify that this number is returned upon passing the object to int.&lt;br /&gt;&lt;pre&gt;a = A()&lt;br /&gt;assert int(a) == 2&lt;br /&gt;a.__int__ = lambda: 5&lt;br /&gt;assert int(a) == 5&lt;/pre&gt;&lt;br /&gt;Removing the "__setattr__ = oldstyle" declaration we can see that normal new-style classes do not support replacing of magic methods in the instance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1885433992261025123?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1885433992261025123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1885433992261025123&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1885433992261025123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1885433992261025123'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/10/dusting-sandbox-2-mocking-oldstyle.html' title='Dusting the Sandbox #2: Mocking oldstyle lookup on newstyle classes.'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2635219271442707757</id><published>2010-10-16T01:25:00.019+02:00</published><updated>2010-11-11T16:39:18.934+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dusting the Sandbox'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Dusting the Sandbox #1: Get nth digit and other funny, but useless, solutions to problems no one will ever face</title><content type='html'>&lt;p style="font-style: italic;"&gt;“Dusting the Sandbox” is a series of blogposts where I pick scripts or modules of my sandbox and explain the process of creation and my motives behind it. The Sandbox can be found at &lt;a href="http://github.com/segfaulthunter/sandbox"&gt;Github&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Those who are too impatient to read about the creation of the code can skip &lt;a href="#code"&gt;directly to the complete code&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The other day I've gotten some inspiration on what to code from the #python.de channel on irc.freenode.net, namely a program that gets the n&lt;sup&gt;th&lt;/sup&gt; digit of a number (it later turned out that we were talking about getting one particular digit of small numbers in the channel, which does not require a sophisticated algorithm but rather yields the best results (in terms of performance) when doing the naive method, which is:&lt;/p&gt;&lt;pre&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nmb&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;The solution that yields results for large numbers in a reasonable time is to divide the number by 10&lt;sup&gt;log(x) - n&lt;/sup&gt;.&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629129.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;p&gt;This may be quite nice, but there is a lot of space for improvement. The first thing that came into my mind was allowing the user to specify how many digits he wants to access (that is, how many of the digits that are in a higher decimal place should be returned). That is easily done by raising the 10 after the modulo operator by the power of the number of digits the user wants to access.&lt;br /&gt;&lt;script src="https://gist.github.com/629155.js?file=gistfile1.py"&gt;&lt;/script&gt;&lt;br /&gt;&lt;p&gt;What turned out as a valuable trick throughout the time I have coded so far is to, once a program produces the desired result, take a step back and see how it could be adapted so it can applied to a super-set of problems. The main instrument for doing is, for myself, is to scan the source-code for any constants that are unnecessary and just specialize the problem without adding value. The only constant that can be found in the snipped shown above is 10 (two direct references and one subtle one in `log10`); by replacing all of them with a variable, we can effectively adapt the snippet to work with arbitrary number systems.&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629209.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;p&gt;Now non-negative indices are wholly implemented; the next step is self-evident: implementing negative indices. This is even easier because we need not know how long the number is (that is what the logarithm is for when accessing via positive indices), we just need to divide by s&lt;sup&gt;|n| - 1&lt;/sup&gt;. The -1 is to compensate for the fact that negative indices start at -1 rather than 0, and because the number does not need to be divided at all (i.e. divided by 1) to access the last digit, we need to subtract 1 from the absolute value of the index.&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629233.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;p&gt;The next logical thing to implement is slicing. Slicing is a bit more sophisticated, because it involves two indices which might be of a different type in terms of negative or non-negative indices. The way to easily implement this is use the digits parameter of nth we have defined before but not yet used.  The two indices need to be processed to one index (which is the larger one, being &lt;span style="font-style: italic;"&gt;stop - 1&lt;/span&gt; regardless of the algebraic sign of the index in question [the item with the index given in stop is not included in the slice, just as it isn't with lists, hence &lt;span style="font-style: italic;"&gt;stop -1&lt;/span&gt;]). With all input sanitizing, that handles the case where some parameters are not given and the case where one index is negative while the other is not, included, we end up with the following code; because there is no way to return an “empty int” (which would be the obvious approach when modeling after the list API which returns an empty list in these cases) when there are no digits between the two indices (which happens if start is greater or equal to stop), we need to throw an expection in this case:&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629250.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;a name="code"&gt;&lt;/a&gt;&lt;p&gt;So the final code is:&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629255.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;p&gt;A funny (but not at all useful, like the rest of the code shown here) addition is to write a wrapper class that supplies __getitem__ on int objects. The gotcha is that you need to inherit from long, rather than from int, and that you must not call long's __init__ in yours, lest you face a deprecation warning.&lt;/p&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/629257.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;p&gt;That concludes this post, I hope you enjoyed it. And yes: I have tried implementing slicing with steps, but my implementation was heavily outperformed by the naive str and slice way (which does not work for all number systems, though).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2635219271442707757?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2635219271442707757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2635219271442707757&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2635219271442707757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2635219271442707757'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/10/dusting-sandbox-1-get-nth-digit-and.html' title='Dusting the Sandbox #1: Get nth digit and other funny, but useless, solutions to problems no one will ever face'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6207234258095575182</id><published>2010-10-16T00:57:00.003+02:00</published><updated>2010-10-16T01:06:00.863+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='asynchia'/><title type='text'>asynchia 0.1.1</title><content type='html'>asynchia 0.1.1 was released yesterday, featuring a host of bugfixes for critical bugs that prevented the library from working in corner-cases and a few feature additions. I have tried to put work into optimizing existing operations that wasted a lot of resources, e.g. by not pre-allocating the amount of memory required for the buffer. Python's bytearrays are used for that purpose, in 2.7 or later memoryview and recv_into is used, but I need to do some more benchmarking to see whether this results in a significant speed-up or not, the data I have yet collected is not unambiguous about that matter.&lt;br /&gt;&lt;br /&gt;Check asynchia out at &lt;a href="http://github.com/segfaulthunter/asynchia"&gt;Github&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6207234258095575182?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6207234258095575182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6207234258095575182&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6207234258095575182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6207234258095575182'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/10/asynchia-011.html' title='asynchia 0.1.1'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-857587295977669474</id><published>2010-09-29T03:35:00.005+02:00</published><updated>2010-09-29T03:42:42.914+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scm'/><category scheme='http://www.blogger.com/atom/ns#' term='mercurial'/><category scheme='http://www.blogger.com/atom/ns#' term='bitbucket'/><category scheme='http://www.blogger.com/atom/ns#' term='dvcs'/><title type='text'>Bitbucket changes</title><content type='html'>Albeit me having switched to git for most of my serious development (as it fosters branched development by offering cheap deletable branches; maybe that's possible now with the bookmark extension of hg, but by the time I switched, it was not), I gladly follow the latest development of Bitbucket: Joining forces with Atlassian (to be fair, I have not heard anything of them until now), they now offer unlimited storage, an unlimited number of both private and public repositories and CNAMEs absolutely for free (and also the option to add 5 people to the readers, writers or admins of your private repositories).&lt;br /&gt;&lt;br /&gt;I just considered this to be cool enough to bother anyone that might read this with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-857587295977669474?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/857587295977669474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=857587295977669474&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/857587295977669474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/857587295977669474'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/09/bitbucket-changes.html' title='Bitbucket changes'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-896660422312658849</id><published>2010-09-16T00:43:00.004+02:00</published><updated>2010-09-16T01:10:16.916+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android Application Security</title><content type='html'>Sorry for not having written into this Blog for such a long time, but I just did not have any ideas that I thought to be important enough to bother you (if there is anyone out there reading this). I have recently purchased a HTC Wildfire (good device with some shortcomings, but all in all it offers a good price–value ratio, but discussing the pros and cons of the device would miss the point of this post). I have – of course – installed a couple of applications on it (what's the use of a smartphone without those), many of which communicate with the Internet.&lt;br /&gt;&lt;br /&gt;Considering I will mostly be using those when I am not home (and thus not have access to a real computer), I have started some analysis to find out which of this applications I can securely use on a public WiFi (or using my mobile internet connection) without fearing to have any data compromised to eavesdroppers (like the WiFi hoster or – if the WiFi is public or the key is known to many people – a third-party that can intercept the datastream); the long and the short of it, I wanted to find out which of the applications sends unencrypted data to the Internet.&lt;br /&gt;&lt;br /&gt;I connected my computer (which luckily has two Ethernet cards) to the router with both of them, connected  the Android phone to the WiFi of the router and manually set my computer as the gateway, which in turn forwarded all the data back to the router again. Then I started up Wireshark and thus could see all traffic coming from the smartphone, and have drawn the following conclusions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Google Talk &lt;span style="font-weight: bold;"&gt;seems&lt;/span&gt; safe to use as neither the plaintext of the account credentials nor the one of the messages sent can be found in the data sent.&lt;/li&gt;&lt;li&gt;eBuddy (a multi-IM client inter alia supporting MSN) &lt;span style="font-weight: bold;"&gt;seems&lt;/span&gt; to only encrypt the password when logging in, and definitively &lt;span style="font-weight: bold;"&gt;does not encrypt the user-name or any messages sent over MSN&lt;/span&gt;.&lt;/li&gt;&lt;/ul&gt;Because my setup did not work as well as I expected it (the Internet was terribly slow on the phone and furthermore Wireshark kept segfaulting), I have not yet analyzed other applications, but if you want me to look at one, do not hesitate to tell me in the comments. Other than that I advise you to &lt;span style="font-weight: bold;"&gt;set up your email accounts at home over an encrypted connection&lt;/span&gt; and manually configure it to use SSL (it appears to favour unencrypted communication when autodetecting your account information from the login data),  lest you possibly compromise your login data to the owner of the WiFi or eavesdroppers. Whenever sending sensitive data with the web browser be sure you are using an SSL secured connection to the server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-896660422312658849?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/896660422312658849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=896660422312658849&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/896660422312658849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/896660422312658849'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2010/09/android-application-security.html' title='Android Application Security'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-4611500950012721380</id><published>2009-12-18T20:33:00.007+01:00</published><updated>2009-12-18T21:24:29.964+01:00</updated><title type='text'>web--!</title><content type='html'>First of all, let me explain the strange title. If you are familiar with C-like programming languages, you may already have guessed its meaning. It's a plea to diverge from the path the web is currently taking.&lt;br /&gt;&lt;br /&gt;Seemingly the browser has become the new platform. The extensive use of Javascript faces browsers with challenges they were never designed to meet. None of the components currently used for Web 2.0 applications were designed to be used the way they are. The Web was designed for displaying more or less static pages (which the server may dynamically produce). This results in technical problems and major overheads. Tricks are used to enable stateful communication over the HTTP protocol or dynamic interaction with the web page. Granted, these tricks work most of the time &lt;span class="Unicode"&gt;– &lt;/span&gt;neglecting the overhead they create for the time being. Still apparently many AJAX-requests seem to be lost in the nirvana of the internet, never to be found again. If you have never seen a half-loaded AJAX-page where the content &lt;span class="Unicode"&gt;– &lt;/span&gt;which seems to be acquired by AJAX-requests after the page has loaded &lt;span class="Unicode"&gt;–&lt;/span&gt; is missing, you can count yourself lucky.&lt;br /&gt;&lt;br /&gt;Making web applications compatible with browsers poorly implementing the standards takes a lot of the developers time away which could be used in a better way. Even creating static pages which look exactly the same in all browsers (I am looking at you, Internet Explorer) is a lot of work, fiddling about trivialites such as assigning the page a maximum width (no, CSS max-size is not the answer as it is ignored by Internet Explorer). I cannot even imagine how painful it must be to make a page compatible to mobile-phone browsers (maybe that is why most sites offer a seperate mobile version to which you are automatically taken when connecting with a mobile-phone client).&lt;br /&gt;&lt;br /&gt;But another important issue which I cannot stress enough is that Web 2.0 applications enable their developers to intesively amass your data and/or data about you. Traditionally, you either uploaded things intended for the public to the internet or stored private data (i.e. backups) at trusted places. Nowadays, pretty much everything is uploaded to anyone who offers the particular service. Whatever you produce using a Web 2.0 application is out of your reach. It may be kept even if you delete it on the front end; it may be gone some day; it may become public, either by mistake or on purpose. You have no influence on what happens with it. You do not even have the security that the application even will resemble its current state in the future; you may find yourself with data in a web-application you must learn to use (again).&lt;br /&gt;&lt;br /&gt;The best solution would be to end the browser's unhoped-for streak of popularity and replace it with a technology that it designed for doing what the browser is abused to do &lt;span class="Unicode"&gt;–&lt;/span&gt; running dynamical programs including complex user interaction. If most applications ran on a single virtual machine, it would have the potential to supersede the browser of the common platform. Good riddance. Java's WebStart is a good attempt of streamlining the deployment process of applications.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-4611500950012721380?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/4611500950012721380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=4611500950012721380&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4611500950012721380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4611500950012721380'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/12/web.html' title='web--!'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6498809164082693772</id><published>2009-10-27T21:12:00.002+01:00</published><updated>2009-10-27T21:27:50.522+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>2to3 for map "fixed"!</title><content type='html'>&lt;a href="http://bugs.python.org/issue7203"&gt;The issue&lt;/a&gt; about the problem with 2to3 and map has been resolved with the &lt;a href="http://svn.python.org/view?view=rev&amp;amp;revision=75734"&gt;following changeset&lt;/a&gt;. The fix is generally like saying &lt;span style="font-style: italic;"&gt;"Fix your code yourself"&lt;/span&gt; rather than fixing the issue. Adding a warning is &lt;span style="font-weight: bold;"&gt;not&lt;/span&gt; an adequate fix for any issue. This fix just helps people who think their code will run after 2to3, but it is not addressing the core problem the slightest bit. Every bug (and every non-feature as the one added in the changeset) in 2to3 is hindering the widespread adoption of Python 3.x; I think the CPython developers should take a second to think about that before commiting such "fixes". At least leave the issue open, hoping for someone to patch it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6498809164082693772?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6498809164082693772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6498809164082693772&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6498809164082693772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6498809164082693772'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/10/2to3-for-map-fixed.html' title='2to3 for map &quot;fixed&quot;!'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6465761623161021360</id><published>2009-10-25T23:01:00.010+01:00</published><updated>2009-10-25T23:57:13.709+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>The world's biggest hard-drive</title><content type='html'>Having ruined my Vista (another story I will blog about soon) I want to re-setup my Windows in order to be able to game. Before doing so, I have to backup my user files of Vista. As these are relatively large (~100G), I had to clear some space on my Linux and created a new partition for it (~150G). Having asked some folks in IRC about what file-system to use, I picked ext2. Copying slowed my system as hell (of course), but &lt;tt&gt;df -h&lt;/tt&gt; verified that there was progress. Suddenly, my tty spit out some weird messages.&lt;br /&gt;&lt;blockquote&gt;&lt;tt&gt;EXT2-fs error (device sda6):&lt;br /&gt;ext2_new_blocks: Allocating block in system zone - blocks from 35586561, length 1&lt;/tt&gt;&lt;/blockquote&gt;&lt;br /&gt;It wasn't long until the copy operation failed with the following error message.&lt;br /&gt;&lt;blockquote&gt;&lt;tt&gt;No space left on device.&lt;/tt&gt;&lt;/blockquote&gt;&lt;br /&gt;Okay.. I thought I had become insane and asked &lt;tt&gt;cfdisk&lt;/tt&gt; about the size of the partition and &lt;tt&gt;du -hs&lt;/tt&gt; about the size of the source files. About 150G and 100G, respectively. So everything was okay. Now the weird part starts. I asked &lt;tt&gt;df -h&lt;/tt&gt; about how much of the partition was used, getting the following (quite amusing - considering my harddrive is 1TB large in total) output.&lt;br /&gt;&lt;blockquote&gt;&lt;tt&gt;Filesystem            Size  Used Avail Use% Mounted on&lt;br /&gt;/dev/sda2              92G  6.9G   81G   8% /&lt;br /&gt;tmpfs                 1.5G     0  1.5G   0% /lib/init/rw&lt;br /&gt;varrun                1.5G  120K  1.5G   1% /var/run&lt;br /&gt;varlock               1.5G     0  1.5G   0% /var/lock&lt;br /&gt;udev                  1.5G  152K  1.5G   1% /dev&lt;br /&gt;tmpfs                 1.5G  832K  1.5G   1% /dev/shm&lt;br /&gt;lrm                   1.5G  2.2M  1.5G   1% /lib/modules/2.6.28-16-generic/volatile&lt;br /&gt;/dev/sda5             184G  139G   36G  80% /home&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;/dev/sda6              16T   16T     0 100% /mnt/media&lt;/span&gt;&lt;br /&gt;/dev/sda1             489G  258G  231G  53% /media/disk&lt;br /&gt;&lt;/tt&gt;&lt;/blockquote&gt;&lt;br /&gt;Note the emphasised part. 16T... This means 16 terrabytes. It is apparent that some bug must have occured. But hang on, the drive gets even larger. Disbelieving, I decided to see what &lt;tt&gt;du -hs&lt;/tt&gt; would say about the directory that is on the device (I would be very thankful for any tips about what the error messages were trying to tell me).&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;tt&gt;name@gollum:/mnt/media$ du -hs name&lt;br /&gt;du: cannot access `name/.gimp-2.6/.idlerc': Stale NFS file handle&lt;br /&gt;du: cannot access `name/.gimp-2.6/Anwendungsdaten': Stale NFS file handle&lt;br /&gt;du: cannot access `name/.gimp-2.6/AppData/.idlerc': Stale NFS file handle&lt;br /&gt;du: cannot access `name/.gimp-2.6/AppData/Anwendungsdaten': Stale NFS file handle&lt;br /&gt;du: cannot access `name/.idlerc': Stale NFS file handle&lt;br /&gt;du: cannot access `name/Anwendungsdaten': Stale NFS file handle&lt;br /&gt;du: cannot access `name/AppData/.gimp-2.6/.idlerc': Stale NFS file handle&lt;br /&gt;du: cannot access `name/AppData/.gimp-2.6/Anwendungsdaten': Stale NFS file handle&lt;br /&gt;du: cannot access `name/AppData/.idlerc': Stale NFS file handle&lt;br /&gt;du: cannot access `name/AppData/Anwendungsdaten': Stale NFS file handle&lt;br /&gt;19T name&lt;br /&gt;name@gollum:/mnt/media$ du -hs lost+found&lt;br /&gt;2.0T lost+found&lt;/tt&gt;&lt;/blockquote&gt;&lt;br /&gt;So 19T and 2T, doesn't that make 21T? Either &lt;tt&gt;df&lt;/tt&gt; lied or my maths is really rusty. Right now I'm trying to copy the same data onto an ext3 partition of the same size, hopefully this will work better.&lt;br /&gt;&lt;br /&gt;UPDATE: With ext3, it worked fine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6465761623161021360?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6465761623161021360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6465761623161021360&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6465761623161021360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6465761623161021360'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/10/worlds-biggest-hard-drive.html' title='The world&apos;s biggest hard-drive'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7346965301526986759</id><published>2009-10-25T18:28:00.020+01:00</published><updated>2009-10-25T23:56:26.847+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Of Python3's map</title><content type='html'>Hello, it's been a long time since the last post, but here we go.&lt;br /&gt;&lt;br /&gt;So what is wrong with map? Its semantics have secretly changed between Python 2.x and Python 3.x, without even 2to3 knowing. While the old, non-lazy, map of 2.x stopped when the &lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;last &lt;/span&gt;&lt;/span&gt;sequence was depleted, while the lazy one of 3.x (like 2.x itertools.imap) stops when the first sequence is depleted. The reasonability of this change can be quarreled about, but that is not really the topic here.&lt;br /&gt;&lt;br /&gt;The real topic is that not even 2to3 is aware of this subtle change. An easy fix for this would be to translate &lt;tt&gt;map(fun, a, b, ...)&lt;/tt&gt; to &lt;tt&gt;list(map(fun, *zip(*itertools.zip_longest(a, b, ...))))&lt;/tt&gt; (&lt;tt&gt;itertools.izip_longest&lt;/tt&gt; in 2.6). Another problem with 2to3 and map is that None cannot be given as the function argument with 3.x, but 2to3 is unaware of this. Thus it should translate &lt;tt&gt;map(None, ..) &lt;/tt&gt;to &lt;tt&gt;map(lambda *a: a, ..)&lt;/tt&gt;, which it doesn't.&lt;br /&gt;&lt;br /&gt;So here is what 2to3 does. It minds neither of the semantic changes.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;--- map_test.py (original)&lt;br /&gt;+++ map_test.py (refactored)&lt;br /&gt;@@ -1,1 +1,1 @@&lt;br /&gt;-map(None, [1, 2, 3], [1, 2, 3, 4])&lt;br /&gt;+list(map(None, [1, 2, 3], [1, 2, 3, 4]))&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Python 2.x:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;&gt; map(None, [1, 2, 3], [1, 2, 3, 4])&lt;br /&gt;[(1, 1), (2, 2), (3, 3), (None, 4)]&lt;/pre&gt;&lt;/blockquote&gt;Python 3.x:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;&gt; list(map(None, [1, 2, 3], [1, 2, 3, 4]))&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;File "&lt;stdin&gt;", line 1, in &lt;module&gt;&lt;br /&gt;TypeError: 'NoneType' object is not callable&lt;br /&gt;&gt;&gt;&gt; list(map(lambda *a: a, [1, 2, 3], [1, 2, 3, 4]))&lt;br /&gt;[(1, 1), (2, 2), (3, 3)]&lt;br /&gt;&gt;&gt;&gt; list(map(lambda *a: a,&lt;br /&gt;... *zip(*itertools.zip_longest([1, 2, 3], [1, 2, 3, 4]))))&lt;br /&gt;[(1, 1), (2, 2), (3, 3), (None, 4)]&lt;br /&gt;&lt;br /&gt;&lt;/module&gt;&lt;/stdin&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This shows that the proposed fixes work.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bugs.python.org/issue7203"&gt;Issue created by birkenfeld after discussing the issue with me&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7346965301526986759?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7346965301526986759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7346965301526986759&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7346965301526986759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7346965301526986759'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/10/of-python3s-map.html' title='Of Python3&apos;s map'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3339135990431392645</id><published>2009-08-16T14:31:00.004+02:00</published><updated>2009-08-31T01:05:21.054+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Old-style class lookup</title><content type='html'>By the wide adoption of Python 3 and the discontinuation of maintenance for 2.x, old-style classes will be gone. This also means that there's no way to easily change the magic-methods of your objects (there is of course a way by manually writing the wrappers and replacing the methods they are wrapping, but I don't count that as being easy any more). So today I have written a metaclass that makes your class mimic the behaviour of old-style classes in 2.x. It does that by automatically generating said wrappers and storing the real methods in a closure.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://paste.pocoo.org/show/9kG6qlTPnCweTsDYUGxf/"&gt;Here you got&lt;/a&gt; the code that allows this and also contains an example that verifies that it works. As said in the doc-string, I wouldn't recommend using this for any purpose other than experimenting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3339135990431392645?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3339135990431392645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3339135990431392645&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3339135990431392645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3339135990431392645'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/08/old-style-class-lookup.html' title='Old-style class lookup'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5641355674994319076</id><published>2009-08-06T02:29:00.005+02:00</published><updated>2009-08-15T03:37:02.269+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>epoll is awesome</title><content type='html'>It really is. Tonight I had the idea of trying out something crazy with epoll. I tried out what happens if you modify the flags of a fd in a thread while the epoll.poll call is blocking the main one. I didn't really expect it to mind the changes done by the thread but - unlike poll - epoll does. This is really nifty and I am sure can be put to good use (though I have to admit I cannot think about one just yet). What perplexes me is that this is not documented - neither in the (rather sparse) Python documentation of select.epoll, nor in the Linux manpage for epoll. All I could find was a &lt;a style="font-style: italic;" href="http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg00084.html"&gt;"They are thread safe"&lt;/a&gt;, but that's in an a bit different context.&lt;br /&gt;&lt;br /&gt;I'm thinking about creating an API for &lt;a href="http://bitbucket.org/segfaulthunter/asynchia-mainline/"&gt;&lt;span style="font-style: italic;"&gt;asynchia&lt;/span&gt;&lt;/a&gt; that abstracts changes the the socket-map from other threads (you are not expected to understand this if you are not familiar with asynchia).&lt;br /&gt;&lt;br /&gt;I have also written code that illustrates &lt;a href="http://paste.pocoo.org/show/132862/"&gt;how this works with epoll&lt;/a&gt;, and &lt;a href="http://paste.pocoo.org/show/132863/"&gt;how it does not with poll&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5641355674994319076?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5641355674994319076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5641355674994319076&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5641355674994319076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5641355674994319076'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/08/epoll-is-awesome.html' title='epoll is awesome'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8162602158568967667</id><published>2009-06-27T16:52:00.003+02:00</published><updated>2009-08-06T16:50:03.269+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Principle of Biggest Surprise</title><content type='html'>I've written an article about weird things in Python. You can find it &lt;a href="http://segfaulthunter.github.com/articles/biggestsurprise/"&gt;here&lt;/a&gt;. Please leave your comments under this post or write an email.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8162602158568967667?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8162602158568967667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8162602158568967667&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8162602158568967667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8162602158568967667'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/06/principle-of-biggest-surprise.html' title='Principle of Biggest Surprise'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7834886845652210615</id><published>2009-06-21T21:32:00.004+02:00</published><updated>2009-08-15T02:28:46.891+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Braid</title><content type='html'>This blog isn't really meant to be about games, but this time it has to be.&lt;br /&gt;&lt;br /&gt;I recently (on Friday) purchased the indie-game Braid on Steam. I am really excited by it, and have finished it by now. It features really clever gameplay, beautiful music and, in its own way, beautiful graphics. If you care about the storyline of a game, Braid has a very good, but also confusing story. The major downside it has is that it is incredibly short, I had finished it after about 8 hours. But well, I still have the speed-runs to do, and they will not be easy.&lt;br /&gt;&lt;br /&gt;It was very well worth the 13 euros.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7834886845652210615?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7834886845652210615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7834886845652210615&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7834886845652210615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7834886845652210615'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/06/braid.html' title='Braid'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1324842147262020574</id><published>2009-06-10T10:54:00.003+02:00</published><updated>2009-06-10T10:59:13.687+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='parallel'/><title type='text'>Parallel computing with Python</title><content type='html'>I've been writing a library that streamlines the process of parallelization. It is inspired by &lt;a href="http://en.wikipedia.org/wiki/Cilk#Sample_code"&gt;Cilk&lt;/a&gt; and thus has a really simple design. The name isn't yet decided, but I think I will call it &lt;span style="font-style: italic;"&gt;pylk&lt;/span&gt;. I'm also trying to write a cluster-library, and once that is finished I will try to add a backend that executes the functions that were spawned on the cluster.&lt;br /&gt;&lt;br /&gt;Below is some (commented) example code.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: rgb(96, 160, 176); font-style: italic;"&gt;# Use multiprocessing backend.&lt;/span&gt;&lt;br /&gt;backend &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; MPBackend()&lt;br /&gt;&lt;span style="color: rgb(96, 160, 176); font-style: italic;"&gt;# Start the thread that listens for I/O from the processes.&lt;/span&gt;&lt;br /&gt;backend&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;iohandler&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;start()&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(96, 160, 176); font-style: italic;"&gt;# Do some calculations.&lt;/span&gt;&lt;br /&gt;a &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; backend&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;spawn(&lt;span style="color: rgb(0, 112, 32);"&gt;reduce&lt;/span&gt;, operator&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;mul, &lt;span style="color: rgb(0, 112, 32);"&gt;xrange&lt;/span&gt;(&lt;span style="color: rgb(64, 160, 112);"&gt;1&lt;/span&gt;, &lt;span style="color: rgb(64, 160, 112);"&gt;50000&lt;/span&gt;))&lt;br /&gt;b &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; backend&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;spawn(&lt;span style="color: rgb(0, 112, 32);"&gt;reduce&lt;/span&gt;, operator&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;mul, &lt;span style="color: rgb(0, 112, 32);"&gt;xrange&lt;/span&gt;(&lt;span style="color: rgb(64, 160, 112);"&gt;1&lt;/span&gt;, &lt;span style="color: rgb(64, 160, 112);"&gt;50000&lt;/span&gt;))&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(96, 160, 176); font-style: italic;"&gt;# When you need the results, sync them.&lt;/span&gt;&lt;br /&gt;a, b &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; sync(a, b)&lt;br /&gt;&lt;span style="color: rgb(96, 160, 176); font-style: italic;"&gt;# When done, shut down the I/O thread so the application can exit.&lt;/span&gt;&lt;br /&gt;backend&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;iohandler&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;stop()&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1324842147262020574?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1324842147262020574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1324842147262020574&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1324842147262020574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1324842147262020574'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/06/parallel-computing-with-python.html' title='Parallel computing with Python'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6604637553181878265</id><published>2009-05-24T20:34:00.001+02:00</published><updated>2009-05-24T20:40:34.066+02:00</updated><title type='text'>Blogger sucks</title><content type='html'>Look at the previous post, no more explanations needed.&lt;br /&gt;&lt;br /&gt;Unnecessary explanation: &lt;a href="http://paste.pocoo.org/show/118905/"&gt;That&lt;/a&gt; is the HTML I fed it with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6604637553181878265?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6604637553181878265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6604637553181878265&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6604637553181878265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6604637553181878265'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/05/blogger-sucks.html' title='Blogger sucks'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6830442376389213330</id><published>2009-05-24T20:33:00.011+02:00</published><updated>2009-05-28T14:30:38.443+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python threading (and the GIL)</title><content type='html'>My shiny new Quad-Core Intel i7 has brought my attention to writing software that scales on multiple processors (the OS even considers the i7 a 8-core because of the HyperThreading technology it comes with).&lt;br /&gt;&lt;br /&gt;I like Python, I like it a lot. Still, I have to admit that its threading sucks. It doesn't at all scale to multiple processors (this is due to the GIL). So what does GIL mean anyway? It means that the Python interpreter always only executes one piece of bytecode at a time. This means, that only one thread can execute python code at a time, thus rendering threads for scaleability useless.&lt;br /&gt;&lt;br /&gt;Here are some benchmarks on how long it takes to add a lot of numbers (distributed on n threads or processes) on my i7.&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;th&gt;Threads&lt;/th&gt;&lt;br /&gt;&lt;th&gt;Time (in Seconds)&lt;/th&gt;&lt;br /&gt;&lt;th&gt;Difference&lt;/th&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;1&lt;/td&gt;&lt;br /&gt;&lt;td&gt;21.15&lt;/td&gt;&lt;br /&gt;&lt;td&gt; - &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;2&lt;/td&gt;&lt;br /&gt;&lt;td&gt;23.17&lt;/td&gt;&lt;br /&gt;&lt;td&gt;+9.56%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;3&lt;/td&gt;&lt;br /&gt;&lt;td&gt;24.83&lt;/td&gt;&lt;br /&gt;&lt;td&gt;+7.16%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;4&lt;/td&gt;&lt;br /&gt;&lt;td&gt;25.13&lt;/td&gt;&lt;br /&gt;&lt;td&gt;+1.21%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;5&lt;/td&gt;&lt;br /&gt;&lt;td&gt;23.67&lt;/td&gt;&lt;br /&gt;&lt;td&gt;-5.81%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;6&lt;/td&gt;&lt;br /&gt;&lt;td&gt;24.90&lt;/td&gt;&lt;br /&gt;&lt;td&gt;+5.21%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;7&lt;/td&gt;&lt;br /&gt;&lt;td&gt;24.74&lt;/td&gt;&lt;br /&gt;&lt;td&gt;-0.64%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;8&lt;/td&gt;&lt;br /&gt;&lt;td&gt;25.36&lt;/td&gt;&lt;br /&gt;&lt;td&gt;+2.52%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;th&gt;Processes&lt;/th&gt;&lt;br /&gt;&lt;th&gt;Time (in Seconds)&lt;/th&gt;&lt;br /&gt;&lt;th&gt;Difference&lt;/th&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;1&lt;/td&gt;&lt;br /&gt; &lt;td&gt;20.36&lt;/td&gt;&lt;br /&gt; &lt;td&gt; - &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;2&lt;/td&gt;&lt;br /&gt; &lt;td&gt;10.43&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-48.78%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;3&lt;/td&gt;&lt;br /&gt; &lt;td&gt;6.91&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-33.79%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;4&lt;/td&gt;&lt;br /&gt; &lt;td&gt;5.32&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-22.96%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;5&lt;/td&gt;&lt;br /&gt; &lt;td&gt;5.90&lt;/td&gt;&lt;br /&gt; &lt;td&gt;+11.01%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;6&lt;/td&gt;&lt;br /&gt; &lt;td&gt;5.13&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-13.09%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;7&lt;/td&gt;&lt;br /&gt; &lt;td&gt;4.86&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-5.33%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;8&lt;/td&gt;&lt;br /&gt; &lt;td&gt;4.59&lt;/td&gt;&lt;br /&gt; &lt;td&gt;-5.50%&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6830442376389213330?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6830442376389213330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6830442376389213330&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6830442376389213330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6830442376389213330'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/05/python-threading-and-gil.html' title='Python threading (and the GIL)'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-4138868920721799841</id><published>2009-03-18T00:55:00.005+01:00</published><updated>2009-04-18T13:05:22.618+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>asynchia</title><content type='html'>Today I re-wrote the whole library I deleted yesterday. Here I present: &lt;a href="http://bitbucket.org/segfaulthunter/asynchia-mainline"&gt;asynchia&lt;/a&gt;. It's a minimalistic asynchronous network library (it has about 600 lines of code of which about 100 are LGPL-Headers) licensed under the, you guess, GNU LGPL.&lt;br /&gt;&lt;br /&gt;I hope you like it and am open for any constructive criticism.&lt;br /&gt;&lt;br /&gt;What I learned from deleting: Always use a SCM and always push to a remote location. Plus, commit pretty often so you do not lose so much if you accidentally delete anything.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-4138868920721799841?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/4138868920721799841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=4138868920721799841&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4138868920721799841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4138868920721799841'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/03/asynchia.html' title='asynchia'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1789975014619664278</id><published>2009-03-16T22:17:00.001+01:00</published><updated>2009-03-16T22:18:43.243+01:00</updated><title type='text'>Always use SCM</title><content type='html'>... from the beginning on, or you will learn it the hard way.&lt;br /&gt;&lt;br /&gt;I did.&lt;br /&gt;&lt;br /&gt;I wrote, and deleted, a async networking library today. Hooray!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1789975014619664278?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1789975014619664278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1789975014619664278&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1789975014619664278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1789975014619664278'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/03/always-use-scm.html' title='Always use SCM'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2825993573117347680</id><published>2009-02-22T01:24:00.004+01:00</published><updated>2009-06-16T15:27:20.192+02:00</updated><title type='text'>Houston we have a problem!</title><content type='html'>Okay, let me start this post with a confession: I'm a gamer. Here we go, now it's out.&lt;br /&gt;&lt;br /&gt;I think many people don't like it Steam, but I've learned to hate it. Why is that, you may ask? You shall have your answer.&lt;br /&gt;&lt;br /&gt;I've decided that I want to try out "Empire: Total War", and the demo was available through Steam. Having played some games that require Steam, I didn't think it'd be a problem, but I was about to be proved wrong. I started downloading, it wasn't fast, but okay. Then, the first time at 40%, the download began to stall. Pause - Resume, nope, didn't fix it. That's why I closed Steam. When I tried reopening it told me it was already open - so I killed the process and the download happily continued. The same thing happened again at 80%, I did my closing and reopening. Then, what I saw was horrible. The download got back to 0%. I gave up for this day.&lt;br /&gt;&lt;br /&gt;Today, fresh and full with energy I tried again. In the beginning it went pretty slow, but after trying through many mirrors, I eventually found one that was acceptable (~300KB/s). For those who may be interested, it was the one in the UK. Today I downloaded the demo - there were some problems, but I eventually succeeded. The game's pretty okay, but with my system I have to play it on very low graphics settings.&lt;br /&gt;&lt;br /&gt;I guess they have a lot of work to do stabilizing Steam and the servers, as I think there's no excuse for a commercial service that earns money by distributing software to be slower than university servers for open-source Linux distributions.&lt;br /&gt;&lt;br /&gt;But another thing happened today. While I was downloading, my mouse began to break. Windows made that "device attached" and "device detached" sounds really often. In classic Windows manner, I disconnected both the mouse and the keyboard and reconnected them. This was a mistake, as Windows demanded me to accept to install the mouse driver because it doesn't comply with some tests. The bad thing was that it did that before installing the keyboard driver, and apparently this question blocked the whole device installation process for all the devices. I had to reboot.&lt;br /&gt;&lt;br /&gt;Now comes the weird part. When I tried rebooting, my BIOS hang. I thought resetting it might help (through the jumper on the mainboard), but it did not. When I disconnected my mouse it went fine. So I booted my Arch, connected it. It did not work. This is what dmesg says about it:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;usb 3-2.2: new full speed USB device using uhci_hcd and address 8&lt;br /&gt;usb 3-2.2: device descriptor read/64, error 8&lt;br /&gt;usb 3-2.2: device descriptor read/64, error 8&lt;br /&gt;usb 3-2.2: new full speed USB device using uhci_hcd and address 9&lt;br /&gt;usb 3-2.2: device descriptor read/64, error 8&lt;br /&gt;usb 3-2.2: device descriptor read/64, error 8&lt;br /&gt;usb 3-2.2: new full speed USB device using uhci_hcd and address 10&lt;br /&gt;usb 3-2.2: device descriptor read/8, error -71&lt;br /&gt;usb 3-2.2: device descriptor read/8, error -71&lt;br /&gt;usb 3-2.2: new full speed USB device using uhci_hcd and address 11&lt;br /&gt;usb 3-2.2: device descriptor read/8, error -71&lt;br /&gt;usb 3-2.2: device descriptor read/8, error -71&lt;br /&gt;hub 3-2:1.0: unable to enumerate USB device on port 2&lt;/pre&gt;&lt;/blockquote&gt;Any suggestions of what might be wrong with it are very appreciated. Another mouse works just fine, so I guess my mouse is just broken.&lt;br /&gt;&lt;br /&gt;In other news, I had to delete some Java programs in my Archlinux in order to update all packages as there is some confusion that some appear to want openjdk and some jdk and jre.&lt;br /&gt;&lt;br /&gt;To sum this post up in one sentence: Everything out there is broken!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2825993573117347680?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2825993573117347680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2825993573117347680&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2825993573117347680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2825993573117347680'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/02/houston-we-have-problem.html' title='Houston we have a problem!'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5102408600017656719</id><published>2009-02-02T17:32:00.003+01:00</published><updated>2009-02-02T17:39:41.086+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unittest'/><category scheme='http://www.blogger.com/atom/ns#' term='qt'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='pyqt'/><title type='text'>QTest</title><content type='html'>Hello again. It's been quite some time again since I last posted.&lt;br /&gt;&lt;br /&gt;I am going to blog about a new project of mine. I called it QTest and it is a GUI frontend to the unittest testing framework. You give it your TestSuite, it runs the tests in a background process calling back to the GUI so it can display the information.&lt;br /&gt;&lt;br /&gt;It uses PyQt4 as the GUI framework. You can have a look at a &lt;a href="http://img528.imageshack.us/img528/3968/qtestnewqp1.png"&gt;screenshot&lt;/a&gt; if you like. The source is stored in a Mercurial repository which can be found &lt;a href="http://bitbucket.org/segfaulthunter/qtest-mainline/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I hope that this is useful to anyone out there and I would be very happy if you could tell me your experiences with it.&lt;br /&gt;&lt;br /&gt;As for the usage, it should be explained in the docstring of the module.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5102408600017656719?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5102408600017656719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5102408600017656719&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5102408600017656719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5102408600017656719'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2009/02/qtest.html' title='QTest'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2804084607846429872</id><published>2008-12-14T19:15:00.006+01:00</published><updated>2009-05-28T14:36:41.414+02:00</updated><title type='text'>Update</title><content type='html'>It's been a some time since I last posted here. Still, time didn't stand still. I apologize for my lack of interest in this blog lately, if there are any people out there that like reading it.&lt;br /&gt;&lt;br /&gt;I have chosen PyQt as the new toolkit for pypentago, and started working on the new user-interface, I have implemented the Pentago board in C, and have written a basic AI not quite capable of winning, but it's playing semi-decent.&lt;br /&gt;&lt;br /&gt;By doing this, I've learned a lot about C and how it works. Often enough I wanted to curse it, but in the end it came out working. I'm using minimax with alpha-beta pruning to determine the best turn, but the current problem is that the function that rates a position of the board isn't very good, it just counts the longest line.&lt;br /&gt;&lt;br /&gt;I also took at look at the pictures on my harddrive and uploaded those which I liked to deviantart. &lt;a href="http://just-a-glimpse.deviantart.com/gallery/"&gt;Take a look&lt;/a&gt; at them if you are interested.&lt;br /&gt;&lt;br /&gt;Only for my screencasts, time seemed to have stood still. I haven't touched any of those that I should edit nor have I done a new one. I'll see when I got time to finish those and upload them to ShowMeDo.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2804084607846429872?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2804084607846429872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2804084607846429872&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2804084607846429872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2804084607846429872'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/12/update.html' title='Update'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3112692178659415473</id><published>2008-11-01T23:44:00.002+01:00</published><updated>2008-11-01T23:59:42.894+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Good bye wxPython</title><content type='html'>I've decided to give up wxPython and learn another GUI toolkit. This is mostly decided by the amounts of bugs in wxPython. Firstly, it is easy to get it segfaulting, making the search of the error harder and secondly it likes to create unexpected behaviour, like raising an exception when using getattr on an object. I will have to decide between PyQt and PyGTK, but I am still undecided.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3112692178659415473?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3112692178659415473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3112692178659415473&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3112692178659415473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3112692178659415473'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/11/good-bye-wxpython.html' title='Good bye wxPython'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3718861974039265616</id><published>2008-10-11T23:39:00.008+02:00</published><updated>2008-11-02T12:16:18.963+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Operators</title><content type='html'>In Python, most other operators have higher priority than &lt;span style="font-style: italic;"&gt;not&lt;/span&gt;, this means&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;not&lt;/span&gt; &lt;span style="color: rgb(64, 160, 112);"&gt;1&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102);"&gt;==&lt;/span&gt; &lt;span style="color: rgb(64, 160, 112);"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;gives us the result we'd expect, being True. I've had a lengthy discussion on IRC with someone stating that not has the higher priority, which it hasn't. It's very easy to observe in the example above, because &lt;span style="font-style: italic;"&gt;not 1&lt;/span&gt; evaluates to False, and so does &lt;span style="font-style: italic;"&gt;False == 2&lt;/span&gt;. So the result of the example would be &lt;span style="font-style: italic;"&gt;False&lt;/span&gt;, which it is not. What it really does is evaluate &lt;span style="font-style: italic;"&gt;1 == 2&lt;/span&gt;, which is &lt;span style="font-style: italic;"&gt;False&lt;/span&gt;, and then not takes the opposite, which is &lt;span style="font-style: italic;"&gt;True&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Why am I discussing this anyway? Today, I've written a tool that converts &lt;span style="font-style: italic;"&gt;not foo == bar&lt;/span&gt; to &lt;span style="font-style: italic;"&gt;foo != bar&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;not a in b&lt;/span&gt; to &lt;span style="font-style: italic;"&gt;a not in b&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;not a not in b&lt;/span&gt; to &lt;span style="font-style: italic;"&gt;a in b&lt;/span&gt; and so forth. It's about 70 lines of source code that I will never understand when I re-read it, as it is full of regular expressions.&lt;br /&gt;&lt;br /&gt;I will be releasing it to public once I've cleaned up the code a bit and decided on which license to use, meaning to choose from &lt;span style="font-style: italic;"&gt;MIT&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;GNU GPL&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3718861974039265616?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3718861974039265616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3718861974039265616&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3718861974039265616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3718861974039265616'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/10/operators.html' title='Operators'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-4076733439768850539</id><published>2008-09-25T23:22:00.007+02:00</published><updated>2008-09-27T17:52:02.730+02:00</updated><title type='text'>Roadmap for "Advanced Python" series</title><content type='html'>I've outlined a roadmap for my "Advanced Python" series on ShowMeDo today.&lt;br /&gt;I am going to continue with a brief explanation of the lambda statement, taking a maximum of 2 videos, I would say, then I am going to continue by explaining reduce, map and filter and afterwards I'll show alternatives for them using the list comprehension/generator expression syntax. Eventually I'll also show how to write custom generators.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;variable scope&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;to be done&lt;/span&gt;&lt;/li&gt;&lt;li&gt;decorators &lt;span style="color: rgb(51, 204, 0);"&gt;done&lt;/span&gt;&lt;/li&gt;&lt;li&gt;lambda &lt;span style="color: rgb(255, 153, 0);"&gt;post-production&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;operators module | functools.partial&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 0);"&gt; post-production&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;reduce, map, filter &lt;span style="color: rgb(255, 153, 0);"&gt;post-production&lt;/span&gt;&lt;/li&gt;&lt;li&gt;list comprehensions &lt;span style="color: rgb(255, 153, 0);"&gt;post-production&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;generator expressions &lt;span style="color: rgb(255, 153, 0);"&gt;post-production&lt;/span&gt;&lt;/li&gt;&lt;li&gt;generators &lt;span style="color: rgb(255, 0, 0);"&gt;to be done&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-4076733439768850539?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/4076733439768850539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=4076733439768850539&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4076733439768850539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4076733439768850539'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/roadmap-for-advanced-python-series.html' title='Roadmap for &quot;Advanced Python&quot; series'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-518627262556492219</id><published>2008-09-24T21:22:00.002+02:00</published><updated>2008-09-24T21:26:55.492+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='politics'/><title type='text'>E-Voting</title><content type='html'>&lt;span style="font-style: italic;"&gt;Note: This post is describing the situation in Austria.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;No thanks. When E-Voting is introduced, which they are planning to do, I am declaring our democracy as dead. Why is that, you may ask?&lt;br /&gt;Well, let's first look at the brighter side, what are the advantages of E-Voting? Firstly, it &lt;span style="font-style: italic;"&gt;may&lt;/span&gt; be cheaper, but I am unsure how much maintenance of a computer system secure enough to be capable of being used for a democratic voting, which I think &lt;span style="font-style: italic;"&gt;no computer can do&lt;/span&gt;. Secondly, people won't need to leave their houses. Fine, I can relate to that.&lt;br /&gt;But now let's look at the disadvantages: secrecy of you vote simple &lt;span style="font-style: italic;"&gt;cannot be assured&lt;/span&gt;. There has to be some access control to the system, and no matter how good they may do it, afterwards it may be possible to see what you voted. Would you sell your right to vote secretly just for not leaving your house? I doubt it!&lt;br /&gt;&lt;br /&gt;But the major problem is &lt;span style="font-style: italic;"&gt;transparency&lt;/span&gt;. You simply don't know what the system is doing under the hood when you vote for a particular party. It can vote for any party internally, and you never know it.&lt;br /&gt;&lt;br /&gt;In contrast to that, when you use the traditional paper method, it is hard to manipulate your vote. When the votes are counted, representatives of all political parties observe the process, and most importantly, you have &lt;span style="font-style: italic;"&gt;the right to observe the votes being counted&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Even postal vote is more secure. You put an blank envelope which contains your vote into an envelope that contains your personal information. The personal information is verified, meaning they look whether you are allowed to vote and whether you requested postal voting. After that, the blank envelopes are taken and opened separately. So, at least in theory, you privacy is assured, and I am pretty sure that you are allowed to observe that process, although I am unsure.&lt;br /&gt;&lt;br /&gt;Why should I give my democratic rights into the hand of a computer program of which I've got &lt;span style="font-style: italic;"&gt;no idea how it works?&lt;/span&gt;&lt;br /&gt;It's &lt;span style="font-style: italic;"&gt;far to easy to manipulate non-transparent systems &lt;/span&gt;to give our basic democratic rights in the hand of them. Don't let laziness restrict your democratic rights.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-518627262556492219?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/518627262556492219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=518627262556492219&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/518627262556492219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/518627262556492219'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/e-voting.html' title='E-Voting'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2268398161685767039</id><published>2008-09-22T23:22:00.005+02:00</published><updated>2008-09-23T14:30:17.681+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screencast'/><title type='text'>Decorator screencasts</title><content type='html'>I have done two new screencasts today.&lt;br /&gt;&lt;br /&gt;Decorators: The Basics&lt;br /&gt;Decorators: Real World Example&lt;br /&gt;&lt;br /&gt;Check them out at &lt;a href="http://showmedo.com/videos/series?name=D42HbAhqD"&gt;ShowMeDo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2268398161685767039?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2268398161685767039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2268398161685767039&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2268398161685767039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2268398161685767039'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/decorator-screencasts.html' title='Decorator screencasts'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7668260250015160615</id><published>2008-09-20T21:10:00.010+02:00</published><updated>2008-12-16T16:58:01.336+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>OO - But not quite</title><content type='html'>&lt;div class="highlight"&gt;&lt;pre&gt;_inst &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; Context()&lt;br /&gt;register_handler &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; _inst&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;register_handler&lt;br /&gt;register_nostate_handler &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; _inst&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;register_nostate_handler&lt;br /&gt;remove_handler &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; _inst&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;remove_handler&lt;br /&gt;delete_action &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; _inst&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;delete_action&lt;br /&gt;emmit_action &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; _inst&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;emmit_action&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;I have my actions module, as you might know. It exposed a API with only functions, as it was only one state that all of them shared, and I used a global variable for that.&lt;br /&gt;Realizing that this was a mistake, I quickly refactored it to be object-oriented. Now you can create several Contextes, and register and emmit actions in every one of them.&lt;br /&gt;But after all, most people will not even need this, as they will only use one context. So I remembered how it was solved in Python Standard Library's random.py.&lt;br /&gt;It is done exactly the same way as the code I posted above, and I think it's a very good idea.&lt;br /&gt;&lt;br /&gt;You can find the whole new code &lt;a href="http://gitorious.org/projects/findsilence/repos/mainline/blobs/master/findsilence/actions.py"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I am planning to do a separate repository for that module, as it turns out to be more useful than I expected it to be.&lt;br /&gt;&lt;br /&gt;Yes I am aware of the bug in the gitorious code viewer that makes it write "@@" instead if "@", I already told them in the IRC-Channel.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7668260250015160615?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7668260250015160615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7668260250015160615&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7668260250015160615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7668260250015160615'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/oo-but-not-quite.html' title='OO - But not quite'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7533132140359117312</id><published>2008-09-10T19:39:00.003+02:00</published><updated>2008-09-10T19:44:54.709+02:00</updated><title type='text'>Black Holes would make great dustbins</title><content type='html'>Do you think the guys at &lt;span style="font-style: italic;"&gt;CERN&lt;/span&gt; would be as kind as to send me some?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7533132140359117312?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7533132140359117312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7533132140359117312&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7533132140359117312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7533132140359117312'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/black-holes-would-make-great-dustbins.html' title='Black Holes would make great dustbins'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8943432620739940934</id><published>2008-09-06T01:19:00.007+02:00</published><updated>2008-09-10T20:39:38.103+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Solved 25 projecteuler Problems</title><content type='html'>&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;Bravo, segfaulthunter! Now that you have solved 25 problems you have achieved what 78.5% of members have failed to do and have advanced to level 1. Good luck as you continue.&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;I just solved my 25&lt;sup&gt;th&lt;/sup&gt; projecteuler problem and got this nice message. Hope I will get to level 2 sometime. Though the problems are getting harder, a lot harder, now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8943432620739940934?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8943432620739940934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8943432620739940934&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8943432620739940934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8943432620739940934'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/solved-25-projecteuler-problems.html' title='Solved 25 projecteuler Problems'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7614732868343185271</id><published>2008-09-04T23:03:00.003+02:00</published><updated>2008-09-04T23:52:38.799+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>"Who Can Name the Bigger Number" revised</title><content type='html'>I have produced a revised version of &lt;span style="font-style: italic;"&gt;Who Can Name the Bigger Number&lt;/span&gt; written by &lt;span style="font-style: italic;"&gt;Scott Aaronson&lt;/span&gt; and have uploaded a PDF of it. It is &lt;span style="font-weight: bold;"&gt;exactly&lt;/span&gt; the same text as the one on his site, only that I have changed the formatting in a more printer-friendly and probably even more readable way.&lt;br /&gt;For me this also was a pretty good introduction into LaTeX which I may use a bit more in the future.&lt;br /&gt;If you haven't read the article yet: &lt;span style="font-weight: bold;"&gt;read it!&lt;/span&gt;&lt;br /&gt;You can find my revised version at &lt;a href="http://name.nonlogic.org/bignumbers/bignumbers.pdf"&gt;http://name.nonlogic.org/bignumbers/bignumbers.pdf&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7614732868343185271?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7614732868343185271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7614732868343185271&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7614732868343185271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7614732868343185271'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/who-can-name-bigger-number-revised.html' title='&quot;Who Can Name the Bigger Number&quot; revised'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2794877279862253677</id><published>2008-09-01T14:28:00.007+02:00</published><updated>2008-09-01T15:04:01.036+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screencast'/><title type='text'>How I do my screencasts</title><content type='html'>I this post I am going show how I am doing my screencasts.&lt;br /&gt;First I think about a topic. This is the easiest problem, as my &lt;span style="font-style: italic;"&gt;TODO&lt;/span&gt; file is full of them.&lt;br /&gt;Then I think about an example how to explain it, write some code, try it out and if it works I'll use it.&lt;br /&gt;Afterwards I log into my &lt;span style="font-style: italic;"&gt;tutorial&lt;/span&gt; account and start making the screencast, with recording on. It has to be noted that I have no second monitor showing me the code I am supposed to write, so I pretty much write it from memory. With longer screencasts I might have a paper with notes lying next to me. It is normal that at the first 3 or 4 tries the record will end with &lt;span style="font-style: italic;"&gt;[insert swearing word here]&lt;/span&gt;, because I made a mistake. Whenever I do a mistake, I start all over. I'm no fan of cropping the screencast because it's a lot of work and the output seems odd sometime.&lt;br /&gt;So then after some tries I found out which words I need to look at to pronounce properly(I'm no English native speaker) and which code I need to take care of so I don't get a mistake in.&lt;br /&gt;Once I did a recording that I am comfortable with, I extract its audio using &lt;span style="font-style: italic;"&gt;mplayer&lt;/span&gt;, amplify it a bit, remove some background noise, et cetera. Then I put it back into the video and encode it using &lt;span style="font-style: italic;"&gt;XVid&lt;/span&gt;. Then my screencast is done. I upload it to ShowMeDo and wait for people to comment on it.&lt;br /&gt;&lt;br /&gt;That's how I do it. It might seem like a bit odd approach, but I think it works out. In my opinion you just have to try it a few times in order to get similar output to what long preparation would get you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2794877279862253677?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2794877279862253677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2794877279862253677&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2794877279862253677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2794877279862253677'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/09/how-i-do-my-screencasts.html' title='How I do my screencasts'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1292618094303707619</id><published>2008-08-31T18:38:00.001+02:00</published><updated>2008-08-31T18:39:40.508+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screencast'/><title type='text'>Test Driven Development Screencast</title><content type='html'>Today I've done a screencast on test-driven development.&lt;br /&gt;Have a look at it over at &lt;a href="http://showmedo.com/videos/video?name=2840010&amp;amp;fromSeriesID=284"&gt;ShowMeDo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1292618094303707619?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1292618094303707619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1292618094303707619&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1292618094303707619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1292618094303707619'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/test-driven-development-screencast.html' title='Test Driven Development Screencast'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7431327172130223008</id><published>2008-08-30T22:52:00.005+02:00</published><updated>2008-08-31T22:19:44.936+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>findsilence 0.1rc3</title><content type='html'>The first release candidate of findsilence was released today.&lt;br /&gt;I forgot posting the other releases to here, but this one I am. The changelog can be found at &lt;a href="http://name.nonlogic.org/findsilence/CHANGELOG"&gt;http://name.nonlogic.org/findsilence/CHANGELOG&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://name.nonlogic.org/findsilence/findsilence-0.1rc3.tar.bz2"&gt;[Download findsilence]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7431327172130223008?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7431327172130223008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7431327172130223008&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7431327172130223008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7431327172130223008'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/findsilence-01rc3.html' title='findsilence 0.1rc3'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7043040220120300136</id><published>2008-08-29T22:13:00.006+02:00</published><updated>2010-09-29T04:10:25.930+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Counting digits</title><content type='html'>&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: rgb(6, 40, 126);"&gt;digits&lt;/span&gt;(x):&lt;br /&gt;&lt;span style="color: rgb(64, 112, 160); font-style: italic;"&gt;""" Return amount of digits of x. """&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;    return&lt;/span&gt; &lt;span style="color: rgb(0, 112, 32);"&gt;int&lt;/span&gt;(math&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;floor(math&lt;span style="color: rgb(102, 102, 102);"&gt;.&lt;/span&gt;log10(x)) &lt;span style="color: rgb(102, 102, 102);"&gt;+&lt;/span&gt; &lt;span style="color: rgb(64, 160, 112);"&gt;1&lt;/span&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;Because I needed to create an efficient algorithm to count the amount of digits of a number, I have come up with the one you can read above. It is a bit slower than &lt;span style="font-style: italic;"&gt;len(str(x))&lt;/span&gt; for small numbers, but a lot faster with large ones.&lt;br /&gt;Another example on how a good algorithm beats processing power.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7043040220120300136?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7043040220120300136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7043040220120300136&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7043040220120300136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7043040220120300136'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/counting-digits.html' title='Counting digits'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2458566909764285604</id><published>2008-08-29T14:41:00.007+02:00</published><updated>2008-08-29T15:57:12.199+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python mathmodule.c patch</title><content type='html'>Today I have written a patch for &lt;span style="font-style: italic;"&gt;Modules/mathmodule.c &lt;/span&gt;of Python 2.6. It removes the inaccuracy of &lt;span style="font-style: italic;"&gt;math.log&lt;/span&gt; when called with base 10 compared to &lt;span style="font-style: italic;"&gt;math.log10&lt;/span&gt;. All it does is internally using  &lt;span style="font-style: italic;"&gt;log10&lt;/span&gt; when &lt;span style="font-style: italic;"&gt;log&lt;/span&gt; gets 10 as base. It makes the output of &lt;span style="font-style: italic;"&gt;math.log&lt;/span&gt; much more accurate when used with base 10.&lt;br /&gt;Here is some comparison:&lt;br /&gt;&lt;a href="http://paste.pocoo.org/show/83761/"&gt;[Unpatched Python]&lt;/a&gt; &lt;a href="http://paste.pocoo.org/show/83759/"&gt;[Patched Python]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I hope the patch is good enough to meet Pythons high standards.&lt;br /&gt;Props go out to &lt;span style="font-style: italic;"&gt;Gromit&lt;/span&gt; @ freenode for helping me create the patch.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bugs.python.org/issue3724"&gt;[Python Bug Tracker Issue]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2458566909764285604?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2458566909764285604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2458566909764285604&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2458566909764285604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2458566909764285604'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/python-mathmodulec-patch.html' title='Python mathmodule.c patch'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2480385436341595729</id><published>2008-08-28T13:33:00.011+02:00</published><updated>2008-08-28T18:04:38.485+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>How not to do CLI</title><content type='html'>Having concerned myself with audio programming, I found out that some very established tools have a horrible &lt;span style="font-style: italic;"&gt;command-line interface&lt;/span&gt;. Particularly I am talking about &lt;span style="font-style: italic;"&gt;lame&lt;/span&gt; here.&lt;br /&gt;It is impossible to just convert multiple files without writing a shell-script. I think that every CLI should give the user the option to use their shells' globbing features. Lame also does a good job at overriding options that users are used to them performing in a different way.&lt;br /&gt;When you see &lt;span style="font-style: italic;"&gt;lame -h&lt;/span&gt;, would you expect that the &lt;span style="font-style: italic;"&gt;-h&lt;/span&gt; flag shows you a help, or that it increases the quality of your output file?&lt;br /&gt;Or whats better to read: &lt;span style="font-style: italic;"&gt;lame *.wav&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;for i in *.wav; do lame $i; done&lt;/span&gt;? I'd certainly answer &lt;span style="font-style: italic;"&gt;Of course that should show me the help!&lt;/span&gt; and  &lt;span style="font-style: italic;"&gt;"lame *.wav" is much more concise!&lt;/span&gt; to these questions. And it's not that it would be that hard, at least not with Python and optparse. You just need to iterate over the input files and you are done. &lt;span style="font-style: italic;"&gt;for arg in args: [your code here]&lt;/span&gt;. That's it. So with Python there is absolutely no excuse not to support multiple input files.&lt;br /&gt;I think that CLI need to be thought about and designed just as much as GUI need to. They need to be powerful yet intuitive to use, and I think &lt;i&gt;lame&lt;/i&gt; failed at being either of that. At least with Python, there's no excuse not doing it.&lt;br /&gt;&lt;br /&gt;With &lt;i&gt;findsilence&lt;/i&gt; I tried to achieve that. It works with just one argument, the input file(s), and it puts the output in the directory &lt;i&gt;output/&lt;/i&gt; in the working directory, if it is not specified using the &lt;i&gt;-o&lt;/i&gt; flag. When it gets more than one file, it automatically puts the output of each of them into a separate directory in the output directory, if it only gets one file, it just puts the output into the output directory.&lt;br /&gt;So summarizing I think there are a few things you should note when creating CLI:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Never change behaviour of often used options such as &lt;span style="font-style: italic;"&gt;-h, -v, -q&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Always&lt;/span&gt; accept multiple input files unless you have a good reason not to&lt;/li&gt;&lt;li&gt;Try to minimize the options that are required by keeping sane defaults for unspecified options.&lt;/li&gt;&lt;li&gt;When you have a GUI and a CLI, think about adding a flag to the CLI to start the GUI to not require the user to remember two commands.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2480385436341595729?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2480385436341595729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2480385436341595729&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2480385436341595729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2480385436341595729'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/how-not-to-do-cli.html' title='How not to do CLI'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2319329747205479104</id><published>2008-08-26T23:59:00.003+02:00</published><updated>2008-08-27T00:04:41.152+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>findsilence release coming</title><content type='html'>I am about to release &lt;span style="font-style: italic;"&gt;findsilence 0.1rc1&lt;/span&gt;. I have tweaked the values according to three different records, and am just digitizing an old &lt;span style="font-style: italic;"&gt;Beatles&lt;/span&gt; record for the final test, if that works, I will release.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2319329747205479104?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2319329747205479104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2319329747205479104&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2319329747205479104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2319329747205479104'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/findsilence-release-coming.html' title='findsilence release coming'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1989545054780435963</id><published>2008-08-26T13:59:00.002+02:00</published><updated>2008-08-26T14:39:35.763+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>findsilence improved</title><content type='html'>&lt;span style="font-style: italic;"&gt;Findsilence&lt;/span&gt;, that's the name I gave to my WAV splitting project, has been heavily improved in the last two days since I came back from my vacation.&lt;br /&gt;I have implemented a new algorithm that should find silence more reliably than the old one, and have &lt;span style="font-style: italic;"&gt;really&lt;/span&gt; improved the user interface. You now see a progressbar while the program is working, get the chance to cancel the progress if you want, and most importantly, it doesn't hang once you've started the progress.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1989545054780435963?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1989545054780435963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1989545054780435963&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1989545054780435963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1989545054780435963'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/findsilence-improved.html' title='findsilence improved'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8071699974647086873</id><published>2008-08-25T16:56:00.002+02:00</published><updated>2008-08-26T10:57:56.620+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='photography'/><title type='text'>Photograph</title><content type='html'>This is one of the photographs I took while I was in Switzerland.&lt;br /&gt;I think it is the best one, and that's why I am posting it now. More may follow.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/28467613@N03/2795452667/" title="img_9047 by segfaulthunter, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3080/2795452667_f07eb1e54d_m.jpg" alt="img_9047" width="240" height="180" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8071699974647086873?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8071699974647086873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8071699974647086873&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8071699974647086873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8071699974647086873'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/photograph.html' title='Photograph'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3080/2795452667_f07eb1e54d_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6216936778451866540</id><published>2008-08-25T11:33:00.002+02:00</published><updated>2008-08-25T11:48:33.500+02:00</updated><title type='text'>Back Home</title><content type='html'>Today at about 7AM I arrived home at Vienna again. I will sort out the pictures now, maybe will upload the best to &lt;span style="font-style: italic;"&gt;Flickr&lt;/span&gt; or a similar service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6216936778451866540?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6216936778451866540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6216936778451866540&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6216936778451866540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6216936778451866540'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/back-home.html' title='Back Home'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5154110343286280522</id><published>2008-08-12T19:40:00.003+02:00</published><updated>2008-08-12T20:22:41.838+02:00</updated><title type='text'>Holidays</title><content type='html'>Today in the evening, I am going to leave towards Switzerland, where I'll arrive tomorrow to spend my holidays. I will return on Monday the 25th of August.&lt;br /&gt;I may have WLAN access somewhere and maybe will post to here when the weather outside is not nice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5154110343286280522?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5154110343286280522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5154110343286280522&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5154110343286280522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5154110343286280522'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/holidays.html' title='Holidays'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5285751235357006304</id><published>2008-08-12T00:13:00.002+02:00</published><updated>2008-08-12T00:19:23.177+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>New MP3 Player</title><content type='html'>Today, as I am leaving for holidays tomorrow, I bought a new MP3 player. As buying hardware that works with Linux is like lottery, I just picked the one I liked best without even considering how it might work with Linux.&lt;br /&gt;But today, I've won the Linux-Lottery. The MP3 player is fully usable by just mounting it and transferring your music to the &lt;span style="font-style: italic;"&gt;music&lt;/span&gt; folder. All that even though the package explicitly stated that the product does only work with Windows. I already transferred a lot of music onto it so I can listed to it while sitting in the train. I am pretty satisfied with it, the only shortcoming is that it is only chargeable by USB, but that is not that bad as I am taking a laptop there anyway.&lt;br /&gt;The only thing that, I think, is impossible with Linux is making playlists, but as I never use that feature on mobile MP3 devices anyway, it is not that bad.&lt;br /&gt;&lt;br /&gt;It was a &lt;span style="font-style: italic;"&gt;Sony NWZ-A826&lt;/span&gt;, if you are interested in buying an MP3 player that is well-supported under Linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5285751235357006304?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5285751235357006304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5285751235357006304&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5285751235357006304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5285751235357006304'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/new-mp3-player.html' title='New MP3 Player'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8606485392582648246</id><published>2008-08-11T02:28:00.005+02:00</published><updated>2008-08-30T10:29:56.717+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><title type='text'>Automatic Title splitting</title><content type='html'>I have written a Python program that is capable to separate tracks in a long &lt;span style="font-style: italic;"&gt;.wav&lt;/span&gt; file, as long as there is silence between them. I also supplied it with a nice, minimalistic, User-Interface.&lt;br /&gt;In fact, this is the first User-Interface that I've done with &lt;span style="font-style: italic;"&gt;wxPython&lt;/span&gt; that really looks the way I planned it to, that resizes properly, if odd-looking, and is, in my opinion, intuitive.&lt;br /&gt;The only problem with it as of now is that the User-Interface and the real splitting code are both executed in the same Thread, thus the User-Interface gets unresponsive once you hit the &lt;span style="font-style: italic;"&gt;"Split into Tracks"&lt;/span&gt; button. As this is not too hard to do, I will address it in the next time.&lt;br /&gt;I might even release this to the public if anyone has a use for it, but most likely not until I come home from my vacations again.&lt;br /&gt;&lt;br /&gt;You might be wondering why I did this program?&lt;br /&gt;We got a turntable capable of directly writing the music it plays onto an USB-Stick. But unfortunately, it doesn't split it into the tracks, but rather writes one big &lt;span style="font-style: italic;"&gt;mp3&lt;/span&gt; file that contains the whole record. This is my solution to that, although it is currently unable to directly work on, or at least, convert mp3 files by itself. So for now I will have to manually convert the &lt;span style="font-style: italic;"&gt;mp3&lt;/span&gt; to &lt;span style="font-style: italic;"&gt;wav&lt;/span&gt;. That will change too, but I am still searching a right library for that task. Speaking of which, for the core of this application, I am only using Python builtins, so no external dependencies, but &lt;span style="font-style: italic;"&gt;wxPython&lt;/span&gt; for the UI, are required.&lt;br /&gt;While coding this, nearly the whole day today, I have found out that the Python documentation on &lt;span style="font-style: italic;"&gt;wave&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;audioop&lt;/span&gt; is pretty lacking, so I had to experiment a bit to find out good default values. I might send in some patches for this.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;img alt="Screenshot" src="http://name.nonlogic.org/findsilence.png" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8606485392582648246?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8606485392582648246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8606485392582648246&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8606485392582648246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8606485392582648246'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/automatic-title-splitting.html' title='Automatic Title splitting'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1639465081030057723</id><published>2008-08-09T20:54:00.005+02:00</published><updated>2008-08-12T02:20:09.294+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pypentago'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Code Styleguide</title><content type='html'>I have been working hard today to get a new styleguide up for pypentago. It describes how the code in pypentago has too look. Despite being similar to &lt;span style="font-style: italic;"&gt;PEP8&lt;/span&gt;, it also addresses some things that &lt;span style="font-style: italic;"&gt;PEP8&lt;/span&gt; does not, like cross-platform file-name operations.&lt;br /&gt;The outcome pretty much pleases me, as it is much longer in detail.&lt;br /&gt;&lt;br /&gt;I have written it because at the time of writing there are still 150 &lt;span style="font-style: italic;"&gt;PEP8&lt;/span&gt;-incompatible variable, class and function-names, despite me having removed some of them in the last days.&lt;br /&gt;&lt;br /&gt;It is written using &lt;span style="font-style: italic;"&gt;Sphinx&lt;/span&gt; and I might add some other developer resources to the online documentation some time later.&lt;br /&gt;&lt;br /&gt;If you think I have missed anything in it, feel free to either contact me via email or just leave a comment.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://name.nonlogic.org/pypentago/style.html"&gt;Code Style Guide&lt;/a&gt;&lt;br /&gt;PS: I am aware that there is some encoding problem. I will try to resolve that some time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1639465081030057723?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1639465081030057723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1639465081030057723&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1639465081030057723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1639465081030057723'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/code-styleguide.html' title='Code Styleguide'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-4359885862969728509</id><published>2008-08-07T00:07:00.006+02:00</published><updated>2008-08-07T00:18:39.980+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pypentago'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Gna! SVN repository unbearable</title><content type='html'>&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;[ gna/pypentago/trunk ] % svn update&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ssh_exchange_identification: Connection closed by remote host&lt;br /&gt;svn: Connection closed unexpectedly&lt;/span&gt;&lt;/blockquote&gt;I have been seeing this &lt;span style="font-weight: bold;"&gt;a lot&lt;/span&gt; lately, and when I say a lot, I mean committing fails more often than it succeeds. I often have to wait a minute or so in order to be able to commit, which I think is much too much.&lt;br /&gt;I think I am going to try to find a new home for &lt;span style="font-style: italic;"&gt;pypentago&lt;/span&gt;. Not that &lt;span style="font-style: italic;"&gt;Gna!&lt;/span&gt; was bad, but a repository that is down when you try to commit is just unbearable.&lt;br /&gt;This may also be a chance of switching to a distributed version control system, like &lt;span style="font-style: italic;"&gt;Git &lt;/span&gt;or &lt;span style="font-style: italic;"&gt;Mercurial&lt;/span&gt;.&lt;br /&gt;At the moment I lean more towards &lt;span style="font-style: italic;"&gt;Git&lt;/span&gt;, as I think its command-set is more complete, but on the other hand &lt;span style="font-style: italic;"&gt;Mercurial&lt;/span&gt; is far better when it comes to writing extensions.&lt;br /&gt;The most appealing thing of &lt;span style="font-style: italic;"&gt;Git&lt;/span&gt; is its &lt;span style="font-style: italic;"&gt;rebase&lt;/span&gt; command which takes your changes and puts them on top of another branch. While this may be dangerous and bad when you already have your branch shared, I think it is very useful for keeping your local branches up-to-date with the master branch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-4359885862969728509?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/4359885862969728509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=4359885862969728509&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4359885862969728509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/4359885862969728509'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/gna-svn-repository-unbearable.html' title='Gna! SVN repository unbearable'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1412531179048189798</id><published>2008-08-07T00:00:00.002+02:00</published><updated>2008-08-07T00:07:02.338+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pypentago'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>UI "Action" Bindings</title><content type='html'>Today I have refactored the &lt;span style="font-style: italic;"&gt;pypentago&lt;/span&gt; User-Interface code to make use of the new &lt;span style="font-style: italic;"&gt;action&lt;/span&gt;  module I have written. I also make heavy use of decorators in it, even using my instance-decorator hack.&lt;br /&gt;&lt;br /&gt;I think this is an important step to modularity and I like it much better that way.&lt;br /&gt;On the downside, having used &lt;span style="font-style: italic;"&gt;git-svn&lt;/span&gt;, the connection failed during the &lt;span style="font-style: italic;"&gt;dcommit&lt;/span&gt; which messed up &lt;span style="font-style: italic;"&gt;git &lt;/span&gt;a bit and forced me to &lt;span style="font-style: italic;"&gt;svn rm&lt;/span&gt; the whole source and copy the new one to it instead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1412531179048189798?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1412531179048189798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1412531179048189798&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1412531179048189798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1412531179048189798'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/ui-action-bindings.html' title='UI &quot;Action&quot; Bindings'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5989265630489453085</id><published>2008-08-04T02:04:00.004+02:00</published><updated>2008-08-05T23:17:01.644+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Who Can Name the Bigger Number?</title><content type='html'>&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;i&gt;You have fifteen seconds. Using standard math notation, English words, or both, name a single whole number—not an infinity—on a blank index card. Be precise enough for any reasonable modern mathematician to determine exactly what number you’ve named, by consulting only your card and, if necessary, the published literature.&lt;/i&gt;&lt;/blockquote&gt;I have found an interesting article dealing with numbers so big no human can imagine them.&lt;br /&gt;It also contains an excursus about &lt;span style="font-style: italic;"&gt;Turing Machines&lt;/span&gt; which I found particularly interesting, because they are the basis of modern computing.&lt;br /&gt;&lt;br /&gt;In my opinion it is well-written and understandable, even for people that are not really into maths, such as me. I really enjoyed reading it and think that I learnt a lot of new things from it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.scottaaronson.com/writings/bignumbers.html"&gt;Who Can Name the Bigger Number?&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5989265630489453085?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5989265630489453085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5989265630489453085&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5989265630489453085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5989265630489453085'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/who-can-name-bigger-number.html' title='Who Can Name the Bigger Number?'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5961089517652677883</id><published>2008-08-03T23:27:00.015+02:00</published><updated>2008-08-04T17:18:48.005+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Decorator Magic</title><content type='html'>I have been using Python decorators more in the last time, finding the extremely useful. But there are some pitfalls I have experienced.&lt;br /&gt;First one is that when decorating methods, there is no way for the decorator to find out whether it is a method or a function, which is a bit complicated in some cases.&lt;br /&gt;The second one, that is logical though, is that the methods that get passed to the decorator are &lt;span style="font-style: italic;"&gt;unbound methods&lt;/span&gt;, thus you cannot just store them in a dictionary and execute them later.&lt;br /&gt;When you know which class the method is of, it is enough to just store the name(&lt;span style="font-style: italic;"&gt;func.__name__&lt;/span&gt;) and get the method in the constructor of the class using &lt;span style="font-style: italic;"&gt;getattr(self, func_name)&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;So what did I need decorators for, anyway?&lt;br /&gt;I was searching for a way to reorganize the network code in &lt;span style="font-style: italic;"&gt;pypentago&lt;/span&gt;, and seeing all those pointless &lt;span style="font-style: italic;"&gt;self.bind("EVENT", self.method)&lt;/span&gt; functions, I decided that there has to be a better way.&lt;br /&gt;For me, that better way were decorators, eventually leading the the following form:&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: rgb(85, 85, 85); font-weight: bold;"&gt;@expose&lt;/span&gt;(&lt;span style="color: rgb(64, 112, 160);"&gt;"EVENT"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: rgb(6, 40, 126);"&gt;method&lt;/span&gt;(&lt;span style="color: rgb(0, 112, 32);"&gt;self&lt;/span&gt;, evt):&lt;br /&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;    pass&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;I think this is much more readable, as that way the code of the method and the corresponding event are not so shattered across multiple sections in the code.&lt;br /&gt;During that process, I have also made great use of the &lt;span style="font-style: italic;"&gt;partial &lt;/span&gt;function in the &lt;span style="font-style: italic;"&gt;functools&lt;/span&gt; module. It allows you to store a function with some of the parameters passed, and the other ones left for the time it is executed.&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: rgb(6, 40, 126);"&gt;foo&lt;/span&gt;(bar, spam):&lt;br /&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;    print&lt;/span&gt; bar, spam&lt;br /&gt;baz &lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt; partial(foo, spam&lt;span style="color: rgb(102, 102, 102);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(64, 112, 160);"&gt;"Spam!"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: rgb(0, 112, 32); font-weight: bold;"&gt;print&lt;/span&gt; baz(&lt;span style="color: rgb(64, 112, 160);"&gt;"Bar!"&lt;/span&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;This will output &lt;span style="font-style: italic;"&gt;"Bar! Spam!"&lt;/span&gt;. It is really useful when storing functions for execution to occur later.&lt;br /&gt;I think this is pretty useful, I also have create a pretty hacky way to apply decorators to &lt;span style="font-style: italic;"&gt;bound methods&lt;/span&gt; by storing both the decorator and the method associated with it and decorating it in the &lt;span style="font-style: italic;"&gt;__init__ &lt;/span&gt;method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5961089517652677883?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5961089517652677883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5961089517652677883&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5961089517652677883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5961089517652677883'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/08/decorator-magic.html' title='Decorator Magic'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8938502494211343859</id><published>2008-07-30T19:20:00.003+02:00</published><updated>2008-07-30T19:27:27.855+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Of KMail</title><content type='html'>Today, I have installed KDE4 to look at what has changed. I am mainly a GNOME and xfce user, but I have gotten interested in the new KDE.&lt;br /&gt;So I installed it, opened it up and tried it out a bit. To me it seemed a bit slow and I had some minor graphical problems, meaning that something did not look really good.&lt;br /&gt;Then I began trying out all of those K* programs. When I tried out KMail on my AOL IMAP, it immediately marked &lt;span style="font-weight: bold;"&gt;all&lt;/span&gt; of my email as spam, thus moving it to a local spam folder.&lt;br /&gt;As none of it was really spam, I tried moving it back to the Inbox, which failed. Then I moved it into an empty folder, which took about 15 minutes all in all.&lt;br /&gt;&lt;br /&gt;My initial experience with KDE4 therefore is not really a good one. I'll maybe play around with it later, but I won't let it touch my email account for now ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8938502494211343859?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8938502494211343859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8938502494211343859&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8938502494211343859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8938502494211343859'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/07/of-kmail.html' title='Of KMail'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-1048832772542384612</id><published>2008-07-28T01:22:00.004+02:00</published><updated>2008-07-28T03:11:28.857+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pypentago'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Action Handling</title><content type='html'>I've just written a small module for &lt;span style="font-style: italic;"&gt;pypentago&lt;/span&gt; that allows actions to be emitted, and then to be handled in a handler defined by another module. This emphasizes modularity, as it is much easier to write custom user-interfaces this way.&lt;br /&gt;Both the design and the implementation are simple, though I have set a high value on documenting it properly. This leads to more than half of the lines being docstrings, and this is not an overstatement.&lt;br /&gt;Most of the time when developing this I have spent in developing a good design, that allows both the registrar and the emitter to give information to the handler. I have chosen the most obvious, thus most simple approach. The emitter passes one, and exactly one, variable to the handler, that is passed to it as the first parameter. The registrar may provide any amount of additional parameters.&lt;br /&gt;Due to my high usage of wxPython events, I have more and more grown tired of needing to make my handlers accept an event, although they do not use it. This is why I implemented something called &lt;span style="font-style: italic;"&gt;"nostate handlers"&lt;/span&gt;. This means that these handlers do &lt;span style="font-weight: bold;"&gt;not&lt;/span&gt; take information from the emitter, that information I called &lt;span style="font-style: italic;"&gt;state&lt;/span&gt;. This is useful when trying to bind actions directly to underlying framework functions, such as ones' from wxPython.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dpaste.com/67793/"&gt;[Link to Source Code]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-1048832772542384612?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/1048832772542384612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=1048832772542384612&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1048832772542384612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/1048832772542384612'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/07/action-handling.html' title='Action Handling'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3845454920041803654</id><published>2008-07-15T01:30:00.003+02:00</published><updated>2008-07-28T01:32:55.752+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Project Euler</title><content type='html'>I have found a really nice website offering you problems that you can solve using computer programming. You can then verify whether the result was true, and if you have an account it will take track of which problems you solved and which are still to be solved for you.&lt;br /&gt;Currently my rating is: &lt;span style="font-style: italic;"&gt;Your current rating is 3% genius, having solved 8 out of 202 problems.&lt;/span&gt;&lt;span&gt;&lt;br /&gt;I hope you will also try to solve these problems, because it is a good way to practice both programming and mathematics.&lt;br /&gt;The site can be found at &lt;a href="http://projecteuler.net/"&gt;http://projecteuler.net/&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3845454920041803654?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3845454920041803654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3845454920041803654&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3845454920041803654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3845454920041803654'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/07/project-euler.html' title='Project Euler'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7050105105767262567</id><published>2008-06-30T20:02:00.004+02:00</published><updated>2008-07-10T21:22:40.995+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Regex cheatsheet</title><content type='html'>I have found a neat little cheatsheet for regular expressions on the internet. It can be found &lt;a href="http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/"&gt;here&lt;/a&gt;.&lt;br /&gt;Props go to the author of it for investing work and research and then sharing it with the community, it will for sure help me!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7050105105767262567?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7050105105767262567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7050105105767262567&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7050105105767262567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7050105105767262567'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/regex-cheatsheet.html' title='Regex cheatsheet'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7952371098301790612</id><published>2008-06-28T23:22:00.005+02:00</published><updated>2008-07-22T20:36:39.726+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='screencast'/><title type='text'>unittest screencast</title><content type='html'>I have created a screen cast on unittest today. It explains the basics of unit testing and will be extended by another video explaining more complicated uses of it.&lt;br /&gt;I have already uploaded it, but I will turn up the volume and do some other adjustments and then upload it again and to &lt;a href="http://showmedo.com/videos/video?name=2840000;fromSeriesID=284"&gt;ShowMeDo&lt;/a&gt;.&lt;br /&gt;UPDATE: Uploaded xvid version with louder sound: &lt;a href="http://www.mediafire.com/?4jkjowghy1q"&gt;http://www.mediafire.com/?4jkjowghy1q&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7952371098301790612?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7952371098301790612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7952371098301790612&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7952371098301790612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7952371098301790612'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/unittest-screencast.html' title='unittest screencast'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8868234022965230152</id><published>2008-06-28T12:55:00.004+02:00</published><updated>2008-06-28T23:22:14.250+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='screencast'/><title type='text'>Screencast on XMLRPC</title><content type='html'>&lt;a href="http://paste.pocoo.org"&gt;The Pocoo Pastebin&lt;/a&gt; has made me interested in XMLRPC, because you can post and view pastes using it. I have done some research and now done a short, 5 minute, screencast explaining the most basic features it offers.&lt;br /&gt;If you do not know XMLRPC, it is a way of calling functions on a remote server nearly the same way than if they were in your program directly.&lt;br /&gt;&lt;br /&gt;The screencast can be downloaded &lt;a href="http://www.mediafire.com/?zfumjnygn5x"&gt;here&lt;/a&gt; and should soon be available at &lt;a href="http://showmedo.com/videos/video?name=2830000;fromSeriesID=283"&gt;ShowMeDo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8868234022965230152?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8868234022965230152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8868234022965230152&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8868234022965230152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8868234022965230152'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/screencast-on-xmlrpc.html' title='Screencast on XMLRPC'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5919129408771805836</id><published>2008-06-19T20:03:00.003+02:00</published><updated>2008-06-19T20:06:59.535+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>pyometry Python-3.0 compatible</title><content type='html'>I have just tried out pyometry.vector in a Python-3.0b1 and it has worked perfectly. This means there most likely will be a nearly seamless conversion from Python-2.x to Python-3.x, at least for the vector module.&lt;br /&gt;&lt;a href="http://paste.pocoo.org/show/73810/"&gt;[Python-3.0b1 console session]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5919129408771805836?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5919129408771805836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5919129408771805836&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5919129408771805836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5919129408771805836'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/pyometry-python-30-compatible.html' title='pyometry Python-3.0 compatible'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-2242338467669866790</id><published>2008-06-19T15:22:00.004+02:00</published><updated>2008-06-19T15:33:30.948+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>New Python3.0 string formatting</title><content type='html'>I have just tried out the new Python 3.0 string formatting in the alpha release, and I got to say it is really great. I will make great use of it for the pypentago configuration files as I will not have to manually replace {foo} with "foovalue" but rather do string.format(foo="foovalue").&lt;br /&gt;&lt;br /&gt;Here you've got a code sample: &lt;a href="http://paste2.org/p/40928"&gt;http://paste2.org/p/40928&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-2242338467669866790?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/2242338467669866790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=2242338467669866790&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2242338467669866790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/2242338467669866790'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/new-python30-string-formatting.html' title='New Python3.0 string formatting'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-7207266870429867021</id><published>2008-06-13T20:19:00.006+02:00</published><updated>2008-06-13T20:55:53.243+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Z Shell</title><content type='html'>I have once again installed the Z Shell, better known as &lt;span style="font-style: italic;"&gt;zsh&lt;/span&gt;. I have done this because I got more and more pissed about the bad completion features &lt;span style="font-style: italic;"&gt;bash&lt;/span&gt;, where you cannot tab through the possible commands.&lt;br /&gt;The feature that lets you display the return code of the last command in the prompt is also great.&lt;br /&gt;All in all I like the &lt;span style="font-style: italic;"&gt;zsh&lt;/span&gt; much better than the &lt;span style="font-style: italic;"&gt;bash&lt;/span&gt; as some features are much more advanced in it. It also has a quite helpful first time users configuration program to create a really basic .zshrc.&lt;br /&gt;The bad thing is that &lt;span style="font-style: italic;"&gt;rxvt&lt;/span&gt; prevents me from having a prompt using colour or such without having to escape all the special characters&lt;a href="http://cygwin.com/ml/cygwin/2001-07/msg00147.html"&gt;[1]&lt;/a&gt;. But I think this is not the fault of &lt;span style="font-style: italic;"&gt;zsh&lt;/span&gt; but rather the one of &lt;span style="font-style: italic;"&gt;rxvt&lt;/span&gt;, as the users in that mailing list describe the same problem using the &lt;span style="font-style: italic;"&gt;bash&lt;/span&gt;.&lt;br /&gt;I put my &lt;span style="font-style: italic;"&gt;.zshrc&lt;/span&gt;&lt;a href="http://dotfiles.org/%7Esegfaulthunter/.zshrc"&gt;[2]&lt;/a&gt; onto &lt;a href="http://dotfiles.org/"&gt;dotfiles&lt;/a&gt; if you are interested. I know it is not really advanced so far, but I have most of my stuff defined in &lt;span style="font-style: italic;"&gt;.aliases&lt;/span&gt;&lt;a href="http://dotfiles.org/%7Esegfaulthunter/.aliases"&gt;[3]&lt;/a&gt; which is loaded by &lt;span style="font-style: italic;"&gt;.profile&lt;/span&gt;&lt;a href="http://dotfiles.org/%7Esegfaulthunter/.profile"&gt;[4]&lt;/a&gt;. I have uploaded these two files to dotfiles too.&lt;br /&gt;You might notice that the unp alias in the &lt;span style="font-style: italic;"&gt;.aliases&lt;/span&gt; file does not need different attributes for different types of files. This is due to &lt;span style="font-style: italic;"&gt;tar&lt;/span&gt; being able to auto detect the type of a file in new versions, if it does not work for you replace &lt;span style="font-style: italic;"&gt;tar&lt;/span&gt; with &lt;span style="font-style: italic;"&gt;bsdtar&lt;/span&gt;, which also supported this in earlier versions.&lt;br /&gt;Some of the ideas for these files also came from other ones on dotfiles.&lt;br /&gt;If you think these files could be improved, which for sure they can, please let me know!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-7207266870429867021?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/7207266870429867021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=7207266870429867021&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7207266870429867021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/7207266870429867021'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/z-shell.html' title='Z Shell'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5641475820853978833</id><published>2008-06-09T19:06:00.006+02:00</published><updated>2008-06-09T20:42:10.470+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>pyometry on gitorious</title><content type='html'>I named the package in which I put my vector module pyometry. That name was produced by merging Python and Geometry into &lt;span style="font-weight: bold;"&gt;py&lt;/span&gt;&lt;span style="font-style: italic;"&gt;thonge&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;ometry&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;I also think that the name does not sound bad, so I picked it.&lt;br /&gt;Enough of the name, I put this package, called pyometry, onto &lt;span style="font-style: italic;"&gt;Gitorious &lt;/span&gt;today because I wanted to try out something new. For a change I picked this host, using &lt;span style="font-style: italic;"&gt;Git&lt;/span&gt; instead of &lt;span style="font-style: italic;"&gt;SVN&lt;/span&gt; which all hosting sites I used so far provided. So far I like it really good, because it has a simplistic web interface but still has all the features one would need. For source code management, that is, because &lt;span style="font-style: italic;"&gt;Gitorious&lt;/span&gt; does not offer any features like web-hosting, file-mirroring or bug-tracking.&lt;br /&gt;I think in the beginning I will be fine without those, but maybe I will need to host these somewhere else, if the package is used by some people eventually.&lt;br /&gt;&lt;br /&gt;If you like Python and maths, and always waited for some chance to develop something, head over to &lt;a href="http://gitorious.org/"&gt;Gitorious&lt;/a&gt;, create yourself an account and clone the &lt;a href="http://gitorious.org/projects/pyometry/repos/mainline"&gt;&lt;span style="font-style: italic;"&gt;mainline &lt;/span&gt;branch&lt;/a&gt; and eventually file a merge request so I can merge the changes you have done into the mainline branch.&lt;br /&gt;&lt;br /&gt;Be ready for some more posts about git in the future, now that I can try it out first handidly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5641475820853978833?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5641475820853978833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5641475820853978833&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5641475820853978833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5641475820853978833'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/pyometry-on-gitorious.html' title='pyometry on gitorious'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-5700276265678214299</id><published>2008-06-09T17:12:00.003+02:00</published><updated>2008-06-09T17:18:22.663+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Vectors in Python</title><content type='html'>I have just created a module capable of doing vector calculations for Python. It currently supports calculation cross products, scalar products, unit vectors, the length of vectors  and angles between two vectors.&lt;br /&gt;It is pretty easy to use as this &lt;a href="http://paste.pocoo.org/show/65817/"&gt;code-snippet&lt;/a&gt; should show. If there is anything in this that you do not understand, feel free to leave me a comment.&lt;br /&gt;I also tinker with the idea of putting this onto some hosting-site, because I plan extending it so it is capable of doing calculations with planes and lines as well.&lt;br /&gt;&lt;br /&gt;If you think you could make use of this, feel free to contact me so I can send you the code I have at the moment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-5700276265678214299?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/5700276265678214299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=5700276265678214299&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5700276265678214299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/5700276265678214299'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/vectors-in-python.html' title='Vectors in Python'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-8605368340678604785</id><published>2008-06-06T17:49:00.006+02:00</published><updated>2008-06-13T22:28:25.718+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>eric IDE for Python code refactoring</title><content type='html'>I have just found a way to refactor Python projects. You can use &lt;span style="font-style: italic;"&gt;eric4&lt;/span&gt; using the &lt;span style="font-style: italic;"&gt;rope&lt;/span&gt; plugin. It allows you to rename methods and classes in your whole project and&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;appears to be working well.&lt;br /&gt;With MS Windows I have experienced some problems with it, but with Archlinux it seems to work fine. I will post again once I have tried it out a bit more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-8605368340678604785?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/8605368340678604785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=8605368340678604785&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8605368340678604785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/8605368340678604785'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/python-code-refactoring-2.html' title='eric IDE for Python code refactoring'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3913971041044119870</id><published>2008-06-04T15:50:00.002+02:00</published><updated>2008-06-04T15:55:32.573+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python code refactoring</title><content type='html'>I have been searching a tool that refactors my Python code, thus renaming my methods, classes and functions throughout the project so I do not have to manually change the names and all references to it.&lt;br /&gt;I have not yet found any tool that really meets my requirements. Most of them are just plain hard to use, or are only integrating into IDEs or editors that I do not use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3913971041044119870?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3913971041044119870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3913971041044119870&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3913971041044119870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3913971041044119870'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/python-code-refactoring.html' title='Python code refactoring'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-3998547669849857756</id><published>2008-06-01T16:30:00.005+02:00</published><updated>2008-06-01T16:35:16.279+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Change permissions for NTFS partition</title><content type='html'>I have just found out a little hack to change the permissions for a whole NTFS &lt;span style="font-weight: bold;"&gt;partition&lt;/span&gt;, but &lt;span style="font-weight: bold;"&gt;not for the files&lt;/span&gt; in it. It is good if you have a multi-user system and want to deny other users to access your NTFS drive.&lt;br /&gt;First, create &lt;span style="font-style: italic;"&gt;/mnt/win/win&lt;/span&gt;, then change &lt;span style="font-style: italic;"&gt;/mnt/win&lt;/span&gt; to the permissions you want, mount the ntfs drive at &lt;span style="font-style: italic;"&gt;/mnt/win/win&lt;/span&gt; and then create a symlink at &lt;span style="font-style: italic;"&gt;/mnt/windows&lt;/span&gt; pointing at &lt;span style="font-style: italic;"&gt;/mnt/win/win&lt;/span&gt;.&lt;br /&gt;This will allow you to control access to this NTFS partition, remember that you cannot change the permissions for anything that is in the parition.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-3998547669849857756?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/3998547669849857756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=3998547669849857756&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3998547669849857756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/3998547669849857756'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/change-permissions-for-ntfs-3g-mount.html' title='Change permissions for NTFS partition'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6589192707903330103</id><published>2008-06-01T15:53:00.004+02:00</published><updated>2008-06-01T15:57:34.830+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pypentago'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><title type='text'>pyPentago userbar</title><content type='html'>If someone of you has tried out the pyPentago alpha and liked it, I have created a userbar so you can show that you like it.&lt;br /&gt;You can get the alpha version of pyPentago &lt;a href="http://download.gna.org/pypentago/"&gt;here&lt;/a&gt;, please follow the instructions on how to install it.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_RC5izdkAyLo/SEKqE1a05xI/AAAAAAAAAAU/2PUtqg213E0/s1600-h/pyPentago+userbar+copy.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_RC5izdkAyLo/SEKqE1a05xI/AAAAAAAAAAU/2PUtqg213E0/s320/pyPentago+userbar+copy.png" alt="" id="BLOGGER_PHOTO_ID_5206911119229511442" 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/5101636558333041736-6589192707903330103?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6589192707903330103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6589192707903330103&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6589192707903330103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6589192707903330103'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/pypentago-userbar.html' title='pyPentago userbar'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_RC5izdkAyLo/SEKqE1a05xI/AAAAAAAAAAU/2PUtqg213E0/s72-c/pyPentago+userbar+copy.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5101636558333041736.post-6362280329129661717</id><published>2008-06-01T14:24:00.000+02:00</published><updated>2008-06-01T14:25:56.248+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='general'/><title type='text'>New Blog</title><content type='html'>I have opened a blog here on Blogger.&lt;br /&gt;I will write about releases of my software or software I am excited about and my thoughts on different things, mostly computers, I think.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5101636558333041736-6362280329129661717?l=blog.bitsrc.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.bitsrc.org/feeds/6362280329129661717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5101636558333041736&amp;postID=6362280329129661717&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6362280329129661717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5101636558333041736/posts/default/6362280329129661717'/><link rel='alternate' type='text/html' href='http://blog.bitsrc.org/2008/06/new-blog.html' title='New Blog'/><author><name>Florian Mayer</name><uri>http://www.blogger.com/profile/03196339871121984848</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
