<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>tlensing.org blog</title>
	<atom:link href="http://blog.tlensing.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tlensing.org</link>
	<description>Aesthetics, Technology and more</description>
	<pubDate>Mon, 12 Apr 2010 11:43:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Installing Mercurial on a Shared Web Server without Root Access (HostEurope)</title>
		<link>http://blog.tlensing.org/2010/04/12/installing-mercurial-on-a-shared-web-server-without-root-access-hosteurope/</link>
		<comments>http://blog.tlensing.org/2010/04/12/installing-mercurial-on-a-shared-web-server-without-root-access-hosteurope/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 11:27:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Server]]></category>

		<category><![CDATA[DVCS]]></category>

		<category><![CDATA[Mercurial]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[SVN]]></category>

		<category><![CDATA[Version Control]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=165</guid>
		<description><![CDATA[SVN did a great job for me for at least four years now. Lately, I stumbled upon Mercurial and decided to have a closer look. It turned out that Mercurial (also called &#8220;hg&#8221;) comes with some great advantages, namely:

Not a &#8220;Version Control System&#8221; (VCS), but a &#8220;Distributed Version Control System&#8221; (DVCS) enabling you to check [...]]]></description>
			<content:encoded><![CDATA[<p>SVN did a great job for me for at least four years now. Lately, I stumbled upon <a href="http://www.mercurial.org">Mercurial</a> and decided to have a closer look. It turned out that Mercurial (also called &#8220;hg&#8221;) comes with some great advantages, namely:</p>
<ul>
<li>Not a &#8220;Version Control System&#8221; (VCS), but a &#8220;Distributed Version Control System&#8221; (DVCS) enabling you to check in changes locally (offline, without an internet connection). The advantages of this one are also discussed in detail in <a href="http://www.python.org/dev/peps/pep-0374/#usage-scenarios">PEP 374 (Python Foundation)</a>.</li>
<li>Available in pure Python, therefore installable on a standard shared web server without root access (not a virtual server, just a &#8220;web host&#8221;). Thereby cutting my costs of maintaining a root server on my own or being charged by a specialized host for an SVN/VPS plan.</li>
</ul>
<p>This post is a small guide on how to accomplish the mission of installing Mercurial (the pure Python version) on a shared web host. In this exemplary case a &#8220;WebPack Pro&#8221; that we rent from our ISP of choice, HostEurope, is going to be used. However, what is described herein should basically work for any web hosting plan that fulfills the following requirements. This article is therefore most interesting for people who already own a shared web hosting plan and wish to use that plan for hg hosting also.</p>
<p><strong>Requirements</strong></p>
<ul>
<li><a href="http://mercurial.selenic.com/release/mercurial-1.5.1.tar.gz">Source version of Mercurial</a></li>
<li>A shared web server at an arbitrary web host enabling execution of CGI scripts written in Python (HostEurope provides Python 2.4 which appears to be sufficient).</li>
<li><code>mod_python</code> or <code>mod_wsgi</code> (better).</li>
<li>SSH access to that host. This is required to setup Mercurial on your shared web server. No need for root privileges.</li>
</ul>
<p><strong>Installation (Step by Step)</strong></p>
<ol>
<li>Unpack the Mercurial source tarball on your local system.</li>
<li>Create a temporary directory on your web server and transfer the extracted Mercurial source tree to that directory. You can do so via SSH or FTP.</li>
<li>SSH into the server (if you did not so already) and create a top-level directory named &#8220;python&#8221;. This is going to hold all the Python modules you would like to use, but which are not currently installed on the server&#8217;s root Python distribution.</li>
<li>Change to the Mercurial source directory and build the module in pure Python mode (instructions adopted from <a href="http://mercurial.selenic.com/wiki/WindowsInstall#Building_pure_Python_alternative">Mercurial Wiki</a>) :
<pre>
$ python setup.py --pure build_py -c -d . build_ext -i build_mo --force
</pre>
</li>
<li>Likewise, install the module. Here, it is essential to enter the correct prefix path, as you want an <a href="http://docs.python.org/install/#alternate-installation-unix-the-prefix-scheme">alternate installation following the prefix scheme</a>, not a standard installation. Please specify the path to your &#8220;python&#8221; directory, which you created in step 3 (in my case this is &#8220;../../python&#8221;):
<pre>
$ python setup.py --pure install --prefix ../../python --force
</pre>
</li>
<li>If everything went well <code>setup.py</code> has installed the Mercurial module files to <code>python/lib/python2.4/site-packages</code> and the <code>hg</code> binary to <code>python/bin</code>.</li>
<li>In order to get the <code>hg</code> binary running via SSH you have to export your custom <code>PYTHONPATH</code> so Python knows where to look for the hg modules. Via SSH go to your home directory on the web host and create a <code>.bash_profile</code> file as follows:
<pre>
$ cd ~
$ touch .bash_profile
</pre>
<p>Open the file in a text editor and add the following line to it (adjust the path so that it fits your configuration):</p>
<pre>
export PYTHONPATH=/is/htdocs/wpXXXXX_XXX/python/lib/python2.4/site-packages
</pre>
<p>In order to make <code>hg</code> accessible from any directory within the shell, add the following line (adjust path corresponding to your environment again):</p>
<pre>
export PATH=/is/htdocs/wpXXXXX_XXX/python/bin:$PATH
</pre>
</li>
<li>Logout and login again via SSH. Type <code>hg</code>. If you get the Mercurial Distribution SCM help screen you now have finished installation and are ready to go for setting up Mercurial web access.</li>
</ol>
<p><strong>Setting up hgwebdir.cgi</strong></p>
<ol>
<li>First of all, create a directory on your webspace for hg. This directory must be reachable via HTTP. You may also want to set up a subdomain, e.g. hg.yourdomain.com and link that to your hg web directory.</li>
<li>Get hgwebdir.cgi from the root of the Mercurial source tree or <a href="http://www.selenic.com/repo/hg-stable/raw-file/tip/hgwebdir.cgi">download hgwebdir.cgi from the Mercurial website</a>, upload it to your hg directory and rename it to <code>index.cgi</code>.</li>
<li>Make sure your web host is configured appropriately to handle .cgi files and index.cgi files. (You should be able to configure these settings in the scripts settings of your ISP&#8217;s administrative UI.)</li>
<li>Open index.cgi using your text editor of choice. It is a good idea to check the script environment statement that is located in the first line of the file. It should look like the following:
<pre>
#!/usr/bin/env python
</pre>
<p>This should work on most servers. However, if your python binary is not linked (or located) in /usr/bin/python you may have to correct for this.</li>
<li>Find the following comment <code># enable importing on demand to reduce startup time</code>. Beneath the comment line there should be two commented lines. Change these lines to something like this:
<pre>
import sys
sys.path.insert(0, "/is/htdocs/wpXXXXX_XXX/python/lib/python2.4/site-packages")
</pre>
<p>Replace the absolute path to the site-packages directory with your own one.
</li>
<li>If everything works as intended, the script should now be callable via HTTP. Enter the address of your hg web directory into your web browser and check whether the script runs correctly.</li>
</ol>
<p><strong>Setting Up Your First Repository and Configuring hgweb.config</strong></p>
<ol>
<li>Via SSH you can setup a first test repository like this:
<pre>
$ cd /path/to/www/hg
$ hg init test
</pre>
<p>hg will create a directory named <code>test</code> and place a <code>.hg</code> subdirectory in it containing repository-specific configuration and payload data.
</li>
<li><code>hgwebdir.cgi</code> has to know which repositories to serve. You tell this by creating a file named <code>hgweb.config</code>. Simply put the config file into the directory of <code>hgwebdir.cgi</code>.</li>
<li>Open the config file with a text editor and add the following lines:
<pre>
[paths]
test=test
</pre>
<p>Note: more info on how to configure <code>hgwebdir.cgi</code> can be found on <a href="http://mercurial.selenic.com/wiki/HgWebDirStepByStep">HgWebDirStepByStep</a> (in the Mercurial Wiki).
</li>
<li>Finally, the repository itself needs some configuration. In <code>test/.hg</code> create a new file named <code>hgrc</code> and add the following lines to it:
<pre>
[ui]
user = Firstname Lastname <mail@yourdomain.com>

[web]
push_ssl = false
allow_push = *
</pre>
<p>This will register a first user, allow for HTTP pushing, and allow pushing for everyone (we will take care of security later on).
</li>
<li>That&#8217;s it. Your first repository is served via Mercurial on your shared web host.</li>
</ol>
<p><strong>Testing the Whole Thing</strong></p>
<p>You may want to do a simple test to check whether your repository is working and you are able to pull and push changes as intended. You can do so by opening a terminal and type something like the following:</p>
<pre>
$ hg clone http://hg.yourdomain.com/index.cgi/test
$ cd test
$ touch testfile
$ echo "This is just a test" > testfile
$ hg add testfile
$ hg commit -m 'Testing...' -u username
$ hg push
</pre>
<p>If everything went right, this should add the file <code>testfile</code> to the repository root and push it to the web server.</p>
<p>For now, you hopefully have a working Mercurial repository directory service up and running on your shared web host. However, there are two major flaws. Firstly, the repository address is not as beautiful as it could be, because of the <code>index.cgi</code> contained in any path. Secondly, the repositories are accessible for everyone. We will fix these issues in what follows.</p>
<p><strong>Beautifying hgwebdir Paths</strong></p>
<p>In order to strip <code>index.cgi</code> from the repository URLs we will have to use <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewrite</a> (and your server needs to support that apache module).</p>
<p>Go to your hg webdir root directory and create a file named <code>.htaccess</code>. Open the file in a text editor and add the following lines:</p>
<pre>
# Taken and adapted from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
RewriteEngine On
#write base depending on where the base url lives
RewriteBase /
RewriteRule ^$ index.cgi  [L]
# Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f
# Send requests to hgwebdir.cgi, appending the rest of url.
RewriteRule (.*) index.cgi/$1  [QSA,L]
</pre>
<p>Note: this apache script rewrites URLs so that any <code>directory</code> queried in the form <code>hg.yourdomain.com/directory</code> is automatically rewritten to <code>hg.yourdomain.com/index.cgi/directory</code> internally. Consequently, users can omit disturbing repetitive typing of <code>index.cgi</code> in hg repository URLs. Please note that you may have to adapt <code>RewriteBase</code> to your specific server environment. If you do not serve hg repositories via a subdomain you should specify the relative base directory of your hg webdir here instead (this may e.g. be <code>/hg</code> if you serve hg repositories via <code>www.yourdomain.com/hg</code>). The approach is also discussed in <a href="http://mercurial.selenic.com/wiki/PublishingRepositories#Publishing_Multiple_Repositories">PublishingMultipleRepositories</a> on the Mercurial Wiki.</p>
<p><strong>Securing hgwebdir</strong></p>
<p>You can secure your hg web directory in multiple ways. You may want to allow pulling by anyone and pushing only to specific core developers. Detailed information about hg authentication can be found on <a href="http://mercurial.selenic.com/wiki/PublishingRepositories#Publishing_Multiple_Repositories">PublishingMultipleRepositories</a>. </p>
<p>However, my intention is to have private repositories, which I share only with my friends (no public pulling). Me and my friends will use HTTP authentication and I will create a user and password for everyone who is allowed to pull and push. Fortunately, this scenario is relatively simple to configure for everyone who knows about apache authentication configuration using htaccess files.</p>
<p>First of all, use <i>htpasswd</i> to create a password file for hg users. Name the file <code>.hgusers</code> and place it in a location that is not accessible via HTTP. For example, you may want to do it this way:</p>
<pre>
$ cd /private-path
$ htpasswd -c hgusers username
Enter password twice, etc...
</pre>
<p>Since we already have a <code>.htaccess</code> file, it is even more simple. Re-open the file using a text editor and add the following lines at the end of the file:</p>
<pre>
# Authentication
AuthName "Please enter your username and password."
AuthType Basic
Require valid-user
AuthUserFile /is/htdocs/wpXXXXX_XXX/.hgusers
</pre>
<p>Please change the path to the <code>.hgusers</code> file conforming to your server environment.</p>
<p>Congratulations! You now have a running, secured, beautified, pure-python hg repository server on your cheap web hosting account.</p>
<p><strong>Remarks</strong><br />
Building Mercurial in pure Python may have drawbacks in terms of performance. This has more thoroughly been discussed on the Mercurial mailing list, see <a href="http://www.selenic.com/pipermail/mercurial/2009-March/024334.html">mailing list archive on pure python Mercurial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2010/04/12/installing-mercurial-on-a-shared-web-server-without-root-access-hosteurope/feed/</wfw:commentRss>
		</item>
		<item>
		<title>openFrameworks 006 Python Binding? Sorry guys, not yet</title>
		<link>http://blog.tlensing.org/2009/06/30/openframeworks-006-python-binding-sorry-guys-not-yet/</link>
		<comments>http://blog.tlensing.org/2009/06/30/openframeworks-006-python-binding-sorry-guys-not-yet/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:19:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Creative Coding]]></category>

		<category><![CDATA[openframeworks]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=153</guid>
		<description><![CDATA[First, I&#8217;d like to apologize for the long time I wasn&#8217;t blogging anything. I was working on my M.Sc. Thesis which is now finished. Btw.: we used of005 for the visualization part of a fancy machine learning experiment. Perhaps you are interested in it. The doc is online here.
However, the actual reason why I type [...]]]></description>
			<content:encoded><![CDATA[<p>First, I&#8217;d like to apologize for the long time I wasn&#8217;t blogging anything. I was working on my M.Sc. Thesis which is now finished. Btw.: we used of005 for the visualization part of a fancy machine learning experiment. Perhaps you are interested in it. The doc is online <a href="http://tlensing.org/pub">here</a>.</p>
<p>However, the actual reason why I type all this is that a lot of people have asked me whether I am about to provide an update of the openFrameworks 005 binding since 006 has been released. I am sorry to say that even though I plan to do so, I do not have the time to do it right now. What&#8217;s more, I don&#8217;t really know how long it will take, as there are some major changes in this of release.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2009/06/30/openframeworks-006-python-binding-sorry-guys-not-yet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WhyNotUnmount 0.3 Beta</title>
		<link>http://blog.tlensing.org/2008/12/18/whynotunmount-03-beta/</link>
		<comments>http://blog.tlensing.org/2008/12/18/whynotunmount-03-beta/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 18:03:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[WhyNotUnmount]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=145</guid>
		<description><![CDATA[WhyNotUnmount 0.3 is out now. Version 0.3 provides a number of stability improvements (multi-threading issues were fixed), improved unmounting of volumes, automatic list updating on device mounting / unmounting, and finally, several updated user interface details.
WhyNotUnmount works on Mac OS X 10.4 (Tiger) and 10.5 (Leopard) and comes as a Universal Binary.
For more information on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tlensing.org/pub/downloads/WhyNotUnmount0.3.dmg"><img src="http://blog.tlensing.org/wp-content/uploads/2008/11/stylehdicon100.png" style="margin-right: 15px;" alt="WhyNotUnmount" align="left"/></a>WhyNotUnmount 0.3 is out now. Version 0.3 provides a number of stability improvements (multi-threading issues were fixed), improved unmounting of volumes, automatic list updating on device mounting / unmounting, and finally, several updated user interface details.</p>
<p>WhyNotUnmount works on Mac OS X 10.4 (Tiger) and 10.5 (Leopard) and comes as a Universal Binary.</p>
<p>For more information on what the application does, please see the <a href="http://blog.tlensing.org/2008/11/12/whynotunmount-v01-%e2%80%93-prerelease-alpha/">original post on WhyNotUnmount</a>.</p>
<p><a href="http://www.tlensing.org/pub/downloads/WhyNotUnmount0.3.dmg">Download WhyNotUnmount</a> (DMG, 315 KB, Freeware)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/12/18/whynotunmount-03-beta/feed/</wfw:commentRss>
		</item>
		<item>
		<title>openFrameworks 005 Python Binding for OS X 10.5 Leopard</title>
		<link>http://blog.tlensing.org/2008/12/17/openframeworks-005-python-binding-for-os-x-105/</link>
		<comments>http://blog.tlensing.org/2008/12/17/openframeworks-005-python-binding-for-os-x-105/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 09:11:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Creative Coding]]></category>

		<category><![CDATA[binding]]></category>

		<category><![CDATA[leopard]]></category>

		<category><![CDATA[openframeworks]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=137</guid>
		<description><![CDATA[
A new openFrameworks-Python Binding for OS X 10.5 is finally available for download. The new binding comes with an Xcode project including the openFrameworks 005 source code and required libraries plus an example of how to use the binding. As in the previous versions, after building the binding using Xcode, you may run the test [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.tlensing.org/wp-content/uploads/2008/12/of.jpg" alt="" /></p>
<p>A new <a href="http://www.tlensing.org/pub/downloads/of005python.zip">openFrameworks-Python Binding for OS X 10.5</a> is finally available for download. The new binding comes with an Xcode project including the openFrameworks 005 source code and required libraries plus an example of how to use the binding. As in the previous versions, after building the binding using Xcode, you may run the test example as follows: open up a terminal, go to the build/release directory of the binding and type: &#8216;python animation.py&#8217;. The example script should run out of the box. If it does not please don&#8217;t hesitate to contact me.</p>
<p>Note: for those who want to build the binding for OS X 10.4, please see the readme file contained in the package. It contains hints on how to build the project using the 10.4 SDK.</p>
<p>Requirements: OS X 10.5.5, Xcode 3.1.1+, SWIG, Python 2.5(+)<br />
<a href="http://www.tlensing.org/pub/downloads/of005python.zip">Download openFrameworks-Python Binding for OS X 10.5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/12/17/openframeworks-005-python-binding-for-os-x-105/feed/</wfw:commentRss>
		</item>
		<item>
		<title>openFrameworks-0.04-Python Live Coding POC Reloaded</title>
		<link>http://blog.tlensing.org/2008/12/12/openframeworks-004-python-live-coding-poc-reloaded/</link>
		<comments>http://blog.tlensing.org/2008/12/12/openframeworks-004-python-live-coding-poc-reloaded/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 06:38:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Creative Coding]]></category>

		<category><![CDATA[live coding]]></category>

		<category><![CDATA[openframeworks]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=133</guid>
		<description><![CDATA[Recently I presented the openFrameworks-Python live coding proof of concept on this blog. Unfortunately, the first version was quite unstable, because code changes introducing syntax errors would crash the running application framework.
This has now been solved as suggested by Maddi with an exception handling block. That is, as soon as draw.py has syntax errors in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I presented the <a href="http://blog.tlensing.org/2008/11/20/openframeworks-live-coding-proof-of-concept/">openFrameworks-Python live coding proof of concept</a> on this blog. Unfortunately, the first version was quite unstable, because code changes introducing syntax errors would crash the running application framework.</p>
<p>This has now been solved as suggested by Maddi with an exception handling block. That is, as soon as draw.py has syntax errors in it, the draw code&#8217;s exception is caught by the Python code in animation.py. Rendering stops under this condition, but does not crash the framework. What is more the type of exception is outputted on stdout. As soon as the error is corrected, rendering is automatically resumed.</p>
<p>Unfortunately stderr is still redirected to nirvana inside the overridden functions called by the openframeworks library. I appreciate any suggestions on this issue.</p>
<p>&raquo; <a href="http://www.tlensing.org/pub/downloads/of0.04-live-coding-poc2.zip">Download openFrameworks-0.04-Python Live Coding POC</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/12/12/openframeworks-004-python-live-coding-poc-reloaded/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Kill PIL – The Python Imaging Library Headache or Building PIL on Mac OS X</title>
		<link>http://blog.tlensing.org/2008/12/04/kill-pil-%e2%80%93-the-python-imaging-library-headache/</link>
		<comments>http://blog.tlensing.org/2008/12/04/kill-pil-%e2%80%93-the-python-imaging-library-headache/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 07:26:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Creative Coding]]></category>

		<category><![CDATA[Information Visualization]]></category>

		<category><![CDATA[imaging]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[PIL]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=124</guid>
		<description><![CDATA[
Pythonware&#8217;s PIL, the Python Imaging Library, is an extension to Python enabling you to process and arrange images quickly. It supports the popular JPEG and PNG image formats and provides font rendering using the freetype2 library. Unfortunately, PIL is not included in the standard Python environment on Mac OS X 10.4/10.5, so you have to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.tlensing.org/wp-content/uploads/2008/12/pilclusters.jpg" alt="PIL Clusters" /></p>
<p><a href="http://www.pythonware.com/products/pil/">Pythonware&#8217;s PIL</a>, the Python Imaging Library, is an extension to Python enabling you to process and arrange images quickly. It supports the popular JPEG and PNG image formats and provides font rendering using the freetype2 library. Unfortunately, PIL is not included in the standard Python environment on Mac OS X 10.4/10.5, so you have to <a href="http://effbot.org/downloads/Imaging-1.1.6.tar.gz">download</a> and build it.</p>
<p>First of all, you might find that there is plenty of forum/blog posts, articles etc. on the web attempting to provide useful instructions on how to build and install PIL in the right fashion. However, I found that most of them are telling different things and so I didn&#8217;t really trust them. I tried a lot and basically all of them failed. I am going to explain now, why that was.</p>
<p>Following the README what you need in advance is: libjpeg (6b), libpng3 and freetype2. You can get these using <a href="http://www.finkproject.org/">fink</a> or <a href="http://www.macports.org/">MacPorts</a>. Since I don&#8217;t like my machine to re-compile all the stuff that is easily available in a binary form, I used fink.</p>
<p>After installing the required libraries via fink I tried to build PIL using the command as described in the README file:</p>
<p><code>
<pre>$ python setup.py install</pre>
<p></code></p>
<p>&hellip; and all I got was a lousy:</p>
<p><code>
<pre>--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 supported not available</pre>
<p></code></p>
<p>It turned out that the setup.py file did for some reason not search the correct directories for the freetype2 library. Fixing this is quite easy: just set</p>
<p><code>
<pre>FREETYPE_ROOT = "/sw/lib/freetype2/lib"</pre>
<p></code></p>
<p>Note: This does only apply as long as you use fink. MacPorts directories differ!</p>
<p>I again built PIL using the setup.py install command. Everything seemed OK this time. So, as suggested by the installer script, I tried to run PIL&#8217;s self test now using</p>
<p><code>
<pre>python selftest.py</pre>
<p></code></p>
<p>which would result in</p>
<p><code>
<pre>Failure in example: _info(Image.open("Images/lena.jpg"))
from line #24 of selftest.testimage
Exception raised:
Traceback (most recent call last):
  File "./doctest.py", line 499, in _run_examples_inner
    exec compile(source, "<string>", "single") in globs
  File "<string>", line 1, in <module>
  File "./selftest.py", line 22, in _info
    im.load()
  File "PIL/ImageFile.py", line 180, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "PIL/Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
1 items had failures:
   1 of  57 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 57 failed.</pre>
<p></code></p>
<p>I googled and googled and found a lot of similar results, but no answers unfortunately. After some time I realized that PIL would run from any other directory, but only the selftest.py failed. The reason for this is that in the Imaging-1.1.6 directory there is a PIL.pth file and a PIL subdirectory. Python picks these up and tries to run PIL from there. Of course this cannot succeed, since the library is not built properly for our system there. The solution is to delete both the PIL subdirectory and the PIL.pth file and there it goes – the self test runs through without any failures.</p>
<p>Hope I have saved you some valuable time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/12/04/kill-pil-%e2%80%93-the-python-imaging-library-headache/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Nose Gestures</title>
		<link>http://blog.tlensing.org/2008/12/04/iphone-nose-gestures/</link>
		<comments>http://blog.tlensing.org/2008/12/04/iphone-nose-gestures/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 06:30:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Fun]]></category>

		<category><![CDATA[HCI]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=118</guid>
		<description><![CDATA[
When it gets really cold in winter and you find your hands wrapped in thick gloves, it&#8217;s not that easy to pick up an iPhone call fast enough. CHCH.cc has a great solution on MacOSXHints.com: use your nose!  I have googled around a bit to find some illustration of this (see YouTube video above).
Of [...]]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="320"><param name="movie" value="http://www.youtube.com/v/-bcss9rRlAw&#038;hl=de&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-bcss9rRlAw&#038;hl=de&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="320"></embed></object></p>
<p>When it gets really cold in winter and you find your hands wrapped in thick gloves, it&#8217;s not that easy to pick up an iPhone call fast enough. CHCH.cc has a great solution on MacOSXHints.com: <a href="http://www.macosxhints.com/article.php?story=20081120142756793">use your nose</a>! <img src='http://blog.tlensing.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> I have googled around a bit to find some illustration of this (see YouTube video above).</p>
<p>Of course there are alternative solutions. For instance: <a href="http://dotsgloves.com/">iPhone-enabled Dots Gloves</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/12/04/iphone-nose-gestures/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WhyNotUnmount 0.2 (Alpha Prerelease)</title>
		<link>http://blog.tlensing.org/2008/11/21/whynotunmount-02-alpha-prerelease/</link>
		<comments>http://blog.tlensing.org/2008/11/21/whynotunmount-02-alpha-prerelease/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 10:11:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[WhyNotUnmount]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=105</guid>
		<description><![CDATA[WhyNotUnmount 0.2 has been released today. A number of bugs are fixed now. WhyNotUnmount will now display all blocking processes regardless of whether they are UI or system processes.
For more information on what the program does, please see the original post on WhyNotUnmount.
Download WhyNotUnmount (DMG, 530 KB, Freeware)
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tlensing.org/pub/downloads/WhyNotUnmount0.2.dmg"><img src="http://blog.tlensing.org/wp-content/uploads/2008/11/stylehdicon100.png" style="margin-right: 15px;" alt="WhyNotUnmount" align="left"/></a>WhyNotUnmount 0.2 has been released today. A number of bugs are fixed now. WhyNotUnmount will now display all blocking processes regardless of whether they are UI or system processes.</p>
<p>For more information on what the program does, please see the <a href="http://blog.tlensing.org/2008/11/12/whynotunmount-v01-%e2%80%93-prerelease-alpha/">original post on WhyNotUnmount</a>.</p>
<p><a href="http://www.tlensing.org/pub/downloads/WhyNotUnmount0.2.dmg">Download WhyNotUnmount</a> (DMG, 530 KB, Freeware)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/11/21/whynotunmount-02-alpha-prerelease/feed/</wfw:commentRss>
		</item>
		<item>
		<title>openFrameworks Live Coding Proof of Concept</title>
		<link>http://blog.tlensing.org/2008/11/20/openframeworks-live-coding-proof-of-concept/</link>
		<comments>http://blog.tlensing.org/2008/11/20/openframeworks-live-coding-proof-of-concept/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 08:26:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Creative Coding]]></category>

		<category><![CDATA[live coding]]></category>

		<category><![CDATA[openframeworks]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=91</guid>
		<description><![CDATA[
Recently I promised to write another post on what cool stuff can be done with the openFrameworks-Python binding. Besides the fact that being able to quickly write openFrameworks apps with Python is cool enough actually, Python is an interpreted language and does therefore enable us to execute and change code dynamically &#8212; even at runtime. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.tlensing.org/wp-content/uploads/2008/11/lifecoding-large1.jpg"><img src="http://blog.tlensing.org/wp-content/uploads/2008/11/lifecoding-small1.jpg" alt="Live Coding OF Proof of Concept"  class="withborder"/></a></p>
<p>Recently I promised to write another post on what cool stuff can be done with the <a href="http://blog.tlensing.org/2008/10/22/openframeworks-vs-python/">openFrameworks-Python binding</a>. Besides the fact that being able to quickly write openFrameworks apps with Python is cool enough actually, Python is an interpreted language and does therefore enable us to execute and change code dynamically &mdash; even at runtime. Hence, an obvious purpose for using this feature is live coding.</p>
<p>In order to get us there, modifications need to be made to the original source code of <em>animation.py</em>. More precisely, the draw function of the testApp class has to be changed to something like this:<br />
<code>
<pre>
def draw(self):
    file = open(oscwd + '/draw.py', 'r')
    source = file.read()
    exec(source)
    file.close()
</pre>
<p></code>This code snippet loads the file <em>draw.py</em> located in the current working directory, which has previously been stored to a variable called <em>oscwd</em>. <em>draw.py</em> is going to contain the actual code responsible for rendering the openFrameworks scene. As you can see on the <a href="http://blog.tlensing.org/wp-content/uploads/2008/11/lifecoding-large1.jpg">screenshot</a> you can now start <em>animation.py</em>, fire up a code editor (in this case Xcode) to edit draw.py and begin live coding. As soon as you save your changes to the draw.py file the modified code will be executed in the animation.py application.</p>
<p>So far so good, but there are still some issues: for some reason (which I will explain later) the code inside the testApp class has a different Python environment than the surrounding code. This causes stdout / stderr to be redirected into nirvana (what ever you try to put on stdout inside the class will not appear in the shell; errors in your code will not be prompted either). What is more, the os and sys functions do not work properly here. This is the reason why I temporarily stored os.getcwd() in the oscwd variable of the animation module. Finally, the execution of the whole application will be broken as soon as you save draw.py with syntax errors (and as mentioned previously, stderr will not be prompted on the shell in this case). Consequently, the whole approach is still quite unstable and should therefore be considered a POC.</p>
<p><a href="http://www.tlensing.org/pub/downloads/of0.04-live-coding-poc.zip">Download the live coding POC files</a> (ZIP file, 5.1 MB, requires Mac OS X 10.4.11+ and Python 2.5)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/11/20/openframeworks-live-coding-proof-of-concept/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WhyNotUnmount v0.1 – Prerelease Alpha</title>
		<link>http://blog.tlensing.org/2008/11/12/whynotunmount-v01-%e2%80%93-prerelease-alpha/</link>
		<comments>http://blog.tlensing.org/2008/11/12/whynotunmount-v01-%e2%80%93-prerelease-alpha/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 10:01:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[OS X]]></category>

		<category><![CDATA[WhyNotUnmount]]></category>

		<guid isPermaLink="false">http://blog.tlensing.org/?p=78</guid>
		<description><![CDATA[
WhyNotUnmount is a small project which I have started to make life a little bit easier for all those people carrying external hard drives with their MacBook. Of course, it is suitable for all other kinds of Macs also. WhyNotUnmount attempts to tell you why a certain (external) hard drive, DMG or other volume cannot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tlensing.org/pub/downloads/whynotunmount0.1.zip"><img src="http://blog.tlensing.org/wp-content/uploads/2008/11/whynotunmount2.gif" alt="WhyNotUnmount Screenshot" class="withborder"/></a></p>
<p><a href="http://www.tlensing.org/pub/artefacts/whynotunmount.html">WhyNotUnmount</a> is a small project which I have started to make life a little bit easier for all those people carrying external hard drives with their MacBook. Of course, it is suitable for all other kinds of Macs also. WhyNotUnmount attempts to tell you why a certain (external) hard drive, DMG or other volume cannot be unmounted. In most cases this is because a file on that disk remains opened by an application on your Mac. WhyNotUnmount tells you which Application prevents your volume from being unmounted properly.</p>
<p>The application is currently in alpha (prerelease) state, which means that there may still be a number of bugs and – more importantly – that it may not always detect the correct reason for why unmounting is not possible. I am working on these issues at the moment. However, WhyNotUmmount is freeware, so it may take a little while until it is completely stable. In the meantime enjoy the early version!</p>
<p>Requirements:<br />
Mac OS X 10.4 (Tiger) or 10.5 (Leopard).<br />
<a href="http://www.tlensing.org/pub/artefacts/whynotunmount.html">Details on the artefacts page</a> / <a href="http://www.tlensing.org/pub/downloads/whynotunmount0.1.zip">Direct download</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlensing.org/2008/11/12/whynotunmount-v01-%e2%80%93-prerelease-alpha/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
