<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
	<channel>
<title>filipp&#x27;s blog</title><link>http://homepage.mac.com/filipp/index.html</link><description>Learning OS X &#x7c; Server</description><dc:language>en</dc:language><dc:creator>filipp@mac.com</dc:creator><dc:rights>Copyright 2006 filipp</dc:rights><dc:date>2007-02-12T23:36:15+02:00</dc:date><admin:generatorAgent rdf:resource="http://www.realmacsoftware.com/" />
<admin:errorReportsTo rdf:resource="mailto:filipp@mac.com" /><sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<lastBuildDate>Mon, 12 Feb 2007 23:51:23 +0200</lastBuildDate><item><title>Cyrus weirdness</title><dc:creator>filipp@mac.com</dc:creator><category>OS X Server</category><dc:date>2007-02-12T23:36:15+02:00</dc:date><link>http://homepage.mac.com/filipp/files/4880d2f25218f6c4a2f61f787f94f979-183.html#unique-entry-id-183</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/4880d2f25218f6c4a2f61f787f94f979-183.html#unique-entry-id-183</guid><content:encoded><![CDATA[<pre>Feb 12 23:35:35 server launchd: edu.cmu.andrew.cyrus.master: exited with exit code: 75<br />Feb 12 23:35:35 server launchd: edu.cmu.andrew.cyrus.master: respawning too quickly! throttling<br />Feb 12 23:35:35 server launchd: edu.cmu.andrew.cyrus.master: 1 more failure without living at least 60 seconds will cause job removal<br />Feb 12 23:35:35 server launchd: edu.cmu.andrew.cyrus.master: will restart in 10 seconds<br />Feb 12 23:35:45 server master[14119]: empty option value on line 14 of configuration file<br />Feb 12 23:35:45 server master[14119]: exiting</pre><br />That's just <em>launchd's</em> special way of saying that that <em>cyrus</em> is not starting up. The question is - what conf file is it talking about?<br />Let's check:<br /><pre>> man cyrus-master</pre><br />OK, so there's two of them - /etc/cyrus.conf and /etc/imapd.conf. The first one had a comment on line 14, but the second one:<br /><pre>tls_common_name:</pre><br />Setting a CN fixed the problem and cyrus was purring like a kitten again:<br /><pre>Feb 12 23:40:42 server master[14244]: process started<br />Feb 12 23:40:43 server ctl_cyrusdb[14245]: verifying cyrus databases<br />Feb 12 23:40:43 server ctl_cyrusdb[14245]: skiplist: recovered /var/imap/mailboxes.db (30 records, 5008 bytes) in 0 seconds<br />Feb 12 23:40:43 server ctl_cyrusdb[14245]: skiplist: recovered /var/imap/annotations.db (0 records, 144 bytes) in 0 seconds<br />Feb 12 23:40:43 server ctl_cyrusdb[14245]: done verifying cyrus databases<br />Feb 12 23:40:44 server master[14244]: ready for work</pre><br />]]></content:encoded></item><item><title>Good Things pt 2: YAML</title><dc:creator>filipp@mac.com</dc:creator><category>Code</category><dc:date>2007-02-09T19:36:48+02:00</dc:date><link>http://homepage.mac.com/filipp/files/cfa36dfaf2b510fa19ed269202a15b07-182.html#unique-entry-id-182</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/cfa36dfaf2b510fa19ed269202a15b07-182.html#unique-entry-id-182</guid><content:encoded><![CDATA[I got acquinted with <a href="http://www.yaml.org/" rel="external">YAML</a> during my short run-in with <a href="http://www.rubyonrails.org/" rel="external">Ruby on Rails</a> (more on this some other day, hopefully). Their official description is:<br /><blockquote><p>YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as Perl and Python.</p></blockquote><br />Absolutely brilliant stuff. What it gives you, is a simple (no joke!) portable data format that's <strong>truly</strong> human-readable (indentation, baby!) and can easily be parsed into virtually any programming language's native data structure.<br /><br />For example, in PHP (via the excellent <a href="http://spyc.sourceforge.net/" rel="external">Spyc library</a>), this is how my webapp's DB settings would look like:<br /><pre>database:<br />    host: localhost<br />    name: collective_development<br />    username: name<br />    password: passwd<br />    type: mysql<br />    charset: utf-8</pre><br />Then you just do<br /><pre>include 'lib/spyc.php5';<br />$c = Spyc::YAMLLoad( 'lib/collective.yml' );</pre><br />And your whole configuration is accessible in a PHP array:<br /><pre>$link = mysql_connect( $c['database']['host'], $c['database']['username'], $c['database']['password'] );</pre><br />]]></content:encoded></item><item><title>RewritesRule</title><dc:creator>filipp@mac.com</dc:creator><category>OS X Server</category><dc:date>2007-02-09T12:53:25+02:00</dc:date><link>http://homepage.mac.com/filipp/files/693925259414af4c44a952a6d5cd96b3-181.html#unique-entry-id-181</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/693925259414af4c44a952a6d5cd96b3-181.html#unique-entry-id-181</guid><content:encoded><![CDATA[For my thesis, I'm building a simple (there's that word again!) publishing backend that basically just accepts any kind of media, gives you an interface to catalogue it, creates Torrent metafiles, etc and then spits out XHTML and RSS. For this to look nice, I decided to use Apache's mod_rewrite to use simple canonical URI's (like show/get/11, genre/Horror etc), so my rule looked something like this (L flag means it's the last rule and NC that the regex is case-insensitive)<br /><pre>RewriteRule ^([a-z]+)/(.*)? shows.php?p=$1&id=$2 [L,NC]</pre><br />But then you hit the age-old problem. You have some files (like images, css, javascript etc) that you want the browser to access directly, without the redirect. I must have tried a bazillion different permutations of Rewrite conditions, but then ended up with these two:<br /><pre>RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteCond %{REQUEST_FILENAME} !-f</pre><br />Which, put before your RewriteRule, simply say:<br /><pre>Only apply the rule if the accessed file or directory doesn't exist on the server</pre><br />Perfect. Mind you, there's also a "-U" switch which the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" rel="external">Apache docs</a> say should do the same thing, but I simply couldn't get it to work.<br /><br />A really good way to learn these is to, in your httpd.conf set:<br /><pre>RewriteLog /private/var/log/httpd/rewrite_log<br />RewriteLogLevel 9</pre><br />And just follow the output of that while your working on these.<br /><br /><a href="http://httpd.apache.org/docs/1.3/misc/rewriteguide.html" rel="external">Here's</a> also some good practical RewriteRule documentation.Oh, and there's also a handy RewriteRule <a href="http://www.ilovejackdaniels.com/apache/mod_rewrite-cheat-sheet/" rel="external">cheatsheet</a> over at ILJD.<br />]]></content:encoded></item><item><title>Apache 2.2.4 Universal Binary</title><dc:creator>filipp@mac.com</dc:creator><category>Mac OS X</category><dc:date>2007-02-03T11:57:34+02:00</dc:date><link>http://homepage.mac.com/filipp/files/7bf954086e49d29e6a7de4a740c9c4df-179.html#unique-entry-id-179</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/7bf954086e49d29e6a7de4a740c9c4df-179.html#unique-entry-id-179</guid><content:encoded><![CDATA[Long story short, I needed a server-side Python interpreter. For this there's two options (that I know of) - install <a href="http://www.zope.org/Products/Zope/2.10.2" rel="external">Zope</a> and run it along or in place of your existing web server (probably what any intelligent being would do), or go the hard way and run <a href="http://httpd.apache.org/modules/python-download.cgi" rel="external">mod_python</a> instead. The latest version works with either <em>httpd</em> 2.0 or later so it won't run OOtB on OS X. I figured since I'm upgrading my Apache anyway, I may as well grab the latest version. Turns out there's actually no OS X package out there for that (not counting the <a href="http://www.apachefriends.org/en/xampp-macosx.html#849" rel="external">XAMPP monster</a>, which is Intel-only). OK, no biggie I'll roll it myself - and why not make it UB as well.<br /><br /><pre>> ./configure --prefix=/usr/local/httpd-2.2 --enable-isapi --disable-mem-cache --enable-mime-magic --enable-ssl \<br />--enable-http --enable-dav --enable-cgi --enable-rewrite --enable-so --enable-headers --with-ldap --enable-dbd \<br />--enable-auth-digest --enable-authnz-ldap --enable-authn-anon --enable-mods-shared=most --enable-ldap --enable-cache</pre><br />I think those features should make it more or less usable also in a real server environment.<br /><br />Then, due to <a href="http://lists.apple.com/archives/Unix-porting/2006/Mar/msg00030.html" rel="external">a bug in GNU libtool</a>, you have to manually replace all the <em>sys_lib_search_path_spec</em> lines in two files - <em>srclib/apr/libtool</em> and <em>srclib/apr-util/xml/expat/libtool</em> to<br /><pre>sys_lib_search_path_spec="/Developer/SDKs/MacOSX10.4u.sdk/usr/lib"</pre><br />After compiling and installing I had to go through the config files to make it more of a drop-in replacement for Apache 1.3. So that it works nicely with what's already there without actually replacing anything. Simply start with config/httpd.config and work through it and all the included files to check for any "incompatibilities" with OS X (document rooot, the www user, homedirs, tmp dirs, the usual).<br /><br />Finally you just need an interface to control the server. Some fancier distros come with PrefPanes, mine simply has a <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/index.html" rel="external">StartupItem</a> with the service name "Apache 2.2". You set this up by adding something in /etc/hostconfig (like <em>APACHE22=-YES-</em>) and then the relevant StartupItem into /LibraryStartupItems. So finally, to start our new server:<br /><pre>> sudo SystemStarter start "Apache 2.2"</pre><br />You can't use <em>launchd</em> because it's not appropriate for wrapping things like <em>apachectl.<br /><br /></em>Currently things seem to run nicely, I'm still testing stuff before maybe building a package. WebDAV works, which is nice.<br /><br />It's incredible how many things you have to keep in mind to finally get a successful build out, a lot due to the fact that configure scripts don't seem to do any sanity checking between the different switches. For example, you can enable DAV, but if you forget to add any auth modules, nothing will work. Or the fact that --with-ldap and --enable-ldap are two different things - and you only find out that the first one (which isn't even mentioned in --help, btw) is compulsory if you want to add <em>any</em> kind of LDAP support. It took a lot of TTA to finally get this far...<br />]]></content:encoded></item><item><title>Fixing the Lumbard</title><dc:creator>filipp@mac.com</dc:creator><category>Random</category><dc:date>2007-02-01T15:33:47+02:00</dc:date><link>http://homepage.mac.com/filipp/files/321e95552c35aecb6ecf4752e77f86d6-178.html#unique-entry-id-178</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/321e95552c35aecb6ecf4752e77f86d6-178.html#unique-entry-id-178</guid><content:encoded><![CDATA[The <a href="http://everymac.com/systems/apple/powerbook_g3/stats/powerbook_g3_400.html" rel="external">G3 "Series" PowerBook</a> is a really good machine for your parents - it looks "mature", it's "laptop enough" to take it to the cottage if needed, has a big screen (although pretty dim by today's standards), runs a browser and email just fine and is cheap. Ours had a problem with the power connect though, requiring them to wedge something under the power connector for it to work. Obviously just a bad contact - a perfect opportunity for some light hardware work. Not to mention a great excuse to buy some new tools:<br /><ul><br /><li>The <a href="http://www.panavise.com/nf/vises/inuse/201.html" rel="external">small Panavise</a> that is simply awesome. I don't understand why they don't recommend these anywhere. Here it's about 40 EUR, but it's well worth it.</li><br /><li>A new soldering iron. I got a <a href="http://www.velleman.be/ot/en/product/view/?id=361196" rel="external">fairly cheap Velleman</a> to replace my old iron. Works well but the stand is pretty useless and it doesn't come with a sponge.</li><br /><li>Some <a href="http://www.chemtronics.com/products/product.asp?id=317" rel="external">soder-wick</a> and obviously some nice, thin lead-free solder</li><br /><li>#8 (50mm) torx. This will be your new best friend if you work a lot with Apple laptops. I got <a href="http://www.velleman.be/ot/en/product/view/?id=350986" rel="external">a Velleman</a> which was cheap (3 EUR) and came pre-magnetized.</li><br /></ul><br /><p style="text-align:center;" ><img class="imageStyle" alt="Image008" src="http://homepage.mac.com/filipp/files//page7_blog_entry178_1.png"width="448" height="358"/><br /></p><p><br />If you haven't soldered in a while (or ever), there's <a href="http://www.makezine.com/blog/archive/2007/01/soldering_tutor_1.html" rel="external">a really nice tutorial</a> over at Makezine.com as well as a primer on <a href="http://www.makezine.com/blog/archive/2007/01/multimeter_tuto.html" rel="external">using a multimeter</a>.<br /><br />The plastic on these old G3 PowerBooks is pretty brittle by now from all the heat and long age, so you have to be extra careful! The problem turned out be a cold solder joint on the power connector. Works just fine now.<br /><br />Working with hardware can be really rewarding - both in terms of fun and money. It's nice to work on something that you can actually touch, for a change. Sad that, in the long run, PC hw hacking is <em>kind of</em> a dying art because of all the crazy integration going on. I would not have been able to pull this off with a MacBook, I bet. That thing's just one big (actually small) logic board on the inside. So it's nice that there's still things like the Makezine.<br /><br />My next hardware project's going to be building a RS 232 to USB adapter + some logging software for my trusty and obsolete <a href="http://www.protektest.com/ProdInfo.asp?prodId=506" rel="external">Protek 506</a>.<br /></p>]]></content:encoded></item><item><title>iTunes Store tips</title><dc:creator>filipp@mac.com</dc:creator><category>Random</category><dc:date>2007-01-31T18:12:50+02:00</dc:date><link>http://homepage.mac.com/filipp/files/ca14641df228b265ecf1e377ccee7d72-177.html#unique-entry-id-177</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/ca14641df228b265ecf1e377ccee7d72-177.html#unique-entry-id-177</guid><content:encoded><![CDATA[<ol><br /><li>Define a shortcut for Power Search. System Preferences > Keyboard & Mouse > Shortcuts > iTunes > Search&hellip; I set mine to Cmd -F (odd that that doesn't focus on the search field, by default)</li><br /><li>Wishlists. Just create a playlist and drag stuff from the store to it. Only works with individual tracks, sadly</li><br /><li>Don't forget to de-authorize computer before formatting the HD. It's OK if you restore from a complete backup (including the stuff under /Volumes).</li><br /><li>Use the Browse command (Cmd-B)</li><br /></ol><br />]]></content:encoded></item><item><title>AppleScripting Keynote 3</title><dc:creator>filipp@mac.com</dc:creator><category>Code</category><dc:date>2007-01-30T22:32:43+02:00</dc:date><link>http://homepage.mac.com/filipp/files/7a04b3dc0dc515af56bde365e32af578-176.html#unique-entry-id-176</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/7a04b3dc0dc515af56bde365e32af578-176.html#unique-entry-id-176</guid><content:encoded><![CDATA[And in particular the add chart command. At first it seems like a really cool thing - easily create beautiful charts out of virtually any source. I was excited to try this with some Webalizer output. Looks like you have two options - the Automator Action or Script Editor<br /><br />The action produces a chart right off the bat, but the input is weird:<br /><blockquote><p>Input: (Anything) Two dimensional array of chart labels and data.</p></blockquote><br />What is that? After trying every possible permutation of what I thought an AS 2D array would look like (some of which even compiled!) with different kinds of input sources (AS, text) I finally gave up the Automator Action option.<br /><br />Using script editor seemed promising at first, but a simple <em>add chart</em> with all the properties produced nothing. Finally managed to find <a href="http://lists.apple.com/archives/applescript-users/2006/Jan/msg00363.html" rel="external">this really nice exampl</a>e, but it only worked with Pages. Digging in the action's bundle revealed that you're supposed to tell <em>the slide</em> to add the chart. OK, time to put this new-found knowledge to work:<br /><pre>tell application "Keynote"<br />    set theData to {{1, 2, 3}, {4, 5, 6}}<br />    set theSlide to (slide 1) of first slideshow<br />    tell theSlide<br />        add chart row names {"Dec", "Jan"} column names {"Machines", "Visits", "Hits"} &not;<br />        data theData type "vertical_bar_3d" group by "column"<br />    end tell<br />end tell</pre><br /><p style="text-align:center;" ><img class="imageStyle" alt="Pasted Graphic 2" src="http://homepage.mac.com/filipp/files//page7_blog_entry176_1.jpg"width="596" height="431"/><br /></p><p>Tadaa! Sweet. Now all that remains is to add the webalizer parsing code...<br /></p>]]></content:encoded></item><item><title>servermgrd bus error</title><dc:creator>filipp@mac.com</dc:creator><category>OS X Server</category><dc:date>2007-01-28T23:44:09+02:00</dc:date><link>http://homepage.mac.com/filipp/files/446a2730bd7a9cd896502efda67596a6-174.html#unique-entry-id-174</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/446a2730bd7a9cd896502efda67596a6-174.html#unique-entry-id-174</guid><content:encoded><![CDATA[This happened after a failed attempt to add a signed cert from a CA - <em>servermgrd</em> just crashed. Trying to disable all SSL (/Library/Preferences/com.apple.servermgrd.plist) had no effect. Starting in debug mode just said this:<br /><pre># servermgrd -d<br />2007-01-28 23:39:04.717 servermgrd[20540] *** _NSAutoreleaseNoPool(): Object 0x306030 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-28 23:39:04.717 servermgrd[20540] *** _NSAutoreleaseNoPool(): Object 0x306420 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-28 23:39:04.733 servermgrd[20540] Entering initialize<br />2007-01-28 23:39:05.600 servermgrd[20540] Starting idle processing<br />Bus error</pre><br />Well, it turns out that the stuff about memory leaking is "normal". Here's the output of the same command on a totally unrelated, perfectly in-order Tiger server:<br /><pre># servermgrd -d<br />2007-01-28 23:52:46.348 servermgrd[21665] *** _NSAutoreleaseNoPool(): Object 0x306020 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-28 23:52:46.348 servermgrd[21665] *** _NSAutoreleaseNoPool(): Object 0x306410 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-28 23:52:46.349 servermgrd[21665] Entering initialize</pre><br />It's the <em>Bus error</em> that I'm worried about. Most of <em>ktrace servermgrd -d</em> and <em>kdump -f ktrace.out</em> is incomprehensible and so is pretty much /Library/Logs/CrashReporter/servermgrd.crash.log<br /><br />Checking the last lines of kdump (<em>kdump -f ktrace.out | tail -n 20</em>) did mention <em>/Library/Keychains/System.keychain</em>, just shortly before the crash. A <em>find -ctime 2</em> confirms that System.keychain was modified just around that fateful moment when this problem started. For the heck of it, I decided to move the old keychain aside, and create a new one:<br /><pre># mv System.keychain System.keychain.old<br /># security create-keychain /Library/Keychains/System.keychain</pre><br />Sure enough, <em>servermgrd</em> was open for business again:<br /><pre>server:/Library/Keychains root# servermgrd -d       <br />2007-01-29 00:20:48.654 servermgrd[20712] *** _NSAutoreleaseNoPool(): Object 0x306030 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-29 00:20:48.655 servermgrd[20712] *** _NSAutoreleaseNoPool(): Object 0x306420 of class NSCFData autoreleased with no pool in place - just leaking<br />2007-01-29 00:20:48.655 servermgrd[20712] Entering initialize<br />2007-01-29 00:20:48.946 servermgrd[20712] Starting idle processing<br />2007-01-29 00:20:51.534 servermgrd[20712] Done with idle processing</pre><br />I was actually able to salvage the certs and private keys from the damaged keychain file like thus:<br /><pre># security export -k /Library/Keychains/System.keychain.old -t all -o ./all.pem</pre><br />and then import them back into the fresh keychain:<br /><pre># security import ./all.pem -P -k /Library/Keychains/System.keychain   <br />2 keys imported.<br />3 certificates imported.</pre><br />The bad news is that although Server Admin works again, I'm unable to use the Certificate Manager. Any attempt to either add or import a cert gets replied by a dull "The selected certificate could not be retrieved. Going back to the list." Oh well, just another good reason to get more comfortable with the CLI - it's not as fragile... By the way, If you change SSL certs in <em>httpd</em> conf files, it seems it's better to stop and start the server, not restart (otherwise the old cert is still used).<br /><br />Just for the record, the cert and key in <em>/etc/servermgrd</em> are disposable. If you delete them, they will be re-created by <em>servermgrd</em> on the next launch. Oh, and there's also <em>certadmin</em>, but it did absolutely nothing for me.<br />]]></content:encoded></item><item><title>An interesting quote</title><dc:creator>filipp@mac.com</dc:creator><category>Random</category><dc:date>2007-01-27T17:24:21+02:00</dc:date><link>http://homepage.mac.com/filipp/files/ecabaeedb763f126482a9e5473a97e3f-172.html#unique-entry-id-172</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/ecabaeedb763f126482a9e5473a97e3f-172.html#unique-entry-id-172</guid><content:encoded><![CDATA[<blockquote><p>If the Mac was so great, why did it lose? Cost, again. Microsoft concentrated on the software business and unleashed a swarm of cheap component suppliers on Apple hardware. It did not help, either that suits took over during a critical period. (And it hasn't lost yet. If Apple were to grow the iPod into a cell phone with a web browser, Microsoft would be in big trouble.)</p></blockquote><br />Excerpt taken from Paul Graham's excellent <a href="http://www.oreilly.com/catalog/hackpaint/index.html" rel="external">Hackers & Painters</a>, published in 2004.<br />]]></content:encoded></item><item><title>Building universal binaries</title><dc:creator>filipp@mac.com</dc:creator><category>Code</category><dc:date>2007-01-24T15:23:51+02:00</dc:date><link>http://homepage.mac.com/filipp/files/e82114062e2f8125f0a4c0bc3637fcca-171.html#unique-entry-id-171</link><guid isPermaLink="true">http://homepage.mac.com/filipp/files/e82114062e2f8125f0a4c0bc3637fcca-171.html#unique-entry-id-171</guid><content:encoded><![CDATA[So far I've had the best success with defining the following before <em>configure</em>:<br /><pre>> export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"<br />> export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"</pre><br />Sometimes this lead to:<br /><pre>gcc: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags</pre><br />in which case passing <em>--disable-dependency-tracking</em> to <em>configure</em> seemed to help.<br />]]></content:encoded></item></channel>
</rss>