<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.2" -->
<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/"
>

<channel>
	<title>fdiv.net</title>
	<link>http://fdiv.net</link>
	<description>the floating point divide</description>
	<pubDate>Tue, 26 Aug 2008 18:13:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>
	<language>en</language>

		<item>
		<title>Silicon Dioxide (SiO2)</title>
		<link>http://fdiv.net/2008/07/30/silicon-dioxide-sio2/</link>
		<comments>http://fdiv.net/2008/07/30/silicon-dioxide-sio2/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 17:50:33 +0000</pubDate>
		<dc:creator>cwright</dc:creator>
		
	<category>Social Story</category>
	<category>kineme</category>
	<category>Interactive Media</category>
	<category>Quartz Composer</category>
	<category>Apple</category>
	<category>Software Development</category>
	<category>Kosada</category>
		<guid>http://fdiv.net/2008/07/30/silicon-dioxide-sio2/</guid>
		<description><![CDATA[	In the wee small hours of this morning, Kineme Interactive Media released its first commercial product, QuartzCrystal.
	QuartzCrystal is an offline renderer that turns Quartz Compositions into portable QuickTime movies.  It supports 3rd party plugins, as well as patches that do not work in safe-mode-only environments (such as QuickTime Pro).  It also supports software [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://kineme.net/product/QuartzCrystal"><img style="background: none;" align="right" alt="QuartzCrystal Logo" src="http://kineme.net/files/imagecache/product/files/QuartzCrystal-1.0.png" /></a>In the wee small hours of this morning, <a href="http://kineme.net/">Kineme Interactive Media</a> released its first commercial product, <a href="http://kineme.net/product/QuartzCrystal">QuartzCrystal</a>.</p>
	<p>QuartzCrystal is an offline renderer that turns Quartz Compositions into portable QuickTime movies.  It supports 3rd party plugins, as well as patches that do not work in safe-mode-only environments (such as QuickTime Pro).  It also supports software scene antialiasing, so if you have a Mac with plenty of RAM and a hard-core video card, you can make spectacularly beautiful renderings of your plugins, effects, and compositions.</p>
	<p>Beside QuartzCrystal, the only other product that renders and encodes compositions to movies is <a href="http://www.apple.com">Apple</a>&#8217;s own <a href="http://store.apple.com/us/product/D3380Z/A">QuickTime Pro</a>, which doesn&#8217;t support plugins, unsafe patches, or antialiasing.</p>
	<p><a href="http://kineme.net/product/QuartzCrystal"><img style="background: none;" alt="QuartzCrystal Main Window Screenshot" src="http://kineme.net/system/files/QuartzCrystal+Main+Window_1.png" /></a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://fdiv.net/2008/07/30/silicon-dioxide-sio2/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Zero Grams of Trans Fat Binaries</title>
		<link>http://fdiv.net/2007/12/19/zero-grams-of-trans-fat-binaries/</link>
		<comments>http://fdiv.net/2007/12/19/zero-grams-of-trans-fat-binaries/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 05:36:15 +0000</pubDate>
		<dc:creator>cwright</dc:creator>
		
	<category>Antisocial Story</category>
	<category>Apple</category>
	<category>Not Apple</category>
	<category>Software Development</category>
	<category>Kosada</category>
		<guid>http://fdiv.net/2007/12/19/zero-grams-of-trans-fat-binaries/</guid>
		<description><![CDATA[	People like their applications to work.  Even better, they like them to work, even when things change.  For the WinTel world, this isn&#8217;t a big deal (Vista aside ;), because the underlying CPU architecture hasn&#8217;t really changed, from a program&#8217;s point of view, in the past two decades.  Unless you have a [...]]]></description>
			<content:encoded><![CDATA[	<p><img align="right" src="http://img.b33p.net/pub/ywiHvPcTv8ZWhWv6nf-AHhne2GUlkx99/png-indexed-64" alt="tons of xcode build targets" />People like their applications to work.  Even better, they like them to work, even when things change.  For the WinTel world, this isn&#8217;t a big deal (Vista aside ;), because the underlying CPU architecture hasn&#8217;t really changed, from a program&#8217;s point of view, in the past two decades.  Unless you have a weird program that&#8217;s designed for AMD&#8217;s 3DNow! instruction set and you switch to an Intel CPU, or perhaps an application designed for a more esoteric old SIMD architecture, your application should run just fine (as long as your Operating System is ok with it).</p>
	<p>Mac OS X doesn&#8217;t have the luxury of working on the same underlying CPU though, so things need to be handled a little bit differently.  The solution Apple came up with was <a id="more-115"></a>the idea of a &#8220;Fat&#8221; binary, sometimes called a &#8220;Universal Binary&#8221;.  In other words, instead of a single program being contained in a program file, the program file can contain several programs for different architectures.  For example:</p>
	<pre class="code">
cwright@phendrana:~>file /bin/ls
/bin/ls: Mach-O universal binary with 2 architectures
/bin/ls (for architecture i386):	Mach-O executable i386
/bin/ls (for architecture ppc7400):	Mach-O executable ppc
</pre>
	<p>or an even more convoluted example:</p>
	<pre class="code">
cwright@phendrana:~>file GLTools
GLTools: Mach-O universal binary with 4 architectures
GLTools (for architecture ppc7400):	Mach-O bundle ppc
GLTools (for architecture i386):	Mach-O bundle i386
GLTools (for architecture ppc64):	Mach-O 64-bit bundle ppc64
GLTools (for architecture x86_64):	Mach-O 64-bit bundle x86_64
</pre>
	<p>This increases file size considerably (4x in the last example), but it provides you with the cool side effect of being able to drop the exact same program onto a PowerPC Mac, and have it operate identically &#8212; as long as you&#8217;re properly handling architectural differences such as <a href="http://en.wikipedia.org/wiki/Endianness">endianness</a>.  Overall, this is a pretty slick solution, and with the exception of a few small tweaks, I doubt I could have come up with a better idea.  (The small tweaks, in case you&#8217;re wondering, would be shared data segments across the binaries inside, such that non-code stuff only needs to be included once, instead of 4 times.  This doesn&#8217;t work well when the data contains code though, so you&#8217;d need to have flags to control how it operates).</p>
	<p>One of many problems rears its ugly head though when developing such portable applications:  Linking with static and dynamic libraries.</p>
	<p>Out of the box, OS X ships with many libraries that are all appropriately compiled to support all the above architectures, so you never notice this problem when compiling against standard included libraries.  However, if you stray off the beaten path, and use another library, you&#8217;re destined for trouble.  Open Source libraries, especially the ones whose build system depends on the monstrosity that is <a href="http://en.wikipedia.org/wiki/Autoconf">AutoConf</a> (<code>./configure</code> scripts and all that), are surprisingly difficult to get working.  In part, because they&#8217;re not designed to be built for multiple architectures in parallel, and in part because AutoConf is infuriatingly worthless when it comes to documentation.</p>
	<p>Of course, since I&#8217;m writing all of this, I&#8217;m obviously in the middle of such a battle :)</p>
	<p>By default, I run configure like this: </p>
	<pre class="code">
CFLAGS=\"-Os -fomit-frame-pointer\" ./configure [options]
</pre>
	<p>where options is stuff like <code>--enable-shared</code> and other library stuff.  On occasion (only 85% of the time), I also have to override other environment variables because parts like <code>pkg-config</code> don&#8217;t work, because other libraries don&#8217;t install properly, and a whole host of other problems.  I really can&#8217;t believe I actually <i>liked</i> dealing with this crap when I used linux&#8230;  but I digress.</p>
	<p>So first off, I think &#8220;Hey, I can add some magic to the CFLAGS parameter, and it&#8217;ll just compile!&#8221; &#8230; hahaha &#8230; I wish.  Here&#8217;s what happens:</p>
	<pre class="code">
cwright@phendrana:~/Desktop/Recent Source Stuff/libSomeLib-X.Y.Z>CFLAGS=\"-Os -fomit-frame-pointer -arch i386 -arch ppc -arch x86_64 -arch ppc64\" ./configure --enable-shared
</pre>
	<p>Configure does its thing, and then says it&#8217;s done and you&#8217;re ready to build.  It&#8217;s lying, of course:</p>
	<pre class="code">
cwright@phendrana:~/Desktop/Recent Source Stuff/libSomeLib-X.Y.Z>make
make  all-recursive
Making all in libSomeLib
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I..    -Os -fomit-frame-pointer -arch i386 -arch ppc -arch x86_64 -arch ppc64 -MT io.lo -MD -MP -MF .deps/io.Tpo -c -o io.lo io.c
 gcc -DHAVE_CONFIG_H -I. -I.. -I.. -Os -fomit-frame-pointer -arch i386 -arch ppc -arch x86_64 -arch ppc64 -MT io.lo -MD -MP -MF .deps/io.Tpo -c io.c  -fno-common -DPIC -o .libs/io.o
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
make[2]: *** [io.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
</pre>
	<p>So, -M options aren&#8217;t allowed to have multiple arch flags, says gcc.  I do some spelunking to find out exactly what these flags do, and find that they&#8217;re for creating Makefile dependencies.  But wait a minute, isn&#8217;t that Configure&#8217;s job?  Man these build tools are awesome. &#8230;  (technically speaking, it <i>is</i> Make&#8217;s job to make this stuff.  There just isn&#8217;t a hook to add architecture support anywhere else without completely re-engineering the build system.)</p>
	<p>Next up, I read some Apple documentation to see how they go about doing it (for stuff like OpenSSL, etc.).  They recommend making a new XCode project, and then making a <a href="http://developer.apple.com/opensource/images/AllTargets.cropped.jpg">zillion build targets</a>, taped together with some <a href="http://developer.apple.com/opensource/images/BuildPPCScript.cropped.jpg">shell scripts</a>.  To be honest, it doesn&#8217;t seem very Apple-like.  If I&#8217;m going to be dealing with shell scripts, I&#8217;ll just do it myself in Terminal.</p>
	<p>The second attempt consists of duplicating the source tree into 4 directories, one for each architecture.  Then, my plan goes, I&#8217;ll use <code>lipo</code> to glue them all together into a fat binary, and I&#8217;ll be on my way.</p>
	<p>I run configure in each directory tree, careful to include only one <code>-arch</code> parameter in each one.  I issue make in the i386, ppc, and x86_64 trees without issue, and start to think a bit smugly to myself that I&#8217;ve defeated this silly monster.  But then, another Configure Dragon charges.</p>
	<pre class="code">
cwright@phendrana:~/Desktop/Recent Source Stuff/libSomeLib-X.Y.Z-ppc64>CFLAGS=\"-Os -fomit-frame-pointer -arch ppc64\" ./configure --enable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/bin/sh: /Users/cwright/Desktop/Recent: No such file or directory
configure: WARNING: `missing' script is too old or missing
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
</pre>
	<p>Of course, whenever configure tells you to check &#8220;config.log&#8221; for more details, it&#8217;s about as informative as reading a <a href="http://www.thecybersource.com/images/bsod.jpg">Blue Screen</a>.  Also, note the 4th or 5th line, which shows a lack of quoted paths.  That looks safe&#8230;</p>
	<p>The problem, according to configure, is that it &#8220;cannot run C compiled programs,&#8221; which is actually accurate for this case:  Rosette doesn&#8217;t translate ppc64 binaries to x86.  However, gcc can compile such programs, so we know we can do it.  Configure suggests using the &#8220;-<nop />-host&#8221; command.</p>
	<p>Running configure with -<nop />-help reveals how -<nop />-host is supposed to be used.  It&#8217;ll look like this, I suppose:  &#8220;-<nop />-host=ppc64&#8243;.</p>
	<p>It issues this warning, but continues to do its thing:</p>
	<pre class="code">
configure: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet.  If you think this
configuration is useful to you, please write to autoconf@gnu.org.
</pre>
	<p>I hope that&#8217;s ok.. ?</p>
	<p>I run make, and it builds, and finishes.  A bit earlier than the others.  In the .libs directory, there&#8217;s no .dylib, which is what &#8211;enable-shared is supposed to create.  So, I look at the output from previous builds, and copy the line it inexplicably skips.  It&#8217;s a pretty long, but simple gcc line that takes all the .o&#8217;s and makes them into a .dylib.  No idea why it skipped over that one&#8230;</p>
	<p>And at last, we&#8217;re able to build our fat binary using lipo.  Hurray for portable cross-platform build tools!
</p>
]]></content:encoded>
			<wfw:commentRSS>http://fdiv.net/2007/12/19/zero-grams-of-trans-fat-binaries/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>fAIL: The Self-Replicating Network Connection</title>
		<link>http://fdiv.net/2007/12/11/fail-the-self-replicating-network-connection/</link>
		<comments>http://fdiv.net/2007/12/11/fail-the-self-replicating-network-connection/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 13:55:03 +0000</pubDate>
		<dc:creator>mradcliffe</dc:creator>
		
	<category>Social Story</category>
	<category>Antisocial Story</category>
	<category>Not Apple</category>
	<category>Kosada</category>
		<guid>http://fdiv.net/2007/12/11/fail-the-self-replicating-network-connection/</guid>
		<description><![CDATA[	


	Good morning gentle readers.  I opened up my craptop this morning to witness the struggles of what seemed to be a laptop battling cancer.  No, this was not another case of opteron cancer.   Instead I found that Windows, unable to cope with my Cisco Aironet 350 wireless card, was creating network [...]]]></description>
			<content:encoded><![CDATA[	<div style="float: right;">
<image src="http://img.b33p.net/pub/z1QUKOctz9KGEcYtr10csyTHjvH40t5I/thumbnail-256" border=0><br />
</image></div>
	<p>Good morning gentle readers.  I opened up my <a href="http://www.lenovo.com/us/en/">craptop</a> this morning to witness the struggles of what seemed to be a laptop battling cancer.  No, this was not another case of <a href="http://fdiv.net/2007/03/20/amd-opteron-dual-core-meltdown/">opteron cancer</a>.   Instead I found that Windows, unable to cope with my <a href="http://www.cisco.com">Cisco</a> Aironet 350 wireless card, was creating network connections one after another in the system tray.</p>
	<p><a id="more-113"></a></p>
	<p>Recently I have been taking out my wireless network card while at work, which used to always reside in my laptop&#8217;s PCMCIA slot.  At the end of the day I&#8217;d plug it back in usually either before or after I had sent my laptop into power save mode.</p>
	<p>So this morning like all mornings I take out my laptop, set it up, open the lid and log in.  Within seconds I notice my system tray bombarded by a new wireless network connection appearing once every second or so, enlarging the system tray beyond its normal size (note the arrow to the far right of the screenshot).  My esteemed colleague <a href="http://softpixel.com/~cwright/">Chris Wright</a> and I were both disappointed that the info bubble did not in fact pop up for each of those connection icons.  Luckily this cancer seemed benign, and within a few seconds Windows realized there actually was only one wireless networking device.</p>
	<div style="text-align: center;">
<img src="http://softpixel.com/~mradcliffe/images/self-replicating-network-connection.png" border=0/>
</div>
	<p>Though it seems this all boils down to the lesson: <b>never mess with an IBM trying to get some sleep</b>.   Whether it&#8217;s not waiting long enough for a print process to get out of the queue causing endless beeping or windows self-replicating wireless network connections, you&#8217;ll face the seemingly impossible behavior of a laptop pushing the boundaries of sanity.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://fdiv.net/2007/12/11/fail-the-self-replicating-network-connection/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>iPhoto-Thunderbird Bridge</title>
		<link>http://fdiv.net/2007/08/22/iphoto-thunderbird-bridge/</link>
		<comments>http://fdiv.net/2007/08/22/iphoto-thunderbird-bridge/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 11:59:11 +0000</pubDate>
		<dc:creator>cwright</dc:creator>
		
	<category>softpixel</category>
	<category>Apple</category>
	<category>Not Apple</category>
	<category>Software Development</category>
	<category>Photography</category>
	<category>Kosada</category>
		<guid>http://fdiv.net/2007/08/22/iphoto-thunderbird-bridge/</guid>
		<description><![CDATA[	For years, iPhoto users have been stuck using a limited number of email clients to send their photos easily.  This was mostly remedied by the iPhoto Mailer Patcher, but it left out non-applescript aware applications because, after all, iPhoto uses applescript to interface with them.  One of the more notable omissions is Thunderbird.
	Finally, [...]]]></description>
			<content:encoded><![CDATA[	<p><img align="right" alt="iPhoto logo" src="http://img.b33p.net/pub/HK0-oPRuL9-u_9Wz5KxycaakqUdEXdfI" />For years, iPhoto users have been stuck using a limited number of email clients to send their photos easily.  This was mostly remedied by the <a href="http://homepage.mac.com/jacksim/software/imp403.html">iPhoto Mailer Patcher</a>, but it left out non-applescript aware applications because, after all, iPhoto uses applescript to interface with them.  One of the more notable omissions is Thunderbird.</p>
	<p>Finally, this void has also been filled, via the <a href="http://softpixel.com/~cwright/programming/iPhoto/">iPhoto Thunderbird Bridge</a>.  It&#8217;s still quite primitive, but all the basics are there for iPhoto-Thunderbird integration.</p>
	<p>If you&#8217;re an iPhoto/Thunderbird user, give it a whirl.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://fdiv.net/2007/08/22/iphoto-thunderbird-bridge/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Paper Is Bad Records gets a makeover</title>
		<link>http://fdiv.net/2007/08/20/paper-is-bad-records-gets-a-makeover/</link>
		<comments>http://fdiv.net/2007/08/20/paper-is-bad-records-gets-a-makeover/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 00:12:15 +0000</pubDate>
		<dc:creator>bbinkovitz</dc:creator>
		
	<category>Social Story</category>
	<category>ruori: electro-music 2006</category>
	<category>ruori</category>
	<category>softpixel</category>
	<category>Kosada</category>
	<category>Paper Is Bad Records</category>
		<guid>http://fdiv.net/2007/08/20/paper-is-bad-records-gets-a-makeover/</guid>
		<description><![CDATA[	Paper Is Bad Records, Inc. was formed with no fanfare whatsoever back in 2005 by some of the people behind Tuesday Afternoon at China Wong Buffet as a venue for production and distribution of the resulting DVD. The DVD was a huge success and we all became rock stars. In our decadent complacency, we never [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://paperisbad.com/"><img align="right" src="http://img.b33p.net/pub/dOC0UQ4_B5BLCPv0Gu3Cw4H5q17Q2TqN/thumbnail-256" alt="Paper Is Bad Records, Inc." /></a>Paper Is Bad Records, Inc. was formed with <em>no fanfare whatsoever</em> back in 2005 by some of the people behind <a href="http://ruori.org/tacwb/">Tuesday Afternoon at China Wong Buffet</a> as a venue for production and distribution of the resulting DVD. The DVD was a huge success and we all became rock stars. In our decadent complacency, we never got around to making a website for our one-hit-wonder.  <a id="more-108"></a></p>
	<p>Flash forward to August 2007. <a href="http://ruori.org">project ruori</a> has just completed its first &#8220;real&#8221; album, and close friend and talented acoustic guitarist/singer/songwriter <a href="http://tarvis.org">Tarvis</a> has just cranked out not one, but <strong>two</strong> new records of his own.  <em>In record time.</em></p>
	<p>So, how to pump all this new material into the stream of commerce, send it off into the world, get it out there?</p>
	<p>After finishing the cover art and sending the whole bundle off to be manufactured, and heading to <a href="http://www.pbase.com/bobz1947/image/68517438">Burgerville</a> to celebrate, we (now wearing our <a href="http://kosada.com">Kosada</a> hats) immediately got to work on the new website and released it less than 48 hours later. </p>
	<p>Dear reader, we give you:<br />
<a href="http://paperisbad.com">Paper Is Bad Records, Inc.</a></p>
]]></content:encoded>
			<wfw:commentRSS>http://fdiv.net/2007/08/20/paper-is-bad-records-gets-a-makeover/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
