<?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>#{Unspecific}</title>
	<atom:link href="http://www.knauel.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.knauel.org/blog</link>
	<description>No values returned</description>
	<pubDate>Sat, 07 Oct 2006 15:13:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Myscsh 0.1</title>
		<link>http://www.knauel.org/blog/2006/10/07/myscsh-01/</link>
		<comments>http://www.knauel.org/blog/2006/10/07/myscsh-01/#comments</comments>
		<pubDate>Sat, 07 Oct 2006 15:13:19 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/2006/10/07/myscsh-01/</guid>
		<description><![CDATA[I&#8217;m pleased to announce the release of the first version of Myscsh.
Myscsh is an implementation of the MySQL client/server protocol written entirely in Scheme.  This package provides functions to connect to a MySQL database server, authenticate, send queries, and receive and parse result sets.  The API is quite low-level: it&#8217;s just about reading [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the release of the first version of Myscsh.</p>
<p>Myscsh is an implementation of the MySQL client/server protocol written entirely in Scheme.  This package provides functions to connect to a MySQL database server, authenticate, send queries, and receive and parse result sets.  The API is quite low-level: it&#8217;s just about reading and parsing messages and sending messages.  Thus, using the low-level API of Myscsh requires a bit of knowledge of the MySQL client/server protocol.</p>
<p>Future versions of Myscsh will include a higher-level API for convenient database programming.  Myscsh implements the MySQL 4.1 protocol (which has the internal protocol version number 10) and has been tested in conjunction with a MySQL 4.1 server on Linux. It might work with a 5.x server as well, but that&#8217;s completely untested.  It won&#8217;t work with 3.20 servers, that&#8217;s for sure.</p>
<p><strong>Download</strong></p>
<p>The latest version is available at</p>
<p><a href="http://www-pu.informatik.uni-tuebingen.de/users/knauel/myscsh/">http://www-pu.informatik.uni-tuebingen.de/users/knauel/myscsh/</a></p>
<p><strong>Why an implementation of the protocol?</strong></p>
<p>An alternative approach for connecting to MySQL is to use the C library libmysqlclient.so.  A lot of language implementations provide bindings to this library.  Hence, this is a well-tested approach.  However, here<br />
are some reasons for implementing the protocol in Scheme:</p>
<ul>
<li>No C code to compile, no header files to search for, no shared libraries to search for, and no dynamic modules to load.  Less high-tech, less trouble.</li>
<li>In scsh and Scheme 48, calling C functions from Scheme blocks the whole Scheme system until the C function returns.  Hence, sending a complex query to MySQL using the corresponding C function will stop all Scheme threads until the SQL result is available.  This is not acceptable, especially since the SQL queries may take seconds to compute.  There is no easy way to fix this.</li>
<li>The Scheme code is quite portable and could be used by other Scheme implementations.  The code only uses very few Scheme 48 or scsh specific features, i. e. for network connections.</li>
<li>Writing C bindings is boring.  I have written too much C bindings in the past years.</li>
</ul>
<p>Implementing the protocol is not a particular original idea: For example, there is a Ruby implementation of the 3.20 protocol.</p>
<p><strong>Source code repository</strong></p>
<p>The latest version of the source code resides in a darcs repository at the following address:</p>
<p><a href="http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/">http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/<br />
</a></p>
<p><strong>Known bugs, limitations</strong></p>
<p>Some things that may cause trouble:</p>
<ul>
<li>The code completely ignores character encoding issues.  It just assumes that the character encoding the Scheme system is using is the right one for communicating with the server.  This works in many cases, but is a bad idea in principal.</li>
</ul>
<p>Some things that have not been implemented or tested yet:</p>
<ul>
<li>receiving result sets that contain binary values</li>
<li>repared statements, parameter messages, and long data packets</li>
<li>compression</li>
</ul>
<p><strong>Future work</strong></p>
<ul>
<li>Write some documentation</li>
<li>Add a high-level API for convenient database programming</li>
<li>Better error-handling using SRFI 34 and SRFI 35</li>
</ul>
<p>Technorati Tags: <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/MySQL" rel="tag"> MySQL</a>, <a href="http://technorati.com/tag/Protocol" rel="tag"> Protocol</a>, <a href="http://technorati.com/tag/Scheme+48" rel="tag"> Scheme 48</a>, <a href="http://technorati.com/tag/scsh" rel="tag"> scsh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/10/07/myscsh-01/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finally, MySQL client auth messages</title>
		<link>http://www.knauel.org/blog/2006/08/21/finally-mysql-client-auth-messages/</link>
		<comments>http://www.knauel.org/blog/2006/08/21/finally-mysql-client-auth-messages/#comments</comments>
		<pubDate>Mon, 21 Aug 2006 12:53:49 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=55</guid>
		<description><![CDATA[Finally, I have had some time to finish the Scheme code that generates the MySQL client auth protocol messages. The SHA1 implementation seems to work fine, although it&#8217;s quite slow: The specification contains a test case that consists of calculating the hash value of one million a characters. This test took 35 minutes on a [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, I have had some time to finish the Scheme code that generates the MySQL client auth protocol messages. The SHA1 implementation seems to work fine, although it&#8217;s quite slow: The <a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm">specification</a> contains a test case that consists of calculating the hash value of one million <tt>a</tt> characters. This test took 35 minutes on a 3 GHz Pentium III processor&#8230; So, you probably don&#8217;t want to replace <tt>/sbin/sha1</tt> with the Scheme implementation yet&#8230;</p>
<p>However, for small messages, such as the MySQL passwords, the implementation is fast enough.  Next on my list: Generating query messages and reading replies. Doesn&#8217;t look too complicated.  Here&#8217;s my code (as a <a href="http://www.darcs.net">darcs</a> repository):</p>
<p><tt><a href="http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/">http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/</a></tt></p>
<p>Technorati Tags: <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/MySQL" rel="tag">MySQL</a>, <a href="http://technorati.com/tag/SHA1" rel="tag">SHA1</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/08/21/finally-mysql-client-auth-messages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SHA1 in Scheme</title>
		<link>http://www.knauel.org/blog/2006/08/13/sha1-in-scheme/</link>
		<comments>http://www.knauel.org/blog/2006/08/13/sha1-in-scheme/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 12:53:06 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=54</guid>
		<description><![CDATA[News on my favorite low priority, by the way project: a pure Scheme implementation of the MySQL protocol.  Login for user accounts without passwords seems to work fine.  The next thing is to implement the MySQL password algorithm.   This involves the SHA1 cryptographic hash functions.  There are plenty of implementations [...]]]></description>
			<content:encoded><![CDATA[<p>News on my favorite low priority, by the way project: a pure Scheme implementation of the MySQL protocol.  Login for user accounts without passwords seems to work fine.  The next thing is to implement the MySQL password algorithm.   This involves the SHA1 cryptographic hash functions.  There are plenty of implementations in C which I could have used via FFI bindings.  However, I didn&#8217;t like the idea of an &#8220;impure&#8221; part in the protocol implementation. Especially not, if the impure part only does some integer arithmetic.</p>
<p>So, I wrote an SHA1 implementation in Scheme.  This was a quite nice experience, SHA1 deals with 512 bit message blocks which can easily represented as a bignum in Scheme.  The code for chopping the input message into 512 bit blocks is still not complete (preprocessing the message is actually an annoying task), but once this works I hope I can login into MySQL with a password.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/MySQL" rel="tag">MySQL</a>, <a href="http://technorati.com/tag/SHA1" rel="tag">SHA1</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/08/13/sha1-in-scheme/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Universal Floating Errors</title>
		<link>http://www.knauel.org/blog/2006/08/01/universal-floating-errors/</link>
		<comments>http://www.knauel.org/blog/2006/08/01/universal-floating-errors/#comments</comments>
		<pubDate>Tue, 01 Aug 2006 12:52:07 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[OS X]]></category>

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

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=53</guid>
		<description><![CDATA[I&#8217;m pretty happy with MacBookPro: For me the transition to an Intel based Mac worked very well.  Not problems at all.  So far. Till now. This one is really scary:
Welcome to Scheme 48 1.3 (made by knauel on Sat Apr  1 18:38:35 MST 2006)
[...]
&#62; (* 3 1.0)
5.307579804e-315
The scary thing is that this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty happy with MacBookPro: For me the transition to an Intel based Mac worked very well.  Not problems at all.  So far. Till now. This one is really scary:</p>
<pre><code>Welcome to Scheme 48 1.3 (made by knauel on Sat Apr  1 18:38:35 MST 2006)
[...]
&gt; (* 3 1.0)
5.307579804e-315</code></pre>
<p>The scary thing is that this only happens when I use the <a rel="tag" href="http://www.technorati.com/tags/UniversalBinary">universal binary</a> of <a rel="tag" href="http://www.technorati.com/tags/Scheme48">Scheme48 1.3</a> on a PPC system&#8212;the same calculation with exactly the same binary on the MacBookPro yields the correct result. A PPC binary on a PPC machine also calculates the correct result&#8230;</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/Scheme48" rel="tag">Scheme48</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/08/01/universal-floating-errors/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Binary parsing and ASN.1</title>
		<link>http://www.knauel.org/blog/2006/07/30/binary-parsing-and-asn1/</link>
		<comments>http://www.knauel.org/blog/2006/07/30/binary-parsing-and-asn1/#comments</comments>
		<pubDate>Sun, 30 Jul 2006 12:51:36 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=52</guid>
		<description><![CDATA[The semester has ended; time to prepare the next semester. Two weeks ago I conducted a lot of job interviews with students applying as TAs for the introduction course &#8220;Informatik I&#8221; starting in October. There was a gap of about 5 to 10 minutes after each interview&#8212;too few time to something reasonable.  So I [...]]]></description>
			<content:encoded><![CDATA[<p>The semester has ended; time to prepare the next semester. Two weeks ago I conducted a lot of job interviews with students applying as TAs for the introduction course &#8220;Informatik I&#8221; starting in October. There was a gap of about 5 to 10 minutes after each interview&#8212;too few time to something reasonable.  So I spent the time on a low-priority project: an implementation of the MySQL protocol for Scheme.  Well, even though I normally enjoy hacking low-level stuff, I wish I had more tool support.  For example, I wish I had an <a href="http://asn1.elibel.tm.fr/">ASN.1</a> compiler for Scheme.  I really would like to be able to write a ASN.1 notation of the packet and turn this description into a Scheme function which parses the packet. This would be even cooler than better binary parsing functions. An ASN.1 compiler for Scheme would open a wide range of uses. For example, the LDAP protocol is specified in terms of ASN.1.  It would be so cool to have a portable pure Scheme implementation of  LDAP! Writing bindings for the LDAP client library is an option, but that&#8217;s not portable nor lightweight.  (I&#8217;ve written such bindings for scsh, but that was just another waste of time: Lots of boring C code, annoying GC problems, and so on.) Other famous uses of ASN.1: digital certificates a la X.509 and PKCS7, Kerberos V messages, SNMP, and I bet one could specify lots of binary file formats in terms of ASN.1. </p>
<p>Note to myself: Once you have more time, spend it on hacking a ASN.1 compiler.  </p>
<p>(BTW, once I managed to assemble correct &#8220;client authentication&#8221; packets for the MySQL protocol, I&#8217;ll post a link to the darcs repository.)</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/MySQL" rel="tag">MySQL</a>, <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/ASN.1" rel="tag">ASN.1</a>, <a href="http://technorati.com/tag/LDAP" rel="tag">LDAP</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/07/30/binary-parsing-and-asn1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Id-tables</title>
		<link>http://www.knauel.org/blog/2006/07/29/id-tables/</link>
		<comments>http://www.knauel.org/blog/2006/07/29/id-tables/#comments</comments>
		<pubDate>Sat, 29 Jul 2006 12:50:48 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=51</guid>
		<description><![CDATA[I&#8217;ve been working on a control-flow analysis for Scheme 48 for a while now. In this analysis, functions represented as maps are omnipresent: variable environments map bindings to abstract values, binding environment map this to that, and so on. It&#8217;s quite easy to represent these functions as association lists, which is how they are represented [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a control-flow analysis for Scheme 48 for a while now. In this analysis, functions represented as maps are omnipresent: variable environments map bindings to abstract values, binding environment map this to that, and so on. It&#8217;s quite easy to represent these functions as association lists, which is how they are represented now.  Well, obviously a kind of hash table would be much faster.  </p>
<p>However, most of the domains of these functions are actually represented by complex Scheme record types which makes it hard to come up with a reasonable hash function. Actually, in many cases it would be the best solution to use the memory address of the Scheme record as the hash value: Many of the association lists use <tt>eq?</tt> as the comparison operator anyways.  However, you can&#8217;t do that in Scheme: There is no way to get the memory address of an object.  Which makes sense: The Scheme implementation is free to move the program values around at any time. And implementations with a moving garbage collector do this all the time.  Hence, a hash table that uses the address as a key must be rehashed after each garbage collection. Some implementations such as PLT Scheme offer such functionality and call such tables <tt>eq?</tt>-hash tables.  </p>
<p>During the last weeks I started to implement <tt>eq?</tt>-hash tables (which I call <em>id-tables</em>) for Scheme 48.  That just seemed to be a good idea.  Here is how they work.  I have added a new &#8220;stob type&#8221; (think of it as a record type defined by the VM) for id-tables to the VM and added new instructions for adding, searching, and deleting items in that table.  An id-table consists of two fields: A <em>counter</em> field that says how many values are currently stored in the table and a <em>vector</em> which is the actual hash table. The entries of the vector are a lists of pairs.  Each pair consists of the object used as the key and the object used as the value for this key. It&#8217;s necessary to remember the key object since the hash function (the address of the key object modulo the vector size) may map more than one object to the same vector index.  Well, this is just the usual simple representation of a hash table.  </p>
<p>Things get interesting when a garbage collection occurs: Scheme 48&#8217;s two space copier moves the key objects (and all other objects) two the new heap space, hence the hash key of the object changes.  The id-table and it&#8217;s content is treated like any other Scheme object. Hence, after the garbage collection there is a copy of the id-table in the new heap space.  All addresses in the table&#8217;s vector are updated to the corresponding new addresses.  That&#8217;s fine, but in general the objects are now at the wrong index: We need to rehash.  Rehashing is quite easy: Traverse all entries of the vector, re-calculate the hash-key for each key object and either move the entry to a new index in the vector or leave it untouched (in case the hash functions maps the old and new address to the same index).  All this is done in place: The rehashing modifies the copy of the hash table instead of copying the contents to a fresh vector.  The latter would probably be a little bit easier and faster, but harder to implement: rehashing happens just after the garbage collection and it&#8217;s a bad idea to allocate new heap space in this situation (Actually, these post-gc cleanup hooks are part of the GC process).  However, the in-place rehashing has the disadvantage that the algorithm actually might re-calculate the hash function for each object twice (worst case).  I think that&#8217;s a fair trade-off, calculating the hash function should be very fast.  </p>
<p>A diffrent solution would be to treat the id-tables specially during the garbage collection.  But I found that complicated: The objects in the table don&#8217;t have their new addresses yet and doing the whole copying and so on is a tedious business.  The advantage would be that the id-tables are easy to find: The GC algorithm traverses the heap and this way just stumbles over the id-tables.  The post-gc rehashing mechanism I have implemented has to involve some extra machinery to find the id-tables: The constructor for id-tables registers the freshly created id-table in a global list.  The rehashing procedure uses this list to find all id-tables.  </p>
<p>I should mention that at the moment I have only considered the two space copy collector of Scheme 48.  So, the id-tables won&#8217;t work with the upcoming new generational collector yet.  Actually, id-tables is the second approach.  I started with an implementation of <a href="http://citeseer.ifi.unizh.ch/peytonjones99stretching.html">stable names</a>, but I gave up this approach.  Various reasons, might tell later.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/Scheme+48" rel="tag">Scheme 48</a>, <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/garbage+collector" rel="tag">garbage collector</a>, <a href="http://technorati.com/tag/PLT+Scheme" rel="tag">PLT Scheme</a>, <a href="http://technorati.com/tag/id-tables" rel="tag">id-tables</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/07/29/id-tables/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.knauel.org/blog/2006/07/15/50/</link>
		<comments>http://www.knauel.org/blog/2006/07/15/50/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 12:50:08 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=50</guid>
		<description><![CDATA[The last weeks in catchwords

Don&#8217;t use bullets, don&#8217;t mention the C-word
A bit control flow analysis, some inlining
Concurrent activity
More reading
eq?-hashtables for Scheme 48
More control flow analysis
More indifference
&#8220;necessary preparations&#8221;

]]></description>
			<content:encoded><![CDATA[<p>The last weeks in catchwords</p>
<ul>
<li>Don&#8217;t use <a href="http://www.dagstuhl.de/programm/kalender/semhp/?semid=27149">bullets</a>, don&#8217;t mention the C-word</li>
<li>A bit control flow analysis, some inlining</li>
<li>Concurrent <a href="http://www-pu.informatik.uni-tuebingen.de/cp-2006/">activity</a></li>
<li>More <a href="http://scheme2006.cs.uchicago.edu/">reading</a></li>
<li><tt>eq?</tt>-hashtables for Scheme 48</li>
<li>More control flow analysis</li>
<li>More indifference</li>
<li>&#8220;necessary preparations&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/07/15/50/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL bindings</title>
		<link>http://www.knauel.org/blog/2006/04/19/mysql-bindings/</link>
		<comments>http://www.knauel.org/blog/2006/04/19/mysql-bindings/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 12:49:26 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=49</guid>
		<description><![CDATA[I&#8217;m missing MySQL bindings for Scheme 48 or scsh. Well, I wrote ODBC bindings for scsh a few years ago, but using ODBC on UNIX systems is just too painful. Looking at ruby, I found out that it seems to be fairly easy to implement the MySQL protocol. Although there is no official documentation, there [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m missing MySQL bindings for Scheme 48 or scsh. Well, I wrote ODBC bindings for scsh a few years ago, but using ODBC on UNIX systems is just too painful. Looking at <a href="http://www.ruby-lang.org">ruby</a>, I found out that it seems to be fairly easy to implement the MySQL protocol. Although there is no official documentation, there are <a href="http://www.redferni.uklinux.net/mysql/MySQL-Protocol.html">some hints</a> available on the web and the ruby source code is a second source of information. I&#8217;ll convince the next student entering my office door that this is a perfect term project.<br /><p>Technorati Tags: <a href="http://technorati.com/tag/Ruby" rel="tag">Ruby</a>, <a href="http://technorati.com/tag/MySQL" rel="tag"> MySQL</a>, <a href="http://technorati.com/tag/Scheme" rel="tag"> Scheme</a>, <a href="http://technorati.com/tag/Scheme+48" rel="tag"> Scheme 48</a>, <a href="http://technorati.com/tag/scsh" rel="tag"> scsh</a>, <a href="http://technorati.com/tag/ODBC" rel="tag"> ODBC</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/04/19/mysql-bindings/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Universal Binaries</title>
		<link>http://www.knauel.org/blog/2006/04/19/universal-binaries/</link>
		<comments>http://www.knauel.org/blog/2006/04/19/universal-binaries/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 12:48:41 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=48</guid>
		<description><![CDATA[I forgot to mention that it&#8217;s easy to build Scheme 48 as an Universal Binary.  Thus, it works fine and fast on Intel-based Macs. Apple&#8217;s tech note 2137 gives some hints how to build multiarchitecture binaries on OS X.  However, the hints described in this document don&#8217;t seem to work in all cases. [...]]]></description>
			<content:encoded><![CDATA[<p>I forgot to mention that it&#8217;s easy to build Scheme 48 as an <a href="http://en.wikipedia.org/wiki/Universal_binary">Universal Binary</a>.  Thus, it works fine and fast on Intel-based Macs. Apple&#8217;s <a href="http://developer.apple.com/technotes/tn2005/tn2137.html">tech note 2137</a> gives some hints how to build multiarchitecture binaries on OS X.  However, the hints described in this document don&#8217;t seem to work in all cases. Building the binaries for each architecture separatly and later combining them with <a href="http://www.hmug.org/man/1/lipo.php"><tt>lipo</tt></a> is an alternative.  This also reminds me that I need to write a scsh script that automatically combines the binaries using <tt>lipo</tt>.<br /><p>Technorati Tags: <a href="http://technorati.com/tag/Scheme+48" rel="tag">Scheme 48</a>, <a href="http://technorati.com/tag/OS+X" rel="tag"> OS X</a>, <a href="http://technorati.com/tag/Universal+Binary" rel="tag"> Universal Binary</a>, <a href="http://technorati.com/tag/scsh" rel="tag"> scsh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/04/19/universal-binaries/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scsh PhotoBase</title>
		<link>http://www.knauel.org/blog/2006/02/23/scsh-photobase/</link>
		<comments>http://www.knauel.org/blog/2006/02/23/scsh-photobase/#comments</comments>
		<pubDate>Thu, 23 Feb 2006 12:47:54 +0000</pubDate>
		<dc:creator>eric</dc:creator>
		
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://www.knauel.org/blog/?p=47</guid>
		<description><![CDATA[During the last six months I advised a student on her project for her diploma thesis which, of course, involved scsh. It&#8217;s a web-application for sharing, organizing, storing, displaying, and manipulating images. Think of it as an crossbreed of applications like iPhoto, ImageMagick, and flickr.com. Completely written as Scheme SUrflets. To my knowledge this application, [...]]]></description>
			<content:encoded><![CDATA[<p>During the last six months I advised a student on her project for her diploma thesis which, of course, involved <a rel="scsh" href="http://www.scsh.net">scsh</a>. It&#8217;s a web-application for sharing, organizing, storing, displaying, and manipulating images. Think of it as an crossbreed of applications like <a rel="iphoto" href="http://www.apple.com/ilife/iphoto/">iPhoto</a>, <a rel="Image" href="http://www.imagemagick.org/script/index.php">ImageMagick</a>, and <a rel="flickr" href="http://www.flickr.com/">flickr.com</a>. Completely written as Scheme <a rel="SUrflets" href="http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_chap_6">SUrflets</a>. To my knowledge this application, named PhotoBase, is the largest SUrflet application so far (16000 LOC).</p>
<p>The basic idea is that users can upload their images either via HTTP-upload or by choosing an directory in the server&#8217;s file-system into an archive. This archive is basically some hierarchical directory structure on the server. The archive is accessible for registered users only. An administrator grants an user the right to create photo albums from the archive pictures.  The idea is the following: the archive stores an immutable original copy of the image and albums contain selections of maybe modified images of the archive.  An user may grant the right to view and comment the pictures of an album to other users, user groups, or the public. Albums may be static or dynamic. Dynamic albums are basically SUrflets which allows the application to do all the stuff like displaying comments, searching  for photos and so on. A static album is just a directory full of image files and HTML files.  Thus, works on all web-servers. Albums are generated by templates, i. e. module that is expected to implement a certain interface. PhotoBase has two neat standard templates. However, it&#8217;s very easy to write new templates.  </p>
<p>Besides the albums there is a web-based image editor. This editor displays the image to be edited along with some widgets to modify the image such as buttons for resizing, rotating, enhancing contrast, and lots of other stuff. The server uses ImageMagick to actually carry out those operations. The editor also has an &#8220;undo preview bar&#8221; which displays a thumbnail version of the image in a certain state of manipulation. Clicking on such a thumbnail returns to that state of the image. A sequence of these operations may be safed as a &#8220;batch program&#8221; and applied to a set of pictures at once.  </p>
<p>An user may add meta information to a picture such as all kind of descriptions (place, people, etc). In fact users define a set of meta data fields that are stored for a photo and may enter that information themselves or let other users edit this information on the album pages. Next to this user-specific meta data, there is also global meta data stored in the archive. This information includes the exif information read by ImageMagick&#8217;s <tt>identify</tt> program and a tag (for searching).   </p>
<p>PhotoBase stores meta data as S-expressions in files, so there is no database involved. To keep the access to the information fast, a seperate thread reads the meta data from disk and waits for request on a synchronous Concurrent ML channel. Thus, all SUrflet instances share one thread that keeps the data for them.  The server thread also saves the information to disk at regular intervals.  </p>
<p>Three things need to be done before an initial release of PhotoBase:</p>
<ul>
<li>Review and committ some patches for SUnet needed by PhotoBase (HTTP upload, for example)</li>
<li>Make it easier to specify where PhotoBase stores its archive</li>
<li>Provide an install-script</li>
</ul>
<p>That&#8217;s not an awful lot of work&#8230;<br /><p>Technorati Tags: <a href="http://technorati.com/tag/Scheme" rel="tag">Scheme</a>, <a href="http://technorati.com/tag/PhotoBase" rel="tag">PhotoBase</a>, <a href="http://technorati.com/tag/Concurrent+ML+channel" rel="tag">Concurrent ML channel</a>, <a href="http://technorati.com/tag/EXIF" rel="tag">EXIF</a>, <a href="http://technorati.com/tag/scsh" rel="tag"> scsh</a>, <a href="http://technorati.com/tag/SUnet" rel="tag"> SUnet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.knauel.org/blog/2006/02/23/scsh-photobase/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
