<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Whatever happened to Benjamin Ragheb?</title>
	<atom:link href="http://www.benzado.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.benzado.com/blog</link>
	<description>I apologize that this blog is using the default Wordpress template.</description>
	<lastBuildDate>Mon, 01 Mar 2010 07:13:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone Apps: Two Kinds of Approval</title>
		<link>http://www.benzado.com/blog/post/335/iphone-apps-two-kinds-of-approval</link>
		<comments>http://www.benzado.com/blog/post/335/iphone-apps-two-kinds-of-approval#comments</comments>
		<pubDate>Mon, 01 Mar 2010 07:13:28 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[itunes app store]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=335</guid>
		<description><![CDATA[Apple recently removed about 5,000 apps from the iTunes App Store on the grounds that they featured &#8220;overtly sexual content.&#8221; John Gruber believes that Apple is trying to protect its image:

I think what Apple was getting squeamish about wasn’t the sexy apps themselves, but the cheesiness that the sexy apps (and their prominence in best [...]]]></description>
			<content:encoded><![CDATA[<p>Apple recently removed about 5,000 apps from the iTunes App Store on the grounds that they featured &#8220;overtly sexual content.&#8221; John Gruber believes that <a href="http://daringfireball.net/2010/02/tits_and_apps">Apple is trying to protect its image</a>:</p>
<blockquote><p>
I think what Apple was getting squeamish about wasn’t the sexy apps themselves, but the cheesiness that the sexy apps (and their prominence in best selling lists) was bestowing upon the general feel and vibe of the App Store. One thing I wasn’t aware of before the recent crackdown was the degree to which these apps were seeping into various non-entertainment categories. E.g., like half the “new” apps in the “productivity” category featured imagery of large-breasted bikini-clad women.</p>
<p>The App Store is never going to be like Apple’s retail stores, and Apple knows it. Apple’s retail stores, branding-wise, convey an image sort of like between the Gap and Banana Republic — friendly premium. The App Store is more Old Navy, or maybe even Target. But these sexy apps were casting the App Store into something junkier, bordering on the skeevy.
</p></blockquote>
<p>This interpretation makes the most sense to me, too. In fact, I sympathize. When I gave my brother an iPod touch for Christmas, I showed him the App Store, and was mildly embarrassed that the number one app that day was a fart sound effects generator.</p>
<p>Unfortunately, the App Store&#8217;s role as the <em>one and only way</em> to distribute an iPhone app means that we have a dilemma. To carry something in a store is an implicit endorsement, so any store owner should have the right to decide what products to include. However, a healthy economy for apps requires a free market. Rejecting apps for subjective reasons makes development more risky than it needs to be.</p>
<h3>Technical Requirements vs. Community Standards</h3>
<p>The source of this dilemma is that the app review process serves two distinct purposes: to approve apps for iPhone and to approve apps for the App Store. If separated, the dilemma can be resolved.</p>
<p>Suppose you have developed an app and submitted it to Apple. It complies with all the <i>technical requirements</i> of an approved app: it sticks to the Human Interface Guidelines, it doesn&#8217;t use any private frameworks, it doesn&#8217;t execute downloaded code. However, it fails to meet Apple&#8217;s <i>community standards</i>: it contains overtly sexual or politically controversial content.</p>
<p>Enforcing technical requirements is for the benefit of the platform. Enforcing community standards is really only about the App Store.</p>
<h3>Kick &#8216;em to the curb, but no further</h3>
<p>In theory, Apple could inform you that your app is permitted to run on iPhone OS but will not be included in the App Store. This could happen in at least two ways:</p>
<p>They could maintain iTunes as the sole distribution method for apps, but designate your app <em>unlisted</em>. Nobody will find it in the store by browsing or searching, and it won&#8217;t appear in the top seller lists. However, it will be reachable by direct link. Apple will still manage the hosting and payment processing, but if you want anybody to find it, you have to market it yourself.</p>
<p>I obviously don&#8217;t know how the store is set up, but I bet Apple could do this relatively easily. (I&#8217;ve already discovered that an iTunes reviews page is accessible via direct link as soon as you submit an app, before the review team has had a chance to see it.)</p>
<p>Alternatively, if Apple wants to completely wash their hands of these dirty apps, is to provide developers with a digitally signed IPA file. You distribute the file yourself; users install your app by dragging the file to iTunes. If you want to charge, you have to roll your own payment and registration system, just like desktop shareware developers do.</p>
<p>This method seems less likely, mostly because it adds a big loophole for those who want to circumvent the App Store for other reasons. On the other hand, if all developers had the option to sell outside the App Store, I think it would be an overall good for the platform. But now we&#8217;re going off on a tangent.</p>
<p>Obviously, everybody would rather be part of the iTunes App Store than operate outside of it, but if given a choice between &#8220;outside&#8221; and &#8220;nowhere&#8221; I think outside is a clear winner. Separating the notion of &#8220;approved for iPhone&#8221; and &#8220;approved for the App Store&#8221; would benefit Apple <em>and</em> developers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/335/iphone-apps-two-kinds-of-approval/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Xcode nag you about unfinished TODOs</title>
		<link>http://www.benzado.com/blog/post/329/make-xcode-nag-you-about-unfinished-todos</link>
		<comments>http://www.benzado.com/blog/post/329/make-xcode-nag-you-about-unfinished-todos#comments</comments>
		<pubDate>Fri, 08 Jan 2010 08:51:15 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Nerdery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=329</guid>
		<description><![CDATA[Add a simple Run Script Build Phase to your project and you'll never forget another TODO again.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, you often make promises to yourself in the form of TODO comments in your code. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// TODO: make sure file exists before opening!</span>
fooBar <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>FooBar alloc<span style="color: #002200;">&#93;</span> initWithFile<span style="color: #002200;">:</span>path<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>This is a reasonable thing to do, because sometimes you just want to get something working right now and aren&#8217;t in the mood to write all the required error checking code. But, you also know that you cannot trust your <a href="http://theinfosphere.org/Transcript:I,_Roommate#time-04-13">soft human brain</a> to remember to add the check later, so you write a comment to remind yourself to do it.</p>
<p>Xcode recognizes the TODO: keyword in your comments and helpfully <a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeWorkspace/100-The_Text_Editor/text_editor.html#//apple_ref/doc/uid/TP40002679-SW10">adds items to the function popup menu</a> so that you can quickly navigate to them. In addition to <code>TODO:</code>, Xcode will also recognize <code>FIXME:</code> (when you know the code is broken), <code>???:</code> (when you don&#8217;t know what it does), and <code>!!!:</code> (when you wish you didn&#8217;t know).</p>
<p>That&#8217;s helpful when you&#8217;re editing a file, but what about a TODO tucked away in some dark corner of your source code that you haven&#8217;t visited in a while? You&#8217;re likely to forget about it, and how can you keep a promise you forgot that you made?</p>
<p>The answer, of course, is to have somebody nag you. Fortunately, there&#8217;s a way to have Xcode fill that role. All you have to do is add a simple Run Script Build Phase which turns them into Build Warnings.</p>
<p>Select <b>Project &gt; New Build Phase &gt; New Run Script Build Phase</b> from the menu bar. Then, copy and paste this into the script window:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">KEYWORDS</span>=<span style="color: #ff0000;">&quot;TODO:|FIXME:|\?\?\?:|\!\!\!:&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #800000;">${SRCROOT}</span> \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.h&quot;</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.m&quot;</span> \<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> \
    <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">--with-filename</span> <span style="color: #660033;">--line-number</span> <span style="color: #660033;">--only-matching</span> <span style="color: #ff0000;">&quot;(<span style="color: #007800;">$KEYWORDS</span>).*<span style="color: #000099; font-weight: bold;">\$</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> \
    <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/(<span style="color: #007800;">$KEYWORDS</span>)/ warning: <span style="color: #000099; font-weight: bold;">\$</span>1/&quot;</span></pre></td></tr></table></div>

<p>What does it mean?</p>
<p>Line 1 defines the keywords we want to search for. If you want to exclude a keyword or include a different one, edit this line.</p>
<p>Line 2 uses the <a href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/find.1.html">find</a> command to generate a list of all files in your project directory (SRCROOT) having an .h or .m extension. If you want to search more files, you will need to edit this line.</p>
<p>Line 3 uses <a href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/xargs.1.html">xargs</a> to pass those file names along to <a href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/egrep.1.html">egrep</a>, which searches inside the files for lines containing one of the keywords. If any are found, it outputs the file name, line number, and the matching part of the line.</p>
<p>Line 4 uses Perl to format the lines as warnings.</p>
<p>The output of the script will look like this:</p>
<p><code>/Users/benzado/Projects/FooBart/Baz.m:42: warning: TODO: make sure file exists before opening!</code></p>
<p>Xcode will recognize lines in this format and treat them as first class build warnings. You can see them in the Build Results panel and, just like a warning from the compiler, a double click will open an editor window and take you directly to the offending line.</p>
<p><i>An Exercise For The Enterprising Reader: modify the script so that no warnings or errors are reported during Debug builds, but TODOs are flagged as errors in Release builds.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/329/make-xcode-nag-you-about-unfinished-todos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Draw your own Disclosure Indicator</title>
		<link>http://www.benzado.com/blog/post/325/draw-your-own-disclosure-indicator</link>
		<comments>http://www.benzado.com/blog/post/325/draw-your-own-disclosure-indicator#comments</comments>
		<pubDate>Mon, 04 Jan 2010 03:21:17 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Nerdery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=325</guid>
		<description><![CDATA[In which I share code for a function to draw an iPhone disclosure indicator.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing Cocoa Touch code to draw a button which, when pressed, pushes a new view controller onto the stack. If I was working with a UITableView, I&#8217;d simply set the cell&#8217;s accessory to be a <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/ContentViews/ContentViews.html#//apple_ref/doc/uid/TP40006556-CH12-SW13">disclosure indicator</a> (the little gray arrowhead) and call it a day.</p>
<p>But I&#8217;m not working with table cells, so even though the standard disclosure indicator is <em>perfect</em> for this situation, if I want one I&#8217;ll have to draw it myself.</p>
<p>In this situation I will usually take a screenshot of the real iPhone control, add the image file to my project, and then feel kind of guilty about it. I began to do this, but I realized that the disclosure indicator is really only two gray lines. Two lines! How hard can it be to just draw it in code?</p>
<p>It turns out that it&#8217;s not too hard, if you&#8217;re willing to spend some time experimenting with different numbers and seeing what looks right. Fortunately for you, I&#8217;ve saved you the trouble by posting the answer here:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Draws a disclosure indicator such that the tip of the arrow is at (x,y)</span>
<span style="color: #a61390;">void</span> BRDrawDisclosureIndicator<span style="color: #002200;">&#40;</span>CGContextRef ctxt, CGFloat x, CGFloat y<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat R <span style="color: #002200;">=</span> <span style="color: #2400d9;">4.5</span>; <span style="color: #11740a; font-style: italic;">// &quot;radius&quot; of the arrow head</span>
    <span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat W <span style="color: #002200;">=</span> <span style="color: #2400d9;">3</span>; <span style="color: #11740a; font-style: italic;">// line width</span>
    CGContextSaveGState<span style="color: #002200;">&#40;</span>ctxt<span style="color: #002200;">&#41;</span>;
    CGContextMoveToPoint<span style="color: #002200;">&#40;</span>ctxt, x<span style="color: #002200;">-</span>R, y<span style="color: #002200;">-</span>R<span style="color: #002200;">&#41;</span>;
    CGContextAddLineToPoint<span style="color: #002200;">&#40;</span>ctxt, x, y<span style="color: #002200;">&#41;</span>;
    CGContextAddLineToPoint<span style="color: #002200;">&#40;</span>ctxt, x<span style="color: #002200;">-</span>R, y<span style="color: #002200;">+</span>R<span style="color: #002200;">&#41;</span>;
    CGContextSetLineCap<span style="color: #002200;">&#40;</span>ctxt, kCGLineCapSquare<span style="color: #002200;">&#41;</span>;
    CGContextSetLineJoin<span style="color: #002200;">&#40;</span>ctxt, kCGLineJoinMiter<span style="color: #002200;">&#41;</span>;
    CGContextSetLineWidth<span style="color: #002200;">&#40;</span>ctxt, W<span style="color: #002200;">&#41;</span>;
    CGContextStrokePath<span style="color: #002200;">&#40;</span>ctxt<span style="color: #002200;">&#41;</span>;
    CGContextRestoreGState<span style="color: #002200;">&#40;</span>ctxt<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Before calling the function, you should set the stroke color to 50% gray if you&#8217;re drawing on a white background or white if the control is highlighted and you&#8217;re drawing on a blue background. Or, <a href="http://stackoverflow.com/questions/1852672/best-way-to-change-the-color-view-of-disclosure-indicator-accessory-view-in-a-tab">you can use whatever color you like</a>.</p>
<p>To be honest, I only eyeballed the result, so it <em>might</em> not be a pixel-perfect reproduction of the real thing. However, I think my eyeballs are at least as good as most users&#8217; eyeballs, so I will confidently declare this code Good Enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/325/draw-your-own-disclosure-indicator/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows is still terrible</title>
		<link>http://www.benzado.com/blog/post/323/windows-is-terrible</link>
		<comments>http://www.benzado.com/blog/post/323/windows-is-terrible#comments</comments>
		<pubDate>Sat, 26 Dec 2009 06:49:48 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[eee pc]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=323</guid>
		<description><![CDATA[My brother got me an Eee PC mini notebook computer for Christmas. I want to say right off the bat that I&#8217;m very grateful for the gift: it will be useful for testing web sites on Windows as well as allowing me to run Adventure Game Studio. What follows is more a complaint about what [...]]]></description>
			<content:encoded><![CDATA[<p>My brother got me an Eee PC mini notebook computer for Christmas. I want to say right off the bat that I&#8217;m very grateful for the gift: it will be useful for testing web sites on Windows as well as allowing me to run <a href="http://www.adventuregamestudio.co.uk/">Adventure Game Studio</a>. What follows is more a complaint about what Windows users accept as how computers are.</p>
<p>It was <em>covered</em> in stickers. There were stickers on each side of the display, pointing out things that would presumably be on the screen when I turned it on. The trackpad had a sticker over it explaining the pinch-to-zoom gesture that everybody knows from the iPhone, yet iPhone users were never &#8220;helped&#8221; with a sticker on the screen.</p>
<p>When I powered it on <em>for the first time ever</em>, I was presented with the &#8220;Windows did not shut down properly, do you want to start in Safe Mode?&#8221; screen.</p>
<p>During Windows set up, it:</p>
<ol>
<li>Tried to connect to the Internet automatically.</li>
<li>Told me it could not connect to the Internet and I&#8217;d have to configure it myself later.</li>
<li>Immediately asked if I wanted to connect to the Internet to send my registration information to Microsoft.</li>
</ol>
<p>When I launched Outlook Express, a wizard walked me through the process of connecting to the Internet (even though I was already online), asking if I already had a dial-up account or wanted to sign up for one.</p>
<p>Fortunately, the PC wasn&#8217;t pre-loaded with too much crapware, which is a good thing. I&#8217;m finding it hard to read the thinly rendered text used in most of the system; fortunately Safari for Windows does it&#8217;s own text rendering. Like my MacBook, it supports two finger scrolling, but the cursor turns into a tiny scrollbar graphic (in case I don&#8217;t know what&#8217;s going on?) and the page jerks around instead of moving smoothly.</p>
<p>My dad bought a MacBook Air for my mom, and I spent a long time setting it up. On the whole, it was much more pleasant experience, though in the interest of fairness I&#8217;ll say that using Migration Assistant over a network connection is annoyingly unreliable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/323/windows-is-terrible/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t call it a comeback!</title>
		<link>http://www.benzado.com/blog/post/321/dont-call-it-a-comeback</link>
		<comments>http://www.benzado.com/blog/post/321/dont-call-it-a-comeback#comments</comments>
		<pubDate>Wed, 09 Dec 2009 17:59:38 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[FatWatch]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=321</guid>
		<description><![CDATA[I confess, I have some minor narcissistic tendencies. For example, the App Store search bar on my iPhone usually contains my own name, so I can check on the ratings of my apps at a glance.
That&#8217;s how I noticed this new review of FatWatch, my weight tracking app for iPhone:
It does exactly what it says [...]]]></description>
			<content:encoded><![CDATA[<p>I confess, I have some minor narcissistic tendencies. For example, the App Store search bar on my iPhone usually contains my own name, so I can check on the ratings of my apps at a glance.</p>
<p>That&#8217;s how I noticed this new review of <a href="http://www.fatwatchapp.com/">FatWatch, my weight tracking app for iPhone</a>:</p>
<blockquote><p>It does exactly what it says it does, but it&#8217;s far too expensive and the developer seems to have abandoned it. Get one of the free weight apps and save yourself the dough.</p></blockquote>
<p>Ouch!</p>
<p>In a world of disposable mobile apps, FatWatch might seem expensive, but it&#8217;s actually quite cheap for what it does: tracking your weight <em>against a moving average</em> in a well-designed application. <a href="http://fourmilab.ch/hackdiet/e4/signalnoise.html">The average is key</a>; it&#8217;s the only useful way to track a human being&#8217;s weight, and none of the free apps can do the math for you.</p>
<p>For devotees of <a href="http://fourmilab.ch/hackdiet/">The Hacker&#8217;s Diet</a>, it also lets you import your weight history from the old Palm Eat Watch app and export it to your computer any time you choose.</p>
<p>As for the other concern, <strong>I assure you that FatWatch has not been abandoned.</strong> I use it every day! I suppose it is overdue for an update, but that&#8217;s only to add new features, as (save for a minor cosmetic issue) no bugs have been reported in FatWatch 1.4.</p>
<p>The good news is that I recently completed a contract project that puts me in a comfortable enough financial position to devote time to a FatWatch update. So, watch this space, and if you&#8217;re interested in beta testing, wait for an announcement soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/321/dont-call-it-a-comeback/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nicer ways to view UNIX man pages</title>
		<link>http://www.benzado.com/blog/post/319/nicer-ways-to-view-unix-man-pages</link>
		<comments>http://www.benzado.com/blog/post/319/nicer-ways-to-view-unix-man-pages#comments</comments>
		<pubDate>Mon, 30 Nov 2009 02:38:57 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Nerdery]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=319</guid>
		<description><![CDATA[There is a wealth of information available in the UNIX manual pages, but it feels a little silly to be reading text out of a terminal window, especially since I paid so much money for all this fancy font rendering technology.
Here are some alternatives:
To view a man page in Xcode&#8217;s documentation window, simply select &#8220;Open [...]]]></description>
			<content:encoded><![CDATA[<p>There is a wealth of information available in the <a href="http://en.wikipedia.org/wiki/Man_page">UNIX manual pages</a>, but it feels a little silly to be reading text out of a terminal window, especially since I paid so much money for <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/ArchitectureOverview.html">all this fancy font rendering technology</a>.</p>
<p>Here are some alternatives:</p>
<p>To view a man page in Xcode&#8217;s documentation window, simply select &#8220;Open man Page&#8230;&#8221; from the Help menu. For some reason, I hadn&#8217;t noticed that menu item until I read this <a href="http://toxicsoftware.com/manoxcode/">hint on accessing it via AppleScript</a>. Nicely formatted and references to other man pages are hyperlinked.</p>
<p><a href="http://bruji.com/bwana/index.html">Bwana</a> allows you to read man pages in any web browser, by registering itself as a protocol handler for <code>man:</code> URLs. Once installed, you can type <code>man:perl</code> in your browser&#8217;s address bar or <code>open man:perl</code> at a command prompt to read a manual page in your browser. Like Xcode, cross-references become hyperlinks, but it formats text using Courier. Source code is available, so I guess if I care enough I can do something about it.</p>
<p>Finally, a surprisingly short incantation will <a href="http://www.macosxhints.com/article.php?story=20051225101106519">open any man page as a beautifully formatted document in Preview</a>:</p>
<pre>man -t perl | open -f -a /Applications/Preview.app</pre>
<p>The <code>-t</code> option tells <code>man</code> to output PostScript, and the <code>-f</code> option tells <code>open</code> to put its input into a temporary file and pass that along to the specified application.</p>
<p>After reading that hint I set about writing a shell function so I could type <code>manp perl</code> to open Perl&#8217;s manual page in Preview. However, Preview&#8217;s PostScript to PDF conversion is kind of slow, so I wound up writing something slightly more sophisticated:</p>
<pre>function manp {
    local M=`man -w $*`               # Get path of page source.
    if [ -z $M ]; then return; fi     # Quit if it doesn't exist.
    local N=`basename $M .gz`         # Extract the name of the file and
    local P=$TMPDIR/man.$N.pdf        # use it to create a PDF file name.
    if [ ! -e $P ]; then              # If the PDF file doesn't exist,
        echo Creating PDF for $N...
        man -t $1 | pstopdf -i -o $P  # generate it.
    fi
    open $P                           # Open the PDF version.
}</pre>
<p>Then I went back and read the <a href="http://www.macosxhints.com/article.php?story=20051225101106519#comments">comments</a>, which contain a dozen or so different versions of the same idea. But mine&#8217;s the best! Copy and paste it into the your <code>.profile</code> if you agree.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/319/nicer-ways-to-view-unix-man-pages/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t printf when you can tcpdump</title>
		<link>http://www.benzado.com/blog/post/317/dont-printf-when-you-can-tcpdump</link>
		<comments>http://www.benzado.com/blog/post/317/dont-printf-when-you-can-tcpdump#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:04:20 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Nerdery]]></category>
		<category><![CDATA[tcpdump]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=317</guid>
		<description><![CDATA[Instead of using print statements to debug network communication, use tcpdump and get a complete and accurate picture of what's on the wire.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on an app that talks to a web service, and in the course of debugging it&#8217;s good to know what exactly is being sent to and from the web server. I had been doing so with the tried and true method of <a href="http://stackoverflow.com/questions/189562/what-is-the-proper-name-for-doing-debugging-by-adding-print-statements">printf() debugging</a> (this is Cocoa, so NSLog() debugging, actually), but it was getting to be a pain:</p>
<ol>
<li>If I print all network traffic all the time, it overwhelms my console, making it useless for any other kind of output. So instead, I&#8217;m constantly inserting or removing NSLog() statements as I work. Not to mention having to reproduce a request because the right logging statements weren&#8217;t in place the first time around.</li>
<li>NSURLConnection returns downloaded information as an NSData object, so simply passing it to NSLog() dumps a lot of useless hexadecimal code to the screen. That means I must first create an NSString from the data, print it, then release it. (I can&#8217;t use %s, the data isn&#8217;t null terminated.)</li>
<li>NSURLConnection does a lot of behind the scenes work, like storing cookies and setting Content-Length headers. That&#8217;s nice, but that makes it hard to know exactly what&#8217;s being sent on the wire.</li>
</ol>
<p>And that&#8217;s when it occurred to me: why not just watch what&#8217;s on the wire? tcpdump is a command line utility which monitors network traffic and prints out packets that you specify.</p>
<p>Here&#8217;s the incantation to monitor HTTP traffic to and from a specified host:</p>
<blockquote><p><code>sudo tcpdump -l -q -A "host <b>(Specified Host)</b> and tcp port 80 and (((ip[2:2] - ((ip[0]&#038;0xf)<<2)) - ((tcp[12]&#038;0xf0)>>2)) != 0)"</code></p></blockquote>
<p>To explain briefly, <code>sudo</code> runs the command as root, <code>-l</code> enables line buffering, <code>-q</code> hides some of the less interesting protocol information, and <code>-A</code> prints the content of each packet in ASCII. The filtering expression that follows selects packets to or from (Specified Host), to or from port 80, and ignoring SYN, FIN, ACK-only, and other non-data packets. I&#8217;ll confess, I don&#8217;t understand that last part completely, I copied it from the <a href="http://linux.die.net/man/8/tcpdump">tcpdump man page</a>.</p>
<p>To make the output a little easier to read, I pipe the output to a Perl script I quickly hacked together which watches for the packet header lines and outputs the <a href="http://isthe.com/chongo/tech/comp/ansi_escapes.html">ANSI escape codes</a> to render them in bold. But I&#8217;ll leave that as an exercise to you, dear reader.</p>
<p>There&#8217;s no need to download anything, tcpdump is already installed on your Mac. (I don&#8217;t know if it&#8217;s part of the standard install or the Developer Tools, but what do you care?)</p>
<p>Now, what would be <em>really</em> sweet is a graphical app to do this. I found <a href="http://www.tastycocoabytes.com/cpa/">Cocoa Packet Analyzer</a>, but it&#8217;s a little low-level for me. I don&#8217;t care about packet specifics; I&#8217;d prefer something that reconstructed the tcp streams in an easy to navigate way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/317/dont-printf-when-you-can-tcpdump/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing MetroCost</title>
		<link>http://www.benzado.com/blog/post/313/introducing-metrocost</link>
		<comments>http://www.benzado.com/blog/post/313/introducing-metrocost#comments</comments>
		<pubDate>Thu, 29 Oct 2009 03:32:56 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[MetroCost]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=313</guid>
		<description><![CDATA[After writing my last post, I realized that I had never formally announced MetroCost on this blog. Well, now is as good a time as any, because until the end of the week I&#8217;m giving it away for free!
MetroCost is an app for iPhone or iPod touch that helps you track your public transit expenses. [...]]]></description>
			<content:encoded><![CDATA[<p>After writing my last post, I realized that I had never formally announced MetroCost on this blog. Well, now is as good a time as any, because until the end of the week I&#8217;m giving it away for free!</p>
<p><strong><a href="http://www.metrocost.com/">MetroCost</a> is an app for iPhone or iPod touch that helps you track your public transit expenses.</strong> I live in New York City, so I use the subway a lot, but I&#8217;m a freelancer, so I don&#8217;t ride it every day. I began to wonder: should I really be paying $89 a month for an Unlimited Ride card, or would I save money if I paid $2.25 per ride?</p>
<p>Except it&#8217;s not that simple, because if you add $8 or more to a Pay-Per-Ride MetroCard, a 15% bonus is added to your total. As long as you add at least $8 at a time, a ride actually costs $1.96.</p>
<p>So, how does MetroCost help figure this out?</p>
<p><span id="more-313"></span>Each time you ride the subway or the bus, launch MetroCost and swipe a finger across the &#8220;magnetic&#8221; strip. It will keep a record and, based on your average ride count per day, compare the costs of an unlimited versus a pay-per-ride card.</p>
<p>If you&#8217;ve recorded 30 days&#8217; worth of rides, the calculations will be exact; if you&#8217;ve recorded less than that, you will still get a useful estimate. Either way, the next time you need to buy or refill your card, consult MetroCost to see which is best for you.</p>
<p>MetroCost is set up for New York City transit out of the box, but it&#8217;s totally customizable. As long as the fare doesn&#8217;t vary with distance traveled (sorry, Washington, DC) you can use MetroCost to save money.</p>
<p>You can also frivolously change MetroCost&#8217;s appearance to match your transit system&#8217;s color scheme.</p>
<p>MetroCost debuted at $1.99 but for this week only you can <a href="http://www.benzado.com/itunes/app326574369">get it for FREE on the iTunes App Store</a>. On Saturday I&#8217;m restoring the price, and maybe raising it, so you&#8217;d be crazy not to download it now.</p>
<p>Don&#8217;t be crazy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/313/introducing-metrocost/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which App Store?</title>
		<link>http://www.benzado.com/blog/post/305/which-app-store</link>
		<comments>http://www.benzado.com/blog/post/305/which-app-store#comments</comments>
		<pubDate>Tue, 20 Oct 2009 22:01:53 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[FatWatch]]></category>
		<category><![CDATA[itunes app store]]></category>
		<category><![CDATA[MetroCost]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=305</guid>
		<description><![CDATA[I nodded my head when Marco Arment (Tumblr) posited there were two App Stores, but Steven Frank (Panic) has identified their origins:
The iPhone/iPod Touch, being available for both Mac and Windows, has a single source of software in the app store. That Mac AND Windows thing is key. The app store is not just a [...]]]></description>
			<content:encoded><![CDATA[<p>I nodded my head when <a href="http://www.marco.org/208454730">Marco Arment (Tumblr) posited there were two App Stores</a>, but <a href="http://stevenf.tumblr.com/post/218293148/a-couple-people-have-asked-me-to-post-an-update">Steven Frank (Panic) has identified their origins</a>:</p>
<blockquote><p>The iPhone/iPod Touch, being available for both Mac and Windows, has a single source of software in the app store. That Mac AND Windows thing is key. The app store is not just a software market for Mac users. This is why it blows the minds of indie Mac developers like myself. It’s because it follows the rules of the general software market, not just the Mac software microcosm that we Mac indies enjoy.</p>
<p>Specifically, you have a large group of people who will download and suffer any old shit by the bucketload as long as it is free or extremely cheap. And you have 10% of people who are actually particular about software quality and are willing to pay for it.</p>
<p>In other words, you have the Windows market, and the Mac market, but within the app store itself. And you’d better be damn sure which one you’re targeting, and set pricing and development schedule accordingly.</p></blockquote>
<p>I am firmly in the Mac, not Windows, camp, and that is why <a href="http://www.fatwatchapp.com/">FatWatch</a> is $9.99. Yes, the iPhone provides a bigger market to sell software to, but customers who care about quality will always be a minority. And that&#8217;s fine with me. To paraphrase Douglas Adams, they may only be 10% of the market, but they are clearly the top 10%.</p>
<p>Now I&#8217;m thinking I should raise the price of <a href="http://www.metrocost.com/">MetroCost</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/305/which-app-store/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Spam Filter for Facebook Events</title>
		<link>http://www.benzado.com/blog/post/290/fb-events-filter</link>
		<comments>http://www.benzado.com/blog/post/290/fb-events-filter#comments</comments>
		<pubDate>Fri, 16 Oct 2009 19:46:56 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Nerdery]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[google calendar]]></category>
		<category><![CDATA[ical]]></category>
		<category><![CDATA[icalproxy]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.benzado.com/blog/?p=290</guid>
		<description><![CDATA[I love that Facebook exports events as a calendar that I can subscribe to in Apple iCal or Google Calendar. It saves much copying and pasting. Unfortunately, somebody is almost always creating an event that spans several days. Then my calendar looks like this:

This is annoying, because that purple monster isn&#8217;t even a real event; [...]]]></description>
			<content:encoded><![CDATA[<p>I love that Facebook exports events as a calendar that I can subscribe to in Apple iCal or Google Calendar. It saves much copying and pasting. Unfortunately, somebody is almost always creating an event that spans several days. Then my calendar looks like this:</p>
<p style="text-align: center;"><img class="size-medium wp-image-289 aligncenter" title="Giant event messing up my calendar" src="http://www.benzado.com/blog/wp-content/uploads/2009/10/Screen-shot-2009-10-16-at-12.31.25-PM-300x166.png" alt="Giant event messing up my calendar" width="300" height="166" /></p>
<p>This is annoying, because that purple monster isn&#8217;t even a real event; it&#8217;s just a notice that <a href="http://www.amazon.com/gp/product/B002FQ8NEM?ie=UTF8tag=benjpeteragh-20linkCode=as2camp=1789creative=390957creativeASIN=B002FQ8NEM">somebody&#8217;s film is available for download from Amazon</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=benjpeteragh-20l=as2o=1a=B002FQ8NEM" border="0" alt="" width="1" height="1" />. As much as I encourage everybody to watch that film, I don&#8217;t want it eating up my calendar. I am routinely invited to events like this, and they are always announcements, or &#8220;I&#8217;m looking for a roommate,&#8221; or &#8220;I was too lazy to create four separate events for the show I&#8217;m doing four times this month.&#8221; In other words, calendar spam.</p>
<p>This would be tolerable, if there were some way to hide individual events, but there isn&#8217;t. Facebook includes every event you&#8217;ve been invited to, even if you RSVP: Not Attending. You can uninvite yourself using the &#8220;Remove from My Events&#8221; link, but it&#8217;s tedious and doesn&#8217;t protect you from being re-invited in the future. It&#8217;s also of no use if you&#8217;re away from the computer and viewing your calendar on your iPhone.</p>
<h3>How to Clean Your Calendar</h3>
<p>I solved the problem with a program that acts as a proxy between your calendar app and Facebook, removing events that are longer than 12 hours. It&#8217;s on the web, so you can use it, too.</p>
<p>First, find your Facebook Calendar URL by going to <a href="http://www.facebook.com/events.php">Facebook Events</a> and clicking &#8220;Export Events&#8221; in the top left corner. A box will appear with an address that looks something like this:</p>
<pre>http://www.facebook.com/ical/u.php?uid=123456&amp;key=789abcdef</pre>
<p>To use the filter, change the first part of the address (everything before the question mark) so that it looks like this:</p>
<pre>http://www.benzado.com/bin/icalproxy.php?uid=123456&amp;key=789abcdef</pre>
<p>Then you can use the new address to subscribe to your filtered calendar in apps like <a href="http://docs.info.apple.com/article.html?path=iCal/4.0/en/9869.html">Apple iCal</a> or <a href="http://www.google.com/support/calendar/bin/answer.py?hl=enanswer=37100">Google Calendar</a>.</p>
<p>Note that using my filter means your events pass through my web server, and even though I&#8217;m not really interested in looking at them, I could. So if you&#8217;re super concerned about your privacy, keep that in mind.</p>
<p>If you&#8217;d like to see how the script works or make a copy to run on your own server, you can <a href="http://www.benzado.com/bin/icalproxy.php?getsrc">view the source code</a>. If you extend it in any interesting ways, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benzado.com/blog/post/290/fb-events-filter/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
