<?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>Mac Daddy World &#187; OS X</title>
	<atom:link href="http://macdaddyworld.com/category/os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://macdaddyworld.com</link>
	<description>Stand back, here come the MacDaddies from Ecamm Network</description>
	<lastBuildDate>Tue, 26 Jan 2010 18:14:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Iron Coder Live: PoorLocation!</title>
		<link>http://macdaddyworld.com/2008/09/08/iron-coder-live-poorlocation/</link>
		<comments>http://macdaddyworld.com/2008/09/08/iron-coder-live-poorlocation/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 02:49:03 +0000</pubDate>
		<dc:creator>glen</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[c4]]></category>
		<category><![CDATA[ironcoder]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/?p=93</guid>
		<description><![CDATA[We&#8217;re just back from C4[2].  Fantastic speakers and loads of Mac nerdery made for an amazing weekend trip to Chicago. The most unexpected part of the weekend for us was winning the Sunday contest.  Having won Iron Coder Live last year, we weren&#8217;t planning on entering again—that is, until we found out about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rentzsch.com/c4/twoOpen/"><img src="http://macdaddyworld.com/wp-content/uploads/2008/09/c4glasses.png" alt="" title="c4glasses" width="172" height="133" class="alignright size-full wp-image-114" /></a>We&#8217;re just back from <A HREF="http://rentzsch.com/c4">C4[2]</A>.  <A HREF="http://rentzsch.com/c4/twoOpen">Fantastic speakers</A> and loads of Mac nerdery made for an amazing weekend trip to Chicago. The most unexpected part of the weekend for us was winning the Sunday contest.  Having won Iron Coder Live <A HREF="http://www.engadget.com/2007/08/13/mirror-based-video-conferencing-developed-for-iphone/">last year</A>, we weren&#8217;t planning on entering again—that is, until we found out about the <A HREF="http://rentzsch.com/c4/2IronCoderPrizes">amazing prize package</A>.  If there&#8217;s anything you can never have enough of, it&#8217;s Macs&#8230; and software to load onto them.  If you weren&#8217;t there to watch, the entry is a bit difficult to describe but here goes.</p>
<p>In the spirit of the contest, we procrastinated until late Thursday afternoon and hatched a plan in a Starbucks-fueled brainstorm. (The employees at Starbucks are thoroughly convinced that we have no job.)</p>
<p>We had some Core Location-related ideas, but they would have involved lots of running around Chicago with iPhones, and since Wolf had given explicit permission to deviate from the theme &#8220;if the hack was cool enough&#8221;, we decided not to go the Core Location route.  Once we came up with the stupidest idea on the planet, we headed out to buy Radio Shack&#8217;s last four remaining infrared LEDs and some tiny calculator batteries.</p>
<p><img src="http://macdaddyworld.com/wp-content/uploads/2008/09/leds.jpg" alt="" title="LED and battery taped to iPhone" width="153" height="184" class="alignright size-medium wp-image-117" />Six hours later, we had our hack ready:  Using the <A HREF="http://sourceforge.net/projects/darwiin-remote/">WiiRemote.framework</A> and some Apple sample code, we created a Mac app which could track infrared light sources using a Bluetooth link to a Wii Remote to draw colorful lines on the Mac screen.  We also added an HTTP server using Cultured Code&#8217;s <A HREF="http://culturedcode.com/cocoa/">Simple HTTP Server</A> Cocoa project.  We then created an iPhone application to send HTTP requests to the Mac via Wifi.  These requests controlled what kind of &#8220;artwork&#8221; would be generated by the Mac application.  (Line color, thickness, etc.)  As a finishing touch, we taped the infrared LEDs and batteries to the front of the iPhone.  This allowed for a &#8220;digital whiteboard&#8221; effect.  By pressing button on the iPhone&#8217;s cool UI and waving it around in a drawing motion, we were able to paint designs in the Mac program.</p>
<p><img src="http://macdaddyworld.com/wp-content/uploads/2008/09/phoneapp1.png"/><img src="http://macdaddyworld.com/wp-content/uploads/2008/09/phoneapp2.png"/></p>
<p>Friday was something of a blur and no work happened on the hack.  I think I signed up for <A HREF="http://twitter.com/pimpinglen">Twitter</A> at some point.  Tweet.</p>
<p>Saturday afternoon, we decided that we needed a &#8220;clincher&#8221; feature.  A new mode was added to the application (using a UITabBarController of course) which allowed for the positioning and stamping of image files.  We also added iPhone X-axis accelerometer data to the mix to allow for rotating of the stamped images by simply twisting the iPhone.</p>
<p>The next 24 hours was spent trying to decide what images we would use.  We finally decided on Ken and Glen heads, tinfoil hats, nose glasses and fake moustaches, inspired by Josh and Dave&#8217;s <A HREF="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?mt=8&#038;id=284880416">Mr. Shuffle</A> app, and the &#8220;paranoia&#8221; theme.</p>
<p><IMG SRC="http://macdaddyworld.com/wp-content/uploads/2008/09/macapp.png"></p>
<p>After spending Sunday morning in Photoshop lassoing fake moustaches, the live demo was a complete disaster.  We positioned the Wii remote too far away from the Mac for the Bluetooth link to function, and our iPhones randomly jumped from out of our ad-hoc network to the conference network midway through the demo.  Much awkwardness was <A HREF="http://twitter.com/c4/statuses/913116184">twittered</A>.  </p>
<p>In the end, we somehow managed to take first place. Thanks for your votes, and thanks to all of the companies who donated software and t-shirts!</p>
<p>Here&#8217;s the <A HREF="http://macdaddyworld.com/wp-content/uploads/2008/09/poorlocation1.zip">source</A> (875k) for our hack including Mac and iPhone projects.  You&#8217;ll need Xcode 3.1, iPhone SDK and the <A HREF="http://sourceforge.net/projects/darwiin-remote/">WiiRemote.framework</A> if you would like to build it.  You&#8217;ll also need infrared LEDs&#8230; and tape&#8230;</p>
<p><I>Known issues:</I> HTTP did not prove to be the best way to send rapid-fire requests from the iPhone to the Mac.  The iPhone&#8217;s HTTP request system seems to freeze up if we send requests too quickly.  Also, the IP address of the Mac server is hardcoded into the iPhone app for extra credit laziness.  </p>
<p><i>One more thing:</i> This code was mashed together in a few hours, and just barely.  It contains some nasty bits and should not be used as an example of proper or efficient Cocoa programming!</p>
<p>So will anyone actually try this themselves?  Let us know if you do!</p>
<div id="attachment_132" class="wp-caption center" style="width: 510px"><a href="http://macdaddyworld.com/wp-content/uploads/2008/09/output.jpeg"><img src="http://macdaddyworld.com/wp-content/uploads/2008/09/output.jpeg" alt="Actual Program Output" title="Actual Program Output" width="500" height="389" class="size-full wp-image-132" /></a><p class="wp-caption-text">Actual Program Output</p></div>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2008%2F09%2F08%2Firon-coder-live-poorlocation%2F';
  addthis_title  = 'Iron+Coder+Live%3A+PoorLocation%21';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2008/09/08/iron-coder-live-poorlocation/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>I ♥ DockStar v2.1</title>
		<link>http://macdaddyworld.com/2007/12/27/i-%e2%99%a5-dockstar-v21/</link>
		<comments>http://macdaddyworld.com/2007/12/27/i-%e2%99%a5-dockstar-v21/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 20:21:56 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/2007/12/27/i-%e2%99%a5-dockstar-v21/</guid>
		<description><![CDATA[We rolled out a cool new version of DockStar on Christmas day.  The feature everyone&#8217;s talking about is the clickable indicators in the menu bar.  
Before I was even finished coding this feature, I already knew I couldn&#8217;t live without it.  Glen used more explicit terms; something leading to him and the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ecamm.com/mac/dockstar/"><img src='http://macdaddyworld.com/wp-content/uploads/2007/12/picture-12.png' alt='DockStar v2.1' class="alignright" border=0 /></a>We rolled out a cool <a href="http://www.ecamm.com/mac/dockstar/">new version of DockStar</a> on Christmas day.  The feature everyone&#8217;s talking about is the <b>clickable indicators in the menu bar</b>.  </p>
<p>Before I was even finished coding this feature, I already knew I couldn&#8217;t live without it.  Glen used more explicit terms; something leading to him and the new feature having babies.</p>
<p>In short, you can see unread counts for any mailbox or folder up in the status area, and a simple click on the indicator pops open Mail.app and brings up the right mailbox.  This was a requested feature from DockStar fans. (We get a lot of our best ideas from customers.)  It&#8217;s not limited to unread counts either: You can set each indicator to count flagged messages, total message counts, and even monitor Smart Mailboxes.</p>
<p><a href="http://www.ecamm.com/mac/dockstar/"><img src='http://macdaddyworld.com/wp-content/uploads/2007/12/todo_options.jpg' alt='todos' class="alignright" border=0 /></a>This upgrade brings many new features for Leopard users.  <b>If you use To Do items in Mail.app or Calendar.app, you can use DockStar to monitor the number of incomplete To Dos.  You can also count Notes or even keep track of unread RSS feed items.</b></p>
<p>The DockStar Dashboard Widget also got some improvements. You can now click on the widget to jump right into the relevant mailbox.  </p>
<p>If you&#8217;re a serious emailer, and you&#8217;ve never tried DockStar, you should try the <a href="http://www.ecamm.com/mac/dockstar/">free trial</a>, but be warned: Afterwards, you won&#8217;t be able to live without it.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F12%2F27%2Fi-%25e2%2599%25a5-dockstar-v21%2F';
  addthis_title  = 'I+%E2%99%A5+DockStar+v2.1';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/12/27/i-%e2%99%a5-dockstar-v21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leopard: How to be a super user</title>
		<link>http://macdaddyworld.com/2007/12/05/leopard-how-to-be-a-super-user/</link>
		<comments>http://macdaddyworld.com/2007/12/05/leopard-how-to-be-a-super-user/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 23:07:09 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/2007/12/05/leopard-how-to-be-a-super-user/</guid>
		<description><![CDATA[I spent a lot of time working this issue, so I&#8217;ll go into some detail here in the hopes that it will help others.   
If you take a look at my previous post, you&#8217;ll see a list of new restrictions which Leopard puts on Input Manager plugins.  Number 3 is: Processes running [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a lot of time working this issue, so I&#8217;ll go into some detail here in the hopes that it will help others.   </p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/12/picture-2.png' alt='picture-2.png' class="alignright" />If you take a look at my previous post, you&#8217;ll see a list of new restrictions which Leopard puts on Input Manager plugins.  Number 3 is: <b>Processes running with the root privilege (getuid() == 0 or geteuid() == 0) cannot load any bundle input manager.</b>  While I do consider this overkill (given #2), it seemed a very straightforward requirement and sensible if you&#8217;re trying to be as safe as possible.</p>
<p>A handful of users weren&#8217;t getting our plugins to load, so we created a test application to run down all of the requirements one by one and see which one was failing. To our surprise, we found the test application (and presumably all of their apps) was running geteuid() == 0!  <b>Yes, all running as super user, root, the big 0.</b> A quick check in Activity Monitor revealed that sure enough, most every process on the machines in question was running as root.  Now remember, they&#8217;re not logged in as root. They&#8217;re logged in as their normal user; let&#8217;s call him Steve.  Whenever Steve opens a program from the Dock, it runs with root privileges instead of Steve privileges.  This is nasty. Steve doesn&#8217;t even know it, but I&#8217;m sure his system is acting rather strange.  Most people with this problem reported &#8220;other stability issues&#8221; and eventually did a clean install of Leopard (which fixed the problem.)</p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/12/picture-3.png' alt='picture-3.png' class=alignleft /> I asked around on the Apple-cdsa listserv to see if anyone had seen this problem. I quickly heard from another developer who had already seen the same issue, but nobody else on the list had seen it and nobody had a quick solution.  </p>
<p>I went back on a few weeks later asking for any help with troubleshooting the problem.  This was fruitful.  Although it wasn&#8217;t entirely on topic, heads were scratched, hallway discussions were had, and I heard from an Apple engineer who quickly guessed at the actual cause of this.</p>
<p>Apparently, some major changes have been made to how Leopard launches applications.</p>
<p>If you&#8217;ve spent the last several years seeing Tiger crash reports, you&#8217;ve probably become quite familiar with seeing:</p>
<p><code>Parent:  WindowServer [123]</code></p>
<p>On Tiger, the very first process (PID 1) is launchd, which launches all daemons, including WindowServer, which is in turn the parent of all of your &#8220;apps&#8221;.  launchd runs as root, WindowServer runs as windowserver, and your apps should all be running as, well, as you.</p>
<p>On Leopard, you might have noticed that the parent process in crash reports has now become launchd.  When you login on Leopard, the PID 1 launchd forks a second launchd, which is the parent of all your apps.  This second launchd runs as your normal user.</p>
<p>In our messed up case, this second launchd was running as root.  </p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/12/picture-5.png' alt='picture-5.png' class="alignright" /> On these affected machines /sbin/launchd had its setuid bit set.  The setuid attribute is a permissions bit flag, which causes a program to run as root even if a non-privileged user executes it.  Sound like bad idea jeans to you too?  Set this bit on launchd, and that&#8217;s exactly what happens: It always runs as root no matter who starts it. </p>
<p>launchd is normally setuid on Tiger, but it&#8217;s not supposed to be on Leopard. I&#8217;m assuming this is some kind of 10.4 -> 10.5 migration issue.</p>
<p>It&#8217;s not hard to turn off the setuid bit and fix this problem, but the user will have lingering ownership issues.  Every file they&#8217;ve created since upgrading to Leopard is going to be owned by root and unwritable by their normal user. This isn&#8217;t hard to fix but who knows what other weird issues they&#8217;ll see.  Yuck.  Clean install highly recommended.</p>
<p>There are obvious reasons why having all your apps running with root privileges is bad, especially if your machine is being used by non-admin users.</p>
<p>It&#8217;s interesting that a single bit flag can give you super user privileges on your own machine.  If at least half dozen of my customers had this problem, then there must be thousands of users out there running as root.  At least one person at Apple is now aware of the issue, so hopefully there will eventually be a fix for this.</p>
<p>What exactly caused this bit to be set for these unfortunate users?  This is the one question we still don&#8217;t have an answer to.  </p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F12%2F05%2Fleopard-how-to-be-a-super-user%2F';
  addthis_title  = 'Leopard%3A+How+to+be+a+super+user';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/12/05/leopard-how-to-be-a-super-user/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QuickTime 7.2 Brings Leopard Functionality</title>
		<link>http://macdaddyworld.com/2007/07/13/quicktime-72-brings-leopard-functionality/</link>
		<comments>http://macdaddyworld.com/2007/07/13/quicktime-72-brings-leopard-functionality/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 21:20:20 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[QuickTime]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/?p=30</guid>
		<description><![CDATA[Following a continuing trend of adding new things without telling anyone, the recent QuickTime 7.2 update includes more than just bug fixes.
We&#8217;ve confirmed that the QTKit Capture functionality previously billed as a feature of Leopard is included with the update. (See the section on QuickTime Improvements.)
The fun new functionality is all there after updating to [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/07/writinguin.thumbnail.gif' alt='writinguin.gif' class=alignright />Following a continuing trend of adding new things without telling anyone, the recent <a href="http://www.apple.com/support/downloads/quicktime72formac.html" target="_new">QuickTime 7.2 update</a> includes more than just bug fixes.<br />
We&#8217;ve confirmed that the QTKit Capture functionality previously billed as a feature of Leopard is included with the update. (<a href="http://developer.apple.com/leopard/overview/" target="_new">See the section on QuickTime Improvements</a>.)</p>
<p>The fun new functionality is all there after updating to 7.2, but there are no new header files (no public API yet).  Also, <strong>the functionality is now used by QuickTime Player Pro</strong>. However, you probably won&#8217;t notice much of a change except a little progress indicator in the Recording section of the prefs when it&#8217;s scanning for cameras, and <em>hopefully</em> a performance improvement. <img src='http://macdaddyworld.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Since it&#8217;s in the wild, I can now talk freely about this cool new feature of QuickTime.</strong>  All of this I learned simply by hunting around and looking at sample traces of a running video stream in the new version of QuickTime Player.</p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/07/fiendish.jpg' alt='fiendish.jpg' class=alignleft /> QTKit Capture looks to be a total ground-up replacement of the Sequence Grabber.  The Sequence Grabber is a very ancient part of QuickTime, designed long ago as the way to capture streaming audio/video.  It doesn&#8217;t appear to be going away, but QTKit Capture doesn&#8217;t use it internally except for reverse compatibility* with old vdig drivers.  Where the Sequence Grabber uses QuickDraw, QTKit Capture makes heavy use of Core Video and OpenGL.  Also, the top layer is Objective-C so it can be integrated easily into a Cocoa app.</p>
<p><strong>I&#8217;ve done some looking around and found some interesting things:<br />
</strong><br />
It makes use of some new private frameworks.  New to the club are:<br />
CoreMediaAuthoringPrivate.framework<br />
CoreMediaIOServicesPrivate.framework<br />
CoreMediaPrivate.framework</p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/07/pengy2.thumbnail.png' alt='pengy2.png' class=alignright />CoreMediaIOServicesPrivate&#8217;s framework Resources folder contains a number of plugin modules. There&#8217;s one for AVC (DV cams), IIDC (external iSight), and VDC (the built-in iSight).  In a nutshell, CoreMedia appears to implement a Device Abstraction Layer (A way to allow access to all video devices without having to know the details of the device.)</p>
<p>Other notes:</p>
<ul>
<li>* QTKit Capture still works with existing QuickTime component vdig modules (macam still works). In this case, it is actually running the Sequence Grabber below CoreMedia. For the built-in iSight however, the Sequence Grabber is not being used.  Hopefully, Apple will provide a new way to write plugins for third party devices so the SequenceGrabber doesn&#8217;t have to be used.  However, they do support 3 major video camera standards (IIDC, AVC, and UVC), so device developers going forward would be wise to implement one of these standards, eliminating the need for writing their own driver.</li>
<li>You <em><strong>can</strong></em> build and link against the new functionality if you have the proper header files.</li>
</ul>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F07%2F13%2Fquicktime-72-brings-leopard-functionality%2F';
  addthis_title  = 'QuickTime+7.2+Brings+Leopard+Functionality';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/07/13/quicktime-72-brings-leopard-functionality/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ouch&#8230; It hertz!</title>
		<link>http://macdaddyworld.com/2007/06/30/ouch-it-hertz/</link>
		<comments>http://macdaddyworld.com/2007/06/30/ouch-it-hertz/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 02:14:44 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/?p=22</guid>
		<description><![CDATA[Often times, you want to change your program&#8217;s behavior based on available CPU Mhz (or GHz as is more common nowadays). For example, Call Recorder won&#8217;t default to using AAC encoding for audio recording if your Mac is under 800 Mhz. 
So let&#8217;s say you want to find out the current CPU speed. It&#8217;s common [...]]]></description>
			<content:encoded><![CDATA[<p>Often times, you want to change your program&#8217;s behavior based on available CPU Mhz (or GHz as is more common nowadays). For example, <A HREF="http://www.ecamm.com/mac/callrecorder/">Call Recorder</a> won&#8217;t default to using AAC encoding for audio recording if your Mac is under 800 Mhz. </p>
<p>So let&#8217;s say you want to find out the current CPU speed. It&#8217;s common to use the ancient but useful <code>sysctl</code> call.</p>
<blockquote><p><code>int args[] = {CTL_HW, HW_CPU_FREQ};<br />
int freq = 0;<br />
size_t len = sizeof(freq);<br />
if (sysctl(args, 2, &#038;freq, &#038;len, NULL, 0) == 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("It's %d Hz\n", freq);<br />
</code></p></blockquote>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/06/gold-star.thumbnail.jpg' alt='gold-star.jpg' class="alignright"/>A Gold Star if you can see what&#8217;s wrong with that code.  </p>
<p>Wait for it&#8230;</p>
<p>Since <code>sysctl</code> returns the clock speed in tiny little old Hz (1 billionth of a GHz), we&#8217;re quickly running out of space in our 32-bit int.  We&#8217;d overflow an <code>unsigned int</code> when we hit 4,294,967,296 Hz and we&#8217;ll overflow the signed <code>int</code> we used in the code above at only 2,147,483,648 Hz.  </p>
<p><strong>But that&#8217;s only 2.14 Ghz.</strong></p>
<p>So on my 2.33 Ghz MacBook Pro, the code above will return:<br />
<em>It&#8217;s -1,964,967,296 Hz</em>.<br />
<strong>Oops&#8230;</strong></p>
<p>Obviously, using an <code>unsigned int </code>instead of a normal int would have been wiser. However, even that will overflow when clock speeds double (in 2 years if you trust Moore&#8217;s law.)</p>
<p>Indeed, the solution is to use a <code>long long</code> or int64 (whichever camp you&#8217;re from.)</p>
<p>Here&#8217;s better code, using <code>sysctlbyname</code> instead, which is the recommended way to do it nowadays:</p>
<blockquote><p><code>uint64_t freq = 0;<br />
size_t size = sizeof( freq );<br />
if (sysctlbyname( "hw.cpufrequency_max", &#038;freq, &#038;size, NULL, 0 ) == 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("It's %lld Hz\n", freq);<br />
</code>
</p></blockquote>
<p>This introduces a new overflow point when CPU speeds exceed 18,446,744,073 Ghz.</p>
<p>Interestingly, if you believe that Moore&#8217;s law will continue to hold, we should reach these speeds around 2071.  That is, of course, assuming that the human race survives the <a href="http://en.wikipedia.org/wiki/Year_2038_problem">Year 2038 Problem</a> which will cause a similar overflow issue with the way OS X keeps track of the date seconds in an unsigned int.  </p>
<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/06/20061222_star.thumbnail.jpg' alt='20061222_star.jpg' class="alignright"/>Switching the date seconds to an int64 will cause a new problem in about 290 billion years.<br />
However, due to predicted changes to the Solar System, it is not widely regarded as a pressing issue.</p>
<p>Also, don&#8217;t forget about good old OS 9&#8217;s <code>Gestalt</code> routine.  You can&#8217;t use <code>gestaltProcClkSpeed</code> anymore for the same reason. (It returns a <code>long</code>.) But <code>Gestalt</code> also has a selector <code>gestaltProcClkSpeedMHz</code>, which drops the six useless zeros.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F06%2F30%2Fouch-it-hertz%2F';
  addthis_title  = 'Ouch%26%238230%3B+It+hertz%21';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/06/30/ouch-it-hertz/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Megapixel Test Program and more details</title>
		<link>http://macdaddyworld.com/2007/06/28/the-megapixel-test-program-and-more-details/</link>
		<comments>http://macdaddyworld.com/2007/06/28/the-megapixel-test-program-and-more-details/#comments</comments>
		<pubDate>Thu, 28 Jun 2007 14:42:01 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/?p=19</guid>
		<description><![CDATA[The iApps like iChat and Photo Booth only request a 640&#215;480 or smaller image from the iSight. Therefore it can be troublesome to find a way to test the full capabilities of the new 1.3 MP iSight.  That&#8217;s why we wrote our own little test program.
Today we cleaned it up and are posting it [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://macdaddyworld.com/wp-content/uploads/2007/06/guage.thumbnail.jpg' alt='MacDaddy' class="alignright"/>The iApps like iChat and Photo Booth only request a 640&#215;480 or smaller image from the iSight. Therefore it can be troublesome to find a way to test the full capabilities of the new 1.3 MP iSight.  That&#8217;s why we wrote our own little test program.</p>
<p>Today we cleaned it up and are posting it here so new-MacBook-Pro-having visitors can try it out see the new and improved image for themselves.</p>
<p>The app requests and displays a video stream from the camera at 1280&#215;1024.  If you&#8217;re on an older iSight it will still stretch the VGA image out to be this size but it won&#8217;t look very good.  The app will report the frame actual size from the ImageDescription at the top.  </p>
<p>There&#8217;s also a snapshot button so you can take your own picture and make your friends jealous of your fancy new laptop.  Sorry: no Photo Booth effects yet! <img src='http://macdaddyworld.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you get to try it, leave a comment and let me know how it works for you.<br />
<a href='http://macdaddyworld.com/wp-content/uploads/2007/06/macdaddytestapp.zip' title='The Test App'>The Test App (68 k)</a></p>
<p><b>Tech Talk Follows:</b></p>
<p>The app does Hi-Lite™ a potential reason why Apple might not be yelling from the rooftops about the new camera: You can see right away how slow it is to stream the full sized video.  Why? It&#8217;s more than four times more data than VGA.  The Sequence Grabber was designed decades ago and wasn&#8217;t designed to handle more than NTSC/PAL sizes. Until the Sequence Grabber is revamped, it&#8217;s a little too slow to run such a large stream.</p>
<p>1,280 x 1,024 = 1,310,720 pixels<br />
It&#8217;s 4:2:2 compressed YUV data, so that&#8217;s 2 bytes per pixel or 2,621,440, or 2.5 megabytes per raw frame.<br />
So for full 30 fps video, this translates to about 75 megabytes per second or 600 Mbps.<br />
Now keep in mind the camera controller allows for a compressed MJPEG mode which cuts the required USB bandwidth signifcantly.  (You&#8217;d never fit that over USB 2.0 without compression.) </p>
<p>But even if it is being compressed on-camera, it&#8217;s then being decompressed in the driver and passed to QuickTime in YUV. That&#8217;s a lot of data to push through the poor Sequence Grabber pipes.  Technically, you should be able to request MJPEG data from the sequence grabber, but the default seems to be YUV. I haven&#8217;t tried requesting other compression types as I don&#8217;t actually have one of these new machines in front of me.*</p>
<p><b>More details about the new camera:</b></p>
<p>The original iSight didn&#8217;t advertise itself as a UVC device (It was Vendor Specific).<br />
The new one does advertise as UVC, so you can easily use USB Prober to decode the device descriptor:<br />
According to the descriptor the camera supports the following frame formats:</p>
<p>MJPEG 640&#215;480 @ up to 60fps<br />
MJPEG 720&#215;480 @ up to 60fps<br />
MJPEG 800&#215;600 @ up to 30fps<br />
MJPEG 1024&#215;576 @ up to 30fps<br />
MJPEG 1024&#215;768 @ up to 30fps<br />
MJPEG 1280&#215;960 @ up to 30fps<br />
MJPEG 1280&#215;1024 @ up to 30fps<br />
Uncompressed 640&#215;480 @ up to 30 fps<br />
Uncompressed 352&#215;288 @ up to 30 fps<br />
Uncompressed 160&#215;120 @ up to 30 fps<br />
Uncompressed 704&#215;576 @ up to 25 fps<br />
Uncompressed 720&#215;480 @ up to 25 fps</p>
<p>Maybe another SequenceGrabber savvy engineer out there with the new MBP could experiment and see what you get back from <code>VDGetCompressionTypes</code>.  Can we request MJPEG data through the pipes?</p>
<p>*Another thanks to Dave for running some tests for me on his MBP. Dave is a web designer and <a href="http://www.davedudek.com/" target="_new">has a website that I&#8217;ll plug</a>. </p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F06%2F28%2Fthe-megapixel-test-program-and-more-details%2F';
  addthis_title  = 'The+Megapixel+Test+Program+and+more+details';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/06/28/the-megapixel-test-program-and-more-details/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>New MacBook Pros == New 1.3 MP Camera Sensor</title>
		<link>http://macdaddyworld.com/2007/06/26/new-macbook-pros-new-13-mp-camera-sensor/</link>
		<comments>http://macdaddyworld.com/2007/06/26/new-macbook-pros-new-13-mp-camera-sensor/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 23:31:39 +0000</pubDate>
		<dc:creator>ken</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://macdaddyworld.com/?p=9</guid>
		<description><![CDATA[


digg_url = 'http://digg.com/apple/New_MacBook_Pros_have_1_3_megapixel_iSight';




or&#8230; Built-in iSight The Next Generation 

At WWDC, Glen had the unenviable task of hitting the compatibility lab and testing the upcoming release of iGlasses on as many computers as he could.  When checking out the new 2.2 and 2.4 GHz MacBook Pros, he noticed something interesting about the built-in iSight:
It&#8217;s a whole new [...]]]></description>
			<content:encoded><![CDATA[<table border=0 cellspacing=10 align=right>
<tr>
<td><script type="text/javascript">
digg_url = 'http://digg.com/apple/New_MacBook_Pros_have_1_3_megapixel_iSight';
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></td>
</tr>
</table>
<p>or&#8230; Built-in iSight The Next Generation 
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">
<img  class="alignleft" src='http://macdaddyworld.com/wp-content/uploads/2007/06/builtinisight.jpg' alt='builtin' />At WWDC, Glen had the unenviable task of hitting the compatibility lab and testing the upcoming release of iGlasses on as many computers as he could.  When checking out the new 2.2 and 2.4 GHz MacBook Pros, he noticed something interesting about the built-in iSight:</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia"><strong>It&#8217;s a whole new camera.</strong>  <strong><em>Really!</em></strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia"><a href='http://macdaddyworld.com/wp-content/uploads/2007/06/sysprof.jpg' title='System Profiler'><img src='http://macdaddyworld.com/wp-content/uploads/2007/06/sysprof.thumbnail.jpg' alt='System Profiler' class="alignright" border="1" /></a>First, looking at System Profiler:</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">It has a new USB PID.  What I&#8217;ll henceforth have to refer to as the original built-in iSight, had the USB Product ID: 0&#215;8501 and reports its manufacturer as <em>Micron</em>. <strong>The new built-in iSight</strong> has the Product ID of 0&#215;8502 and reports manufacturer of <em>Apple Inc.</em>   </p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">Now the cool part:  It&#8217;s a 1.3 megapixel sensor!  I wrote a simple test application to capture a frame of video using an SGDataProc and save it to the Desktop.  On my older 2.33 GHz MB Pro with the original built-in iSight, what I get is a <a href="http://macdaddyworld.com/wp-content/uploads/2007/06/test2picture11.jpg" target="_new">VGA (640&#215;480) image</a><span class="Apple-style-span" style="font-family: Verdana; font-size: 13px; line-height: 18px; white-space: pre-wrap"><span class="Apple-style-span" style="font-family: Georgia; font-size: 16px; line-height: 20px; white-space: normal">.  This is the maximum size of the original camera, which I know for sure uses a VGA sensor.</span></span>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia"><img src='http://macdaddyworld.com/wp-content/uploads/2007/06/weather-copy.jpg' alt='hot' class="alignleft"/>Then, braving the 95 degree the heat, we got on our bikes and cruised down to the Cambridge Apple Store.  After fighting our way through the crowds of people asking if they can pre-order an iPhone, we commandeered some MB Pros.  <strong>The same test program produced a <a href="http://www.flickr.com/photo_zoom.gne?id=639890910&#038;size=o" target="_new">nice, big 1.3 MP (1280&#215;1024) image</a>. </strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">
<B>UPDATE:</B> Test app <a href="http://macdaddyworld.com/?p=19">available here</a>.
</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia"><strong>Other differences:</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">The new camera supports all of the VDSetBrightness, VDSetContrast, etc. calls. The old camera only supported Saturation and Sharpness.  This causes an odd bug in <A HREF="http://www.ecamm.com/mac/iglasses/">iGlasses</A> which we&#8217;ll have to fix very soon.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">Whereas the original camera was uyvy (&#8217;2vuy&#8217; in QuickTime), the new camera&#8217;s data is yuyv compressed. (that&#8217;s YUY2 for you Windows users or &#8216;yuvs&#8217; in QuickTime parlance.) It&#8217;s the same as the previous 4:2:2 format except the 16-bit words are byte swapped. This doesn&#8217;t cause a problem for iGlasses which knows how to deal with both data types as this is the YUV format used by our <a href="http://www.ecamm.com/mac/imagewebcam/" target="_new">iMage USB Webcam</a>.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia"><strong>Interesting:</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">- I haven&#8217;t verified this yet, but I&#8217;m going to guess that 10.4.10 (which includes a new 2.0 version of the UVC driver) is required to get the larger sized image.  This would explain why nobody noticed this last month when they were first released.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">- I&#8217;m guessing they&#8217;re still using a Micron sensor.  A few sources have indicated that the iPhone will also use a Micron sensor for its camera.  The phone is supposed to have a 2 MP camera. </p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">- iChat and other iApps don&#8217;t take advantage of the larger image size.  If we stretched our iChat preview window up to around 1280 wide (the aspect ratio is not 4:3 in iChat 3), it was clear that we were looking at a VGA image scaled up.  iChat and other such apps are probably calling SGSetChannelBounds with 320&#215;240 or 640&#215;480 because that&#8217;s the size they use for conferences, whereas I&#8217;m specifying a really large size (1600&#215;1200).</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 20px; font: normal normal normal 16px/normal Georgia">- Thanks to Dave for letting me mess around with his new laptop this afternoon. </p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fmacdaddyworld.com%2F2007%2F06%2F26%2Fnew-macbook-pros-new-13-mp-camera-sensor%2F';
  addthis_title  = 'New+MacBook+Pros+%3D%3D+New+1.3+MP+Camera+Sensor';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://macdaddyworld.com/2007/06/26/new-macbook-pros-new-13-mp-camera-sensor/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>

