<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Der M-Blog</title>
	<atom:link href="http://blog.mro.name/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mro.name</link>
	<description>Technik und Tamtam</description>
	<lastBuildDate>Tue, 09 Feb 2010 07:21:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Poignant: Xml meets Huffman</title>
		<link>http://blog.mro.name/2010/02/poignant-xml-meets-huffman/</link>
		<comments>http://blog.mro.name/2010/02/poignant-xml-meets-huffman/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:26:12 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[Huffman]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1686</guid>
		<description><![CDATA[There&#8217;s a spec at the w3c about compressing (XML) named &#8220;Efficient XML Interchange&#8221; Format taking into account the grammar and likelihood of atoms within the document. They indeed use something similar the the Huffman Coding.
The results are quite impressive &#8211; nice charts!
]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a <a href="http://www.w3.org/TR/2009/CR-exi-20091208/">spec at the w3c about compressing (XML) named &#8220;Efficient XML Interchange&#8221; Format</a> taking into account the grammar and likelihood of atoms within the document. They indeed use something similar the the <a href="http://en.wikipedia.org/wiki/Huffman_coding">Huffman Coding</a>.</p>
<p>The <a href="http://www.w3.org/TR/2009/WD-exi-evaluation-20090407/">results</a> are quite impressive &#8211; nice charts!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2010/02/poignant-xml-meets-huffman/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>T-Mobile / MMS / iPhone</title>
		<link>http://blog.mro.name/2010/01/t-mobile-mms-iphone/</link>
		<comments>http://blog.mro.name/2010/01/t-mobile-mms-iphone/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 08:25:50 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[seenontheweb]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[MMS]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1678</guid>
		<description><![CDATA[klick ich den Link, den T-Mobile mir per SMS geschickt hat, kriege ich:
]]></description>
			<content:encoded><![CDATA[<p>klick ich den Link, den T-Mobile mir per SMS geschickt hat, kriege ich:</p>
<div id="attachment_1679" class="wp-caption alignnone" style="width: 330px"><img class="size-full wp-image-1679 " title="T-Mobile Scherz" src="http://blog.mro.name/wp-content/uploads/2010/01/IMG_1318.png" alt="T-Mobile Scherz" width="320" height="480" /><p class="wp-caption-text">T-Mobile Scherz</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2010/01/t-mobile-mms-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSCachedURLResponse / NSKeyedUnarchiver pain</title>
		<link>http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/</link>
		<comments>http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 18:42:00 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSCachedURLResponse]]></category>
		<category><![CDATA[NSKeyedArchiver]]></category>
		<category><![CDATA[NSKeyedUnarchiver]]></category>
		<category><![CDATA[NSURLCache]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1667</guid>
		<description><![CDATA[as the iPhone SDK comes with a rather dysfunctional NSURLCache — Apple suggests to implement it from scratch yourself in the code examples about caching — I went for just this.
Until I came across the [NSKeyedUnarchiver unarchiveObjectWithData:...] not restoring userInfo, storagePolicy and data of NSCachedURLResponse.
Couldn&#8217;t believe it and spent almost the whole day verifying that the [...]]]></description>
			<content:encoded><![CDATA[<p>as the iPhone SDK comes with a rather dysfunctional <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html">NSURLCache</a> — Apple suggests to implement it from scratch yourself in the <a href="http://developer.apple.com/iphone/library/samplecode/URLCache/index.html#//apple_ref/doc/uid/DTS40008061">code examples about caching</a> — I went for just this.</p>
<p>Until I came across the <code>[<a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSKeyedUnarchiver_Class/Reference/Reference.html">NSKeyedUnarchiver</a> unarchiveObjectWithData:...]</code> not restoring <code>userInfo</code>, <code>storagePolicy</code> and <code>data</code> of <code><a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSCachedURLResponse_Class/Reference/Reference.html">NSCachedURLResponse</a></code>.</p>
<p>Couldn&#8217;t believe it and spent almost the whole day verifying that the error is not within my code but really the unarchiver treats those fields transient.</p>
<p>See yourself:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>testiPhoneSDK312NSKeyedArchiver
<span style="color: #002200;">&#123;</span>
<span style="color: #11740a; font-style: italic;">//  prepare a NSCachedURLResponse</span>
    <span style="color: #400080;">NSCachedURLResponse</span> <span style="color: #002200;">*</span>src <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>i_url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.url.example/path/file.html&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>i_mime <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;text/html&quot;</span>;
        NSInteger expectedContentLength <span style="color: #002200;">=</span> <span style="color: #2400d9;">112</span>;
        <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>i_encoding <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;iso-8859-2&quot;</span>;
&nbsp;
        <span style="color: #400080;">NSURLResponse</span> <span style="color: #002200;">*</span>i_response <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLResponse</span> alloc<span style="color: #002200;">&#93;</span> initWithURL<span style="color: #002200;">:</span>i_url
            MIMEType<span style="color: #002200;">:</span>i_mime
            expectedContentLength<span style="color: #002200;">:</span>expectedContentLength
            textEncodingName<span style="color: #002200;">:</span>i_encoding<span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span>i_data <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Hello, world!&quot;</span> dataUsingEncoding<span style="color: #002200;">:</span>NSISOLatin2StringEncoding<span style="color: #002200;">&#93;</span>;
        NSURLCacheStoragePolicy i_storage <span style="color: #002200;">=</span>  NSURLCacheStorageAllowed;
        <span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>i_userInfo <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithObject<span style="color: #002200;">:</span>
        <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> dateWithTimeIntervalSince1970<span style="color: #002200;">:</span><span style="color: #2400d9;">13</span><span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;era&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #400080;">NSCachedURLResponse</span> <span style="color: #002200;">*</span>src <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSCachedURLResponse</span> alloc<span style="color: #002200;">&#93;</span> initWithResponse<span style="color: #002200;">:</span>i_response
            data<span style="color: #002200;">:</span>i_data
            userInfo<span style="color: #002200;">:</span>i_userInfo
            storagePolicy<span style="color: #002200;">:</span>i_storage<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//      ensure it's all in place:</span>
        STAssertEqualObjects<span style="color: #002200;">&#40;</span>i_url, src.response.URL, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEqualObjects<span style="color: #002200;">&#40;</span>i_mime, src.response.MIMEType, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEquals<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>expectedContentLength, <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>src.response.expectedContentLength, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEqualObjects<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;file.html&quot;</span>, src.response.suggestedFilename, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEqualObjects<span style="color: #002200;">&#40;</span>i_encoding, src.response.textEncodingName, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
        STAssertEqualObjects<span style="color: #002200;">&#40;</span>i_data, src.data, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEqualObjects<span style="color: #002200;">&#40;</span>i_userInfo, src.userInfo, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
        STAssertEquals<span style="color: #002200;">&#40;</span> 0u, src.storagePolicy, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//  archive + unarchive:</span>
    <span style="color: #400080;">NSCachedURLResponse</span> <span style="color: #002200;">*</span>dst <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSKeyedUnarchiver</span> unarchiveObjectWithData<span style="color: #002200;">:</span>
      <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSKeyedArchiver</span> archivedDataWithRootObject<span style="color: #002200;">:</span>src<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//  check whether src == dst</span>
    STAssertEqualObjects<span style="color: #002200;">&#40;</span>src.response.URL, dst.response.URL, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span>src.response.MIMEType, dst.response.MIMEType, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEquals<span style="color: #002200;">&#40;</span>src.response.expectedContentLength, dst.response.expectedContentLength, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span>src.response.suggestedFilename, dst.response.suggestedFilename, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span>src.response.textEncodingName, dst.response.textEncodingName, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//  !!!!!!!!!!</span>
<span style="color: #11740a; font-style: italic;">//  sad information loss after unarchiving:</span>
    STAssertNil<span style="color: #002200;">&#40;</span> dst.data, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> <span style="color: #002200;">&#41;</span>;
    STAssertNil<span style="color: #002200;">&#40;</span> dst.userInfo, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> <span style="color: #002200;">&#41;</span>;
    STAssertEquals<span style="color: #002200;">&#40;</span> 2u , dst.storagePolicy, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> <span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>When my NSURLCache replacement is ready I think about publishing it a github — interested anyone?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binary Search NSArray</title>
		<link>http://blog.mro.name/2010/01/binary-search-nsarray/</link>
		<comments>http://blog.mro.name/2010/01/binary-search-nsarray/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 22:02:07 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSArray]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1652</guid>
		<description><![CDATA[Though CFArray comes with binary search capability, NSArray does not &#8211; at least not within the iPhone SDK. The indexOfObject:inSortedRange:options:usingComparator: can&#8217;t be found.
Plus the CFArrayBSearchValues doesn&#8217;t tell you whether the key actually is part of the list or not. That&#8217;s what the Java JDK does, so let&#8217;s implement some category methods

-&#40;NSInteger&#41;binarySearch:&#40;id&#41;key;
-&#40;NSInteger&#41;binarySearch:&#40;id&#41;key usingSelector:&#40;SEL&#41;comparator;
-&#40;NSInteger&#41;binarySearch:&#40;id&#41;key usingSelector:&#40;SEL&#41;comparator inRange:&#40;NSRange&#41;range;
-&#40;NSInteger&#41;binarySearch:&#40;id&#41;key usingFunction:&#40;NSInteger [...]]]></description>
			<content:encoded><![CDATA[<p>Though <a href="http://developer.apple.com/mac/library/DOCUMENTATION/CoreFoundation/Reference/CFArrayRef/index.html">CFArray</a> comes with <a href="http://en.wikipedia.org/wiki/Binary_search_algorithm#Iterative">binary search</a> capability, <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html">NSArray</a> does not &#8211; at least not within the iPhone SDK. The <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/indexOfObject:inSortedRange:options:usingComparator:">indexOfObject:inSortedRange:options:usingComparator:</a> can&#8217;t be found.</p>
<p>Plus the <a href="http://developer.apple.com/mac/library/DOCUMENTATION/CoreFoundation/Reference/CFArrayRef/Reference/reference.html#//apple_ref/doc/uid/20001192-CH201-F10956">CFArrayBSearchValues</a> doesn&#8217;t tell you whether the key actually is part of the list or not. That&#8217;s what the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html#binarySearch(T[],%20T,%20java.util.Comparator)">Java JDK</a> does, so let&#8217;s implement some <a href="http://developer.apple.com/mac/library/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html">category</a> methods</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingSelector<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>comparator;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingSelector<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>comparator inRange<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">NSRange</span><span style="color: #002200;">&#41;</span>range;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingFunction<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger <span style="color: #002200;">&#40;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span>, <span style="color: #a61390;">id</span>, <span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>comparator context<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>context;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingFunction<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger <span style="color: #002200;">&#40;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span>, <span style="color: #a61390;">id</span>, <span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>comparator context<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>context inRange<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">NSRange</span><span style="color: #002200;">&#41;</span>range;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingDescriptors<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>sortDescriptors;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingDescriptors<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>sortDescriptors inRange<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">NSRange</span><span style="color: #002200;">&#41;</span>range;</pre></div></div>

<p>ourselves, like</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>binarySearch<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>key usingFunction<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger <span style="color: #002200;">&#40;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span>, <span style="color: #a61390;">id</span>, <span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>comparator context<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>context inRange<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">NSRange</span><span style="color: #002200;">&#41;</span>range
<span style="color: #002200;">&#123;</span>
    NSLogD<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;[NSArray(MroBinarySearch) binarySearch:%@ usingFunction:]&quot;</span>, key<span style="color: #002200;">&#41;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>self.count <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span> || key <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span> || comparator <span style="color: #002200;">==</span> <span style="color: #a61390;">NULL</span><span style="color: #002200;">&#41;</span>
        <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>self binarySearch<span style="color: #002200;">:</span>key usingSelector<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> inRange<span style="color: #002200;">:</span>range<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//	check overflow?</span>
    NSInteger min <span style="color: #002200;">=</span> range.location;
    NSInteger max <span style="color: #002200;">=</span> range.location <span style="color: #002200;">+</span> range.length <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span>;
&nbsp;
    <span style="color: #a61390;">while</span> <span style="color: #002200;">&#40;</span>min <span style="color: #002200;">&amp;</span>lt; <span style="color: #002200;">=</span> max<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">// http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html</span>
        <span style="color: #a61390;">const</span> NSInteger mid <span style="color: #002200;">=</span> min <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>max <span style="color: #002200;">-</span> min<span style="color: #002200;">&#41;</span> <span style="color: #002200;">/</span> <span style="color: #2400d9;">2</span>;
        <span style="color: #a61390;">switch</span> <span style="color: #002200;">&#40;</span>comparator<span style="color: #002200;">&#40;</span>key, <span style="color: #002200;">&#91;</span>self objectAtIndex<span style="color: #002200;">:</span>mid<span style="color: #002200;">&#93;</span>, context<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#123;</span>
            <span style="color: #a61390;">case</span> NSOrderedSame<span style="color: #002200;">:</span>
                <span style="color: #a61390;">return</span> mid;
            <span style="color: #a61390;">case</span> NSOrderedDescending<span style="color: #002200;">:</span>
                min <span style="color: #002200;">=</span> mid <span style="color: #002200;">+</span> <span style="color: #2400d9;">1</span>;
                <span style="color: #a61390;">break</span>;
            <span style="color: #a61390;">case</span> NSOrderedAscending<span style="color: #002200;">:</span>
                max <span style="color: #002200;">=</span> mid <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span>;
                <span style="color: #a61390;">break</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>min <span style="color: #002200;">+</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>See the <a href="http://gist.github.com/275631/">full interface + implementation + testcase without html encoding dirt at github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2010/01/binary-search-nsarray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hübsche Dropbox Links</title>
		<link>http://blog.mro.name/2010/01/hubsche-dropbox-links/</link>
		<comments>http://blog.mro.name/2010/01/hubsche-dropbox-links/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 13:09:31 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Netiquette]]></category>
		<category><![CDATA[Redirect]]></category>
		<category><![CDATA[RewriteEngine]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1633</guid>
		<description><![CDATA[Weil große Email Anhänge stinken, bietet sich z.B. die Dropbox als Dateiaustauschplatform an.
Einfach die Datei in den (lokalen) Dropbox/Public Ordner verfrachten, syncen lassen und per &#8220;Rechte Maustaste -&#62; Copy Public Link&#8221; in die Mail kopieren.
Redirect
Nun sind solche Links nicht besonders hübsch (Branding!, Branding!, CI! ruft die Marketingabteilung) und  spätestens wenn man&#8217;s abtippen muß oder per [...]]]></description>
			<content:encoded><![CDATA[<p>Weil <a href="http://friendfeed.com/akawee/10ab93b0/e-mail-missbrauch-teil-2-der-anhang-ist-oft-die">große Email Anhänge stinken</a>, bietet sich z.B. die <a href="http://friendfeed.com/webjuwelen/9ed5b1a9/skrupellose-werbung-fur-die-dropbox-dieser">Dropbox</a> als Dateiaustauschplatform an.</p>
<p>Einfach die Datei in den (lokalen) Dropbox/Public Ordner verfrachten, syncen lassen und per &#8220;Rechte Maustaste -&gt; Copy Public Link&#8221; in die Mail kopieren.</p>
<h3>Redirect</h3>
<p>Nun sind solche Links nicht besonders hübsch (Branding!, Branding!, CI! ruft die Marketingabteilung) und  spätestens wenn man&#8217;s abtippen muß oder per Telephon weitersagt wird&#8217;s gruslig.</p>
<p>Hat man aber eine eigene Website, lassen sich die <a href="http://www.cimitan.com/blog/2008/09/17/htaccess-to-redirect-on-dropboxs-public-folder/#">Dropbox Links aufhübschen</a> und eine Weiterleitung einrichten, dann wird aus</p>
<pre>http://dl.dropbox.com/u/1234567/BigDocument.pdf</pre>
<p>z.B.</p>
<pre>http://dropbox.mydomain.com/BigDocument.pdf</pre>
<p>und schon sind die Brandingfreunde happy.</p>
<h3>index.html</h3>
<p>Geht es nicht um eine einzelne Datei sondern um mehrere, will man evtl. eine Übersicht in einer index.html haben. So eine Übersicht legt z.B. mein <a href="http://www.ruby-lang.org/de/">ruby</a> Script <a href="http://gist.github.com/271223">htmlizedb</a> an. Das Script will im <a href="http://de.wikipedia.org/wiki/Bourne-again_shell">Terminal</a> in dem Verzeichnis gestartet werden, für das die Übersicht her soll.</p>
<h3>Redirect + index.html</h3>
<p>Bei Webservern ist allgemein üblich, daß man den Dateinamen index.html im Link weglassen kann. Der Webserver nimmt dann an man meint selbige. Die Dropbox verhält sich aber in dieser Hinsicht nicht wie ein normaler Webserver, sondern will immer den kompletten Dateinamen.</p>
<p>Hat man aber bereits den Redirect Trick in Benutzung, läßt sich die Redirect Steuerdatei (<code>.htaccess</code>) aufbohren, daß der Redirect die index.html Angabe ergänzt:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">on</span>
<span style="color: #adadad; font-style: italic;"># dropbox abbreviation:</span>
<span style="color: #adadad; font-style: italic;"># http://www.cimitan.com/blog/2008/09/17/htaccess-to-redirect-on-dropboxs-public-folder/#</span>
<span style="color: #adadad; font-style: italic;"># last path component has no dot -&amp;gt; redirect to index.html</span>
<span style="color: #00007f;">RewriteRule</span> ^(.+/)?([^./]+)/?$	http://dl.dropbox.com/u/<span style="color: #ff0000;">1234567</span>/$<span style="color: #ff0000;">1</span>$<span style="color: #ff0000;">2</span>/index.html	[last,qsappend]
<span style="color: #adadad; font-style: italic;"># everything else: redirect as is</span>
<span style="color: #00007f;">RewriteRule</span> ^(.+)$	http://dl.dropbox.com/u/<span style="color: #ff0000;">1234567</span>/$<span style="color: #ff0000;">1</span>	[last,qsappend]</pre></div></div>

<p>violá, nun wird von</p>
<pre>http://dropbox.mydomain.com/FolderWithBigFiles</pre>
<p>automatisch auf den Dropbox Link</p>
<pre>http://dl.dropbox.com/u/1234567/FolderWithBigFiles/index.html</pre>
<p>weitergeleitet.</p>
<p>Toll, nicht?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2010/01/hubsche-dropbox-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Radiomitschnitt per Rezept</title>
		<link>http://blog.mro.name/2009/12/radiomitschnitt-per-rezept/</link>
		<comments>http://blog.mro.name/2009/12/radiomitschnitt-per-rezept/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 00:08:22 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Cronjob]]></category>
		<category><![CDATA[id3v2]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Radio]]></category>
		<category><![CDATA[Stream]]></category>
		<category><![CDATA[streamripper]]></category>
		<category><![CDATA[vServer]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1619</guid>
		<description><![CDATA[Seit längerem schneide ich mir interessante Sendungen aus dem (Internet-)Radio mit, vor allem Hörspiele auf B2.
Bisher mußte dazu immer mein alter (Linux-)Rechner laufen und den Mitschnitt mußte ich händisch starten &#8211; wie unbequem. Oder man ist unterwegs und verpaßt den Mitschnitt. Wie ärgerlich.
Doch das ist ab jetzt vorbei, denn ab sofort schneidet mein vServer (läuft [...]]]></description>
			<content:encoded><![CDATA[<p>Seit längerem schneide ich mir interessante Sendungen aus dem (Internet-)Radio mit, vor allem <a href="http://www.br-online.de/bayern2/hoerspiel-und-medienkunst/index.xml">Hörspiele auf B2</a>.</p>
<p>Bisher mußte dazu immer mein alter (Linux-)Rechner laufen und den Mitschnitt mußte ich händisch starten &#8211; wie unbequem. Oder man ist unterwegs und verpaßt den Mitschnitt. Wie ärgerlich.</p>
<p>Doch das ist ab jetzt vorbei, denn ab sofort schneidet mein vServer (läuft ja eh ständig) mit!</p>
<p>Und so geht&#8217;s:</p>
<ol>
<li>Ein Script auf dem vServer, das den Mitschnitt startet und beendet:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># id3v2 scheint Bilder nicht zu mögen:</span>
<span style="color: #666666; font-style: italic;"># - http://ubuntuforums.org/showthread.php?t=1353213</span>
<span style="color: #666666; font-style: italic;"># - readonly: http://id3v2.cvs.sourceforge.net/viewvc/id3v2/id3v2/id3v2.cpp?revision=1.17&amp;view=markup#l_610</span>
<span style="color: #666666; font-style: italic;"># - http://www.id3.org/id3v2.4.0-frames Kapitel4.14.</span>
<span style="color: #666666; font-style: italic;"># erfolglos: id3v2 --APIC &quot;0\0image/jpeg\03hello\0`cat moby_dick.jpg`&quot; $file</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;rip audio streams to a local file.&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage:&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  $0 stream marker duration id3v2_tags&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    stream     typically a URL, see 'man streamripper'&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    marker     filename prefix&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    seconds    how long will we dump&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    id3v2_tags optional, tag the download with id3v2&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Example:&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  $0 http://gffstream.ic.llnwd.net/stream/gffstream_w11a bayern2 3660&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">src</span>=$<span style="color: #000000;">1</span> ; <span style="color: #7a0874; font-weight: bold;">shift</span>
<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">basename</span></span>=$<span style="color: #000000;">1</span> ; <span style="color: #7a0874; font-weight: bold;">shift</span>
<span style="color: #007800;">seconds</span>=$<span style="color: #000000;">1</span> ; <span style="color: #7a0874; font-weight: bold;">shift</span>
&nbsp;
<span style="color: #007800;">dst</span>=<span style="color: #007800;">$basename</span>-<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--iso-8601</span>=seconds<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;dumping <span style="color: #007800;">$seconds</span> (sec) from <span style="color: #007800;">$src</span> to <span style="color: #007800;">$dst</span> ...&quot;</span>
&nbsp;
streamripper <span style="color: #007800;">$src</span> <span style="color: #660033;">-u</span> Mozilla <span style="color: #660033;">-i</span> <span style="color: #660033;">-a</span> <span style="color: #007800;">$dst</span> <span style="color: #660033;">-l</span> <span style="color: #007800;">$seconds</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$dst</span>.cue
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	id3v2 <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #007800;">$dst</span>.mp3
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chmod</span> a+r <span style="color: #007800;">$dst</span>.<span style="color: #000000; font-weight: bold;">*</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> done.</pre></div></div>

</li>
<li>Ein Cronjob für jeden Mitschnitt:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin 
<span style="color: #007800;">HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>USERNAME
&nbsp;
<span style="color: #666666; font-style: italic;"># Recorder</span>
&nbsp;
<span style="color: #007800;">rec_cmd</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stream-rip
<span style="color: #007800;">rec_dir</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>recorder
&nbsp;
<span style="color: #007800;">ON3</span>=http:<span style="color: #000000; font-weight: bold;">//</span>gffstream.ic.llnwd.net<span style="color: #000000; font-weight: bold;">/</span>stream<span style="color: #000000; font-weight: bold;">/</span>gffstream_w9a
<span style="color: #007800;">BAYERN1</span>=http:<span style="color: #000000; font-weight: bold;">//</span>gffstream.ic.llnwd.net<span style="color: #000000; font-weight: bold;">/</span>stream<span style="color: #000000; font-weight: bold;">/</span>gffstream_w10a
<span style="color: #007800;">BAYERN2</span>=http:<span style="color: #000000; font-weight: bold;">//</span>gffstream.ic.llnwd.net<span style="color: #000000; font-weight: bold;">/</span>stream<span style="color: #000000; font-weight: bold;">/</span>gffstream_w11a
<span style="color: #007800;">M945</span>=http:<span style="color: #000000; font-weight: bold;">//</span>stream.m945.mwn.de:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">/</span>m945-hq.mp3
&nbsp;
<span style="color: #666666; font-style: italic;"># B2 Krimihörspiel</span>
<span style="color: #000000;">29</span> <span style="color: #000000;">20</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">3</span> <span style="color: #007800;">$rec_cmd</span> <span style="color: #007800;">$BAYERN2</span> <span style="color: #007800;">$rec_dir</span><span style="color: #000000; font-weight: bold;">/</span>b2-krimi <span style="color: #000000;">3660</span> <span style="color: #660033;">-A</span> <span style="color: #ff0000;">&quot;B2 Krimi&quot;</span></pre></div></div>

</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/12/radiomitschnitt-per-rezept/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>underretain in CoreAnimation / iPhone Simulator</title>
		<link>http://blog.mro.name/2009/12/underretain-in-coreanimation-iphone-simulator/</link>
		<comments>http://blog.mro.name/2009/12/underretain-in-coreanimation-iphone-simulator/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 21:32:07 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[3.2.1]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[CoreAnimation]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Simulator]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[underretain]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1603</guid>
		<description><![CDATA[After upgrading to Snow Leopard and XCode 3.2.1 I&#8217;ve seen such console output
CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3838000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
when rotating the iPhone Simulator in a project with base SDK 3.0.
This can be reproduced as follows:

Create a fresh iPhone project (I use a [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://blog.mro.name/2009/11/upgrade-to-snow-leopard/">upgrading to Snow Leopard and XCode 3.2.1</a> I&#8217;ve seen such console output</p>
<pre>CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3838000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug</pre>
<p>when rotating the iPhone Simulator in a project with base SDK 3.0.</p>
<p>This can be reproduced as follows:</p>
<ol>
<li>Create a fresh iPhone project (I use a &#8220;navigation App&#8221; with CoreData)
<div id="attachment_1605" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.38.06.png"><img class="size-medium wp-image-1605" title="Fresh Navigation based App + CoreData" src="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.38.06-300x255.png" alt="Fresh Navigation based App + CoreData" width="300" height="255" /></a><p class="wp-caption-text">Fresh Navigation based App + CoreData</p></div></li>
<li>add

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Override to allow orientations other than the default portrait orientation.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>shouldAutorotateToInterfaceOrientation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIInterfaceOrientation<span style="color: #002200;">&#41;</span>interfaceOrientation <span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// Return YES for supported orientations.</span>
	<span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>willRotateToInterfaceOrientation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIInterfaceOrientation<span style="color: #002200;">&#41;</span>toInterfaceOrientation duration<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSTimeInterval<span style="color: #002200;">&#41;</span>duration <span style="color: #002200;">&#123;</span>
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;willRotateToInterfaceOrientation&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>to the <code>RootViewConroller.m</code></li>
<li>set the base SDK to 3.0:
<p><div id="attachment_1606" class="wp-caption aligncenter" style="width: 300px"><a href="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.41.02.png"><img class="size-medium wp-image-1606" title="Base SDk 3.0" src="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.41.02-290x300.png" alt="Base SDk 3.0" width="290" height="300" /></a><p class="wp-caption-text">Base SDk 3.0</p></div></li>
<li>compile + run with Simulator 3.1.2, everthing fine when rotating the simulator:
<p><div id="attachment_1607" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.42.09.png"><img class="size-medium wp-image-1607" title="Simulator 3.1.2 rotates fine" src="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.42.09-300x158.png" alt="Simulator 3.1.2 rotates fine" width="300" height="158" /></a><p class="wp-caption-text">Simulator 3.1.2 rotates fine</p></div></li>
<li>Simulator 3.0 shows the underretain:
<p><div id="attachment_1608" class="wp-caption aligncenter" style="width: 275px"><a href="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.50.41.png"><img class="size-medium wp-image-1608" title="Simulator 3.0 underretain" src="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-12-um-21.50.41-265x300.png" alt="Simulator 3.0 underretain" width="265" height="300" /></a><p class="wp-caption-text">Simulator 3.0 underretain</p></div>

<div class="wp_syntax"><div class="code"><pre class="gdb" style="font-family:monospace;">[Session started at 2009-12-12 21:49:31 +0100.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type &quot;show copying&quot; to see the conditions.
There is absolutely no warranty for GDB.  Type &quot;show warranty&quot; for details.
This GDB was configured as &quot;x86_64-apple-darwin&quot;.sharedlibrary apply-load-rules all
Attaching to process 32139.
2009-12-12 21:49:43.845 CAUnderRetain[32139:207] willRotateToInterfaceOrientation
CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x1853000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3824000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
warning: Unable to restore previously selected frame.
warning: Couldn't find minimal bounds for &quot;_sigtramp&quot; - backtraces may be unreliable
(gdb) break malloc_error_break
Breakpoint 1 at 0x92626072
(gdb) continue
2009-12-12 21:49:58.490 CAUnderRetain[32139:207] willRotateToInterfaceOrientation
CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3838000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
&nbsp;
Unable to disassemble malloc_error_break.
(gdb) bt
#0  0x92626072 in malloc_error_break ()
#1  0x92535303 in free ()
#2  0x0015ce49 in dataReleaseInfo ()
#3  0x001481d9 in data_provider_finalize ()
#4  0x30204421 in _CFRelease ()
#5  0x00147fa2 in image_finalize ()
#6  0x30204421 in _CFRelease ()
#7  0x00c12ded in CALayerStateRelease ()
#8  0x00c18290 in -[CALayer dealloc] ()
#9  0x00c0a00e in CALayerRelease ()
#10 0x00c0b265 in CA::release_root_if_unused ()
#11 0x00c0b1ef in x_hash_table_remove_if ()
#12 0x00c0afd4 in CA::Transaction::commit ()
#13 0x00c132e0 in CA::Transaction::observer_callback ()
#14 0x30245c32 in __CFRunLoopDoObservers ()
#15 0x3024503f in CFRunLoopRunSpecific ()
#16 0x30244628 in CFRunLoopRunInMode ()
#17 0x32044c31 in GSEventRunModal ()
#18 0x32044cf6 in GSEventRun ()
#19 0x309021ee in UIApplicationMain ()
#20 0x00002018 in main (argc=1, argv=0xbfffea84) at /Users/.../CAUnderRetain/main.m:14
(gdb)</pre></div></div>

</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/12/underretain-in-coreanimation-iphone-simulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoreData generic findManyByKey</title>
		<link>http://blog.mro.name/2009/12/coredata-generic-findmanybykey/</link>
		<comments>http://blog.mro.name/2009/12/coredata-generic-findmanybykey/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 03:32:34 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[CoreData]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSEntityDescription]]></category>
		<category><![CDATA[NSManagedObject]]></category>
		<category><![CDATA[NSManagedObjectContext]]></category>
		<category><![CDATA[NSPredicate]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1583</guid>
		<description><![CDATA[The base for many of my SELECT-ish queries when querying by exact match is one generic method I created in some category methods on NSManagedObjectContext:

-&#40;NSArray*&#41;entityName:&#40;NSString*&#41;entityName findManyByRelation:&#40;NSDictionary*&#41;dict
&#123;
//  TODO handle dict nil and emptyness
    NSMutableArray *arr = &#91;&#91;NSMutableArray alloc&#93; initWithCapacity:dict.count&#93;;
    for&#40;NSString *key in dict&#41;
    &#123;
   [...]]]></description>
			<content:encoded><![CDATA[<p>The base for many of my <a href="http://en.wikipedia.org/wiki/Select_%28SQL%29">SELECT</a>-ish queries when querying by exact match is one generic method I created in some <a href="http://developer.apple.com/iphone/library/DOCUMENTATION/Cocoa/Conceptual/ObjectiveC/Articles/ocCategories.html#//apple_ref/doc/uid/TP30001163-CH20-SW1">category methods</a> on <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/NSManagedObjectContext.html">NSManagedObjectContext</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName findManyByRelation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dict
<span style="color: #002200;">&#123;</span>
<span style="color: #11740a; font-style: italic;">//  TODO handle dict nil and emptyness</span>
    <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>arr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> alloc<span style="color: #002200;">&#93;</span> initWithCapacity<span style="color: #002200;">:</span>dict.count<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>key <span style="color: #a61390;">in</span> dict<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSExpression</span> <span style="color: #002200;">*</span>left <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSExpression</span> expressionForKeyPath<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSExpression</span> <span style="color: #002200;">*</span>right <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSExpression</span> expressionForConstantValue<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dict objectForKey<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSComparisonPredicate</span> <span style="color: #002200;">*</span>cp <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSComparisonPredicate</span> alloc<span style="color: #002200;">&#93;</span> initWithLeftExpression<span style="color: #002200;">:</span>left
            rightExpression<span style="color: #002200;">:</span>right modifier<span style="color: #002200;">:</span>NSDirectPredicateModifier type<span style="color: #002200;">:</span>NSEqualToPredicateOperatorType options<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>arr addObject<span style="color: #002200;">:</span>cp<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>cp release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #400080;">NSPredicate</span> <span style="color: #002200;">*</span>pred <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>arr.count <span style="color: #002200;">==</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>
        pred <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>arr objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span> retain<span style="color: #002200;">&#93;</span>;    <span style="color: #11740a; font-style: italic;">// why do I have to retain here?</span>
    <span style="color: #a61390;">else</span>
        pred <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSCompoundPredicate</span> alloc<span style="color: #002200;">&#93;</span> initWithType<span style="color: #002200;">:</span>NSAndPredicateType subpredicates<span style="color: #002200;">:</span>arr<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #400080;">NSFetchRequest</span> <span style="color: #002200;">*</span>fr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSFetchRequest</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
    fr.entity <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSEntityDescription</span> entityForName<span style="color: #002200;">:</span>entityName inManagedObjectContext<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
    fr.predicate <span style="color: #002200;">=</span> pred;
    <span style="color: #002200;">&#91;</span>arr release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>pred release<span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">//	NSLog(@&quot;predicate effective: %@&quot;, fr.predicate);</span>
&nbsp;
    <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>err <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>ps <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self executeFetchRequest<span style="color: #002200;">:</span>fr error<span style="color: #002200;">:&amp;</span>amp;err<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>err <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSException</span> <span style="color: #a61390;">raise</span><span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DB Error&quot;</span> format<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Fetch problem %@&quot;</span>, fr.predicate.predicateFormat<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>fr release<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> ps;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>For example it serves under the hood of it&#8217;s sibling helpers</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSManagedObject</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName findByPrimaryKey<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dict
<span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>ps <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self entityName<span style="color: #002200;">:</span>entityName findManyByRelation<span style="color: #002200;">:</span>dict<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>ps <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span> || ps.count <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
        <span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>ps.count <span style="color: #002200;">==</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>
        <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>ps objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSException</span> <span style="color: #a61390;">raise</span><span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DB Error&quot;</span> format<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Multiple hits for %@&quot;</span>, dict<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSManagedObject</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #2400d9;">1</span><span style="color: #002200;">/</span><span style="color: #2400d9;">0</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSManagedObject</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>entityName selectOrInsertWithKey<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dict
<span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSManagedObject</span> <span style="color: #002200;">*</span>o <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self entityName<span style="color: #002200;">:</span>entityName findByPrimaryKey<span style="color: #002200;">:</span>dict<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>o <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSEntityDescription</span> <span style="color: #002200;">*</span>ed <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSEntityDescription</span> entityForName<span style="color: #002200;">:</span>entityName inManagedObjectContext<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
        o <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSManagedObject</span> alloc<span style="color: #002200;">&#93;</span> initWithEntity<span style="color: #002200;">:</span>ed insertIntoManagedObjectContext<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>key <span style="color: #a61390;">in</span> dict<span style="color: #002200;">&#41;</span>
            <span style="color: #002200;">&#91;</span>o setValue<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dict objectForKey<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>o autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> o;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Those methods again are called by custom convenience wrappers in the <a href="http://developer.apple.com/iPhone/library/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html">model classes</a> loosely following the <a href="http://martinfowler.com/eaaCatalog/activeRecord.html">ActiveRecord Pattern</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/12/coredata-generic-findmanybykey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heute nur für Stammgäste?</title>
		<link>http://blog.mro.name/2009/12/heute-nur-fur-stammgaste/</link>
		<comments>http://blog.mro.name/2009/12/heute-nur-fur-stammgaste/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 00:18:15 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[seenontheweb]]></category>
		<category><![CDATA[gmx]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1577</guid>
		<description><![CDATA[Von wegen Schock beim Logout &#8211; mich lassen sie gar nicht erst rein:

]]></description>
			<content:encoded><![CDATA[<p>Von wegen <a href="http://detzi.wordpress.com/2009/12/08/nahtod/">Schock beim Logout</a> &#8211; mich lassen sie gar nicht erst rein:<br />
<a href="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-08-um-01.15.45.png"><img class="aligncenter size-full wp-image-1578" title="Bildschirmfoto 2009-12-08 um 01.15.45" src="http://blog.mro.name/wp-content/uploads/2009/12/Bildschirmfoto-2009-12-08-um-01.15.45.png" alt="Bildschirmfoto 2009-12-08 um 01.15.45" width="867" height="604" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/12/heute-nur-fur-stammgaste/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSDateFormatter case sensitive trap</title>
		<link>http://blog.mro.name/2009/12/nsdateformatter-case-sensitive-trap/</link>
		<comments>http://blog.mro.name/2009/12/nsdateformatter-case-sensitive-trap/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 14:05:24 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSDateFormatter]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[SenTestingKit]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1427</guid>
		<description><![CDATA[Though NSDateFormatter behaves slightly different than documented, the following might even be correct, as strange as it might look (mind the last two lines):

-&#40;void&#41;testNSDateFormatterTrap
&#123;
    NSDateFormatter *lower = &#91;&#91;&#91;NSDateFormatter alloc&#93; init&#93; autorelease&#93;;
    lower.dateFormat = @&#34;yyyy-MM-dd HH:mm:SS ZZZ&#34;;
&#160;
    NSDateFormatter *upper = &#91;&#91;&#91;NSDateFormatter alloc&#93; init&#93; autorelease&#93;;
    [...]]]></description>
			<content:encoded><![CDATA[<p>Though <a href="http://blog.mro.name/2009/08/nsdateformatter-http-header/">NSDateFormatter behaves slightly different than documented</a>, the following might even be correct, as strange as it might look (mind the last two lines):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>testNSDateFormatterTrap
<span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>lower <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    lower.dateFormat <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;yyyy-MM-dd HH:mm:SS ZZZ&quot;</span>;
&nbsp;
    <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>upper <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    upper.dateFormat <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;YYYY-MM-dd HH:mm:SS ZZZ&quot;</span>;
&nbsp;
    lower.timeZone <span style="color: #002200;">=</span> upper.timeZone <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSTimeZone</span> timeZoneForSecondsFromGMT<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>d <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>lower dateFromString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1970-01-01 00:00:00 +0000&quot;</span><span style="color: #002200;">&#93;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1970-01-01 00:00:00 +0000&quot;</span>, <span style="color: #002200;">&#91;</span>lower stringFromDate<span style="color: #002200;">:</span>d<span style="color: #002200;">&#93;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;lower iso wrong&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1970-01-01 00:00:00 +0000&quot;</span>, <span style="color: #002200;">&#91;</span>upper stringFromDate<span style="color: #002200;">:</span>d<span style="color: #002200;">&#93;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;upper iso wrong&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
    d <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>d addTimeInterval<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">-</span><span style="color: #2400d9;">60</span><span style="color: #002200;">*</span><span style="color: #2400d9;">60</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1969-12-31 23:00:00 +0000&quot;</span>, <span style="color: #002200;">&#91;</span>lower stringFromDate<span style="color: #002200;">:</span>d<span style="color: #002200;">&#93;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;lower iso wrong&quot;</span><span style="color: #002200;">&#41;</span>;
    STAssertEqualObjects<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1970-12-31 23:00:00 +0000&quot;</span>, <span style="color: #002200;">&#91;</span>upper stringFromDate<span style="color: #002200;">:</span>d<span style="color: #002200;">&#93;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;upper iso wrong&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>The <a href="http://unicode.org/reports/tr35/tr35-6.html#Date_Field_Symbol_Table">Unicode Format Pattern Documentation</a> explains the difference of the upper- and lowercase year format &#8211; but frankly I don&#8217;t get the &#8220;Year of week of year&#8221; idea.</p>
<p>But that subtracting one hour in fact <strong>adds almost a whole year</strong> &#8211; that&#8217;s odd to me.</p>
<p>So I rather stay away from the uppercase form &#8211; be it correct or buggy.</p>
<p>Seen with iPhone SDK 3.1.2 and XCode 3.2.1 on Snow Leopard.</p>
<p><strong>Update:</strong></p>
<p>I think I got it! Uppercase YYYY makes sense only in combination with a calendar week &#8211; and not months or quarters.</p>
<p>Look at January 1st 2010. It belongs to calendar week 53 of 2009. Week 1/2010 starts on Jan 4th.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/12/nsdateformatter-case-sensitive-trap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade to Snow Leopard</title>
		<link>http://blog.mro.name/2009/11/upgrade-to-snow-leopard/</link>
		<comments>http://blog.mro.name/2009/11/upgrade-to-snow-leopard/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 21:58:42 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Graphviz]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[SANE]]></category>
		<category><![CDATA[SenTestingKit]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Twain]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1391</guid>
		<description><![CDATA[
Mac OS X 10.6 Snow Leopard (partition 25G, HFS+ Journaled, Upper/Lower)
Mac OS X 10.5 Leopard (partition 25G, HFS+ Journaled, Upper/Lower)
partition userspace 100G, HFS+ Journaled, Upper/Lower

$ cat /etc/fstab
# mount partition &#34;userspace&#34; as /Users
UUID=D016E3FD-E322-3006-A8F5-D2348C6A5B7B	/Users	hfs	rw,auto


create user &#8220;mig&#8221;
TimeMachine restore Users + Settings
delete user &#8220;mig&#8221;
manually copy user &#8220;Shared&#8221;
iPhone SDK 3.1.2 + XCode 3.2.1
modgenerator 1.5 plus trick

$ ln -s /Developer/usr/bin/momc /Developer/Library/Xcode/Plug-ins/XDCoreDataModel.xdplugin/Contents/Resources/momc


git [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Mac OS X 10.6 Snow Leopard (partition 25G, HFS+ Journaled, Upper/Lower)</li>
<li>Mac OS X 10.5 Leopard (partition 25G, HFS+ Journaled, Upper/Lower)</li>
<li>partition userspace 100G, HFS+ Journaled, Upper/Lower

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab
<span style="color: #666666; font-style: italic;"># mount partition &quot;userspace&quot; as /Users</span>
<span style="color: #007800;">UUID</span>=D016E3FD-E322-<span style="color: #000000;">3006</span>-A8F5-D2348C6A5B7B	<span style="color: #000000; font-weight: bold;">/</span>Users	hfs	rw,auto</pre></div></div>

</li>
<li>create user &#8220;mig&#8221;</li>
<li>TimeMachine restore Users + Settings</li>
<li>delete user &#8220;mig&#8221;</li>
<li>manually copy user &#8220;Shared&#8221;</li>
<li>iPhone SDK 3.1.2 + XCode 3.2.1</li>
<li><a href="http://rentzsch.com/code/mogenerator_v1.5">modgenerator 1.5</a> plus <a href="http://aralbalkan.com/2152">trick</a>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>momc <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>Plug-ins<span style="color: #000000; font-weight: bold;">/</span>XDCoreDataModel.xdplugin<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Resources<span style="color: #000000; font-weight: bold;">/</span>momc</pre></div></div>

</li>
<li><a href="http://code.google.com/p/git-osx-installer/">git 1.6.5.2</a>, manually add to <code>.bash_profile</code>:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>git<span style="color: #000000; font-weight: bold;">/</span>bin</pre></div></div>

</li>
<li><a href="http://www.macports.org/install.php">Macports</a> / http://trac.macports.org/wiki/Migration

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> port selfupdate
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> bcpp pwgen <span style="color: #c20cb9; font-weight: bold;">wget</span> lftp fortune optipng graphviz ragel imagemagick
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> port clean <span style="color: #660033;">--all</span> installed
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #660033;">-f</span> uninstall inactive</pre></div></div>

</li>
<li><a href="http://www.graphviz.org/Download_macos.php">graphviz-2.25.20091129.0545.pkg</a></li>
<li><a href="http://www.barebones.com/products/TextWrangler/">Textwrangler 3.0 (2538)</a></li>
<li><a href="http://gimp.lisanet.de/Website/Download.html">Gimp 2.6.7</a></li>
<li><a href="http://www.neooffice.org/neojava/de/mirrors.php?file=NeoOffice-3.0-Intel.dmg">NeoOffice 3.0.1</a></li>
<li><a href="http://www.evernote.com/about/intl/de/download/">Evernote 1.5.2 (62233)</a></li>
<li><a href="http://www.truecrypt.org/downloads">TrueCrypt 6.3a</a></li>
<li><a href="http://www.dropbox.com/">Dropbox v0.6.570</a></li>
<li><a href="http://skype.com/">Skype 2.8.0.722</a></li>
<li><a href="http://www.mozilla-europe.org/de/firefox/">Firefox 3.5,5</a></li>
<li><a href="http://www.getmiro.com/">Miro Video Player 2.5.3 (775f9134)</a></li>
<li><a href="http://sourceforge.net/projects/maxima/files/">wxMaxima-0.8.3 &amp; Maxima-5.19.2.dmg</a></li>
<li><a href="http://blog.mro.name/2008/12/scanner-mustek-1200-cu-unter-mac-os-x-105/">Twain SANE Scanner Support</a></li>
</ol>
<p>Remaining issues:</p>
<ol>
<li>SenTestingKit error highlighting not working.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/11/upgrade-to-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Was belegt eigentlich wieviel Plattenplatz?</title>
		<link>http://blog.mro.name/2009/11/was-belegt-eigentlich-wieviel-plattenplatz/</link>
		<comments>http://blog.mro.name/2009/11/was-belegt-eigentlich-wieviel-plattenplatz/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 20:36:53 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jdiskreport]]></category>
		<category><![CDATA[Webstart]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1394</guid>
		<description><![CDATA[sagt einem JDiskReport (z.B. per Java Webstart) recht schön zum Durchklicken:

]]></description>
			<content:encoded><![CDATA[<p>sagt einem <a href="http://www.jgoodies.com/freeware/jdiskreport/">JDiskReport</a> (z.B. <a href="http://www.jgoodies.com/download/jdiskreport/jdiskreport.jnlp">per Java Webstart</a>) recht schön zum Durchklicken:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.jgoodies.com/freeware/jdiskreport/images/jdiskreport_med.jpg" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/11/was-belegt-eigentlich-wieviel-plattenplatz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cute idea</title>
		<link>http://blog.mro.name/2009/11/cute-idea/</link>
		<comments>http://blog.mro.name/2009/11/cute-idea/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 10:43:43 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[screendesign]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1384</guid>
		<description><![CDATA[to trigger a refresh &#8211; just pull down the list:

Seen in NibiruTech Mobile RSS v1.2.
]]></description>
			<content:encoded><![CDATA[<p>to trigger a refresh &#8211; just pull down the list:</p>
<p><a href="http://blog.mro.name/wp-content/uploads/2009/11/IMG_1223.PNG"><img class="aligncenter size-full wp-image-1385" title="IMG_1223" src="http://blog.mro.name/wp-content/uploads/2009/11/IMG_1223.PNG" alt="IMG_1223" width="320" height="480" /></a></p>
<p>Seen in <a href="http://www.nibirutech.com/product_MR.html">NibiruTech Mobile RSS v1.2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/11/cute-idea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Email Sicherheit II &#8211; neue Zertifikate</title>
		<link>http://blog.mro.name/2009/11/email-sicherheit-ii-neue-zertifikate/</link>
		<comments>http://blog.mro.name/2009/11/email-sicherheit-ii-neue-zertifikate/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 00:09:28 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[CAcert]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[S/MIME]]></category>
		<category><![CDATA[Thawte]]></category>
		<category><![CDATA[X.509]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1371</guid>
		<description><![CDATA[Nachdem Thawte die Lust verloren hat kostenlose Email Zertifikate auszugeben, bin ich eben zu CAcert gewechselt. Schien mir sogar noch einfacher als damals bei Thawte.
Ein kleiner Wermutstropfen ist, daß CAcert Zertifikate (leider) noch selten von Haus aus als vertrauenswürdig eingestuft werden.
P.S.: Thunderbird zickt ein wenig wegen den Root-Zertifikate von CAcert, aber folgt man der Anleitung [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem <a href="http://www.heise.de/security/meldung/Thawte-stellt-Web-of-Trust-fuer-kostenlose-SSL-Zertifikate-ein-822145.html">Thawte die Lust verloren hat kostenlose Email Zertifikate auszugeben</a>, bin ich eben zu <a href="https://www.cacert.org/index.php?id=1">CAcert</a> gewechselt. Schien mir sogar noch einfacher als <a href="http://blog.mro.name/2009/03/email-sicherheit/">damals bei Thawte</a>.</p>
<p>Ein kleiner Wermutstropfen ist, daß <a href="http://de.wikipedia.org/wiki/CAcert#Vertrauensw.C3.BCrdigkeit">CAcert Zertifikate (leider) noch selten von Haus aus als vertrauenswürdig eingestuft werden</a>.</p>
<p>P.S.: Thunderbird zickt ein wenig wegen den Root-Zertifikate von CAcert, aber folgt man der <a href="http://wiki.cacert.org/ThunderBird">Anleitung  von CAcert</a> ist das auch fix vom Tisch.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/11/email-sicherheit-ii-neue-zertifikate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>T-Mobile Rechnungen auspacken und umbenennen</title>
		<link>http://blog.mro.name/2009/11/t-mobile-rechnungen-auspacken-umbenennen/</link>
		<comments>http://blog.mro.name/2009/11/t-mobile-rechnungen-auspacken-umbenennen/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 17:50:19 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[GnuPG]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1354</guid>
		<description><![CDATA[über T-Mobile RechnungOnline kann man sich die Rechnung als gpg-verschlüsselten Anhang per Mail schicken lassen &#8211; incl. Einzelverbindungsnachweis. Und obwohl&#8217;s nur 1x im Monat kommt, ist das Auspacken und Umbenennen in sinnvolle Dateinamen eine lästige Routinearbeit.
Also &#8211; automatisieren. Das folgende Ruby-Script erledigt das, nachdem der Rechnungsanhang in einen der Ordner &#8220;Downloads&#8221; oder &#8220;Desktop&#8221; gelegt wurde:

#!/usr/bin/ruby
&#160;
dst=&#34;#{ENV['HOME']}/Documents/tmobile&#34;
&#160;
# [...]]]></description>
			<content:encoded><![CDATA[<p>über <a href="http://www.t-mobile.de/faq/1,1951,18-_,00.html">T-Mobile RechnungOnline</a> kann man sich die Rechnung als <a href="http://www.gnupg.org/">gpg</a>-verschlüsselten Anhang per Mail schicken lassen &#8211; incl. Einzelverbindungsnachweis. Und obwohl&#8217;s nur 1x im Monat kommt, ist das Auspacken und Umbenennen in sinnvolle Dateinamen eine lästige Routinearbeit.</p>
<p>Also &#8211; automatisieren. Das folgende Ruby-Script erledigt das, nachdem der Rechnungsanhang in einen der Ordner &#8220;Downloads&#8221; oder &#8220;Desktop&#8221; gelegt wurde:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby</span>
&nbsp;
dst=<span style="color:#996600;">&quot;#{ENV['HOME']}/Documents/tmobile&quot;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># 1. pull together all pgp crypted find Rechnung_15.10.2009.zip.pgp in Desktop, Downloads, local dir</span>
<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;#{ENV['HOME']}/Downloads&quot;</span>, <span style="color:#996600;">&quot;#{ENV['HOME']}/Desktop&quot;</span>, dst<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>dir<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#CC00FF; font-weight:bold;">Dir</span>.<span style="color:#9900CC;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span>dir<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>file<span style="color:#006600; font-weight:bold;">|</span>
    m = <span style="color:#006600; font-weight:bold;">/</span>Rechnung_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>\.<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>\.<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>\.<span style="color:#9900CC;">zip</span><span style="color:#006600; font-weight:bold;">&#40;</span>\.<span style="color:#9900CC;">pgp</span><span style="color:#006600; font-weight:bold;">|</span>\.<span style="color:#9900CC;">gpg</span><span style="color:#006600; font-weight:bold;">&#41;</span>?<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">match</span> file
    <span style="color:#9966CC; font-weight:bold;">if</span> m
      s = <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mv #{dir}/#{file} #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip#{m[4]}&quot;</span>
      s = <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;gpg #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip#{m[4]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> m<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;rm #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip#{m[4]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> s <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> m<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      s = <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;unzip #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip&quot;</span>
      <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;rm #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> s
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;de-crypted &amp; unpacked #{dst}/#{m[3]}-#{m[2]}-#{m[1]}-bill.zip&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># 2. rename unpacked files accordingly</span>
<span style="color:#CC00FF; font-weight:bold;">Dir</span>.<span style="color:#9900CC;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span>dst<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>file<span style="color:#006600; font-weight:bold;">|</span>
  m = <span style="color:#006600; font-weight:bold;">/</span>^Rechnung_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">match</span> file
  <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mv #{dst}/#{file} #{dst}/#{m[1]}-#{m[2]}-bill-#{m[3]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> m
  m = <span style="color:#006600; font-weight:bold;">/</span>^Einzelverbindungsnachweis_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">match</span> file
  <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mv #{dst}/#{file} #{dst}/#{m[1]}-#{m[2]}-evn--#{m[3]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> m
  m = <span style="color:#006600; font-weight:bold;">/</span>^Rechnung_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">5</span>,<span style="color:#006666;">20</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">match</span> file
  <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mv #{dst}/#{file} #{dst}/#{m[3]}-#{m[2]}-bill-#{m[1]}#{m[4]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> m
  m = <span style="color:#006600; font-weight:bold;">/</span>^Einzelverbindungsnachweis_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">5</span>,<span style="color:#006666;">20</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>_<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">match</span> file
  <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mv #{dst}/#{file} #{dst}/#{m[3]}-#{m[2]}-evn--#{m[1]}#{m[4]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> m
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/11/t-mobile-rechnungen-auspacken-umbenennen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Filmfest iPhone App v1.0 online!</title>
		<link>http://blog.mro.name/2009/10/filmfest-iphone-app-v1-0-online/</link>
		<comments>http://blog.mro.name/2009/10/filmfest-iphone-app-v1-0-online/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 22:00:44 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[Filmfest]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1345</guid>
		<description><![CDATA[After almost 6 weeks of eagerly waiting I found Filmfest 1.0 shows in the App Store. Didn&#8217;t get a confirmation / announcement mail but anyway, here it is:

]]></description>
			<content:encoded><![CDATA[<p>After almost 6 weeks of eagerly waiting I found <a href="http://filmfestapp.com/">Filmfest 1.0</a> shows in the <a href="http://filmfestapp.com/go/appstore">App Store</a>. Didn&#8217;t get a confirmation / announcement mail but anyway, here it is:<br />
<a href="http://blog.mro.name/wp-content/uploads/2009/10/IMG_1119.PNG"><img class="size-full wp-image-1347  alignleft" title="IMG_1119" src="http://blog.mro.name/wp-content/uploads/2009/10/IMG_1119.PNG" alt="IMG_1119" width="320" height="480" /></a><a href="http://blog.mro.name/wp-content/uploads/2009/10/IMG_1118.PNG"><img class="size-full wp-image-1346  alignright" title="IMG_1118" src="http://blog.mro.name/wp-content/uploads/2009/10/IMG_1118.PNG" alt="IMG_1118" width="320" height="480" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/10/filmfest-iphone-app-v1-0-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CocoaTouch, CoreData and binary String Search</title>
		<link>http://blog.mro.name/2009/10/cocoatouch-coredata-and-binary-string-search/</link>
		<comments>http://blog.mro.name/2009/10/cocoatouch-coredata-and-binary-string-search/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 18:27:59 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[CoreData]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSPredicate]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1321</guid>
		<description><![CDATA[The query optimiser for NSPredicate queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search enabled quick results:


+&#40;NSPredicate*&#41;findBySearchTerm:&#40;NSString*&#41;rawTerm within:&#40;BOOL&#41;within context:&#40;NSManagedObjectContext*&#41;context
&#123;
    NSSet *tokens = &#91;MovieM indexTokens:rawTerm&#93;;
    if&#40;tokens == nil &#124;&#124; tokens.count &#38;lt; = 0&#41;
      [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/Query_optimizer">query optimiser</a> for <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html">NSPredicate</a> queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search enabled quick results:</p>
<p><span id="more-1321"></span></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">+</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSPredicate</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>findBySearchTerm<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>rawTerm within<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>within context<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSManagedObjectContext</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>context
<span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSSet</span> <span style="color: #002200;">*</span>tokens <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>MovieM indexTokens<span style="color: #002200;">:</span>rawTerm<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>tokens <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span> || tokens.count <span style="color: #002200;">&amp;</span>lt; <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
        <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSPredicate</span> predicateWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;FALSEPREDICATE&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>preds <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> arrayWithCapacity<span style="color: #002200;">:</span>tokens.count<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>within <span style="color: #002200;">==</span> <span style="color: #a61390;">NO</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; context <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// As queries aren't optimised by default we do it ourselves:</span>
	<span style="color: #11740a; font-style: italic;">// 1st: find matching entries from the IndexKey table - leveraging it's index:</span>
        <span style="color: #400080;">NSFetchRequest</span> <span style="color: #002200;">*</span>fr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSFetchRequest</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
        fr.entity <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSEntityDescription</span> entityForName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;IndexKey&quot;</span> inManagedObjectContext<span style="color: #002200;">:</span>context<span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSMutableSet</span> <span style="color: #002200;">*</span>result <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
        <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
        <span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>token <span style="color: #a61390;">in</span> tokens<span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#123;</span>
	    <span style="color: #11740a; font-style: italic;">// BETWEEN uses the table-index while BEGINSWITH does not:</span>
            fr.predicate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSPredicate</span> predicateWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;key BETWEEN {%@, %@}&quot;</span>, token, <span style="color: #002200;">&#91;</span>MovieM upperBoundSearchString<span style="color: #002200;">:</span>token<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>keys <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>context executeFetchRequest<span style="color: #002200;">:</span>fr error<span style="color: #002200;">:&amp;</span>amp;error<span style="color: #002200;">&#93;</span>;
            <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>error <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
                NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Oops: %@&quot;</span>, error<span style="color: #002200;">&#41;</span>;
	    <span style="color: #11740a; font-style: italic;">// turn IndexKey entries to movies (join up):</span>
            <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>movs <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>keys valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;movie&quot;</span><span style="color: #002200;">&#93;</span>;
	    <span style="color: #11740a; font-style: italic;">// aggregate the results for each token:</span>
            <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>result <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
                result <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableSet</span> setWithArray<span style="color: #002200;">:</span>movs<span style="color: #002200;">&#93;</span>;
            <span style="color: #a61390;">else</span>
                <span style="color: #002200;">&#91;</span>result intersectSet<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSSet</span> setWithArray<span style="color: #002200;">:</span>movs<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #002200;">&#91;</span>fr release<span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSPredicate</span> predicateWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SELF IN %@&quot;</span>, result<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #400080;">NSPredicate</span> <span style="color: #002200;">*</span>template <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>within<span style="color: #002200;">&#41;</span>
        template <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSPredicate</span> predicateWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;ANY index.key CONTAiNS $searchTerm&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">else</span>
        template <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSPredicate</span> predicateWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;ANY index.key BEGINSWITH $searchTerm&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>token <span style="color: #a61390;">in</span> tokens<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>params <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithObject<span style="color: #002200;">:</span>token forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;searchTerm&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>preds addObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>template predicateWithSubstitutionVariables<span style="color: #002200;">:</span>params<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSCompoundPredicate</span> andPredicateWithSubpredicates<span style="color: #002200;">:</span>preds<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Helpers herein are</p>
<ul>
<li><code>[MovieM indexTokens:rawTerm]</code> folds diacritics and uppercase and cuts at whitespace or interpunction,</li>
<li><code>[MovieM upperBoundSearchString:token]</code> which was inspired by <a href="http://developer.apple.com/mac/library/samplecode/DerivedProperty/listing8.html">Apple Sample Code &#8220;DerivedProperty&#8221;</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/10/cocoatouch-coredata-and-binary-string-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ist das zensursula?</title>
		<link>http://blog.mro.name/2009/10/ist-das-zensursula/</link>
		<comments>http://blog.mro.name/2009/10/ist-das-zensursula/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 21:59:04 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Artikel auf deutsch]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Root-Nameserver]]></category>
		<category><![CDATA[T-Online]]></category>
		<category><![CDATA[zensursula]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1306</guid>
		<description><![CDATA[Seit heute ca. 15:30 sind die Root-Nameserver für mich (T-Online Kunde) nicht mehr erreichbar:
$ nslookup google.com - j.root-servers.net
Server:		j.root-servers.net
Address:	192.58.128.30#53

Non-authoritative answer:
*** Can't find google.com: No answer
Ist das die Vorbereitung der China Wochen bei T-Online &#38; Co.? Bei Gelegenheit mal ausprobieren: eigene bind Nameserver Instanz.
[Update]: Am rosa Riesen scheint&#8217;s nicht zu liegen &#8211; das Problem liegt wohl in [...]]]></description>
			<content:encoded><![CDATA[<p>Seit heute ca. 15:30 sind die <a href="http://de.wikipedia.org/wiki/Root-Nameserver">Root-Nameserver</a> für mich (T-Online Kunde) nicht mehr erreichbar:</p>
<pre>$ nslookup google.com - j.root-servers.net
Server:		j.root-servers.net
Address:	192.58.128.30#53

Non-authoritative answer:
*** Can't find google.com: No answer</pre>
<p>Ist das die Vorbereitung der <a href="http://www.zdnet.de/news/wirtschaft_sicherheit_security_geheime_technische_details_zum_internetzensurgesetz_aufgetaucht_story-39001024-41515822-1.htm">China Wochen</a> bei T-Online &amp; Co.? Bei Gelegenheit mal ausprobieren: <a href="http://www.zdnet.de/sicherheit_in_der_praxis_sperre_von_freien_dns_servern_so_umgeht_man_die_blockade_story-39001543-41502966-1.htm">eigene bind Nameserver Instanz</a>.</p>
<p><strong>[Update]</strong>: Am rosa Riesen scheint&#8217;s nicht zu liegen &#8211; das Problem liegt wohl in <a href="http://de.wikipedia.org/wiki/OSI-Modell">Layer 8</a>.</p>
<pre>$ nslookup google.com - resolver1.opendns.com
Server:		resolver1.opendns.com
Address:	208.67.222.222#53

Non-authoritative answer:
Name:	google.com
Address: 74.125.67.100
Name:	google.com
Address: 74.125.45.100
Name:	google.com
Address: 74.125.53.100</pre>
<p>In Zukunft also nicht mehr mit den Root-Nameservern, sondern einem vom <a href="http://ccc.de/censorship/dns-howto/#dnsserver">CCC</a> empfohlenen.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/10/ist-das-zensursula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apns4j &#8211; look at the dark side of FOSS</title>
		<link>http://blog.mro.name/2009/10/apns4j-look-at-the-dark-side-of-foss/</link>
		<comments>http://blog.mro.name/2009/10/apns4j-look-at-the-dark-side-of-foss/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 22:53:36 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[APNS]]></category>
		<category><![CDATA[apns4j]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Push]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1297</guid>
		<description><![CDATA[It&#8217;s either trivial or harder than it looks &#8211; (at least) four stalled projects named apns4j:

http://sourceforge.net/projects/apns4j/ (zero files in svn)
https://apns4j.dev.java.net/source/browse/apns4j/ (zero *.java in svn, same ownername as above)
http://code.google.com/p/apns4j/ (zero files in svn, same ownername as above)
http://github.com/netmask/apns4j (three commits)

I didn&#8217;t look closer &#8211; maybe the last was gifted with a mature birth. The first three look [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s either trivial or harder than it looks &#8211; (at least) four stalled projects named apns4j:</p>
<ul>
<li><a href="http://sourceforge.net/projects/apns4j/">http://sourceforge.net/projects/apns4j/</a> (zero files in svn)</li>
<li><a href="https://apns4j.dev.java.net/source/browse/apns4j/">https://apns4j.dev.java.net/source/browse/apns4j/</a> (zero *.java in svn, same ownername as above)</li>
<li><a href="http://code.google.com/p/apns4j/">http://code.google.com/p/apns4j/</a> (zero files in svn, same ownername as above)</li>
<li><a href="http://github.com/netmask/apns4j">http://github.com/netmask/apns4j</a> (three commits)</li>
</ul>
<p>I didn&#8217;t look closer &#8211; maybe the last was gifted with a mature birth. The first three look like the project got stuck in choosing it&#8217;s hoster.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/10/apns4j-look-at-the-dark-side-of-foss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google App Engine + XSLT</title>
		<link>http://blog.mro.name/2009/10/google-app-engine-xslt/</link>
		<comments>http://blog.mro.name/2009/10/google-app-engine-xslt/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 13:47:46 +0000</pubDate>
		<dc:creator>mro</dc:creator>
				<category><![CDATA[Articles in english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Xalan]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://blog.mro.name/?p=1292</guid>
		<description><![CDATA[Google App Engine (java) doesn&#8217;t do XSLT transformations out of the box. Using a Transformer like

TransformerFactory.newInstance&#40;&#41;.newTransformer&#40;new StreamSource&#40;...&#41;&#41;.transform&#40;...&#41;;

yields a
Nested in javax.servlet.ServletException: java.lang.NoClassDefFoundError: com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary is a restricted class. Please see the Google App Engine developer's guide for more details.:
java.lang.NoClassDefFoundError: com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary is a restricted class. Please see the Google App Engine developer's guide for more details.
These google groups [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/intl/en-GB/appengine/docs/java/">Google App Engine (java)</a> doesn&#8217;t do <a href="http://www.w3.org/TR/xslt">XSLT transformations</a> out of the box. Using a <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html">Transformer</a> like</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">TransformerFactory.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">newTransformer</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> StreamSource<span style="color: #009900;">&#40;</span>...<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">transform</span><span style="color: #009900;">&#40;</span>...<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>yields a</p>
<p><code>Nested in javax.servlet.ServletException: java.lang.NoClassDefFoundError: com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary is a restricted class. Please see the Google App Engine developer's guide for more details.:<br />
java.lang.NoClassDefFoundError: com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary is a restricted class. Please see the Google App Engine developer's guide for more details.</code></p>
<p>These google groups posts <a href="http://code.google.com/p/googleappengine/issues/detail?id=1452">http://code.google.com/p/googleappengine/issues/detail?id=1452</a> and <a href="http://groups.google.com/group/google-appengine-java/browse_thread/thread/9c9fb88e1b175395">http://groups.google.com/group/google-appengine-java/browse_thread/thread/9c9fb88e1b175395</a> lead into the right direction but didn&#8217;t completely solve my problem. I added <code>xalan.jar</code> and <code>serializer.jar</code> from xalan-2.7.1 to <code>war/WEB_INF/lib</code> as suggested, but <strong>didn&#8217;t change</strong> the TransformerFactory setup.</p>
<p>This got me the WARNING log entries <code>Failed calling setMethod method</code> and <code>Failed calling setIndent method</code>.</p>
<p>This <a href="http://blog.ad.by/2009/07/xslt-google-app-enginejava.html">cyrillc blog-post</a> lead me to removing all <code>&lt;xsl:output/&gt;</code> statements from the transformation and voilá &#8211; the trafo ran fine!</p>
<p>The whole procedure in short:</p>
<ul>
<li>add <code>xalan.jar</code> and <code>serializer.jar</code> to <code>war/WEB_INF/lib</code>,</li>
<li>remove <code>&lt;xsl:output/&gt;</code> from the stylesheet.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mro.name/2009/10/google-app-engine-xslt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
