<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>rel=me</title>
	
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Mon, 02 Nov 2009 19:07:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/gabrielh" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>JSON Parsing Speed Test: YAJL vs SBJSON (iPhone Edition)</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/d0LeoCgxPR0/</link>
		<comments>http://rel.me/2009/10/08/json-parsing-speed-test-yajl-vs-sbjson-iphone/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 06:18:57 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[sbjson]]></category>
		<category><![CDATA[yajl]]></category>

		<guid isPermaLink="false">http://rel.me/?p=255</guid>
		<description><![CDATA[I was curious about the difference, if any, in performance between SBJSON and YAJL with Objective-C bindings. SBJSON is a strict JSON parser written in Objective-C. YAJL is a small event-driven (SAX-style) JSON parser written in ANSI C. Awhile back I wrote YAJL Objective-C bindings and I did some very basic speed tests on JSON [...]]]></description>
			<content:encoded><![CDATA[<p>I was curious about the difference, if any, in performance between SBJSON and YAJL with Objective-C bindings. <a href="http://code.google.com/p/json-framework/">SBJSON</a> is a strict JSON parser written in Objective-C. <a href="http://lloyd.github.com/yajl/">YAJL</a> is a small event-driven (SAX-style) JSON parser written in ANSI C. Awhile back I wrote <a href="http://github.com/gabriel/yajl-objc">YAJL Objective-C bindings</a> and I did some very basic speed tests on JSON data from twitter, delicious, last.fm and yelp. I ran these tests on the original, 3G and 3GS iPhones. </p>
<p>The SBJSON test ran <code>NSString#JSONValue</code>, and the equivalent YAJL test ran <code>NSData#yajl_JSON</code>. The YAJL bindings operate directly on NSData, and this makes a bit more sense since we usually have NSData first, whereas for SBJSON you have to decode to a string before parsing. I <strong>didn&#8217;t</strong> include this difference in my tests though.</p>
<p>These are tests of parsing only (and not loading of any data or strings) of the 4 APIs datasets run 100 times on the original iPhone, 3G and 3GS:</p>
<hr/>
<img src="http://rel.me/wp-content/uploads/2009/10/iphone.png" alt="iphone" title="iphone" width="575" height="320" class="aligncenter size-full wp-image-286" /></p>
<hr/>
<img src="http://rel.me/wp-content/uploads/2009/10/iphone3g.png" alt="iphone3g" title="iphone3g" width="595" height="320" class="aligncenter size-full wp-image-285" /></p>
<hr/>
<img src="http://rel.me/wp-content/uploads/2009/10/iphone3gs.png" alt="iphone3gs" title="iphone3gs" width="503" height="320" class="aligncenter size-full wp-image-284" /></p>
<hr/>
<p>So the YAJL framework gives about a 60% speed increase. The YAJL Objective-C bindings can be found on <a href="http://github.com/gabriel/yajl-objc">github</a>.</p>
<p>Be sure to thank <a href="http://twitter.com/lloydhilaiel">@lloydhilaiel</a> for making <a href="http://lloyd.github.com/yajl/">YAJL</a> full of so much awesomeness.</p>
<p><b>Update</b>: The project used to do the perf test can be found <a href="http://github.com/gabriel/json-objc-perf">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/d0LeoCgxPR0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2009/10/08/json-parsing-speed-test-yajl-vs-sbjson-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rel.me/2009/10/08/json-parsing-speed-test-yajl-vs-sbjson-iphone/</feedburner:origLink></item>
		<item>
		<title>YAJL JSON Parser (Objective-C Bindings)</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/mGde6YiQP5I/</link>
		<comments>http://rel.me/2009/06/15/yajl-json-parser-objective-c-bindings/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 07:27:18 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[yajl]]></category>

		<guid isPermaLink="false">http://rel.me/?p=238</guid>
		<description><![CDATA[I recently was investigating using a more lightweight JSON parser for iPhone projects (other than the standard SBJSON library) and came across the YAJL C JSON library. While using it as a document style parser didn&#8217;t result in a huge performance gain, it does a support a streaming &#8220;SAX&#8221; style parser which might help memory [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was investigating using a more lightweight JSON parser for iPhone projects (other than the standard <a href="http://code.google.com/p/json-framework/">SBJSON</a> library) and came across the <a href="http://lloyd.github.com/yajl/">YAJL</a> C JSON library. While using it as a document style parser didn&#8217;t result in a huge performance gain, it does a support a streaming &#8220;SAX&#8221; style parser which might help memory usage in larger documents.</p>
<p>Hopefully, sometime soon I will do some performance comparisons. In the meantime, if you try these bindings, let me know how it goes. You can find it on github at: <a href="http://github.com/gabriel/yajl-objc">http://github.com/gabriel/yajl-objc</a>.</p>
<p>Right now, I only have a framework (for 10.5) built, but check back and at some point will have a static iPhone library built as well.</p>
<p>Here are some quick usage examples:</p>
<h3>Usage</h3>
<p><script src="http://gist.github.com/138679.js"></script></p>
<h3>Usage (Streaming)</h3>
<p><script src="http://gist.github.com/138680.js"></script></p>
<h3>Usage (Document style)</h3>
<p><script src="http://gist.github.com/138682.js"></script></p>
<p><b>Updated</b> (07/01/2009): Updated usage to use new API changes for better streaming support.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/mGde6YiQP5I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2009/06/15/yajl-json-parser-objective-c-bindings/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://rel.me/2009/06/15/yajl-json-parser-objective-c-bindings/</feedburner:origLink></item>
		<item>
		<title>Invoking forward</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/WIHpZUI4CTA/</link>
		<comments>http://rel.me/2009/05/22/nsinvocation-nsproxy-forwardinvocatio/#comments</comments>
		<pubDate>Fri, 22 May 2009 06:10:50 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://rel.me/?p=215</guid>
		<description><![CDATA[Typically when you want to invoke methods on a separate thread, with a delay, back on the main thread after a long operation, etc,  you are stuck with the performSelector:onThread: methods. With performSelector you are limited to invoking with a limited number of arguments, which must be objects; it won&#8217;t auto-unbox NSValue/NSNumber/NSNull like key value [...]]]></description>
			<content:encoded><![CDATA[<p>Typically when you want to invoke methods on a separate thread, with a delay, back on the main thread after a long operation, etc,  you are stuck with the performSelector:onThread: methods. With performSelector you are limited to invoking with a limited number of arguments, which must be objects; it won&#8217;t auto-unbox NSValue/NSNumber/NSNull like key value coding does.</p>
<p>This limitation can be really frustrating, particularly when you are using NSOperation or threading in general and need your delegates to call back onto the main (UI) thread.</p>
<p>A possible solution is to use NSInvocation with performSelector to deal with multiple arguments and primitives, for example:</p>
<p><script src="http://gist.github.com/138684.js"></script></p>
<p>but it gets cumbersome, especially setting up the invocation instance. (BTW, the first argument is at index 2 because of the hidden arguments self and _cmd.) Also you would need to call retainArguments if your arguments were objects, that may be released by the calling thread.</p>
<p>Thankfully there is a better way. In a post called &#8216;<a href="http://toxicsoftware.com/grab-that-invocation/">Grab that Invocation</a>&#8216; and later at Dave Dribbin&#8217;s post &#8216;<a href="http://www.dribin.org/dave/blog/archives/2008/05/22/invoke_on_main_thread/">Invoke on Main Thread</a>&#8216; we can see how to get an NSInvocation instance from an NSProxy/forwardInvocation: automatically; and now we can combine the proxy with performSelector:onThread: or any of the other peformSelector methods to invoke back on the main thread, invoke on other threads, delay invocation, or other more general <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">aspects</a> like timing methods, debugging, logging, or security.</p>
<p>You can find Dave Dribbins original <a href="http://www.dribin.org/dave/hg/DDFoundation/file/702f3ad9dc6f/lib/DDInvocationGrabber.m">DDInvocationGrabber</a> implementation in his <a href="http://www.dribin.org/dave/hg/DDFoundation/">DDFoundation</a> library.</p>
<p>I&#8217;ve expanded on it a bit in <a href="http://github.com/gabriel/gh-kit">GHKit</a>, (see <a href="http://github.com/gabriel/gh-kit/blob/master/Classes/GHNSInvocationProxy.h">GHNSInvocationProxy</a>) and plan on adding more features. If you use it with the <a href="http://github.com/gabriel/gh-kit/blob/master/Classes/GHNSObject+Invocation.h">GHNSObject+Invocation</a> category, it gets even better:</p>
<p><script src="http://gist.github.com/138685.js"></script></p>
<p>This category also includes other performSelector helpers (supporting var args and argument lists). </p>
<p>What might be some other ways to use this? Maybe an NSOperationProxy that allows you to queue and prioritize invocations, or more complex debugging or analytics proxies that can keep stats of certain activities.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/WIHpZUI4CTA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2009/05/22/nsinvocation-nsproxy-forwardinvocatio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://rel.me/2009/05/22/nsinvocation-nsproxy-forwardinvocatio/</feedburner:origLink></item>
		<item>
		<title>Unit Testing Framework &amp; GUI for Mac OS X and iPhone (GHUnit)</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/nSv1fdyl-gI/</link>
		<comments>http://rel.me/2009/02/21/unit-testing-for-mac-os-x-and-iphone-ghunit/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 08:08:35 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://rel.me/?p=197</guid>
		<description><![CDATA[I&#8217;ve always wondered why XCode doesn&#8217;t have a unit testing GUI like other IDEs, or why the SenTesting framework has to be such a pain to setup, with all its RunScript build phases, shell scripts, octest bundle insanity.  After using the GTMTestCase for the iPhone (since SenTesting isn&#8217;t supported on the iPhone SDK) I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always wondered why XCode doesn&#8217;t have a unit testing GUI like other IDEs, or why the SenTesting framework has to be such a pain to setup, with all its RunScript build phases, shell scripts, octest bundle insanity.  After using the GTMTestCase for the iPhone (since SenTesting isn&#8217;t supported on the iPhone SDK) I decided to try to re-purpose some of the GTM Unit Testing code into a standalone testing framework and GUI that I could use on both my Mac OS X and iPhone projects.</p>
<p>GHUnit (pronounced <span class="pronchars">\<span class="unicode">ˈ</span>gü-</span><span class="pronchars"><span class="unicode">ˈ</span>nit</span><span class="pronchars">\, I guess?), hosted at <a href="http://github.com/gabriel/gh-unit/tree/master" target="_self">gabriel/gh-unit</a>, is meant to be installed as a framework (or embedded in your project for iPhone apps), and run as an application in a separate Test target. The idea being that you can run and crash into the XCode debugger directly and utilize all the debugging techniques that you normally use. The test GUI should allow you to see test failures more clearly, view timings / stats and not have to go fishing for the build console window. And an automated way to view stack traces.<br />
</span></p>
<p>Details on how to use the framework are included in the <a href="http://github.com/gabriel/gh-unit/blob/master/README.markdown">README</a>.</p>
<div id="attachment_200" class="wp-caption aligncenter" style="width: 564px"><img class="size-full wp-image-200" title="GHUnit Test GUI for Mac OS X App" src="http://rel.me/wp-content/uploads/2009/02/gh-unit5.jpg" alt="GHUnit Test GUI for Mac OS X App" width="554" height="450" /><p class="wp-caption-text">GHUnit Test GUI for Mac OS X App</p></div>
<div id="attachment_201" class="wp-caption alignleft" style="width: 325px"><img class="size-full wp-image-201" title="Unit Test GUI for iPhone App" src="http://rel.me/wp-content/uploads/2009/02/gh-unit-iphone1.jpg" alt="Unit Test GUI for iPhone App" width="315" height="557" /><p class="wp-caption-text">Unit Test GUI for iPhone App</p></div>
<p>For the iPhone side, I included a similar GUI that runs the tests in the simulator. Though since frameworks are not supported on the iPhone SDK, you&#8217;ll have to embed it in your project, which is a little bit cumbersome. (Any ideas on how to make this easier?)</p>
<p>GHUnit can be used as a standalone test framework (by subclassing GHTestCase), or with your existing SenTestCase tests or GTMTestCase tests.</p>
<p>So far its pretty basic, but I am using it on a couple projects and its been helping my development a bunch and letting me to write tests as I go without completely destroying my workflow or sanity.</p>
<p>Any feedback is appreciated and let me know if you have any problems with the install/embed instructions or in general. Also thanks to the <a href="http://code.google.com/p/google-toolbox-for-mac/source/browse/#svn/trunk/UnitTesting">GTM</a> peeps, on which much of this is based.</p>
<p>Maybe the next step is an XCode plugin?</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/nSv1fdyl-gI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2009/02/21/unit-testing-for-mac-os-x-and-iphone-ghunit/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://rel.me/2009/02/21/unit-testing-for-mac-os-x-and-iphone-ghunit/</feedburner:origLink></item>
		<item>
		<title>Getting a useful stack trace from NSException#callStackReturnAddresses</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/4rheUblrYls/</link>
		<comments>http://rel.me/2008/12/30/getting-a-useful-stack-trace-from-nsexception-callstackreturnaddresses/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 08:27:15 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://rel.me/?p=175</guid>
		<description><![CDATA[Its always been a little painful when you get an exception and the debugger decides not to cooperate, leaving you with something like:

Thanks!
As far as I could work out, traditional methods of grabbing a symbolic stack trace don&#8217;t work on the iPhone. (If I am remembering right, I don&#8217;t think NSStackTraceKey exists in UIKit.)
A little [...]]]></description>
			<content:encoded><![CDATA[<p>Its always been a little painful when you get an exception and the debugger decides not to cooperate, leaving you with something like:</p>
<p><img src="http://rel.me/wp-content/uploads/2008/12/stacktrace.jpg" alt="Stack Trace" title="Stack Trace" width="556" height="512" class="aligncenter size-full wp-image-176" /></p>
<p>Thanks!</p>
<p>As far as I could work out, traditional methods of grabbing a <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/Exceptions/Tasks/ControllingAppResponse.html#//apple_ref/doc/uid/20000473-DontLinkElementID_3">symbolic stack trace</a> don&#8217;t work on the iPhone. (If I am remembering right, I don&#8217;t think NSStackTraceKey exists in UIKit.)</p>
<p>A little while ago I hacked the GTMStackTrace from <a href="http://code.google.com/p/google-toolbox-for-mac/">google-toolbox-for-mac</a>, to lookup the symbolic stack trace from the call stack return addresses (<a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSException_Class/Reference/Reference.html#//apple_ref/occ/instm/NSException/callStackReturnAddresses">NSException#callStackReturnAddresses</a> introduced in 10.5) and print it out using <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSetUncaughtExceptionHandler">NSSetUncaughtExceptionHandler</a>. Life has been a little bit easier ever since. Thankfully, the awesome people who work on GTM added it in themselves (see <a href="http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/GTMStackTrace.h?r=74#61">GTMStackTrace.h#61</a>). Here is how you might set it up, in main.m:</p>
<p><script src="http://gist.github.com/138687.js"></script></p>
<p>For me, DEBUG is set in GCC_PREPROCESSOR_DEFINITIONS via the awesome GTM <a href="http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/?r=73#trunk/XcodeConfig/Project">xcconfg</a> files, which you should also be using. Hopefully, you should get a trace that looks like:</p>
<p><script src="http://gist.github.com/138688.js"></script></p>
<p>And the source of the exception usually starts around the 5th line.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/4rheUblrYls" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/12/30/getting-a-useful-stack-trace-from-nsexception-callstackreturnaddresses/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://rel.me/2008/12/30/getting-a-useful-stack-trace-from-nsexception-callstackreturnaddresses/</feedburner:origLink></item>
		<item>
		<title>Shrub: S3 Proxy Service on Google App Engine</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/fVIsNIzV6r4/</link>
		<comments>http://rel.me/2008/09/23/shrub-s3-proxy-service-on-google-app-engine/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 01:10:45 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[opentape]]></category>

		<guid isPermaLink="false">http://rel.me/?p=151</guid>
		<description><![CDATA[Shrub is a simple proxy to S3 to provide an RSS feed or HTML listing of files in a bucket or directory. Also, JSON, mixtape and ID3 lookups (more on that below).
Me and my friends have been using it for a little while to keep track of when we are uploading files (via RSS) and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://shrub.appspot.com">Shrub</a> is a simple proxy to S3 to provide an RSS feed or HTML listing of files in a bucket or directory. Also, JSON, mixtape and ID3 lookups (more on that below).</p>
<p>Me and my friends have been using it for a little while to keep track of when we are uploading files (via RSS) and it seems to work pretty well.</p>
<p>Last week, I was playing around with the idea of a <a href="http://muxtape.com">MuxTape</a>/<a href="http://opentape.fm">OpenTape</a> type format where you could point it at a directory of mp3&#8217;s and you could play them straight from the browser. I have a preliminary version, an example of it, at: <a href="http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=tape">http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=tape</a> (songs from the official <a href="http://subpop.com/media/">Subpop Records</a> free downloads page). So it seems like an OK way to share mixtapes by hosting them on your own S3 account, or to just stream mp3&#8217;s that you have backed up from a web browser.</p>
<p>In order to get it to show the track information, I wrote a handler to pull ID3v2 tag info from the mp3s by doing a request using the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1">Range</a> header (which S3 supports) of the first 1024 bytes (Range: bytes=0-1024). I think most ID3v2 taggings are at the beginning of the mp3 (I think ID3v1 was at the end). For example, if you have the S3 file:</p>
<p><tt>sub-pop-mix-1/01-Dntel-The_Distance_(ft._Arthur&amp;Yu).mp3</tt></p>
<p>in the <tt>m1xes</tt> bucket, you can do an ID3 lookup using format=id3-json:</p>
<p><tt>http://shrub.appspot.com/m1xes/sub-pop-mix-1/01-Dntel-The_Distance_%28ft._Arthur%26Yu%29.mp3?format=id3-json</tt>:</p>
<pre>{ "album": "Dumb Luck",
  "performer": "Dntel",
  "title": "The Distance (Ft. Arthur &amp; Yu)",
  "track": "5/9",
  "year": null,
  "isTruncated": false }</pre>
<p>It will parse as much as it can from the first 1024 bytes of the mp3 (and isTruncated will be true, if there was more data after that). ID3 lookups are cached for 5 minutes.</p>
<p>Right now it doesn&#8217;t do any authentication (not sure if I want to store secret keys), so its only useful for public buckets and files. I think it makes sense to open source it and then add auth capability, and then people can configure it with their own keys and host it on their own app engine space. I will try to throw some code up on github really soon, after I re-factor some of my noobish python code.</p>
<p>Mainly, its just an excuse to help me learn python and play with <a href="http://www.makotemplates.org/">mako</a> and <a href="http://code.google.com/appengine/">google app engine</a>.</p>
<p>All this, and more detailed info is at: <a href="http://shrub.appspot.com/">http://shrub.appspot.com/</a>. If you see anything wacky, let me know.</p>
<p><strong>Update:</strong> The source is now available on github: <a title="gabriel/shrub" href="http://github.com/gabriel/shrub">gabriel/shrub</a></p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/fVIsNIzV6r4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/09/23/shrub-s3-proxy-service-on-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://rel.me/2008/09/23/shrub-s3-proxy-service-on-google-app-engine/</feedburner:origLink></item>
		<item>
		<title>Cocoa Utils Kit</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/Hj_UU0OGClQ/</link>
		<comments>http://rel.me/2008/08/07/cocoa-utils-kit/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 18:32:04 +0000</pubDate>
		<dc:creator>gabe</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://rel.me/?p=137</guid>
		<description><![CDATA[I pushed my Objective-C utility kit to github: gh-kit. Its a collection of some files I&#8217;ve found, some I wrote for S3Hub. There isn&#8217;t a ton of stuff there. In fact, it probably needs to be merged into another utils framework or obsoleted completely by someone else (like google toolbox for mac). But until then, it [...]]]></description>
			<content:encoded><![CDATA[<p>I pushed my Objective-C utility kit to github: <a href="http://github.com/gabriel/gh-kit/tree/master">gh-kit</a>. Its a collection of some files I&#8217;ve found, some I wrote for S3Hub. There isn&#8217;t a ton of stuff there. In fact, it probably needs to be merged into another utils framework or obsoleted completely by someone else (like google toolbox for mac). But until then, it has some useful stuff like:</p>
<ul>
<li><a href="http://github.com/gabriel/gh-kit/tree/master/Classes/GHNSDate+Parsing.m">GHNSDate+Parsing.m</a>: Various RFC and ISO date formatting and parsing</li>
<li><a href="http://github.com/gabriel/gh-kit/tree/master/Classes/GHNSString+TimeInterval.m">GHNSString+TimeInterval.m</a>: Time ago in words</li>
<li><a href="http://github.com/gabriel/gh-kit/tree/master/Classes/GHViewAnimation.m">GHViewAnimation.m</a>: View animation helper.
</li>
<li><a href="http://github.com/gabriel/gh-kit/tree/master/Classes/GHNSString+HMAC.m">GHNSString+HMAC.m</a>: HMAC-SHA1 implementation which works on iPhone</li>
</ul>
<p>And other stuff for generating uuids, mime types, etc. I blogged earlier about the <a href="http://rel.me/2008/07/22/date-format-rfc82285010361123asctimeiso8601unicode35tr35-6/">date parsing</a> and <a href="http://rel.me/2008/06/09/time-ago-in-words-for-cocoa/">time ago in words</a>.</p>
<p>Also, be sure to checkout the <a title="google toolbox for mac" href="http://code.google.com/p/google-toolbox-for-mac">Google Toolbox For Mac</a> which is way comprehensive (definately check there first). Feel free to pick and choose stuff at will. All files from other sources should have their original licenses which should all be MIT-like.</p>
<p><em>PS, sorry about the crazy feed crossing before. If you want to switch to a &#8220;cleaner&#8221; feed you can use this url: <a href="http://feeds.feedburner.com/gabrielh">feeds.feedburner.com/gabrielh</a>. Google reader caches the feed entries on the other one, so those will likely live forever.</em></p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/Hj_UU0OGClQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/08/07/cocoa-utils-kit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://rel.me/2008/08/07/cocoa-utils-kit/</feedburner:origLink></item>
		<item>
		<title>Date format RFC822/850/1036/1123; asctime; ISO8601; Unicode#35(tr35-6); *#$*&amp;!</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/_JoA5-NNCEo/</link>
		<comments>http://rel.me/2008/07/22/date-format-rfc82285010361123asctimeiso8601unicode35tr35-6/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 12:08:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[date]]></category>

		<guid isPermaLink="false">http://ducktaper.com/?p=91</guid>
		<description><![CDATA[I had to deal with handling of various date formats for S3Hub and totally munged it the first couple passes. This post lists some things to be aware of when parsing and formatting HTTP and XML style dates correctly using the Cocoa API&#8217;s.
HTTP Date
Some quick background on HTTP dates first. S3 requires sending a &#8216;Date&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>I had to deal with handling of various date formats for S3Hub and totally munged it the first couple passes. This post lists some things to be aware of when parsing and formatting HTTP and XML style dates correctly using the Cocoa API&#8217;s.</p>
<h4>HTTP Date</h4>
<p>Some quick background on HTTP dates first. S3 requires sending a &#8216;Date&#8217; header field as part of an authenticated request. (This and signing the request is a common countermeasure against a <a href="http://en.wikipedia.org/wiki/Replay_attack">replay attack</a>.) The spec says, the format of the date should be &#8220;one of the RFC 2616 formats (<a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a>)&#8221;.</p>
<blockquote>
<p>HTTP applications have historically allowed three different formats<br /> for the representation of date/time stamps:</p>
<p>Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123<br /> Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036<br /> Sun Nov  6 08:49:37 1994       ; ANSI C&#8217;s asctime() format</p>
<p>The first format is preferred as an Internet standard and represents<br /> a fixed-length subset of that defined by RFC 1123 [8] (an update to<br /> RFC 822 [9]). The second format is in common use, but is based on the<br /> obsolete RFC 850 [12] date format and lacks a four-digit year.<br /> HTTP/1.1 clients and servers that parse the date value MUST accept<br /> all three formats (for compatibility with HTTP/1.0), though they MUST<br /> only generate the RFC 1123 format for representing HTTP-date values<br /> in header fields. See section 19.3 for further information.</p>
</blockquote>
<p>So these are the standard formats. When sending a formatted date you should only use RFC1123 but should be able to handle any of the formats listed. This is just a way to maintain compatibility while trying to move everything to the latest format. If you are wondering what the difference is, RFC 1123 updated 822 by changing the time zone from hour format (±0000) to GMT format (GMT).</p>
<p>For example, the &#8216;Date&#8217; or &#8216;Expires&#8217; header fields for requests have this (RFC1123) format. Replies might have an HTTP date format in a Last-Modified or Date header as well.</p>
<h4>ISO Date</h4>
<p>XML data which has formatted date fields might use a date format which is defined by the ISO8601 standard and looks like &#8216;2006-02-03T16:45:09.000Z&#8217;.</p>
<h4>Date parsing in Cocoa</h4>
<p>Prior to 10.4, the Cocoa API supported &#8220;strftime-style conversion specifiers&#8221;. In 10.4, they added support for the <a href="http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns">Unicode Technical Standard #35</a> (version tr35-6).</p>
<p>The pre-10.4 strftime patterns look like: &#8220;%m/%d/%y&#8221; and the Unicode standard looks like &#8220;MM/dd/yyyy&#8221;. The default behavior (for backwards compatibility) is strftime format. In order to use the Unicode standard (which you will, its way better), you need to set the formatter behavior to <code>NSDateFormatterBehavior10_4</code> either by calling <tt>setFormatterBehavior</tt> or setting the classes formatter behavior globally. Do NOT use the <code>initWithDateFormat:allowNaturalLanguage:</code> constructor, because it will give you a pre-10.4 date formatter. Using the strftime style of pattern when configured for the 10.4 (Unicode) behavior will fail silently.</p>
<p>So fast forward a few weeks,  an S3Hub  user told me he was getting authentication errors (invalid signing) trying to connect. I couldn&#8217;t replicate the problem but I eventually got the raw HTTP request header it was sending and the Date header looked like.</p>
<p><tt>Fr, 06 Jun 2008 08:49:37 GMT</tt>.</p>
<p>Turns out the user is in Germany and when I change my locale to something German, I can reproduce the problem. Date formatters themselves can have specific styles (and symbols) that are modified by the locale. In the German locale the weekday symbol for friday is &#8216;Fr&#8217; instead of English locale which is &#8216;Fri&#8217;. So when you use a date formatter in this way (with day or month symbols, for example) make sure to set the locale to en_US. The final date formatter looks like:</p>
<p><script src="http://gist.github.com/138689.js"></script></p>
<p><strong>Update</strong>: See <a href="http://github.com/gabriel/gh-kit/blob/master/Classes/GHNSDate+Parsing.m">GHNSDate+Parsing</a> gh-kit category on github for a collection of these date formatters.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/_JoA5-NNCEo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/07/22/date-format-rfc82285010361123asctimeiso8601unicode35tr35-6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://rel.me/2008/07/22/date-format-rfc82285010361123asctimeiso8601unicode35tr35-6/</feedburner:origLink></item>
		<item>
		<title>Moved</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/J0g_RJlo5b8/</link>
		<comments>http://rel.me/2008/07/21/moved/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 18:06:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[xfn]]></category>

		<guid isPermaLink="false">http://rel.me/?p=103</guid>
		<description><![CDATA[So, I got a new domain and decided to move my blog over to it. I am running Wordpress on Ubuntu 8.04 TLS 64-bit, and used this script to migrate all my blogdata from Mephisto.
As far as the domain goes, rel.me is taken from XFN:
XFN presents a simple and easy solution for this identity consolidation problem, with [...]]]></description>
			<content:encoded><![CDATA[<p>So, I got a new domain and decided to move my blog over to it. I am running Wordpress on Ubuntu 8.04 TLS 64-bit, and used <a href="http://jayunit.net/2008/04/16/mephisto-to-wordpress/">this script</a> to migrate all my blogdata from Mephisto.</p>
<p>As far as the domain goes, rel.me is taken from <a href="http://www.gmpg.org/xfn/and/" target="_blank">XFN</a>:</p>
<blockquote><p>XFN presents a simple and easy solution for this identity consolidation problem, with the new &#8220;<code>me</code>&#8221; value in XFN 1.1.</p></blockquote>
<p>So if you use the rel=&#8221;me|friend|co-worker|enemy&#8221; attribute on your links, a crawler can build a social graph.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/J0g_RJlo5b8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/07/21/moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rel.me/2008/07/21/moved/</feedburner:origLink></item>
		<item>
		<title>Font detection with Javascript and Flash</title>
		<link>http://feedproxy.google.com/~r/gabrielh/~3/SmVbH6VKFkw/</link>
		<comments>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 22:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[fonts]]></category>

		<guid isPermaLink="false">/2008/06/26/font-detection-with-javascript-and-flash</guid>
		<description><![CDATA[I was playing around with jquery and I wanted to see if it was possible to generate a cheat sheet of all the fonts on your system. Its also a good run through of how to load a SWF with a callback.

View a demo (Though, its possible it might not work)
The steps I used to [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with jquery and I wanted to see if it was possible to generate a cheat sheet of all the fonts on your system. Its also a good run through of how to load a SWF with a callback.</p>
<p><img src="http://font-detect.s3.amazonaws.com/font-detect.png" alt="" width="583" height="335" /></p>
<p><a href="http://font-detect.s3.amazonaws.com/index.html">View a demo</a> (Though, its possible it might not <a href="http://www.codinghorror.com/blog/images/works-on-my-machine-starburst.png">work</a>)</p>
<p>The steps I used to generate this are:</p>
<ul>
<li>Load SWF</li>
<li>Javascript calls to Actionscript fonts() method via <code>ExternalInterface</code></li>
<li>Get the list of system fonts in Flash via <code>Font.enumerateFonts(true)</code></li>
<li>Curse Flash for giving you a list of font names, where half of them are garbage.</li>
<li>For each font name, in javascript, create a test which adds a DOM element temporarily with a fallback font family set. For example, <code>font-family: 'Apple Garamond Pro', 'Times New Roman';</code>, where Times New Roman is your fallback.</li>
<li>Then check the actual width (via offsetWidth). If it does not match the offsetWidth of the fallback font, then we know it rendered ok. (The original idea is from <a href="http://www.lalit.org/lab/javascript-css-font-detect">http://www.lalit.org/lab/javascript-css-font-detect</a>)</li>
</ul>
<p>The only caveat is, if the actual font width and the fallback font width do match, then you would have a false negative. So its not bulletproof.</p>
<p>The actionscript to enumerate the fonts and call back out is pretty simple:<br />
<script src="http://gist.github.com/138691.js"></script><br />
Expose the method in the constructor using ExternalInterface:<br />
<script src="http://gist.github.com/138692.js"></script><br />
<a href="http://github.com/gabriel/font-detect-js/tree/master/flash/src/FontList.as">FontList.as</a></p>
<p>I used swfobject to load the SWF. Also be sure to enable <code>allowScriptAccess</code>.</p>
<p>The javascript to test the fonts is at: <a href="http://github.com/gabriel/font-detect-js/tree/master/javascripts/font-detect.js">font-detect.js</a></p>
<p>You can use it by including:</p>
<p><script src="http://gist.github.com/138690.js"></script></p>
<p>In the end, I don&#8217;t think this is useful in practice, but I thought I would share anyway. Its on <a href="http://github.com/gabriel/font-detect-js/tree/master">github</a> too.</p>
<p><strong>Updated:</strong> Now uses call straight to actionscript, doesn&#8217;t marshall JSON first so its much faster, and other refactoring.</p>
<img src="http://feeds.feedburner.com/~r/gabrielh/~4/SmVbH6VKFkw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://rel.me/2008/06/26/font-detection-with-javascript-and-flash/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.232 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-11-09 17:35:11 -->
