<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://blog.mro.name/wp-atom.php">
	<title type="text">MRo Blog</title>
	<subtitle type="text">Marcus Rohrmoser mobile Software</subtitle>

	<updated>2010-09-03T11:45:44Z</updated>

	<link rel="alternate" type="text/html" href="http://blog.mro.name" />
	<id>http://blog.mro.name/feed/atom/</id>
	

	<generator uri="http://wordpress.org/" version="3.0.1">WordPress</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MRO-Blog" /><feedburner:info uri="mro-blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-sa/3.0/" /><logo>http://creativecommons.org/images/public/somerights20.gif</logo><entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[UILabel with a (custom) CGFont]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/WfYFD5XyvgI/" />
		<id>http://blog.mro.name/?p=1935</id>
		<updated>2010-09-03T11:45:44Z</updated>
		<published>2010-08-26T16:05:18Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="CGFont" /><category scheme="http://blog.mro.name" term="Cocoa" /><category scheme="http://blog.mro.name" term="iOS" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="Objective C" /><category scheme="http://blog.mro.name" term="OTF" /><category scheme="http://blog.mro.name" term="TrueType" /><category scheme="http://blog.mro.name" term="TTF" /><category scheme="http://blog.mro.name" term="UIFont" /><category scheme="http://blog.mro.name" term="UILabel" />		<summary type="html"><![CDATA[UILabel&#8217;s font property accepts UIFonts &#8211; but strange enough there&#8217;s no way to get a custom loaded CGFont (from a ttf or otf file) converted into such an UIFont. You&#8217;re stuck with the iPhone&#8217;s pre-installed fonts &#8211; at least when you have to support iOS 3.0 devices. After googling a bit and searching Stackoverflow I found [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/08/uilabel-with-a-custom-cgfont/">&lt;p&gt;&lt;a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UILabel_Class/Reference/UILabel.html#//apple_ref/doc/uid/TP40006797-CH3-SW5"&gt;UILabel&amp;#8217;s font property&lt;/a&gt; accepts &lt;a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UIFont_Class/Reference/Reference.html#//apple_ref/doc/c_ref/UIFont"&gt;UIFont&lt;/a&gt;s &amp;#8211; but strange enough there&amp;#8217;s no way to get a custom loaded &lt;a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGFont/Reference/reference.html"&gt;CGFont&lt;/a&gt; (from a &lt;a href="http://en.wikipedia.org/wiki/TrueType"&gt;ttf&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/OpenType"&gt;otf&lt;/a&gt; file) converted into such an UIFont. You&amp;#8217;re stuck with the iPhone&amp;#8217;s pre-installed fonts &amp;#8211; at least when you have to support iOS 3.0 devices.&lt;/p&gt;
&lt;p&gt;After googling a bit and searching &lt;a href="http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application"&gt;Stackoverflow&lt;/a&gt; I found the solutions presented there not ideal or &lt;a href="http://github.com/zynga/FontLabel"&gt;great, but too heavy weight&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So I inherited UILabel with a very lean custom class UILabelWithCGFont and overloaded it&amp;#8217;s &lt;a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UILabel_Class/Reference/UILabel.html#//apple_ref/doc/uid/TP40006797-CH3-SW10"&gt;drawTextInRect:&lt;/a&gt; method like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="objc" style="font-family:monospace;"&gt;&lt;span style="color: #002200;"&gt;-&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;void&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;drawTextInRect&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;CGRect&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;rect
&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
	MRLogD&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;(%f,%f) (%f,%f)&amp;quot;&lt;/span&gt;, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; _CGFont &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
		&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;super drawTextInRect&lt;span style="color: #002200;"&gt;:&lt;/span&gt;rect&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
		&lt;span style="color: #a61390;"&gt;return&lt;/span&gt;;
	&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;
	NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;_mapping &lt;span style="color: #002200;"&gt;!=&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt;, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;Mapping function pointer not set.&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
	&lt;span style="color: #11740a; font-style: italic;"&gt;// prepare the target graphics context.&lt;/span&gt;
	&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; CGContextRef ctx &lt;span style="color: #002200;"&gt;=&lt;/span&gt; UIGraphicsGetCurrentContext&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	CGContextSaveGState&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
		&lt;span style="color: #11740a; font-style: italic;"&gt;// prepare the glyphs array to draw&lt;/span&gt;
		&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; &lt;span style="color: #400080;"&gt;NSString&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;txt &lt;span style="color: #002200;"&gt;=&lt;/span&gt; self.text;
		&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; &lt;span style="color: #a61390;"&gt;size_t&lt;/span&gt; glyphCount &lt;span style="color: #002200;"&gt;=&lt;/span&gt; txt.length;
		CGGlyph glyphs&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;glyphCount&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
		&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
			&lt;span style="color: #11740a; font-style: italic;"&gt;// turn the string txt into glyphs (indices into the font):&lt;/span&gt;
			&lt;span style="color: #11740a; font-style: italic;"&gt;// give non-allocating unicode character retrieval a try:&lt;/span&gt;
			&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; UniChar &lt;span style="color: #002200;"&gt;*&lt;/span&gt;raw_unichars &lt;span style="color: #002200;"&gt;=&lt;/span&gt; CFStringGetCharactersPtr&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;CFStringRef&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;txt &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
			&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; UniChar &lt;span style="color: #002200;"&gt;*&lt;/span&gt;unichars &lt;span style="color: #002200;"&gt;=&lt;/span&gt; raw_unichars &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt; ? &lt;span style="color: #a61390;"&gt;malloc&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; glyphCount &lt;span style="color: #002200;"&gt;*&lt;/span&gt; &lt;span style="color: #a61390;"&gt;sizeof&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;UniChar&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;:&lt;/span&gt; raw_unichars;
			NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;unichars &lt;span style="color: #002200;"&gt;!=&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt;, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;unichars not allocated&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
			&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; raw_unichars &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
				CFStringGetCharacters&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;CFStringRef&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;txt, CFRangeMake&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;0&lt;/span&gt;, txt.length&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;, &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;UniChar &lt;span style="color: #002200;"&gt;*&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;unichars &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
			&lt;span style="color: #a61390;"&gt;for&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #a61390;"&gt;int&lt;/span&gt; i &lt;span style="color: #002200;"&gt;=&lt;/span&gt; glyphCount &lt;span style="color: #002200;"&gt;-&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;1&lt;/span&gt;; i &lt;span style="color: #002200;"&gt;&amp;amp;&lt;/span&gt;gt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;0&lt;/span&gt;; i&lt;span style="color: #002200;"&gt;--&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
				glyphs&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #002200;"&gt;=&lt;/span&gt; _mapping&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;unichars&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
			&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; raw_unichars &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #a61390;"&gt;NULL&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
				&lt;span style="color: #a61390;"&gt;free&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;void&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;unichars &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		CGContextSetFont&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, _CGFont&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		CGContextSetFontSize&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, self.font.pointSize&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		CGContextSetTextMatrix&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; ctx, CGAffineTransformMake&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;1.0&lt;/span&gt;, &lt;span style="color: #2400d9;"&gt;0.0&lt;/span&gt;, &lt;span style="color: #2400d9;"&gt;0.0&lt;/span&gt;, &lt;span style="color: #002200;"&gt;-&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;1.0&lt;/span&gt;, &lt;span style="color: #2400d9;"&gt;0.0&lt;/span&gt;, &lt;span style="color: #2400d9;"&gt;0.0&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
		&lt;span style="color: #11740a; font-style: italic;"&gt;// first print 'invisible' to measure size:&lt;/span&gt;
		CGContextSetTextDrawingMode&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, kCGTextInvisible&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; CGPoint pre &lt;span style="color: #002200;"&gt;=&lt;/span&gt; CGContextGetTextPosition&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		CGContextShowGlyphs&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, glyphs, glyphCount&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; CGPoint post &lt;span style="color: #002200;"&gt;=&lt;/span&gt; CGContextGetTextPosition&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		&lt;span style="color: #11740a; font-style: italic;"&gt;// restore text position&lt;/span&gt;
		CGContextSetTextPosition&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, pre.x, pre.y&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
		&lt;span style="color: #11740a; font-style: italic;"&gt;// centered horizontal + vertical:&lt;/span&gt;
		NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;int&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;rect.origin.x &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;0&lt;/span&gt;, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;origin.x not zero&amp;quot;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;int&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;rect.origin.y &lt;span style="color: #002200;"&gt;==&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;0&lt;/span&gt;, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;origin.y not zero&amp;quot;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;self.baselineAdjustment &lt;span style="color: #002200;"&gt;==&lt;/span&gt; UIBaselineAdjustmentAlignCenters, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;vertical alignment not 'center'&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		NSAssert&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;self.textAlignment &lt;span style="color: #002200;"&gt;==&lt;/span&gt; UITextAlignmentCenter, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;horizontal alignment not 'center'&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		&lt;span style="color: #a61390;"&gt;const&lt;/span&gt; CGPoint p &lt;span style="color: #002200;"&gt;=&lt;/span&gt; CGPointMake&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; rect.size.width &lt;span style="color: #002200;"&gt;-&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;post.x &lt;span style="color: #002200;"&gt;-&lt;/span&gt; pre.x&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;/&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;2&lt;/span&gt;, &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;rect.size.height &lt;span style="color: #002200;"&gt;+&lt;/span&gt; self.font.pointSize &lt;span style="color: #002200;"&gt;+&lt;/span&gt; pre.y&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #002200;"&gt;/&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;2&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
		&lt;span style="color: #11740a; font-style: italic;"&gt;// finally render it to the graphics context:&lt;/span&gt;
		CGContextSetTextDrawingMode&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, kCGTextFill&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		CGContextSetFillColorWithColor&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, self.textColor.CGColor&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
		CGContextShowGlyphsAtPoint&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx, p.x, p.y, glyphs, glyphCount&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;
	CGContextRestoreGState&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;ctx&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Usage:&lt;/strong&gt; Just turn the UILabel instances in Interface Builder into UILabelWithCGFont and implement the &lt;a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW25"&gt;UIViewController::viewDidLoad&lt;/a&gt; method like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="objc" style="font-family:monospace;"&gt;CGGlyph unicode2glyphDeutscheDruckschrift&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;UniChar c&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
	&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'0'&lt;/span&gt; &amp;lt; &lt;span style="color: #002200;"&gt;=&lt;/span&gt; c &lt;span style="color: #002200;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; c &amp;lt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'9'&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
		&lt;span style="color: #a61390;"&gt;return&lt;/span&gt; c &lt;span style="color: #002200;"&gt;+&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;16&lt;/span&gt; &lt;span style="color: #002200;"&gt;-&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'0'&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'A'&lt;/span&gt; &amp;lt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; c &lt;span style="color: #002200;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; c &amp;lt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'Z'&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
		&lt;span style="color: #a61390;"&gt;return&lt;/span&gt; c &lt;span style="color: #002200;"&gt;+&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;32&lt;/span&gt; &lt;span style="color: #002200;"&gt;-&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'A'&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #a61390;"&gt;if&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'a'&lt;/span&gt; &amp;lt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; c &lt;span style="color: #002200;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; c &amp;lt;&lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'z'&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;
		&lt;span style="color: #a61390;"&gt;return&lt;/span&gt; c &lt;span style="color: #002200;"&gt;+&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;58&lt;/span&gt; &lt;span style="color: #002200;"&gt;-&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;'a'&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style="color: #a61390;"&gt;return&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;0&lt;/span&gt;;
&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #002200;"&gt;-&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;void&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;viewDidLoad
&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
	&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;super viewDidLoad&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
	...
	&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;fontLabel setFontFromFile&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;DeutscheDruckschrift&amp;quot;&lt;/span&gt; ofType&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;ttf&amp;quot;&lt;/span&gt; mapping&lt;span style="color: #002200;"&gt;:&lt;/span&gt;unicode2glyphDeutscheDruckschrift&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
	...
&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;See this &lt;a href="http://gist.github.com/551646"&gt;github gist&lt;/a&gt; for the complete implementation.&lt;/p&gt;
&lt;p&gt;The mapping from &lt;a href="http://unicode.org/"&gt;Unicode&lt;/a&gt; character codes to &lt;a href="http://en.wikipedia.org/wiki/Glyph"&gt;glyph&lt;/a&gt; indices (inside the &lt;a href="http://en.wikipedia.org/wiki/TrueType"&gt;font description&lt;/a&gt;) currently is done via a C mapping function you have to provide a &lt;a href="http://en.wikipedia.org/wiki/Function_pointer"&gt;function pointer&lt;/a&gt; for. A later implementation could map the unicode character code to the glyph name and leverage  &lt;a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGFont/Reference/reference.html#//apple_ref/doc/uid/TP30000953-CH1g-SW13"&gt;CGFontGetGlyphWithGlyphName&lt;/a&gt; and render the custom mapping function obsolete.&lt;/p&gt;
&lt;p&gt;&lt;span id="more-1935"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;script src="http://gist.github.com/551646.js"&gt; &lt;/script&gt;&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/WfYFD5XyvgI" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/08/uilabel-with-a-custom-cgfont/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/08/uilabel-with-a-custom-cgfont/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/08/uilabel-with-a-custom-cgfont/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Visualise macports dependencies]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/U8F5uJETL5U/" />
		<id>http://blog.mro.name/?p=1927</id>
		<updated>2010-08-15T16:19:46Z</updated>
		<published>2010-08-15T16:12:04Z</published>
		<category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="Graphviz" /><category scheme="http://blog.mro.name" term="MacPorts" /><category scheme="http://blog.mro.name" term="OS X" /><category scheme="http://blog.mro.name" term="Ruby" />		<summary type="html"><![CDATA[to clean up your installed macports and remove cruft you need to uninstall them in the correct order &#8211; according to their dependencies. A graphical visualisation might help doing so: Call $ ./port-deps2dot.rb &#124; dot -Tpdf -o port-deps.pdf ; open port-deps.pdf with the ruby script port-deps2dot.rb as follows: #!/usr/bin/ruby -w &#160; # visualize macports dependencies. [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/08/visualise-macports-dependencies/">&lt;p&gt;to clean up your installed macports and remove cruft you need to uninstall them in the correct order &amp;#8211; according to their dependencies.&lt;/p&gt;
&lt;p&gt;A graphical visualisation might help doing so:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.mro.name/wp-content/uploads/2010/08/port-deps.png"&gt;&lt;img class="aligncenter size-medium wp-image-1928" title="port-deps" src="http://blog.mro.name/wp-content/uploads/2010/08/port-deps-188x300.png" alt="" width="188" height="300" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Call&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;$ .&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;port-deps2dot.rb &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; dot &lt;span style="color: #660033;"&gt;-Tpdf&lt;/span&gt; &lt;span style="color: #660033;"&gt;-o&lt;/span&gt; port-deps.pdf ; open port-deps.pdf&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with the ruby script &lt;code&gt;port-deps2dot.rb&lt;/code&gt; as follows:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="ruby" style="font-family:monospace;"&gt;&lt;span style="color:#008000; font-style:italic;"&gt;#!/usr/bin/ruby -w&lt;/span&gt;
&amp;nbsp;
&lt;span style="color:#008000; font-style:italic;"&gt;# visualize macports dependencies.&lt;/span&gt;
&lt;span style="color:#008000; font-style:italic;"&gt;# pipe the result through graphviz, e.g.&lt;/span&gt;
&lt;span style="color:#008000; font-style:italic;"&gt;# $ ./port-deps2dot.rb | dot -Tpdf -o port-deps.pdf ; open port-deps.pdf&lt;/span&gt;
&amp;nbsp;
&lt;span style="color:#9966CC; font-weight:bold;"&gt;def&lt;/span&gt; scan_deps
	pat = &lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;^&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;^:&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;+&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;:&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;.&lt;span style="color:#006600; font-weight:bold;"&gt;+&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;$&lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;
	name = &lt;span style="color:#996600;"&gt;''&lt;/span&gt;
	deps = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;
	&lt;span style="color:#CC00FF; font-weight:bold;"&gt;IO&lt;/span&gt;.&lt;span style="color:#9900CC;"&gt;popen&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color:#996600;"&gt;'port info --name --pretty --depends installed'&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color:#9966CC; font-weight:bold;"&gt;do&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;f&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;
		f.&lt;span style="color:#9900CC;"&gt;each_line&lt;/span&gt; &lt;span style="color:#9966CC; font-weight:bold;"&gt;do&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;l&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;
			&lt;span style="color:#9966CC; font-weight:bold;"&gt;case&lt;/span&gt; l
				&lt;span style="color:#9966CC; font-weight:bold;"&gt;when&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;^&lt;span style="color:#006600; font-weight:bold;"&gt;--&lt;/span&gt;$&lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;
					&lt;span style="color:#9966CC; font-weight:bold;"&gt;yield&lt;/span&gt; name, deps
					name = &lt;span style="color:#996600;"&gt;''&lt;/span&gt;
					deps = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;
				&lt;span style="color:#9966CC; font-weight:bold;"&gt;when&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;^&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;^:&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;+&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;:&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;.&lt;span style="color:#006600; font-weight:bold;"&gt;+&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;$&lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;
					&lt;span style="color:#9966CC; font-weight:bold;"&gt;if&lt;/span&gt; &lt;span style="color:#996600;"&gt;'name'&lt;/span&gt; == &lt;span style="color:#996600;"&gt;&amp;quot;#$1&amp;quot;&lt;/span&gt;
						name = &lt;span style="color:#996600;"&gt;&amp;quot;#$2&amp;quot;&lt;/span&gt;.&lt;span style="color:#9900CC;"&gt;strip&lt;/span&gt;
					&lt;span style="color:#9966CC; font-weight:bold;"&gt;else&lt;/span&gt;
						deps.&lt;span style="color:#9900CC;"&gt;concat&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color:#996600;"&gt;&amp;quot;#$2&amp;quot;&lt;/span&gt;.&lt;span style="color:#CC0066; font-weight:bold;"&gt;split&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;\s&lt;span style="color:#006600; font-weight:bold;"&gt;*&lt;/span&gt;,\s&lt;span style="color:#006600; font-weight:bold;"&gt;*/&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#41;&lt;/span&gt;
					&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
				&lt;span style="color:#9966CC; font-weight:bold;"&gt;else&lt;/span&gt;
					&lt;span style="color:#CC0066; font-weight:bold;"&gt;raise&lt;/span&gt; &lt;span style="color:#996600;"&gt;&amp;quot;Fall-through for '#{l}'&amp;quot;&lt;/span&gt;
			&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
		&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
	&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
&amp;nbsp;
all = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
scan_deps &lt;span style="color:#9966CC; font-weight:bold;"&gt;do&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;name,deps&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;
	d = all&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;name&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;
	all&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;name&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt; = d = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color:#9966CC; font-weight:bold;"&gt;if&lt;/span&gt; d.&lt;span style="color:#0000FF; font-weight:bold;"&gt;nil&lt;/span&gt;?
	deps.&lt;span style="color:#9900CC;"&gt;collect&lt;/span&gt;! &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;i&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt; i.&lt;span style="color:#9900CC;"&gt;strip&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#125;&lt;/span&gt;
	d.&lt;span style="color:#9900CC;"&gt;concat&lt;/span&gt; deps
	d.&lt;span style="color:#9900CC;"&gt;sort&lt;/span&gt;!
	d.&lt;span style="color:#9900CC;"&gt;uniq&lt;/span&gt;!
&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
&amp;nbsp;
head = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;lt;&lt;/span&gt;END_OF_STRING
&lt;span style="color:#008000; font-style:italic;"&gt;#!/usr/bin/dot -Tpdf -o port-deps.pdf&lt;/span&gt;
&lt;span style="color:#006600; font-weight:bold;"&gt;/*&lt;/span&gt;
	See http:&lt;span style="color:#006600; font-weight:bold;"&gt;//&lt;/span&gt;www.&lt;span style="color:#9900CC;"&gt;graphviz&lt;/span&gt;.&lt;span style="color:#9900CC;"&gt;org&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;/&lt;/span&gt;Documentation.&lt;span style="color:#9900CC;"&gt;php&lt;/span&gt;
&lt;span style="color:#006600; font-weight:bold;"&gt;*/&lt;/span&gt;
digraph &lt;span style="color:#996600;"&gt;&amp;quot;port deps&amp;quot;&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#123;&lt;/span&gt;
	rankdir=LR;
    label=&lt;span style="color:#996600;"&gt;&amp;quot;port deps&amp;quot;&lt;/span&gt;;
    node &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;style=filled,fillcolor=lightblue,shape=ellipse&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;;
END_OF_STRING
&amp;nbsp;
&lt;span style="color:#CC0066; font-weight:bold;"&gt;puts&lt;/span&gt; head
&amp;nbsp;
all.&lt;span style="color:#9900CC;"&gt;keys&lt;/span&gt;.&lt;span style="color:#9900CC;"&gt;sort&lt;/span&gt;.&lt;span style="color:#9900CC;"&gt;each&lt;/span&gt; &lt;span style="color:#9966CC; font-weight:bold;"&gt;do&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;name&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;
	deps = all&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#91;&lt;/span&gt;name&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#93;&lt;/span&gt;
	&lt;span style="color:#9966CC; font-weight:bold;"&gt;if&lt;/span&gt; deps.&lt;span style="color:#9900CC;"&gt;count&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#006666;"&gt;0&lt;/span&gt;
		deps.&lt;span style="color:#9900CC;"&gt;each&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt;d&lt;span style="color:#006600; font-weight:bold;"&gt;|&lt;/span&gt; &lt;span style="color:#CC0066; font-weight:bold;"&gt;puts&lt;/span&gt; &lt;span style="color:#996600;"&gt;&amp;quot;&lt;span style="color:#000099;"&gt;\t&lt;/span&gt;&lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt;#{name}&lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt; -&amp;gt; &lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt;#{d}&lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt;;&amp;quot;&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#125;&lt;/span&gt;
	&lt;span style="color:#9966CC; font-weight:bold;"&gt;else&lt;/span&gt;
		&lt;span style="color:#CC0066; font-weight:bold;"&gt;puts&lt;/span&gt; &lt;span style="color:#996600;"&gt;&amp;quot;&lt;span style="color:#000099;"&gt;\t&lt;/span&gt;&lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt;#{name}&lt;span style="color:#000099;"&gt;\&amp;quot;&lt;/span&gt;;&amp;quot;&lt;/span&gt;
	&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
&lt;span style="color:#9966CC; font-weight:bold;"&gt;end&lt;/span&gt;
&amp;nbsp;
foot = &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color:#006600; font-weight:bold;"&gt;&amp;lt;&lt;/span&gt;END_OF_STRING
&lt;span style="color:#006600; font-weight:bold;"&gt;&amp;#125;&lt;/span&gt;
END_OF_STRING
&amp;nbsp;
&lt;span style="color:#CC0066; font-weight:bold;"&gt;puts&lt;/span&gt; foot&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/U8F5uJETL5U" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/08/visualise-macports-dependencies/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/08/visualise-macports-dependencies/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/08/visualise-macports-dependencies/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Develop with iOS 4 SDK on an OS 3.0 Device]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/1Edr44emxBA/" />
		<id>http://blog.mro.name/?p=1919</id>
		<updated>2010-06-23T11:32:27Z</updated>
		<published>2010-06-23T11:15:24Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Base SDK" /><category scheme="http://blog.mro.name" term="Deployment Target" /><category scheme="http://blog.mro.name" term="Device" /><category scheme="http://blog.mro.name" term="iOS 4" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="iPhone OS 3.0" /><category scheme="http://blog.mro.name" term="XCode" />		<summary type="html"><![CDATA[After upgrading to iOS 4.0 SDK, iPhone OS 3.0 is no longer a valid &#8220;Base SDK&#8221;. Naively switching to iPhone 3.2 prevents deployment to a 3.0 device. But such &#8220;Project -&#62; Edit Project Settings&#8221; work out fine: &#8220;Deployment Target&#8221; hint found here.]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/06/develop-with-ios-4-on-an-os-3-0-device/">&lt;p&gt;After upgrading to iOS 4.0 SDK, iPhone OS 3.0 is no longer a valid &amp;#8220;Base SDK&amp;#8221;. Naively switching to iPhone 3.2 prevents deployment to a 3.0 device.&lt;/p&gt;
&lt;p&gt;But such &amp;#8220;Project -&amp;gt; Edit Project Settings&amp;#8221; work out fine:&lt;/p&gt;
&lt;div id="attachment_1921" class="wp-caption aligncenter" style="width: 310px"&gt;&lt;a href="http://blog.mro.name/wp-content/uploads/2010/06/iPhoneOS3_0-device-with-iOS4_0-SDK.png"&gt;&lt;img class="size-medium wp-image-1921" title="iPhoneOS 3.0 development device with iOS 4.0 SDK" src="http://blog.mro.name/wp-content/uploads/2010/06/iPhoneOS3_0-device-with-iOS4_0-SDK-300x111.png" alt="iPhoneOS 3.0 development device with iOS 4.0 SDK" width="300" height="111" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;iPhoneOS 3.0 development device with iOS 4.0 SDK&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://forum.unity3d.com/viewtopic.php?p=335612"&gt;&amp;#8220;Deployment Target&amp;#8221; hint found here&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/1Edr44emxBA" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/06/develop-with-ios-4-on-an-os-3-0-device/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/06/develop-with-ios-4-on-an-os-3-0-device/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/06/develop-with-ios-4-on-an-os-3-0-device/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[iOS 4 Simulator crash (when installed to custom folder)]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/8lTssV8Kobk/" />
		<id>http://blog.mro.name/?p=1917</id>
		<updated>2010-06-23T11:23:41Z</updated>
		<published>2010-06-23T10:42:11Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="crash" /><category scheme="http://blog.mro.name" term="iOS 4" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="iPhone Simulator" /><category scheme="http://blog.mro.name" term="Softlink" /><category scheme="http://blog.mro.name" term="XCode" />		<summary type="html"><![CDATA[just downloaded and installed the iOS 4 SDK and as my root OS X partition is rather (too) small, I put it into a custom location /Users/Developer.Snowleopard/. This causes the iPhone Simulator to crash and compiling gives an error like: ibtool failed with exception: Interface Builder encountered an error communicating with the iPhone Simulator. If [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/06/ios-4-simulator-crash-when-installed-to-custom-folder/">&lt;p&gt;just downloaded and installed the iOS 4 SDK and as my root OS X partition is rather (too) small, I put it into a custom location /Users/Developer.Snowleopard/.&lt;/p&gt;
&lt;p&gt;This causes the iPhone Simulator to crash and compiling gives an error like:&lt;/p&gt;
&lt;pre&gt;ibtool failed with exception: Interface Builder encountered an error communicating with the iPhone Simulator. If you choose to file a crash report or radar for this issue, please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" and include their content in your crash report.
...
dyld: Library not loaded: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
  Referenced from: /Users/Developer.SnowLeopard/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
  Reason: image not found&lt;/pre&gt;
&lt;p&gt;The cure &amp;#8211; a softlink:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;$ &lt;span style="color: #c20cb9; font-weight: bold;"&gt;ln&lt;/span&gt; &lt;span style="color: #660033;"&gt;-s&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;Users&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;Developer.SnowLeopard&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;Platforms &lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;Developer&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;Platforms&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/8lTssV8Kobk" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/06/ios-4-simulator-crash-when-installed-to-custom-folder/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/06/ios-4-simulator-crash-when-installed-to-custom-folder/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/06/ios-4-simulator-crash-when-installed-to-custom-folder/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[XCode: missing &#8220;deprecated&#8221; warnings]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/A_22hRbOa3w/" />
		<id>http://blog.mro.name/?p=1889</id>
		<updated>2010-06-23T09:23:34Z</updated>
		<published>2010-06-22T10:55:56Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="alloc" /><category scheme="http://blog.mro.name" term="compiler" /><category scheme="http://blog.mro.name" term="deprecated" /><category scheme="http://blog.mro.name" term="gcc" /><category scheme="http://blog.mro.name" term="initWithFrame" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="Objective C" /><category scheme="http://blog.mro.name" term="UITableViewCell" /><category scheme="http://blog.mro.name" term="warning" /><category scheme="http://blog.mro.name" term="XCode" />		<summary type="html"><![CDATA[when developing for long-term use, you want to use APIs that aren&#8217;t likely to be removed soon, a.k.a. &#8220;deprecated&#8221;. So, don&#8217;t use downward compatible calls below a point you really aim for. XCode helps with compiler warnings about &#8220;deprecated&#8221; calls &#8211; if &#8220;Project -&#62; Edit Project Settings -&#62; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS&#8221; is set: But be careful, this [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/">&lt;p&gt;when developing for long-term use, you want to use APIs that aren&amp;#8217;t &lt;a href="http://en.wikipedia.org/wiki/Deprecation"&gt;likely to be removed soon, a.k.a. &amp;#8220;deprecated&amp;#8221;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, don&amp;#8217;t use downward compatible calls below a point you really aim for.&lt;/p&gt;
&lt;p&gt;XCode helps with compiler warnings about &amp;#8220;deprecated&amp;#8221; calls &amp;#8211; if &amp;#8220;Project -&amp;gt; Edit Project Settings -&amp;gt; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS&amp;#8221; is set:&lt;/p&gt;
&lt;div id="attachment_1890" class="wp-caption aligncenter" style="width: 395px"&gt;&lt;a href="http://blog.mro.name/wp-content/uploads/2010/06/Bildschirmfoto-2010-06-22-um-12.39.48.png"&gt;&lt;img class="size-full wp-image-1890 " title="Compiler setting: Warn about deprecated calls" src="http://blog.mro.name/wp-content/uploads/2010/06/Bildschirmfoto-2010-06-22-um-12.39.48.png" alt="Compiler setting: Warn about deprecated calls" width="385" height="150" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;Compiler setting: Warn about deprecated calls&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;But be careful, this complains e.g. here only once while &lt;code&gt;&lt;a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableViewCell_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/TP40006938-CH3-SW32"&gt;initWithFrame:&lt;/a&gt;&lt;/code&gt; is also deprecated (compiling for iPhone OS 3.0):&lt;/p&gt;
&lt;div id="attachment_1891" class="wp-caption aligncenter" style="width: 310px"&gt;&lt;a href="http://blog.mro.name/wp-content/uploads/2010/06/Bildschirmfoto-2010-06-22-um-12.41.57.png"&gt;&lt;img class="size-medium wp-image-1891  " title="No &amp;quot;deprecated&amp;quot; warning on initXY" src="http://blog.mro.name/wp-content/uploads/2010/06/Bildschirmfoto-2010-06-22-um-12.41.57-300x14.png" alt="" width="300" height="14" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;No &amp;quot;deprecated&amp;quot; warning on initXY&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;As &lt;a href="http://stackoverflow.com/questions/2135514/deprecated-not-triggering-compiler-warning-with-subclass/2136130#comment-2076316"&gt;Kevin Ballard pointed out at Stackoverflow&lt;/a&gt;, this is because &lt;code&gt;[AnyClass alloc]&lt;/code&gt; returns a type &lt;code&gt;id&lt;/code&gt; &amp;#8211; which doesn&amp;#8217;t know about it&amp;#8217;s interface.&lt;/p&gt;
&lt;p&gt;To get this kind of compiler warnings, you have to type-cast the &lt;code&gt;[AnyClass alloc]&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="objc" style="font-family:monospace;"&gt;&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;AnyClass&lt;span style="color: #002200;"&gt;*&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;AnyClass alloc&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt; initXY&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Maybe time for a macro?&lt;/p&gt;
&lt;p&gt;The macro could look like&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="objc" style="font-family:monospace;"&gt;&lt;span style="color: #11740a; font-style: italic;"&gt;// http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/&lt;/span&gt;
&lt;span style="color: #6e371a;"&gt;#define alloc(c)	((c*)[c alloc])&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Migrate your codebase via XCode &amp;#8220;Edit -&amp;gt; Find in Project&amp;#8221; with search pattern &lt;code&gt;\[\s*([^\[\]]+)\s+alloc\s*\]&lt;/code&gt; and replacement pattern &lt;code&gt;alloc(\1)&lt;/code&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/A_22hRbOa3w" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Simple HTTP Access Authorisation]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/0hwhpm5G7Uw/" />
		<id>http://blog.mro.name/?p=1872</id>
		<updated>2010-06-14T10:56:49Z</updated>
		<published>2010-06-14T09:56:46Z</published>
		<category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="apache" /><category scheme="http://blog.mro.name" term="authentication" /><category scheme="http://blog.mro.name" term="authorisation" /><category scheme="http://blog.mro.name" term="Basic Authentication" /><category scheme="http://blog.mro.name" term="Cram" /><category scheme="http://blog.mro.name" term="htaccess" /><category scheme="http://blog.mro.name" term="HTTPS" /><category scheme="http://blog.mro.name" term="mod_rewrite" /><category scheme="http://blog.mro.name" term="rest" /><category scheme="http://blog.mro.name" term="restful" /><category scheme="http://blog.mro.name" term="RewriteCond" /><category scheme="http://blog.mro.name" term="RewriteRule" />		<summary type="html"><![CDATA[sometimes you may want to lock down RESTful APIs or plain HTTP GET resources for authorised access by your own client software only, without requiring authentication. You don&#8217;t know who (not authenticated), but you know she may access (is authorised). If the server has a valid SSL certificate based on a root certificate pre-installed on the [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/06/simple-http-access-authorisation/">&lt;p&gt;sometimes you may want to lock down &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer"&gt;RESTful APIs&lt;/a&gt; or plain HTTP GET resources for &lt;a href="http://en.wikipedia.org/wiki/Authorization"&gt;authorised access&lt;/a&gt; by your own client software only, without requiring &lt;a href="http://en.wikipedia.org/wiki/Authentication"&gt;authentication&lt;/a&gt;. You don&amp;#8217;t know who (not authenticated), but you know she may access (is authorised).&lt;/p&gt;
&lt;p&gt;If the server has a valid &lt;a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html"&gt;SSL certificate&lt;/a&gt; based on a root certificate pre-installed on the iPhone among the simplest ways to do it are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Basic_access_authentication"&gt;HTTP Basic Authentication&lt;/a&gt; with static username + password. This requires just a &lt;a href="http://httpd.apache.org/docs/2.0/mod/core.html#authtype"&gt;&lt;code&gt;.htaccess&lt;/code&gt; configuration setting&lt;/a&gt; and you&amp;#8217;re done.&lt;/li&gt;
&lt;li&gt;send a custom &lt;a href="http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html"&gt;HTTP Request Header&lt;/a&gt; with a secret token, also just a &lt;code&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html"&gt;.htaccess&lt;/a&gt;&lt;/code&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html"&gt; rewrite&lt;/a&gt; setting required:

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="htaccess" style="font-family:monospace;"&gt;RewriteEngine On
RewriteCond %{HTTP:My-Secret-Token} !=WRdsWXwwTZjEIRrgD5tODVf0U
RewriteRule ^.*$ - [forbidden,last]
# Test: $  curl --header &amp;quot;My-Secret-Token:WRdsWXwwTZjEIRrgD5tODVf0U&amp;quot; http://myserver.example.com/demo/&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Decompiling an App may raise the bar high enough though hard-coded secrets surely aren&amp;#8217;t bulletproof Secret Service grade quality. If you don&amp;#8217;t want the password or secret token as literal string inside the App, synthesize it at runtime.&lt;/p&gt;
&lt;p&gt;If your transport channel isn&amp;#8217;t confidential (e.g. plain HTTP, not HTTPS) you might think about &lt;a href="http://en.wikipedia.org/wiki/Digest_access_authentication"&gt;Digest Authentication&lt;/a&gt; or a custom implemented &lt;a href="http://en.wikipedia.org/wiki/CRAM-MD5"&gt;CRAMish&lt;/a&gt; mechanism which I will not go into in this post.&lt;/p&gt;
&lt;p&gt;P.S.: &lt;a href="http://www.evolt.org/ultimate_htaccess_examples"&gt;Here are some really nice &lt;code&gt;.htaccess&lt;/code&gt; examples&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/0hwhpm5G7Uw" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/06/simple-http-access-authorisation/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/06/simple-http-access-authorisation/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/06/simple-http-access-authorisation/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Automatic gzip compression for Apache2 Webservers]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/30ouHzifDT4/" />
		<id>http://blog.mro.name/?p=1864</id>
		<updated>2010-06-13T11:55:25Z</updated>
		<published>2010-06-13T11:55:25Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="apache" /><category scheme="http://blog.mro.name" term="Debian" /><category scheme="http://blog.mro.name" term="gzip" /><category scheme="http://blog.mro.name" term="htaccess" /><category scheme="http://blog.mro.name" term="Linux" /><category scheme="http://blog.mro.name" term="mod_deflate" />		<summary type="html"><![CDATA[after failing and failing again in the last months, I finally got it with the help of http://www.debian-administration.org/articles/137 The .htaccess configuration AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript requires Apache&#8217;s mod_deflate enabled via $ a2enmod deflate Module deflate installed; run /etc/init.d/apache2 force-reload to enable. Check the result with http://www.gidnetwork.com/tools/gzip-test.php Caution: There seems to be an [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/06/automatic-gzip-compression-for-apache2-webservers/">&lt;p&gt;after failing and failing again in the last months, I finally got it with the help of &lt;a href="http://www.debian-administration.org/articles/137"&gt;http://www.debian-administration.org/articles/137&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;.htaccess&lt;/code&gt; configuration&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="htaccess" style="font-family:monospace;"&gt;AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;requires Apache&amp;#8217;s &lt;code&gt;mod_deflate&lt;/code&gt; enabled via&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;$ a2enmod deflate
Module deflate installed; run &lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;etc&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;init.d&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;apache2 force-reload to enable.&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Check the result with &lt;a href="http://www.gidnetwork.com/tools/gzip-test.php"&gt;http://www.gidnetwork.com/tools/gzip-test.php&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Caution:&lt;/strong&gt; There seems to be an &lt;a href="http://phpperformance.de/mod_gzip-mod_deflate-und-sonstige-komprimierungsverfahren-fuer-web-inhalte/#comment-17970"&gt;If-Modified-Since/Last-Modified HTTP 304 bug in mod_deflate&lt;/a&gt;, so better don&amp;#8217;t use it for large, rarely changing files.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/30ouHzifDT4" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/06/automatic-gzip-compression-for-apache2-webservers/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/06/automatic-gzip-compression-for-apache2-webservers/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/06/automatic-gzip-compression-for-apache2-webservers/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[iPhone: libxml2 &amp; RELAX NG validation]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/2zRHqFVQVvo/" />
		<id>http://blog.mro.name/?p=1825</id>
		<updated>2010-06-14T12:37:40Z</updated>
		<published>2010-05-28T11:18:51Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Apple" /><category scheme="http://blog.mro.name" term="Cocoa" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="libxml2" /><category scheme="http://blog.mro.name" term="NSXMLParser" /><category scheme="http://blog.mro.name" term="RELAX NG" /><category scheme="http://blog.mro.name" term="SAX" /><category scheme="http://blog.mro.name" term="W3C" /><category scheme="http://blog.mro.name" term="XML" /><category scheme="http://blog.mro.name" term="xmllint" /><category scheme="http://blog.mro.name" term="xmlTextReader" />		<summary type="html"><![CDATA[Having a validating parser in place can reduce the required code to parse XML a lot &#8211; you know very well what you actually get. As mentioned in my last post about RELAX NG &#38; trang, I prefer RELAX NG over W3C XML Schema &#8211; which doesn&#8217;t matter anyway because Apple&#8217;s suggested XML parser doesn&#8217;t [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/05/iphone-libxml2-relax-ng-validation/">&lt;p&gt;Having a &lt;a href="http://www.w3.org/TR/REC-xml/#dt-valid"&gt;validating parser&lt;/a&gt; in place can reduce the required code to parse &lt;a href="http://en.wikipedia.org/wiki/XML"&gt;XML&lt;/a&gt; a lot &amp;#8211; you know very well what you actually get. As mentioned in my last post about &lt;a href="http://blog.mro.name/2010/05/xml-toolbox-relax-ng-trang/"&gt;RELAX NG &amp;amp; trang&lt;/a&gt;, I prefer &lt;a href="http://www.oasis-open.org/committees/relax-ng/"&gt;RELAX NG&lt;/a&gt; over &lt;a href="http://en.wikipedia.org/wiki/XML_Schema_(W3C)"&gt;W3C XML Schema&lt;/a&gt; &amp;#8211; which doesn&amp;#8217;t matter anyway because &lt;a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html"&gt;Apple&amp;#8217;s suggested XML parser&lt;/a&gt; doesn&amp;#8217;t validate at all.&lt;/p&gt;
&lt;p&gt;So we have to go one level deeper and have a look at &lt;a href="http://www.xmlsoft.org/"&gt;libxml2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://developer.apple.com/iphone/library/samplecode/XMLPerformance/Listings/Classes_LibXMLParser_m.html#//apple_ref/doc/uid/DTS40008094-Classes_LibXMLParser_m-DontLinkElementID_10"&gt;Apple&amp;#8217;s example &amp;#8220;XmlPerformance&amp;#8221;&lt;/a&gt; helped to get started, but didn&amp;#8217;t do the trick because libxml2 allows validation for &lt;a href="http://www.xmlsoft.org/html/libxml-tree.html#xmlDocPtr"&gt;&lt;code&gt;xmlDocPtr&lt;/code&gt;&lt;/a&gt; or &lt;a href="http://www.xmlsoft.org/xmlreader.html"&gt;&lt;code&gt;xmlTextReader&lt;/code&gt;&lt;/a&gt; but not for &lt;a href="http://www.xmlsoft.org/html/libxml-tree.html#xmlSAXHandler"&gt;SAX parsers&lt;/a&gt; as used in the example.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.xmlsoft.org/examples/"&gt;libxml2 examples&lt;/a&gt; didn&amp;#8217;t help me too much either, but luckily there&amp;#8217;s &lt;a href="http://git.gnome.org/browse/libxml2/tree/xmllint.c#n2252"&gt;xmllint available in source&lt;/a&gt; (OSS just rocks) which does almost what we want. It first parses the XML into a &lt;code&gt;xmlDocPtr&lt;/code&gt; and validates afterwards &amp;#8211; and it does so for a reason:&lt;/p&gt;
&lt;p&gt;You can have a validating &lt;code&gt;xmlTextReader&lt;/code&gt; (via &lt;code&gt;&lt;a href="http://xmlsoft.org/html/libxml-xmlreader.html#xmlTextReaderRelaxNGSetSchema"&gt;xmlTextReaderRelaxNGSetSchema&lt;/a&gt;&lt;/code&gt;), but it won&amp;#8217;t detect &lt;a href="http://www.w3.org/TR/xmlschema-2/#IDREF"&gt;IDREF&lt;/a&gt;s missing their referred to &lt;a href="http://www.w3.org/TR/xmlschema-2/#ID"&gt;ID&lt;/a&gt; and the error messages lack the name of the failing item. BTW &amp;#8211; when validating against a &lt;a href="https://bugzilla.gnome.org/show_bug.cgi?id=170795"&gt;W3C schema this ID/IDREF check isn&amp;#8217;t available yet&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I finally discarded streaming XML parsing in favour of validation and &lt;a href="http://www.xmlsoft.org/examples/index.html#parse4.c"&gt;&amp;#8220;push&amp;#8221; parsing&lt;/a&gt; (nice for data coming in over the wire) and did:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://git.gnome.org/browse/libxml2/tree/xmllint.c#n3513"&gt;load the RELAX NG regular form schema (watch out for the assignment of &lt;code&gt;relaxngschemas&lt;/code&gt;)&lt;/a&gt; &amp;#8211; similar to xmllint schema loading,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://git.gnome.org/browse/libxml2/tree/xmllint.c#n2252"&gt;push the raw XML data into a &lt;code&gt;xmlDocPtr&lt;/code&gt; (&lt;code&gt;xmlCreatePushParserCtxt&lt;/code&gt;)&lt;/a&gt; exactly like xmllint,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://git.gnome.org/browse/libxml2/tree/xmllint.c#n2829"&gt;validate the in-memory document (&lt;code&gt;xmlRelaxNGValidateDoc&lt;/code&gt;)&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://xmlsoft.org/html/libxml-xmlreader.html#xmlReaderWalker"&gt;turn it into a &lt;code&gt;xmlTextReader&lt;/code&gt;&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.xmlsoft.org/xmlreader.html#Walking"&gt;process the reader&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Wrap up:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if you want full RELAX NG validation with libxml2 v2.7.3, forget about streamed parsing,&lt;/li&gt;
&lt;li&gt;wrap the document into a &lt;code&gt;xmlTextReader&lt;/code&gt; if you want a SAXish programming model.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I may prepare and publish a &lt;code&gt;MroLibxml2Parser&lt;/code&gt; inheriting &lt;code&gt;&lt;a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html"&gt;NSXMLParser&lt;/a&gt;&lt;/code&gt; and firing it&amp;#8217;s callbacks in order to easily switch validating and non-validating parser implementations, but this has to wait a bit. Stay tuned.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/2zRHqFVQVvo" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/05/iphone-libxml2-relax-ng-validation/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/05/iphone-libxml2-relax-ng-validation/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/05/iphone-libxml2-relax-ng-validation/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[XML Toolbox: RELAX NG &amp; trang]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/r347B9oe4jU/" />
		<id>http://blog.mro.name/?p=1771</id>
		<updated>2010-06-14T20:50:24Z</updated>
		<published>2010-05-21T20:10:25Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Atom" /><category scheme="http://blog.mro.name" term="expat" /><category scheme="http://blog.mro.name" term="libxml2" /><category scheme="http://blog.mro.name" term="regular expression" /><category scheme="http://blog.mro.name" term="RELAX NG" /><category scheme="http://blog.mro.name" term="rest" /><category scheme="http://blog.mro.name" term="restful" /><category scheme="http://blog.mro.name" term="schema" /><category scheme="http://blog.mro.name" term="trang" /><category scheme="http://blog.mro.name" term="W3C" /><category scheme="http://blog.mro.name" term="XML" /><category scheme="http://blog.mro.name" term="xmllint" />		<summary type="html"><![CDATA[e.g. when handling RESTful APIs you may want to validate the response XML &#8211; a custom one in most cases. I typically use tools already installed on every Mac and fire a http GET request with curl and immediately check it with xmllint like $ curl http://www.heise.de/newsticker/heise-atom.xml &#124; xmllint --format --schema myschema.xsd - But I [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/05/xml-toolbox-relax-ng-trang/">&lt;p&gt;e.g. when handling &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer"&gt;RESTful APIs&lt;/a&gt; you may want to &lt;a href="http://www.w3.org/TR/REC-xml/#dt-valid"&gt;validate&lt;/a&gt; the response &lt;a href="http://en.wikipedia.org/wiki/XML"&gt;XML&lt;/a&gt; &amp;#8211; a custom one in most cases.&lt;/p&gt;
&lt;p&gt;I typically use tools already installed on every Mac and fire a &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3"&gt;http GET&lt;/a&gt; request with &lt;code&gt;&lt;a href="http://curl.haxx.se/"&gt;curl&lt;/a&gt;&lt;/code&gt; and immediately check it with &lt;code&gt;&lt;a href="http://xmlsoft.org/xmllint.html"&gt;xmllint&lt;/a&gt;&lt;/code&gt; like&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;$ curl http:&lt;span style="color: #000000; font-weight: bold;"&gt;//&lt;/span&gt;www.heise.de&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;newsticker&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;heise-atom.xml &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; xmllint &lt;span style="color: #660033;"&gt;--format&lt;/span&gt; &lt;span style="color: #660033;"&gt;--schema&lt;/span&gt; myschema.xsd -&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But I just don&amp;#8217;t like to create and edit &lt;a href="http://en.wikipedia.org/wiki/XML_Schema_(W3C)"&gt;W3C XML Schemas&lt;/a&gt; &amp;#8211; the notorious angle brackets hurt my eyes and the redundant element names hide the real stuff in tons of ever same text. Neither do I like to click through graphical schema editors and getting lost hunting for hidden settings and property dialogs.&lt;/p&gt;
&lt;p&gt;A minimal and naive schema validating the above example &lt;a href="http://www.ietf.org/rfc/rfc4287.txt"&gt;Atom&lt;/a&gt; feed (and simply created from the feed itself with trang, see below) as W3C Schema looks like this:&lt;/p&gt;
&lt;div id="attachment_1773" class="wp-caption aligncenter" style="width: 310px"&gt;&lt;a href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-21-um-21.05.49.png"&gt;&lt;img class="size-medium wp-image-1773" title="Naive Atom W3C Schema" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-21-um-21.05.49-300x294.png" alt="Naive Atom W3C Schema" width="300" height="294" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text"&gt;Naive Atom W3C Schema&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Here comes in &lt;a href="http://en.wikipedia.org/wiki/RELAX_NG"&gt;RELAX NG&lt;/a&gt;, especially it&amp;#8217;s &amp;#8220;&lt;a href="http://relaxng.org/compact-tutorial-20030326.html"&gt;compact form&lt;/a&gt;&amp;#8220;, which is just what I like &amp;#8211; a concise, BNF-ish syntax. It was designed by &lt;a href="http://en.wikipedia.org/wiki/Murata_Makoto"&gt;Murata Makoto&lt;/a&gt; and &lt;a href="http://www.jclark.com/"&gt;James Clark&lt;/a&gt;, Technical Lead of the XML Working Group back when XML was created and father of the famous &lt;a href="http://en.wikipedia.org/wiki/Expat_(XML)"&gt;expat parser&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The very same schema as above as RELAX NG boils down to ½ the lines and about ⅓ of the characters without a single angle bracket:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="relaxng" style="font-family:monospace;"&gt;default namespace = &amp;quot;http://www.w3.org/2005/Atom&amp;quot;
&amp;nbsp;
start =
  element feed {
    title,
    element subtitle { text },
    link+,
    updated,
    element author {
      element name { text }
    },
    id,
    element entry { title, link, id, updated }+
  }
title = element title { text }
link =
  element link {
    attribute href { xsd:anyURI },
    attribute rel { xsd:NCName }?
  }
updated = element updated { xsd:dateTime }
id = element id { xsd:anyURI }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And as &lt;a href="http://xmlsoft.org/"&gt;libxml2&lt;/a&gt; and therefore xmllint supports RELAX NG, you can use the regular syntax to validate like in the beginning, but with a much more editable schema:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;$ curl http:&lt;span style="color: #000000; font-weight: bold;"&gt;//&lt;/span&gt;www.heise.de&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;newsticker&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;heise-atom.xml &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; xmllint &lt;span style="color: #660033;"&gt;--format&lt;/span&gt; &lt;span style="color: #660033;"&gt;--relaxng&lt;/span&gt; myschema.rng -&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3&gt;&lt;a href="http://www.thaiopensource.com/relaxng/trang.html"&gt;trang&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;is a schema converter for RELAX NG written in Java which I wrapped inside a &lt;a href="http://en.wikipedia.org/wiki/Bash"&gt;bash&lt;/a&gt; script:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;#!/bin/sh&lt;/span&gt;
java &lt;span style="color: #660033;"&gt;-jar&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;`&lt;/span&gt;&lt;span style="color: #c20cb9; font-weight: bold;"&gt;dirname&lt;/span&gt; $&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;`/&lt;/span&gt;trang-&lt;span style="color: #000000;"&gt;20090818&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;trang.jar $&lt;span style="color: #000000; font-weight: bold;"&gt;@&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Writing a new schema from scratch can be much more convenient if you have a bunch of XML files you can feed into trang:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="sh" style="font-family:monospace;"&gt;$ trang *.xml myschema.rnc&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;then refine the resulting schema in compact form and finally turn it into the regular form:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="sh" style="font-family:monospace;"&gt;$ trang myschema.rnc myschema.rng&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Trang also serves me as a schema indenter by converting from compact to regular and back.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;BUT: trang converts RELAX NG into W3C but not vice versa.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Deep validation&lt;/h3&gt;
&lt;p&gt;Validating XML documents shouldn&amp;#8217;t stop with elements and attributes but rather leverage &lt;a href="http://www.w3.org/TR/xmlschema-2/#built-in-datatypes"&gt;XML Schema Datatypes&lt;/a&gt; and apply e.g. &lt;a href="http://en.wikipedia.org/wiki/Regular_expression"&gt;regular expressions&lt;/a&gt;&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="relaxng" style="font-family:monospace;"&gt;  element uuid {
    xsd:string {
&amp;nbsp;
      ## A UUID
      pattern =
        &amp;quot;[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}&amp;quot;
    }
  }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or range constraints&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="relaxng" style="font-family:monospace;"&gt;        element year {
          xsd:unsignedShort { minInclusive = &amp;quot;1900&amp;quot; maxInclusive = &amp;quot;2100&amp;quot; }
        }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;P.S.: For a more complete Atom RELAX NG schema see &lt;a href="http://www.asahi-net.or.jp/~eb2m-mrt/atomextensions/atom.rnc"&gt;here&lt;/a&gt; or ask your search engine of choice.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/r347B9oe4jU" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/05/xml-toolbox-relax-ng-trang/#comments" thr:count="3" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/05/xml-toolbox-relax-ng-trang/feed/atom/" thr:count="3" />
		<thr:total>3</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/05/xml-toolbox-relax-ng-trang/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[TextWrangler + tidy]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/8jQhy6eZ4dg/" />
		<id>http://blog.mro.name/?p=1751</id>
		<updated>2010-05-21T21:59:42Z</updated>
		<published>2010-05-17T09:30:14Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="bash" /><category scheme="http://blog.mro.name" term="html" /><category scheme="http://blog.mro.name" term="OS X" /><category scheme="http://blog.mro.name" term="TextWrangler" /><category scheme="http://blog.mro.name" term="tidy" /><category scheme="http://blog.mro.name" term="utf8" /><category scheme="http://blog.mro.name" term="xhtml" />		<summary type="html"><![CDATA[as I didn&#8217;t get TidyService to work correctly with UTF8 umlauts, I created a UNIX Shell Script wrapper for html tidy as it comes with OS X that does the job at least for TextWrangler: open TextWranglers &#8220;Unix Filters Folder&#8221; create a file named e.g. &#8220;Tidy Html.sh&#8221;, paste the following lines into the file and [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/05/textwrangler-tidy/">&lt;p&gt;as I didn&amp;#8217;t get &lt;a href="http://www.pixelfreak.net/tidy_service/"&gt;TidyService&lt;/a&gt; to work correctly with &lt;a href="http://en.wikipedia.org/wiki/UTF-8"&gt;UTF8 umlauts&lt;/a&gt;, I created a &lt;a href="http://en.wikipedia.org/wiki/Bourne_shell"&gt;UNIX Shell Script&lt;/a&gt; wrapper for &lt;a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/tidy.1.html"&gt;html tidy as it comes with OS X&lt;/a&gt; that does the job at least for &lt;a href="http://www.barebones.com/products/textwrangler/"&gt;TextWrangler&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;open TextWranglers &amp;#8220;Unix Filters Folder&amp;#8221;&lt;a style="text-decoration: none;" href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-17-um-11.15.12.png"&gt;&lt;img class="aligncenter size-medium wp-image-1752" title="Bildschirmfoto 2010-05-17 um 11.15.12" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-17-um-11.15.12-300x211.png" alt="" width="300" height="211" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;create a file named e.g. &amp;#8220;Tidy Html.sh&amp;#8221;,&lt;/li&gt;
&lt;li&gt;paste the following lines into the file and save it:

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;#!/bin/sh&lt;/span&gt;
&lt;span style="color: #666666; font-style: italic;"&gt;# run &amp;quot;tidy&amp;quot; on the file given as 1st (and only) parameter.&lt;/span&gt;
&lt;span style="color: #666666; font-style: italic;"&gt;#&lt;/span&gt;
&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;usr&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;bin&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;tidy &lt;span style="color: #660033;"&gt;-utf8&lt;/span&gt; &lt;span style="color: #660033;"&gt;-asxhtml&lt;/span&gt; &lt;span style="color: #660033;"&gt;-indent&lt;/span&gt; &lt;span style="color: #660033;"&gt;-wrap&lt;/span&gt; &lt;span style="color: #000000;"&gt;100&lt;/span&gt; &lt;span style="color: #660033;"&gt;-quiet&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;&amp;quot;$1&amp;quot;&lt;/span&gt; &lt;span style="color: #000000;"&gt;2&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;dev&lt;span style="color: #000000; font-weight: bold;"&gt;/&lt;/span&gt;null&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;li&gt;now you can run &lt;a href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-20-um-20.25.44.png"&gt;&lt;img class="aligncenter size-medium wp-image-1764" title="Bildschirmfoto 2010-05-20 um 20.25.44" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-20-um-02.25.44-300x206.png" alt="" width="300" height="206" /&gt;&lt;/a&gt;tidy on files opened in TextWrangler, even remote files.&lt;/li&gt;
&lt;li&gt;assign a keyboard shortcut (I used CTRL-T in the shot above) via the &amp;#8220;Unix Filters&amp;#8221; Palette:&lt;a href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-20-um-20.22.56.png"&gt;&lt;img class="aligncenter size-medium wp-image-1762" title="Bildschirmfoto 2010-05-20 um 20.22.56" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-20-um-02.22.56-300x160.png" alt="" width="300" height="160" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/8jQhy6eZ4dg" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/05/textwrangler-tidy/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/05/textwrangler-tidy/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/05/textwrangler-tidy/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Immo Betrug / Scam]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/y4svjb4bqgU/" />
		<id>http://blog.mro.name/?p=1738</id>
		<updated>2010-05-12T10:43:26Z</updated>
		<published>2010-05-12T10:20:42Z</published>
		<category scheme="http://blog.mro.name" term="Artikel auf deutsch" /><category scheme="http://blog.mro.name" term="offtopic" /><category scheme="http://blog.mro.name" term="Immo" /><category scheme="http://blog.mro.name" term="Nigeria" /><category scheme="http://blog.mro.name" term="Scam" />		<summary type="html"><![CDATA[auf Wohnungssuche begegnet man lustigen Sachen. Da war dieses extrem billige Angebot (2 Zi, 80m² für 550€) mit spannender Adresse, aber fragen kostet ja nix. Die erste Mail der Anbieterin war dann: Hi, Thanks for your interest. The apartment is still available. I moved recently with my job in London, United Kingdom, but the rent [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/05/immo-betrug-scam/">&lt;p&gt;auf Wohnungssuche begegnet man lustigen Sachen. Da war dieses extrem billige Angebot (2 Zi, 80m² für 550€) mit &lt;a href="http://maps.google.de/maps?f=q&amp;amp;source=s_q&amp;amp;hl=de&amp;amp;geocode=&amp;amp;q=karolinenplatz+3,+m%C3%BCnchen&amp;amp;sll=51.151786,10.415039&amp;amp;sspn=21.085965,36.606445&amp;amp;ie=UTF8&amp;amp;hq=&amp;amp;hnear=Karolinenplatz+3,+M%C3%BCnchen+80333+M%C3%BCnchen,+Bayern&amp;amp;t=h&amp;amp;z=18"&gt;spannender Adresse&lt;/a&gt;, aber fragen kostet ja nix.&lt;/p&gt;
&lt;p&gt;Die erste Mail der Anbieterin war dann:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your interest. The apartment is still available. I moved recently with my job in London, United Kingdom, but the rent is high here, I decided to offer to rent the apartment I have in Munchen . I rented the apartment for maximum 10 years &amp;#8230; This is the period that I have a contract here, but I can rent it for a shorter period also. I own the ground and is exactly as in the photos. The rent for 1 month is 550 EUR and does not include all the utilities you (water, electricity, Internet, cable). You can enter the apartment on the same day when receiving the keys .. The only problem is that i had to move with my job to United Kingdom, London where i am now and i left the keys and contract already signed by me at a company called Rent.com and they will handle the payment and delivery for us. If you want to know more about how this deal can work please get back to me ASAP and i will send you the details step by step. Thank you and hope to hear back from you.&lt;/p&gt;
&lt;p&gt;My German is limited at just a few words so i wish a lot to continue our conversation in English.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;dann ging&amp;#8217;s 2x per Mail hin und her,&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If we decide to proceed with this transaction, I will have to contact Rent.com and provide them all the necessary information, so they can start the process right away. I will need your full name and address for that. You will receive a notification from Rent.com shortly after that, together with all the instructions to follow and the invoice as well.&lt;/p&gt;
&lt;p&gt;Regarding the payment, you will be instructed to deposit the money to a Rent.com account. They will hold and insure your money until you check the apartment and decide if you want take it or not. That is how their buyer protection policy works. As far as my concerns, I will be glad to know that Rent.com has the possession of the money during the delivery period. That is my insurance.&lt;/p&gt;
&lt;p&gt;As soon as the funds have been deposited into their account, they will immediately start the shipping process.&lt;/p&gt;
&lt;p&gt;The keys and rental contract will be delivered at your address in no more than 3 working days. You will be given a ten days inspection period from the day you receive the keys and contract at home. If you decide to hold the apartment, then you will have to authorize Rent.com to release the funds to me, and the transaction will be completed. If you will not be satisfied with the apartment, you will be able to send the keys and contract back through the same service and ask Rent.com to return the funds to you.&lt;/p&gt;
&lt;p&gt;Through I am sure you will love the apartment, it is good to know that you do have this second option available. If you wish to proceed with renting the apartment, please provide me your full name and address so I can initiate the deal through Rent.com right away.&lt;/p&gt;
&lt;p&gt;I am looking forward to hearing from you.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;die Anbieterin wollte nicht anrufen aber eine Zahlungsanweisung kam, die mich dann richtig stutizg machte, weil&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;der ganze Ablauf eh schon recht seltsam war,&lt;/li&gt;
&lt;li&gt;deren Absenderemail &amp;#8220;rentcom@consultant.com&amp;#8221; nicht mal von rent.com kam,&lt;a href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.11.41.png"&gt;&lt;img class="aligncenter size-medium wp-image-1740" title="Bildschirmfoto 2010-05-12 um 12.11.41" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.11.41-251x300.png" alt="" width="251" height="300" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;rent.com außerhalb USA gar nix macht,&lt;/li&gt;
&lt;li&gt;die &lt;a href="http://aruljohn.com/info/howtofindipaddress/#aol"&gt;Einlieferungs-IP&lt;/a&gt; der Zahlungsanweisung die gleiche wie die der Mails von der Anbieterin war,&lt;/li&gt;
&lt;li&gt;ja sogar &amp;#8220;In-Reply&amp;#8221; auf die vorherigen Mails,&lt;a href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.08.37.png"&gt;&lt;img class="aligncenter size-medium wp-image-1739" title="Bildschirmfoto 2010-05-12 um 12.08.37" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.08.37-300x92.png" alt="" width="300" height="92" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;das Geld an jemanden anderen gehen sollte,&lt;a style="text-decoration: none;" href="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.24.10.png"&gt;&lt;img class="aligncenter size-medium wp-image-1746" title="Bildschirmfoto 2010-05-12 um 12.24.10" src="http://blog.mro.name/wp-content/uploads/2010/05/Bildschirmfoto-2010-05-12-um-12.24.10-300x131.png" alt="" width="300" height="131" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;an der &lt;a href="http://maps.google.de/maps?f=q&amp;amp;source=s_q&amp;amp;hl=de&amp;amp;geocode=&amp;amp;q=karolinenplatz+3,+m%C3%BCnchen&amp;amp;sll=51.151786,10.415039&amp;amp;sspn=21.085965,36.606445&amp;amp;ie=UTF8&amp;amp;hq=&amp;amp;hnear=Karolinenplatz+3,+M%C3%BCnchen+80333+M%C3%BCnchen,+Bayern&amp;amp;t=h&amp;amp;z=18"&gt;Wohnungs-Adresse&lt;/a&gt; wohl gar keine Wohnungen sind,&lt;/li&gt;
&lt;li&gt;ein &lt;a href="http://aufgehts.wordpress.com/2010/05/12/augen-auf-beim-mietwohnungs-suchen/"&gt;Spezl&lt;/a&gt; mich auf die &lt;a href="http://www.rent.com/company/security/"&gt;Warnungen bei rent.com&lt;/a&gt; und einen &lt;a href="http://www.bbc.co.uk/blogs/watchdog/2008/10/flathunters_transfer_trap.html"&gt;Bericht bei der BBC&lt;/a&gt; hinwies.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Nach meiner Frage nach dem Namen des Hausmeisters war dann Funkstille in London.&lt;/p&gt;
&lt;p&gt;Zu guter letzt hat mich &lt;a href="http://aktuell.immobilienscout24.de/u/gm.php?prm=BEAgxe2VrU_116434665_159087_80916"&gt;Immoscout24 heute nochmal per Mail vor Betrügern gewarnt&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/y4svjb4bqgU" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/05/immo-betrug-scam/#comments" thr:count="10" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/05/immo-betrug-scam/feed/atom/" thr:count="10" />
		<thr:total>10</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/05/immo-betrug-scam/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[WordPress Email Benachrichtigungen]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/ZUOBMhwYI28/" />
		<id>http://blog.mro.name/?p=1734</id>
		<updated>2010-05-04T09:41:26Z</updated>
		<published>2010-05-04T09:36:13Z</published>
		<category scheme="http://blog.mro.name" term="Artikel auf deutsch" /><category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="Email" /><category scheme="http://blog.mro.name" term="Wordpress" />		<summary type="html"><![CDATA[ojeoje, ist das so abseitig oder hab&#8217; ich&#8217;s nicht verstanden? War jedenfalls komplizierter als erwartet: Die Konto Einstellungen für den Email Absender müssen von Hand in die DB geschrieben werden &#8211; die 4 mailserver_* Zeilen in der Tabelle wordpress_options, Absenderadresse und Nick dann noch per Plugin, fertig. Aber wieso so kompliziert?]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/05/wordpress-email-benachrichtigungen/">&lt;p&gt;ojeoje, ist das so abseitig oder hab&amp;#8217; ich&amp;#8217;s nicht verstanden? War jedenfalls komplizierter als erwartet:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Die Konto Einstellungen für den Email Absender müssen von Hand in die DB geschrieben werden &amp;#8211; die 4 &lt;code&gt;mailserver_*&lt;/code&gt; Zeilen in der Tabelle &lt;code&gt;wordpress_options&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;Absenderadresse und Nick dann noch &lt;a href="http://blog.kips-world.de/wp-email-absender-aendern/"&gt;per Plugin&lt;/a&gt;,&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;fertig. Aber wieso so kompliziert?&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/ZUOBMhwYI28" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/05/wordpress-email-benachrichtigungen/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/05/wordpress-email-benachrichtigungen/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/05/wordpress-email-benachrichtigungen/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Tooltip: doxygen &amp; graphviz (OS X)]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/3hWr-_gW8Cw/" />
		<id>http://blog.mro.name/?p=1721</id>
		<updated>2010-04-27T15:42:12Z</updated>
		<published>2010-04-27T15:17:09Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="dot" /><category scheme="http://blog.mro.name" term="Doxygen" /><category scheme="http://blog.mro.name" term="Graphviz" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="make" /><category scheme="http://blog.mro.name" term="OS X" />		<summary type="html"><![CDATA[ever seen error messages like this when generating doxygen docs for an iPhone/Mac Objective C project: .../build/doxygen/html/a00136.png' produced by dot is not a valid PNG! You should either select a different format (DOT_IMAGE_FORMAT in the config file) or install a more recent version of graphviz (1.7+) ? Happened to me this morning when running doxygen [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/04/tooltip-doxygen-graphviz-os-x/">&lt;p&gt;ever seen error messages like this when generating doxygen docs for an iPhone/Mac Objective C project:&lt;/p&gt;
&lt;pre&gt;.../build/doxygen/html/a00136.png' produced by dot is not a valid PNG!
You should either select a different format (DOT_IMAGE_FORMAT in the config file) or install a more recent version of graphviz (1.7+)&lt;/pre&gt;
&lt;p&gt;?&lt;/p&gt;
&lt;p&gt;Happened to me this morning when running &lt;a href="http://www.doxygen.org"&gt;doxygen&lt;/a&gt; on another box. The &lt;a href="http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc"&gt;doxygen dmg&lt;/a&gt; was installed in &lt;code&gt;/Applications&lt;/code&gt;, I even added the &lt;a href="http://graphviz.darwinports.com/"&gt;graphviz macport&lt;/a&gt;, so WTF.&lt;/p&gt;
&lt;p&gt;It turned out, that&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the doxygen dmg brings everything it needs, including graphviz,&lt;/li&gt;
&lt;li&gt;&lt;em&gt;but&lt;/em&gt;: the full path to the dot executable has to be set &lt;em&gt;inside&lt;/em&gt; the &lt;a href="http://www.stack.nl/~dimitri/doxygen/config.html#cfg_dot_path"&gt;doxygen config&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, when using the dot from the doxygen dmg, it has to be set to&lt;/p&gt;
&lt;pre&gt;/Applications/Doxygen.app/Contents/Resources&lt;/pre&gt;
&lt;p&gt;I fixed &lt;a href="http://wiki.mro.name/orga/xcode_project_setup#makefile"&gt;my generic Makefile&lt;/a&gt; and make a good guess now while keeping things configurable per user as the Makefile and doxygen config are committed sources and should not contain user specific settings.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/3hWr-_gW8Cw" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/04/tooltip-doxygen-graphviz-os-x/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/04/tooltip-doxygen-graphviz-os-x/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/04/tooltip-doxygen-graphviz-os-x/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Radio Geeky]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/3U-w3nySB3o/" />
		<id>http://blog.mro.name/?p=1714</id>
		<updated>2010-03-28T09:41:59Z</updated>
		<published>2010-03-27T12:05:02Z</published>
		<category scheme="http://blog.mro.name" term="Artikel auf deutsch" /><category scheme="http://blog.mro.name" term="sysadmin" /><category scheme="http://blog.mro.name" term="Bayern2" /><category scheme="http://blog.mro.name" term="cron" /><category scheme="http://blog.mro.name" term="Debian" /><category scheme="http://blog.mro.name" term="github" /><category scheme="http://blog.mro.name" term="iTunes" /><category scheme="http://blog.mro.name" term="Linux" /><category scheme="http://blog.mro.name" term="Mitschnitt" /><category scheme="http://blog.mro.name" term="Podcast" /><category scheme="http://blog.mro.name" term="Radio" /><category scheme="http://blog.mro.name" term="RSS" /><category scheme="http://blog.mro.name" term="Ruby" /><category scheme="http://blog.mro.name" term="scrAPI" /><category scheme="http://blog.mro.name" term="Screen Scraping" /><category scheme="http://blog.mro.name" term="SQLite" /><category scheme="http://blog.mro.name" term="streamripper" /><category scheme="http://blog.mro.name" term="Zündfunk" />		<summary type="html"><![CDATA[wie schon in einem älteren Artikel angerissen möchte ich zeitgesteuert Radiosendungen aufnehmen &#8211; und zwar auf einem Rechner (mit Apache Webserver), der rund um die Uhr läuft. Nun habe ich kürzlich einem großen Zündfunk-Fan, der selten Zeit hat ihn zu hören, diesen Mitschnitt als Podcast zum Geburtstag geschenkt. Das ganze wurde aufwändiger als ich dachte [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/03/radio-geeky/">&lt;p&gt;wie schon in einem &lt;a href="http://blog.mro.name/2009/12/radiomitschnitt-per-rezept/"&gt;älteren Artikel&lt;/a&gt; angerissen möchte ich zeitgesteuert Radiosendungen aufnehmen &amp;#8211; und zwar auf einem Rechner (mit Apache Webserver), der rund um die Uhr läuft.&lt;/p&gt;
&lt;p&gt;Nun habe ich kürzlich einem großen &lt;a href="http://www.br-online.de/bayern2/zuendfunk/"&gt;Zündfunk&lt;/a&gt;-Fan, der selten Zeit hat ihn zu hören, diesen Mitschnitt als &lt;a href="http://de.wikipedia.org/wiki/Podcast"&gt;Podcast&lt;/a&gt; zum Geburtstag geschenkt. Das ganze wurde aufwändiger als ich dachte und setzt sich mittlerweile zusammen aus:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://www.rechtzweinull.de/index.php?/archives/100-Screen-Scraping-Wann-ist-das-Auslesen-und-die-Veroeffentlichung-fremder-Daten-zulaessig.html"&gt;Screen Scraping&lt;/a&gt; der &lt;a href="http://www.br-online.de/br/jsp/global/funktion/programmvorschau/programmfahne.jsp?programm=B2"&gt;B2 Programmwebsite&lt;/a&gt; mit &lt;a href="http://blog.labnotes.org/tag/scrapi/"&gt;scrAPI&lt;/a&gt; &amp;#8211; incl. Datumskorrektur weil das Programm nicht um Mitternacht umbricht sondern um 5 Uhr früh,&lt;/li&gt;
&lt;li&gt;diese Daten in einer &lt;a href="http://www.sqlite.org/"&gt;SQLite&lt;/a&gt; DB &lt;a href="http://de.wikipedia.org/wiki/Cache"&gt;cachen&lt;/a&gt; um nicht mehrmals am Tag zu scrapen (wenn man z.B. noch andere Sendungen aufnimmt),&lt;/li&gt;
&lt;li&gt;per &lt;a href="http://de.wikipedia.org/wiki/Cron"&gt;cron&lt;/a&gt; einige Minuten vor Sendungsbeginn den &lt;a href="http://de.wikipedia.org/wiki/Streamripper"&gt;streamripper&lt;/a&gt; starten (&lt;a href="http://sourceforge.net/projects/streamripper/files/streamripper%20%28older%20unix%29/1.62.3/streamripper-1.62.3.tar.gz/download"&gt;v1.62.3&lt;/a&gt; wegen alter &lt;a href="http://de.wikipedia.org/wiki/GLib"&gt;glib&lt;/a&gt; auf &lt;a href="http://de.wikipedia.org/wiki/Debian"&gt;Debian Linux&lt;/a&gt;),
&lt;ul&gt;
&lt;li&gt;da der einige Zeit zum Starten braucht triggere ich Sendungsbeginn und -ende zeitlich exakt über ein &lt;a href="http://code.google.com/p/xstreamripper/source/browse/trunk/streamripper/fetch_external_metadata.pl"&gt;Script, das Titelwechsel in den laufenden Streamripper injiziert&lt;/a&gt; &amp;#8211; der B2 Stream liefert selbst keine Sendungsinfos,&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;falls der Stream zwischendurch unterbrochen wurde setzen wir die verschiedenen &lt;a href="http://de.wikipedia.org/wiki/MP3"&gt;mp3&lt;/a&gt; Dateien zu einer zusammen (ohne Überblendung per Holzhammer: &lt;a href="http://en.wikipedia.org/wiki/Cat_(Unix)"&gt;cat&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Sendungsinfos parallel zum mp3 als &lt;a href="http://de.wikipedia.org/wiki/Extensible_Markup_Language"&gt;xml&lt;/a&gt; speichern, um nach Aufnahmeende von der DB unabhängig zu sein,&lt;/li&gt;
&lt;li&gt;aus allen vorhandenen mp3+xml Paaren ein &lt;a href="http://de.wikipedia.org/wiki/RSS"&gt;Podcast RSS&lt;/a&gt; bauen und mit &lt;a href="http://www.gnu.org/software/gzip/"&gt;gzip&lt;/a&gt; packen,&lt;/li&gt;
&lt;li&gt;tägliche Gleitlöschung (mp3 älter als 3 Wochen) per cron+&lt;a href="http://de.wikipedia.org/wiki/Find"&gt;find&lt;/a&gt; damit die Platte nicht volläuft.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Den Podcast abonniert man schließlich z.B. mit &lt;a href="http://de.wikipedia.org/wiki/ITunes"&gt;iTunes&lt;/a&gt; und bekommt direkt nach der Sendung die frische Zündfunkfolge incl. komplettem Text zur Sendung frei Haus.&lt;/p&gt;
&lt;p&gt;Das komplette &lt;a href="http://gist.github.com/345983"&gt;Ruby Script gibts bei github&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/3U-w3nySB3o" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/03/radio-geeky/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/03/radio-geeky/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/03/radio-geeky/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[iPhone Unit Test Coverage]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/tInbv-9Jl-s/" />
		<id>http://blog.mro.name/?p=1707</id>
		<updated>2010-03-27T11:12:48Z</updated>
		<published>2010-03-25T11:11:21Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Coverage" /><category scheme="http://blog.mro.name" term="CoverStory" /><category scheme="http://blog.mro.name" term="gcov" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="Objective C" /><category scheme="http://blog.mro.name" term="SenTestingKit" /><category scheme="http://blog.mro.name" term="Unit Test" />		<summary type="html"><![CDATA[have a look at the CoverStory Howto, download CoverStory, open (with XCode) the XCode Project you want to measure, run the script EnableGCov.scpt linked to from the howto, run your tests and see a linker error, &#8211; dead end for the time being. http://groups.google.com/group/coverstory-discuss/browse_thread/thread/fbcbf5ed61d8d02b#]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/03/iphone-unit-test-coverage/">&lt;ol&gt;
&lt;li&gt;have a look at the &lt;a href="http://code.google.com/p/coverstory/wiki/UsingCoverstory"&gt;CoverStory Howto&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;download CoverStory,&lt;/li&gt;
&lt;li&gt;open (with XCode) the XCode Project you want to measure,&lt;/li&gt;
&lt;li&gt;run the script EnableGCov.scpt linked to from the howto,&lt;/li&gt;
&lt;li&gt;run your tests and see a &lt;a href="http://lists.apple.com/archives/xcode-users/2009/Aug/msg00436.html"&gt;linker error&lt;/a&gt;, &amp;#8211; dead end for the time being. &lt;a href="http://groups.google.com/group/coverstory-discuss/browse_thread/thread/fbcbf5ed61d8d02b#"&gt;http://groups.google.com/group/coverstory-discuss/browse_thread/thread/fbcbf5ed61d8d02b#&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/tInbv-9Jl-s" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/03/iphone-unit-test-coverage/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/03/iphone-unit-test-coverage/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/03/iphone-unit-test-coverage/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[CocoaHeads Vortrag gestern: Unit Testing]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/HHWloixaIMw/" />
		<id>http://blog.mro.name/?p=1701</id>
		<updated>2010-03-18T21:01:57Z</updated>
		<published>2010-03-18T21:01:57Z</published>
		<category scheme="http://blog.mro.name" term="Artikel auf deutsch" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Cocoa" /><category scheme="http://blog.mro.name" term="CocoaHeads" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="OCUnit" /><category scheme="http://blog.mro.name" term="SenTestingKit" /><category scheme="http://blog.mro.name" term="Unit Test" />		<summary type="html"><![CDATA[um ein wenig anzugeben und schlicht den Link hier zu platzieren: Cocoa Unit Testing Folien, Cocoa Unit Testing Wiki Seite]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/03/cocoaheads-vortrag-gestern-unit-testing/">&lt;p&gt;um ein wenig anzugeben und schlicht den Link hier zu platzieren:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wiki.mro.name/_export/s5/cocoaheads/testing"&gt;Cocoa Unit Testing Folien&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mro.name/go/cocoaheads_testing"&gt;Cocoa Unit Testing Wiki Seite&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/HHWloixaIMw" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/03/cocoaheads-vortrag-gestern-unit-testing/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/03/cocoaheads-vortrag-gestern-unit-testing/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/03/cocoaheads-vortrag-gestern-unit-testing/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[iPhone: SQLite Fulltext Index]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/N75KvowIyyk/" />
		<id>http://blog.mro.name/?p=1692</id>
		<updated>2010-03-18T22:13:04Z</updated>
		<published>2010-03-17T17:30:28Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Fulltext" /><category scheme="http://blog.mro.name" term="Index" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="SQLite" />		<summary type="html"><![CDATA[Most blogposts I found on this topic don&#8217;t explain it from the beginning, so it took me quite a while to figure out how simple and powerful the sqlite fulltext search API (FTS3) actually is. get the sqlite3 amalgamation sources (v3.6.22) and just unpack it into your iPhone project &#8211; sqlite3 as shipped on the [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/03/iphone-sqlite-fulltext-index/">&lt;p&gt;Most blogposts I found on this topic don&amp;#8217;t explain it from the beginning, so it took me quite a while to figure out how simple and powerful the &lt;a href="http://www.sqlite.org/fts3.html"&gt;sqlite fulltext search API (FTS3)&lt;/a&gt; actually is.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;get the &lt;a href="http://www.sqlite.org/amalgamation.html"&gt;sqlite3 amalgamation sources (v3.6.22)&lt;/a&gt; and just unpack it into your iPhone project &amp;#8211; sqlite3 as shipped on the iPhone doesn&amp;#8217;t support FTS3,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.v2ex.com/2008/11/22/full-text-search/"&gt;activate FTS3 support&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.sqlite.org/fts3.html#section_1_1"&gt;create the index table&lt;/a&gt; programmatically inside your App as your Macs default sqlite3 doesn&amp;#8217;t support FTS3 either,&lt;/li&gt;
&lt;li&gt;use it like any other table except &lt;a href="http://www.sqlite.org/fts3.html#section_3"&gt;using the MATCH operator for index queries&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&amp;#8217;s it, and it&amp;#8217;s hell quick.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/N75KvowIyyk" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/03/iphone-sqlite-fulltext-index/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/03/iphone-sqlite-fulltext-index/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/03/iphone-sqlite-fulltext-index/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[Poignant: Xml meets Huffman]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/QBYg07KsmlA/" />
		<id>http://blog.mro.name/?p=1686</id>
		<updated>2010-02-02T20:28:41Z</updated>
		<published>2010-02-02T20:26:12Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="Binary" /><category scheme="http://blog.mro.name" term="exchange" /><category scheme="http://blog.mro.name" term="Huffman" /><category scheme="http://blog.mro.name" term="XML" />		<summary type="html"><![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!]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/02/poignant-xml-meets-huffman/">&lt;p&gt;There&amp;#8217;s a &lt;a href="http://www.w3.org/TR/2009/CR-exi-20091208/"&gt;spec at the w3c about compressing (XML) named &amp;#8220;Efficient XML Interchange&amp;#8221; Format&lt;/a&gt; taking into account the grammar and likelihood of atoms within the document. They indeed use something similar the the &lt;a href="http://en.wikipedia.org/wiki/Huffman_coding"&gt;Huffman Coding&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.w3.org/TR/2009/WD-exi-evaluation-20090407/"&gt;results&lt;/a&gt; are quite impressive &amp;#8211; nice charts!&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/QBYg07KsmlA" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/02/poignant-xml-meets-huffman/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/02/poignant-xml-meets-huffman/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/02/poignant-xml-meets-huffman/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[T-Mobile / MMS / iPhone]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/6HbBNzpEwhM/" />
		<id>http://blog.mro.name/?p=1678</id>
		<updated>2010-01-29T09:36:32Z</updated>
		<published>2010-01-29T08:25:50Z</published>
		<category scheme="http://blog.mro.name" term="Artikel auf deutsch" /><category scheme="http://blog.mro.name" term="seenontheweb" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="MMS" /><category scheme="http://blog.mro.name" term="T-Mobile" />		<summary type="html"><![CDATA[klick ich den Link, den T-Mobile mir per SMS geschickt hat, kriege ich:]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/01/t-mobile-mms-iphone/">&lt;p&gt;klick ich den Link, den T-Mobile mir per SMS geschickt hat, kriege ich:&lt;/p&gt;
&lt;div id="attachment_1679" class="wp-caption alignnone" style="width: 330px"&gt;&lt;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" /&gt;&lt;p class="wp-caption-text"&gt;T-Mobile Scherz&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/6HbBNzpEwhM" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/01/t-mobile-mms-iphone/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/01/t-mobile-mms-iphone/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/01/t-mobile-mms-iphone/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>mro</name>
						<uri>http://blog.mro.name</uri>
					</author>
		<title type="html"><![CDATA[NSCachedURLResponse / NSKeyedUnarchiver pain]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MRO-Blog/~3/wbrgsv6kPiQ/" />
		<id>http://blog.mro.name/?p=1667</id>
		<updated>2010-02-09T07:21:00Z</updated>
		<published>2010-01-27T18:42:00Z</published>
		<category scheme="http://blog.mro.name" term="Articles in english" /><category scheme="http://blog.mro.name" term="development" /><category scheme="http://blog.mro.name" term="cache" /><category scheme="http://blog.mro.name" term="Cocoa" /><category scheme="http://blog.mro.name" term="iPhone" /><category scheme="http://blog.mro.name" term="NSCachedURLResponse" /><category scheme="http://blog.mro.name" term="NSKeyedArchiver" /><category scheme="http://blog.mro.name" term="NSKeyedUnarchiver" /><category scheme="http://blog.mro.name" term="NSURLCache" /><category scheme="http://blog.mro.name" term="Objective C" />		<summary type="html"><![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 [...]]]></summary>
		<content type="html" xml:base="http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/">&lt;p&gt;as the iPhone SDK comes with a rather dysfunctional &lt;a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html"&gt;NSURLCache&lt;/a&gt; — Apple suggests to implement it from scratch yourself in the &lt;a href="http://developer.apple.com/iphone/library/samplecode/URLCache/index.html#//apple_ref/doc/uid/DTS40008061"&gt;code examples about caching&lt;/a&gt; — I went for just this.&lt;/p&gt;
&lt;p&gt;Until I came across the &lt;code&gt;[&lt;a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSKeyedUnarchiver_Class/Reference/Reference.html"&gt;NSKeyedUnarchiver&lt;/a&gt; unarchiveObjectWithData:...]&lt;/code&gt; not restoring &lt;code&gt;userInfo&lt;/code&gt;, &lt;code&gt;storagePolicy&lt;/code&gt; and &lt;code&gt;data&lt;/code&gt; of &lt;code&gt;&lt;a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSCachedURLResponse_Class/Reference/Reference.html"&gt;NSCachedURLResponse&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Couldn&amp;#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.&lt;/p&gt;
&lt;p&gt;See yourself:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="objc" style="font-family:monospace;"&gt;&lt;span style="color: #002200;"&gt;-&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;void&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;testiPhoneSDK312NSKeyedArchiver
&lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
&lt;span style="color: #11740a; font-style: italic;"&gt;//  prepare a NSCachedURLResponse&lt;/span&gt;
    &lt;span style="color: #400080;"&gt;NSCachedURLResponse&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;src &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #a61390;"&gt;nil&lt;/span&gt;;
    &lt;span style="color: #002200;"&gt;&amp;#123;&lt;/span&gt;
        &lt;span style="color: #400080;"&gt;NSURL&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_url &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSURL&lt;/span&gt; URLWithString&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;http://www.url.example/path/file.html&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
        &lt;span style="color: #400080;"&gt;NSString&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_mime &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;text/html&amp;quot;&lt;/span&gt;;
        NSInteger expectedContentLength &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #2400d9;"&gt;112&lt;/span&gt;;
        &lt;span style="color: #400080;"&gt;NSString&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_encoding &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;iso-8859-2&amp;quot;&lt;/span&gt;;
&amp;nbsp;
        &lt;span style="color: #400080;"&gt;NSURLResponse&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_response &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSURLResponse&lt;/span&gt; alloc&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt; initWithURL&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_url
            MIMEType&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_mime
            expectedContentLength&lt;span style="color: #002200;"&gt;:&lt;/span&gt;expectedContentLength
            textEncodingName&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_encoding&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
        &lt;span style="color: #400080;"&gt;NSData&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_data &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;Hello, world!&amp;quot;&lt;/span&gt; dataUsingEncoding&lt;span style="color: #002200;"&gt;:&lt;/span&gt;NSISOLatin2StringEncoding&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
        NSURLCacheStoragePolicy i_storage &lt;span style="color: #002200;"&gt;=&lt;/span&gt;  NSURLCacheStorageAllowed;
        &lt;span style="color: #400080;"&gt;NSDictionary&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;i_userInfo &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSDictionary&lt;/span&gt; dictionaryWithObject&lt;span style="color: #002200;"&gt;:&lt;/span&gt;
        &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSDate&lt;/span&gt; dateWithTimeIntervalSince1970&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #2400d9;"&gt;13&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt; forKey&lt;span style="color: #002200;"&gt;:&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;era&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
&amp;nbsp;
        &lt;span style="color: #400080;"&gt;NSCachedURLResponse&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;src &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSCachedURLResponse&lt;/span&gt; alloc&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt; initWithResponse&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_response
            data&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_data
            userInfo&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_userInfo
            storagePolicy&lt;span style="color: #002200;"&gt;:&lt;/span&gt;i_storage&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
&amp;nbsp;
&lt;span style="color: #11740a; font-style: italic;"&gt;//      ensure it's all in place:&lt;/span&gt;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;i_url, src.response.URL, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;i_mime, src.response.MIMEType, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEquals&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;int&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;expectedContentLength, &lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #a61390;"&gt;int&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;src.response.expectedContentLength, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;file.html&amp;quot;&lt;/span&gt;, src.response.suggestedFilename, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;i_encoding, src.response.textEncodingName, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;i_data, src.data, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;i_userInfo, src.userInfo, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
        STAssertEquals&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; 0u, src.storagePolicy, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #11740a; font-style: italic;"&gt;//  archive + unarchive:&lt;/span&gt;
    &lt;span style="color: #400080;"&gt;NSCachedURLResponse&lt;/span&gt; &lt;span style="color: #002200;"&gt;*&lt;/span&gt;dst &lt;span style="color: #002200;"&gt;=&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSKeyedUnarchiver&lt;/span&gt; unarchiveObjectWithData&lt;span style="color: #002200;"&gt;:&lt;/span&gt;
      &lt;span style="color: #002200;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #400080;"&gt;NSKeyedArchiver&lt;/span&gt; archivedDataWithRootObject&lt;span style="color: #002200;"&gt;:&lt;/span&gt;src&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#93;&lt;/span&gt;;
&amp;nbsp;
&lt;span style="color: #11740a; font-style: italic;"&gt;//  check whether src == dst&lt;/span&gt;
    STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;src.response.URL, dst.response.URL, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;src.response.MIMEType, dst.response.MIMEType, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertEquals&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;src.response.expectedContentLength, dst.response.expectedContentLength, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;src.response.suggestedFilename, dst.response.suggestedFilename, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertEqualObjects&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt;src.response.textEncodingName, dst.response.textEncodingName, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
&lt;span style="color: #11740a; font-style: italic;"&gt;//  !!!!!!!!!!&lt;/span&gt;
&lt;span style="color: #11740a; font-style: italic;"&gt;//  sad information loss after unarchiving:&lt;/span&gt;
    STAssertNil&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; dst.data, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertNil&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; dst.userInfo, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
    STAssertEquals&lt;span style="color: #002200;"&gt;&amp;#40;&lt;/span&gt; 2u , dst.storagePolicy, &lt;span style="color: #bf1d1a;"&gt;@&lt;/span&gt;&lt;span style="color: #bf1d1a;"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #002200;"&gt;&amp;#41;&lt;/span&gt;;
&lt;span style="color: #002200;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When my NSURLCache replacement is ready I think about publishing it a github — interested anyone?&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/MRO-Blog/~4/wbrgsv6kPiQ" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://blog.mro.name/2010/01/nscachedurlresponse-nskeyedunarchiver-pain/</feedburner:origLink></entry>
	</feed>
