<?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>Alloysoft Blog &#187; Development</title>
	<atom:link href="http://www.alloysoft.com/blog/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alloysoft.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 02 Sep 2010 13:50:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>		<item>
		<title>Browsing Mac/iPhone Topics on Stack Overflow</title>
		<link>http://www.alloysoft.com/blog/2009/04/browsing-maciphone-topics-on-stack-overflow/</link>
		<comments>http://www.alloysoft.com/blog/2009/04/browsing-maciphone-topics-on-stack-overflow/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 21:20:45 +0000</pubDate>
		<dc:creator>Matt Stevens</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.alloysoft.com/blog/?p=158</guid>
		<description><![CDATA[Stack Overflow has turned into a great resource for developers, the social aspect it brings to helping other users out has brought a lot of very smart people to the site. Often times when a Google search lands me there I&#8217;ll end up browsing around a bit because I usually learn something in the process. [...]]]></description>
			<content:encoded><![CDATA[<p>Stack Overflow has turned into a great resource for developers, the social aspect it brings to helping other users out has brought a lot of very smart people to the site. Often times when a Google search lands me there I&#8217;ll end up browsing around a bit because I usually learn something in the process.</p>
<p>Since it&#8217;s not exactly obvious how to narrow down the focus to particular development topic, I wanted to share a bookmark I use to browse recent Mac and iPhone development questions:</p>
<p><a href="http://stackoverflow.com/questions/tagged/cocoa%20or%20objective-c%20or%20iphone%20or%20iphone-sdk%20or%20cocoa-touch%20or%20xcode%20or%20mac%20or%20osx%20or%20macosx%20or%20applescript?sort=newest">Stack Overflow: Mac/iPhone</a></p>
<p>This works by browsing a <a href="http://stackoverflow.com/questions/218627/how-do-you-search-for-specific-tags-in-stack-overflow/218629#218629">combination of tags</a> and has turned out to be a great addition to my list of time killers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alloysoft.com/blog/2009/04/browsing-maciphone-topics-on-stack-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sizing a Preference Pane Dynamically</title>
		<link>http://www.alloysoft.com/blog/2009/03/sizing-a-preference-pane-dynamically/</link>
		<comments>http://www.alloysoft.com/blog/2009/03/sizing-a-preference-pane-dynamically/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 01:45:05 +0000</pubDate>
		<dc:creator>Matt Stevens</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.alloysoft.com/blog/?p=145</guid>
		<description><![CDATA[If you&#8217;ve tried to develop a system preference pane on the Mac that works across both Tiger and Leopard you may have run into a small but annoying problem: although the System Preferences window is resized to the height of your view it has a fixed width and does not resize your view to fit [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve tried to develop a system preference pane on the Mac that works across both Tiger and Leopard you may have run into a small but annoying problem: although the System Preferences window is resized to the height of your view it has a fixed width and does not resize your view to fit within that width. This renders any autoresizing rules applied to your view useless, so you end up with a preference pane that is either clipped on 10.4 and earlier or too small on 10.5 and later.</p>
<p>The Apple examples for handling this situation recommend creating two separate views sets: one set for 10.4 and earlier and another set for 10.5 and later. Unless your layout is significantly altered between the two OS versions this has some drawbacks. You now have two sets of views to build and maintain, and if a future version of OS X alters the System Preferences window size again you&#8217;re going to need yet another set.</p>
<p>Luckily there is a simple solution. Although System Preferences does not resize the width of our view for us we can do this ourselves quite easily by matching the content width of the System Preferences window.</p>
<pre>
<code>
- (void)mainViewDidLoad {
    NSRect rect = [[self mainView] frame];
    NSWindow *systemPrefsWindow = [[NSApplication sharedApplication] mainWindow];
    rect.size.width = [systemPrefsWindow contentRectForFrameRect:[systemPrefsWindow frame]].size.width;
    [[self mainView] setFrame:rect];
}
</code>
</pre>
<p>We could simplify this code a bit by using the superview&#8217;s frame or the contentView of systemPrefsWindow, but <code>contentRectForFrameRect:</code> is used for a couple of reasons. We need to resize the view before it is first displayed, but the superview will not have valid size information until <code>didSelect</code>, at which point our view is already on the screen. In addition, by obtaining the content rect from the window rather than the frame of the contentView we are making no assumptions about the size of whatever contentView currently represents.</p>
<p>This simple change sizes our main view to the width of the System Preferences window, our autoresizing rules are now applied, and viola: a single set of views that scales to a System Preferences window of any width.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alloysoft.com/blog/2009/03/sizing-a-preference-pane-dynamically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures With AirTunes</title>
		<link>http://www.alloysoft.com/blog/2008/04/adventures-with-airtunes/</link>
		<comments>http://www.alloysoft.com/blog/2008/04/adventures-with-airtunes/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 21:57:47 +0000</pubDate>
		<dc:creator>Matt Stevens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Signal]]></category>

		<guid isPermaLink="false">http://www.alloysoft.com/blog/?p=43</guid>
		<description><![CDATA[The main addition to Signal 1.1 was the ability to control AirTunes speakers, something I was very happy to finally be able to offer as it was by far the most requested feature over the life of the application. Of course, with this implemented one of the new most requested features is &#8220;show which speakers [...]]]></description>
			<content:encoded><![CDATA[<p>The main addition to <a href="http://www.alloysoft.com/blog/2008/02/signal-11-hello-airtunes/">Signal 1.1</a> was the ability to control AirTunes speakers, something I was very happy to finally be able to offer as it was by far the most requested feature over the life of the application. Of course, with this implemented one of the new most requested features is &#8220;show which speakers are actually active!&#8221;. This is something I&#8217;d very much like to see added myself, and the reason it&#8217;s not supported stems from the same limitation of the iTunes programming interface that caused AirTunes control to be delayed for so long.</p>
<p><span id="more-43"></span></p>
<p>When the AirPort Express first came out, I was incredibly excited. Here was a way to put together a whole-house audio system that integrated seamlessly with iTunes, all that was missing was a slick way to control it via Wi-Fi. Of course, I soon discovered that there was in fact no way to control AirTunes through the iTunes API. Ok, no problem, I&#8217;ll just file a feature request (<a href="rdar://problem/3821346">rdar://problem/3821346</a> for any Apple folks). I&#8217;m sure they&#8217;ll add it soon.</p>
<p>That was nearly four years ago. It&#8217;s still not there.</p>
<p>Meanwhile, the requests for AirTunes support kept pouring in, sometimes on a daily basis. Finally I had to relent. So with no support from Apple, and no clever back-door into iTunes available, how can we add support for this feature? Really, there&#8217;s only one way: Simulate the user&#8217;s input in the iTunes interface. In other words, send mouse clicks exactly at the positions where you would make them to select a speaker through iTunes. This is known as UI scripting and should make every developer who hears those words cringe.</p>
<p>At first glance UI scripting doesn&#8217;t seem like such a bad thing. Simulate a click on the speaker selection drop-down, how hard can it be? There&#8217;s just one problem. That drop-down? <em>It moves.</em> Try clicking around between different playlists and source types and you&#8217;ll see how its position changes. What&#8217;s more, in order to send those mouse clicks iTunes has to be the foreground window and there are all kinds of reasons why that might not be the case. Here are just a few of the things that Signal has to account for in order to make those simulated clicks work reliably:</p>
<ul>
<li>The user&#8217;s language</li>
<li>The type of playlist selected</li>
<li>The iTunes window being hidden</li>
<li>The iTunes window being minimized</li>
<li>The Mini Player view being selected</li>
<li>The screen saver being active</li>
</ul>
<p>And of course, my personal favorite:</p>
<ul>
<li>The user&#8217;s language not being English, with the radio tuner playlist selected, with iTunes in the Mini Player view, minimized, with the screen saver active, plus some random process that just happens to act up right then and slow everything down.</li>
</ul>
<p>You have no idea how much cursing was involved in the creation of this feature.</p>
<p>The worst part is that despite all the efforts to make this work as smoothly as possible, it&#8217;s still based on a broken model. If Apple decides to update the iTunes interface and move the speaker selection drop-down to a new location it will break. If there is some odd mouse or application behavior that Signal doesn&#8217;t account for it will break. And of course, although Signal can send the mouse clicks it can&#8217;t get any information back about whether those clicks worked or what speakers are actually turned on.</p>
<p>Sure, Signal could start taking little screenshots of iTunes and try to figure this out from the image. &#8220;Well, that kind of looks like &#8216;Computer&#8217; in Simplified Chinese, I guess we can check the box&#8221;. But then I would go insane and then there would be no further product development.</p>
<p>Applications will always have bugs, but a good application tries to be as reliable as possible so that it &#8220;just works&#8221;. When the limitations of an API prevent your application from doing that, it&#8217;s incredibly frustrating. All of which is to say to Apple: Please, please, for the love of shiny plastic, put AirTunes control in the iTunes API.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alloysoft.com/blog/2008/04/adventures-with-airtunes/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
