<?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>2718.us blog &#187; objective c</title>
	<atom:link href="http://2718.us/blog/tag/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://2718.us/blog</link>
	<description>Miscellaneous Technological Geekery</description>
	<lastBuildDate>Tue, 18 May 2010 02:42:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>NSDocument beginSheet on a New Document</title>
		<link>http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/</link>
		<comments>http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 02:49:43 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[attached]]></category>
		<category><![CDATA[beginSheet]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[detached]]></category>
		<category><![CDATA[interface builder]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[nsdocument]]></category>
		<category><![CDATA[nspanel]]></category>
		<category><![CDATA[obj]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[sheet]]></category>
		<category><![CDATA[xco]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=161</guid>
		<description><![CDATA[This took over an hour for me to hash out, in part because there are a few mailing list archives and whatnot that I came across while looking into this issue that led me down the wrong path.  I have an NSDocument subclass for which I want a sheet to display modal to the window [...]]]></description>
			<content:encoded><![CDATA[<p>This took over an hour for me to hash out, in part because there are a few mailing list archives and whatnot that I came across while looking into this issue that led me down the wrong path.  I have an NSDocument subclass for which I want a sheet to display modal to the window on initialization of the window.  It seemed that no matter what I did to try to get it to work, what would happen was the sheet would show up detached from the document, then the document would show up on top of it.</p>
<p>&#8230; because I had &#8220;Visible At Launch&#8221; checked for the NSPanel that is my sheet in Interface Builder.  Unchecking that fixed everything, no RunLoop or otherwise delayed-running machinations needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML-RPC and Mac Programming, Revisited</title>
		<link>http://2718.us/blog/2009/04/26/xml-rpc-and-mac-programming-revisited/</link>
		<comments>http://2718.us/blog/2009/04/26/xml-rpc-and-mac-programming-revisited/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 05:59:02 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[asLJ]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[xml-rpc]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=139</guid>
		<description><![CDATA[I might have been wrong, or at least not entirely right, when I said that AppleScript&#8217;s XML-RPC was doing something screwy with UTF8-encoded responses to XML-RPC requests.  I&#8217;m not sure if it&#8217;s LiveJournal (and other sites based on their code), or if it&#8217;s something inherent in XML-RPC, but whether I make the XML-RPC calls in [...]]]></description>
			<content:encoded><![CDATA[<p>I might have been wrong, or at least not entirely right, when I said that <a href="http://2718.us/blog/2009/02/14/applescripts-xml-rpc-doesnt-get-along-with-utf8/">AppleScript&#8217;s XML-RPC was doing something screwy with UTF8-encoded responses to XML-RPC requests</a>.  I&#8217;m not sure if it&#8217;s LiveJournal (and other sites based on their code), or if it&#8217;s something inherent in XML-RPC, but whether I make the XML-RPC calls in AppleScript (with its built-in mechanism for calling XML-RPC), in Python (with xmlrpclib), or in Objective-C/Cocoa (using <a href="http://github.com/eczarny/xmlrpc/tree/2.0">the XML-RPC framework</a> from <a href="http://divisiblebyzero.com/">here</a>), things that I was expecting to be UTF8 strings were instead coming through as binary data that needed to be decoded.</p>
<p>Beyond that point, however, AppleScript was severely lacking in that the form in which that data was stored made it entirely unusable&#8211;AppleScript couldn&#8217;t convert it, couldn&#8217;t pass it off to an Objective-C method, etc.  As suggested in my previous post, there was a way around it, and messy though it was, I went about implementing that fix and by and large it worked (though it exposed another minor bug elsewhere).  But it really bothered me.</p>
<p>So I went back to looking at trying to integrate Python code into my tangled web of AppleScript and Objective-C, since XML-RPC is fairly easy in Python, though not quite as easy as in AppleScript.  And, eventually, I succeeded in integrating a class written in Python into the program (documentation on using the PyObjC bridge in this direction is woefully inadequate), using a less ineligant means of fixing the binary UTF8 data—</p>
<pre>unicode(theResult.data,'utf-8')</pre>
<p>(and Python also allowed me to generically recurse through the entire return structure, which wasn&#8217;t possible in Applescript).  Unfortunately, this version was <em>substantially</em> slower than the broken-Unicode version and not particularly any faster (perhaps slower) than the AppleScript-fixed Unicode version.</p>
<p>This led me to look for a way to do the XML-RPC stuff in Objective-C.  Now, mind you, the single thing that enabled me to even think about writing a client for LJ for Mac was seeing just how easy AppleScript XML-RPC calls were.  While I didn&#8217;t particularly want to try Python, the XML-RPC calls there weren&#8217;t that much harder.  But going to Objective-C for XML-RPC&#8230;  that&#8217;s a fundamental change in the program.  At least, to me.</p>
<p>I did a lot of Googling and found that there are actually a few XML-RPC frameworks for Objective-C/Cocoa (<a href="http://github.com/eczarny/xmlrpc/tree/2.0">the one I used by Eric Czarny</a>, <a href="http://ranchero.com/cocoa/xmlrpc/">the one from Brent Simmons</a>, <a href="http://www.mulle-kybernetik.com/software/XMLRPC/">the Mulle one</a>, <a href="http://www.padl.com/Research/XMLRPCObjC.html">XMLRPCObjC</a>, <a href="http://sope.opengroupware.org/en/docs/snippets/xmlrpc_client.html">SOPE</a>).  Supposedly, there&#8217;s a way to do it with Apple&#8217;s own Cocoa stuff, but the documentation is woefully inadequate (none of the frameworks have amazing and wonderful documentation, but Apple&#8217;s documentation is <em>bad</em>) and almost every mention of it that I found on mailing lists and discussion boards said it was broken.  In the end, my framework choice was largely dictated by licensing, though there were also some issues with usability and dependencies.  As with AppleScript and Python, the UTF8 strings weren&#8217;t coming through as strings, but as NSData objects, which are fairly easy to convert with</p>
<pre>[[NSString alloc] initWithData:theObject encoding:NSUTF8StringEncoding]</pre>
<p>Recursing through the entire returned structure wasn&#8217;t particularly any harder in Objective-C than in Python.</p>
<p>The best part is that the resulting client with Objective-C-based-XML-RPC feels <em>faster</em> than the non-Unicode AppleScript-based-XML-RPC client.  In vaguely-objective tests (determine a set of steps that constitute a test and record the total time for just the XML-RPC calls in those steps, run the test several times under each app, compare times), the new version is <em>measurably</em> faster than the old version.</p>
<p>Bottom lines: (1) expect a new version of <a href="http://2718.us/asLJ/">asLJ</a> in the next few days, as soon as I get feedback from my early testers; (2) expect another post or two about other things I&#8217;ve learned in rewriting the XML-RPC aspect of asLJ in Objective-C.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/04/26/xml-rpc-and-mac-programming-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>asLJ: a Mac OS X 10.5+ LiveJournal Client</title>
		<link>http://2718.us/blog/2009/02/09/aslj/</link>
		<comments>http://2718.us/blog/2009/02/09/aslj/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 08:24:18 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[asLJ]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[applescript studio]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[keychain.framework]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[livejournal]]></category>
		<category><![CDATA[livejournal client]]></category>
		<category><![CDATA[lj]]></category>
		<category><![CDATA[lj client]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[sparkle]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=121</guid>
		<description><![CDATA[asLJ is a new client for Macs running Leopard that easily handles multiple accounts on LiveJournal and other LJ-based sites and facilitates cross-posting across accounts. Release notes and download link are in aslj_client. The community for users is aslj_users. (As it is very LJ-centric, most of the information about it will be over at LJ, [...]]]></description>
			<content:encoded><![CDATA[<p>asLJ is a new client for Macs running Leopard that easily handles multiple accounts on LiveJournal and other LJ-based sites and facilitates cross-posting across accounts. Release notes and download link are in <span style="white-space: nowrap;"><a href="http://aslj-client.livejournal.com/profile"><img style="border: 0pt none; vertical-align: bottom; padding-right: 1px;" src="http://p-stat.livejournal.com/img/userinfo.gif" alt="[info]" width="17" height="17" /></a><a href="http://aslj-client.livejournal.com/"><strong>aslj_client</strong></a></span>.  The community for users is <span style="white-space: nowrap;"><a href="http://community.livejournal.com/aslj_users/profile"><img style="border: 0pt none; vertical-align: bottom; padding-right: 1px;" src="http://p-stat.livejournal.com/img/community.gif" alt="[info]" width="16" height="16" /></a><a href="http://community.livejournal.com/aslj_users/"><strong>aslj_users</strong></a></span>.</p>
<p>(As it is very LJ-centric, most of the information about it will be over at LJ, in the two places linked above, but there is a page for it <a href="http://2718.us/asLJ/">here</a>, as well.)</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/02/09/aslj/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NCIDStatusBarMenu v0.1a Release Notes</title>
		<link>http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/</link>
		<comments>http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 03:07:40 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[NCIDStatusBarMenu]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[ncid]]></category>
		<category><![CDATA[NCIDStatusBarMenu Release Notes]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[release notes]]></category>
		<category><![CDATA[whocalled.us]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=49</guid>
		<description><![CDATA[Initial Release Notes for the first release of NCIDStatusBarMenu (copied into the blog) This is the first thing I&#8217;ve ever written with Objective-C/Cocoa and the first OS X-native GUI app I&#8217;ve ever written. This is also the first release. There are probably bugs. The preferences have no default settings yet. The program won&#8217;t create the [...]]]></description>
			<content:encoded><![CDATA[<p>Initial Release Notes for the first release of NCIDStatusBarMenu (copied into the blog)<span id="more-49"></span></p>
<ul>
<li>This is the first thing I&#8217;ve ever written with Objective-C/Cocoa and the first OS X-native GUI app I&#8217;ve ever written. This is also the first release. There are probably bugs.</li>
<li>The preferences have no default settings yet.</li>
<li>The program won&#8217;t create the log file if it doesn&#8217;t exist.</li>
<li>If you don&#8217;t have <a href="http://growl.info/">Growl</a>, you will be prompted to install it at some point. Install it.</li>
<li>The lookups to <a href="http://whocalled.us/">whocalled.us</a> may make use of /usr/bin/curl, but I think that&#8217;s in the base install of OS X 10.4+</li>
<li>Requires OS X 10.4+</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

