<?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>b&#124;tw&#124;se</title>
	<atom:link href="http://danwright.info/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://danwright.info/blog</link>
	<description>by Dan Wright</description>
	<lastBuildDate>Tue, 29 Nov 2011 07:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Web site browser agents (2011 edition)</title>
		<link>http://danwright.info/blog/2011/06/web-site-browser-agents-2011-edition/</link>
		<comments>http://danwright.info/blog/2011/06/web-site-browser-agents-2011-edition/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 23:00:02 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[useragents]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=259</guid>
		<description><![CDATA[It is time once again to take stock of web browser statistics for my various sites, and see how they have changed since last time, back in March of 2010. Here are the overall shares for March 2010 to June 2011: 45% MSIE 24% Firefox 13% Chrome (WebKit) 13% Safari (WebKit) 5% Others (1% Opera) [...]]]></description>
			<content:encoded><![CDATA[<p>It is time once again to take stock of web browser statistics for my various sites, and see how they have changed since last time, <a href="/blog/2010/03/web-site-browser-agents-2010-edition">back in March of 2010</a>.</p>
<p>Here are the overall shares for March 2010 to June 2011:</p>
<ul>
<li>45% MSIE</li>
<li>24% Firefox</li>
<li>13% Chrome (WebKit)</li>
<li>13% Safari (WebKit)</li>
<li>5% Others (1% Opera)</li>
</ul>
<p>So for the past year, MSIE usage fell significantly (from <strong>64%</strong>!), Firefox and Safari rose slightly, and Chrome rose significantly (out of the &#8220;Other&#8221; category). Since both Safari and Chrome use WebKit, WebKit has now passed Firefox&apos;s Gecko engine to become the second most widely used browser engine.</p>
<p>The Internet Explorer breakdown:</p>
<ul>
<li>50% MSIE 8.0</li>
<li>31% MSIE 7.0</li>
<li>18% MSIE 6.0</li>
<li>2% MSIE 9.0</li>
</ul>
<p>Firefox:</p>
<ul>
<li>68% Firefox 3.6</li>
<li>18% Firefox 3.5</li>
<li>6% Firefox 4.0</li>
<li>5% Firefox 3.0</li>
<li>2% Firefox 2.0</li>
<li>2% Firefox 5.0</li>
</ul>
<p>Firefox 2.0 and 3.0 have now all but disappeared. Both 4.0 <em>and</em> 5.0 are simply too new to have garnered much share. It remains to be seen if 4.0 <em>ever</em> garners much share, or if users got directly to 5.0 (or 6.0, or&#8230;).</p>
<p>Safari:</p>
<ul>
<li>40% Safari 5.0</li>
<li>18% Safari 4.0</li>
<li>17% Safari 4.0 Mobile</li>
<li>12% Safari 5.0 Mobile</li>
<li>5% Safari 4.1</li>
<li>4% Safari 5.1</li>
<li>5% Safari 3.0&ndash;3.2</li>
</ul>
<p>The total mobile share has jumped from 20% last year to 29% this year. Safari 5.0 did not appear on last year&apos;s chart at all.</p>
<p>I did not include a by-version breakdown of Chrome share this year; maybe next year. Because Chrome self-updates in the background, I would expect that the latest couple of versions to dominate.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2011/06/web-site-browser-agents-2011-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Photos of Carl</title>
		<link>http://danwright.info/blog/2011/01/carl-holidays-2010/</link>
		<comments>http://danwright.info/blog/2011/01/carl-holidays-2010/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 01:56:37 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[family]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[Carl]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=255</guid>
		<description><![CDATA[New photos of Carl from his first Christmas are now up on Flickr.]]></description>
			<content:encoded><![CDATA[<p>New photos of Carl from his first Christmas are now <a href="http://www.flickr.com/photos/80168386@N00/sets/72157625892294328/show/">up on Flickr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2011/01/carl-holidays-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode project object UUIDs</title>
		<link>http://danwright.info/blog/2010/10/xcode-pbxproject-files-3/</link>
		<comments>http://danwright.info/blog/2010/10/xcode-pbxproject-files-3/#comments</comments>
		<pubDate>Sun, 17 Oct 2010 20:09:14 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[Xcode pbxproject]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=239</guid>
		<description><![CDATA[Continuing our discussion of the Xcode project file format&#8230; Unique Xcode object IDs using Ruby The &#8220;UUIDs&#8221; used in project files are shorter than true UUIDs (only 12 bytes/16 characters), and have no punctuation. We can&#8217;t just use system UUID services to generate new ones, then. In practice, our UUIDs usually do not need to [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing our <a href="xcode-pbxproject-files">discussion</a> of the <a href="xcode-pbxproject-files-2">Xcode project file format</a>&#8230;</p>
<h3>Unique Xcode object IDs using Ruby</h3>
<p>The &#8220;UUIDs&#8221; used in project files are shorter than true UUIDs (only 12 bytes/16 characters), and have no punctuation. We can&rsquo;t just use system UUID services to generate new ones, then. In practice, our UUIDs usually do not need to be <em>universally</em> unique; they must be unique within a project file, and ideally would be unique across all projects built or opened on a given machine. Here, nonetheless, is a quickie ruby class that generates Xcode project UUIDs:</p>
<pre><code class="code">
class XcodeUUIDGenerator

    def initialize
        @num = [Time.now.to_i, Process.pid, getMAC]
    end

    # Get the ethernet hardware address ("MAC"). This version
    # works on Mac OS X 10.6 (Snow Leopard); it has not been tested
    # on other versions.

    def getMAC(interface='en0')
        addrMAC = `ifconfig #{interface} ether`.split("\n")[1]
        addrMAC ? addrMAC.strip.split[1].gsub(':','').to_i(16) : 0
    end

    def generate
        @num[0] += 1
        self
    end

    def to_s
        "%08X%04X%012X" % @num
    end
end
</code></pre>
<p>Usage is simple:</p>
<pre><code class="code">    gen = XcodeUUIDGenerator.new
    id1 = gen.generate.to_s
    id2 = gen.generate.to_s
    id3 = gen.generate.to_s
</code></pre>
<h3>PBXFileReference</h3>
<p>A <code>PBXFileReference</code> is used to track every external file referenced by the project: source files, resource files, libraries, generated application files, and so on. A source file might look like this:</p>
<pre><code>
 29B97316FDCFA39411CA2CEA /* main.m */ = {
	isa = PBXFileReference;
	fileEncoding = 4;
	lastKnownFileType = sourcecode.c.objc;
	path = main.m;
	sourceTree = "<group>";
 };
</code></pre>
<p>The values for <code>lastKnownFileType</code> may be found within Xcode itself, by selecting the file and choosing &#8220;Get Info&#8221;. A sourceTree of &#8220;<group>&#8221; corresponds to &#8220;Relative to Enclosing Group&#8221;. A fileEncoding value of &#8220;4&#8243; is UTF-8. Here, the path is only a file name, however it can be a (longer) relative path or an absolute path (sourceTree = &#8220;<absolute>&#8220;). Relative paths may also be relative to the chosen SDK, the Xcode application (rare), the project file (that is, the .xcodeproj bundle), or the built product.</p>
<pre><code>
 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {
	isa = PBXFileReference;
	lastKnownFileType = wrapper.framework;
	name = Cocoa.framework;
	path = /System/Library/Frameworks/Cocoa.framework;
	sourceTree = "<absolute>";
 };
</code></pre>
<p>Some Xcode templates contain absolute paths to some frameworks (as in the above example), however this is, arguably, &#8220;wrong&#8221;&mdash;SDK files should always use SDK-relative paths (as, indeed, Xcode 3.2.x will do if you add a framework to a project manually):</p>
<pre><code>
 2D04AF89126B8A7A00073224 /* AppleScriptObjC.framework */ = {
	isa = PBXFileReference;
	lastKnownFileType = wrapper.framework;
	name = AppleScriptObjC.framework;
	path = System/Library/Frameworks/AppleScriptObjC.framework;
	sourceTree = SDKROOT;
 };
</code></pre>
<p>Finally, the final output of your target also has a PBXFileReference. It looks slightly different:</p>
<pre><code>
 8D1107320486CEB800E47090 /* MyProject.app */ = {
	isa = PBXFileReference;
	explicitFileType = wrapper.application;
	includeInIndex = 0;
	path = MyProject.app;
	sourceTree = BUILT_PRODUCTS_DIR;
 };
</code></pre>
<p>Instead of <code>lastKnownFileType</code>, it has an <code>explicitFileType</code>; it also has a property <code>includeInIndex</code>, set to 0 (FALSE).</p>
<p>You can add comment to files; these are stored as a <code>comments</code> property on the PBXFileReference.</p>
<h3>PBXBuildFile</h3>
<p>Files that need to be processed in the build (for example compiled, linked, or copied) also have a <code>PBXBuildFile</code>. These are <em>very</em> simple:</p>
<pre><code> 8D11072D0486CEB800E47090 /* main.m in Sources */ = {
	isa = PBXBuildFile;
	fileRef = 29B97316FDCFA39411CA2CEA /* main.m */;
	settings = {ATTRIBUTES = (); };
};
</code></pre>
<p>The fileRef is the id of the <code>PBXFileReference</code>. The <code>settings</code> property is usually omitted entirely. If you specify per-file compiler flags, they will be stored in the <code>COMPILER_FLAGS</code> property of the <code>settings</code> property.</p>
<h3>PBXSourcesBuildPhase</h3>
<p>Projects commonly have several build phases: compiling, linking, copying resources, copying other files, and perhaps running shell scripts. <code>PBXSourcesBuildPhase</code> describes the compiling phase for a target.</p>
<pre><code> 8D11072C0486CEB800E47090 /* Sources */ = {
    isa = PBXSourcesBuildPhase;
    buildActionMask = 2147483647;
    files = (
      8D11072D0486CEB800E47090 /* main.m in Sources */,
      256AC3DA0F4B6AC300CF3369 /* MyProjectAppDelegate.m in Sources */,
    );
    runOnlyForDeploymentPostprocessing = 0;
 };
</code></pre>
<p>The <code>files</code> property contains an array of <code>PBXBuildFile</code> references. <code>buildActionMask</code> is usually 2147483647 (that&rsquo;s 0x7FFFFFFF in hexadecimal). The <code>runOnlyForDeploymentPostprocessing</code> property is normally 0 (FALSE).</p>
<h3>Until next time&#8230;</h3>
<p>That&rsquo;s it for this week! Next time, we&rsquo;ll look at the other build phases.</p>
<p>¶</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/10/xcode-pbxproject-files-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More on the Xcode project format</title>
		<link>http://danwright.info/blog/2010/10/xcode-pbxproject-files-2/</link>
		<comments>http://danwright.info/blog/2010/10/xcode-pbxproject-files-2/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 00:04:16 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[Xcode pbxproject]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=225</guid>
		<description><![CDATA[A 90-Second Project Parser in Ruby Last week we looked at the overall format of Xcode project files. Here&#8217;s an easy parser written in Ruby; this one will only run on Mac OS X, because it uses Foundation from Ruby: #!/usr/bin/ruby # http://danwright.info/blog/xcode-pbxproject-files-2 require 'osx/cocoa' xcodeproj = "/Users/danwr/Documents/MyProject/MyProject.xcodeproj" projectpbxproj = "#{xcodeproj}/project.pbxproj" data = OSX::NSData.dataWithContentsOfFile(projectpbxproj) plist [...]]]></description>
			<content:encoded><![CDATA[<h3>A 90-Second Project Parser in Ruby</h3>
<p><a href="xcode-pbxproject-files">Last week</a> we looked at the overall format of Xcode project files. Here&rsquo;s an easy parser written in Ruby; this one will only run on Mac OS X, because it uses Foundation from Ruby:
<pre><code class="code" style="font-size: 9px;">
#!/usr/bin/ruby
# http://danwright.info/blog/xcode-pbxproject-files-2

require 'osx/cocoa'

xcodeproj = "/Users/danwr/Documents/MyProject/MyProject.xcodeproj"

projectpbxproj = "#{xcodeproj}/project.pbxproj"
data = OSX::NSData.dataWithContentsOfFile(projectpbxproj)
plist = OSX::NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription(data, 0, nil, nil)

rootObject = plist['rootObject']
objects    = plist['objects']

if ARGV.length == 0
	puts "rootObject = #{objects[rootObject]}"
else
	what = ARGV.shift
	if /^[0-9a-fA-F]{24}$/ =~ what
		puts "object #{what} = #{objects[what]}"
	else
		results = objects.keys.find_all {|key| objects[key]['isa'] == what }
		puts "isa '#{what}': #{results}"
	end
end
</code></pre>
<p>If you run this command without any arguments, it will show you the root object (PBXProject). If you run it with a UUID, it will display the corresponding object; if you provide it with an object class (&#8216;isa&#8217;), it will display the UUIDs for all matching objects. For purposes of this article, I&rsquo;ve hard-coded the path to a project; you can edit that to point to your own project, or modify the script to allow a path to be specified as an argument.</p>
<p>Wow, that&rsquo;s silly-easy. If you want your script to run on another platform&mdash;Windows or Linux&mdash;you would need another solution (but it isn&rsquo;t exactly difficult to write a custom parser in a modern scripting language such as Ruby, Python, or even Old Man Perl.</p>
<h3>XCConfigurationList</h3>
<p>An <code>XCConfigurationList</code> is simply a list of configurations. A <em>configuration</em> refers to a group of settings, and commonly we have at least two: Debug and Release, the former for debugging the project, the latter optimized for customers.</p>
<pre><code class="code" style="font-size: 10px;">
C01FCF4E08A954540054247B = {
    buildConfigurations =     (
        C01FCF4F08A954540054247B,
        C01FCF5008A954540054247B
    );
    defaultConfigurationIsVisible = 0;
    defaultConfigurationName = Release;
    isa = XCConfigurationList;
}</code></pre>
<p>The <code>defaultConfigurationName</code> and <code>defaultConfigurationIsVisible</code> properties indicate which configuration is the default when building with the <code>xcodebuild</code> tool, as well as whether this information should be exposed in the Xcode user interface. The <code>buildConfigurations</code> array contains references to objects of type <code>XCBuildConfiguration</code>.</p>
<h3>XCBuildConfiguration</h3>
<p>An <code>XCBuildConfiguration</code> is a collection of build settings, like so:</p>
<pre><code class="code" style="font-size:10px;">
C01FCF4F08A954540054247B = {
    buildSettings =     {
        ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
        "GCC_C_LANGUAGE_STANDARD" = gnu99;
        "GCC_OPTIMIZATION_LEVEL" = 0;
        "GCC_WARN_ABOUT_RETURN_TYPE" = YES;
        "GCC_WARN_UNUSED_VARIABLE" = YES;
        "ONLY_ACTIVE_ARCH" = YES;
        PREBINDING = NO;
        SDKROOT = "macosx10.6";
    };
    isa = XCBuildConfiguration;
    name = Debug;
}</code></pre>
<p>The <code>buildSettings</code> property is the heart of an XCBuildConfiguration. Each build setting should look familiar: these are the same names and settings you would use in an <code>.xcconfig</code> file. Of course, <code>buildSettings</code> can be empty, as it often will be when you have an .xcconfig file specified instead.</p>
<h3>PBXVariantGroup</h3>
<p>A <code>PBXVariantGroup</code> describes a group of files that act like one; this is used to described localized files (strings and xibs).</p>
<pre><code class="code" style="font-size:10px;">
1DDD58140DA1D0A300B32029 = {
    children =     (
        1DDD58150DA1D0A300B32029
    );
    isa = PBXVariantGroup;
    name = "MainMenu.xib";
    sourceTree = "<group>";
}
</code></pre>
<p>This one describes the application&rsquo;s main xib (describing the menu bar and main window). The <strong>name</strong> is the name of the file. The <strong>children</strong> contains a list of localizations; here, there is just one, for the English version. Let&rsquo;s look at that child:</p>
<pre><code class="code" style="font-size:10px;">
1DDD58150DA1D0A300B32029 = {
    isa = PBXFileReference;
    lastKnownFileType = "file.xib";
    name = English;
    path = "English.lproj/MainMenu.xib";
    sourceTree = "<group>";
}
</code></pre>
<p>The path is the path of the actual .xib file (relative to the encoding group). <code>lastKnownFileType</code> indicates the file type.</p>
<h3>Next time&#8230;</h3>
<p>Next time, a look at <code>PBXFileReference</code>, <code>PBXBuildFile</code>, and <code>PBXSourcesBuildPhase</code>.</p>
<p>&para;</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/10/xcode-pbxproject-files-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A brief look at the Xcode project format</title>
		<link>http://danwright.info/blog/2010/10/xcode-pbxproject-files/</link>
		<comments>http://danwright.info/blog/2010/10/xcode-pbxproject-files/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 01:58:03 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=215</guid>
		<description><![CDATA[Let&#8217;s take a quick little tour of the Xcode project file format. Anyone doing Mac OS X or iOS development in a team environment (i.e. just about everybody) has had to deal with the joy of merging project changes in version control (subversion, cvs, git, you name it). An Xcode project, of course, is actually [...]]]></description>
			<content:encoded><![CDATA[<p>Let&rsquo;s take a quick little tour of the Xcode project file format. Anyone doing Mac OS X or iOS development in a team environment (i.e. just about everybody) has had to deal with the joy of merging project changes in version control (subversion, cvs, git, you name it).</p>
<p>An Xcode project, of course, is actually a <strong>package</strong>, a directory with bundled files within. A typical project might look like this:</p>
<pre><code>
MyProject.xcodeproj/
	danwr.mode1v3
	danwr.pbxuser
	project.pbxproj

</code></pre>
<p>The first two files have your username. If multiple users use the same project, you will have a set of <code>.mode1v3</code> and <code>.pbxuser</code> files for each user. These files contain various user settings (preferences, really) that are associated with the project, for example:</p>
<ul>
<li>the size and position of the project window</li>
<li>which groups are open and which are closed</li>
<li>which item in the project is selected</li>
<li>&#8230;and more</li>
</ul>
<p>This information is not normally shared among multiple users, so it is neither necessary nor desirable to add these (<code>.mode1v3</code> and <code>.pbxuser</code>) files to your repository. If you already have, go ahead and remove them (<code>svn remove</code> if you use subversion, for instance). I&rsquo;ll wait.</p>
<h3>Project.pbxproj</h3>
<p>This leaves us with the project file itself, <code>project.pbxproj</code>. Oh, look how smug it is, all undecipherable and all. Or&#8230; is it? Let&rsquo;s open up that bad boy in a text editor and see what it looks like. First, the overall layout:</p>
<pre><code>
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 45;
	objects = {
</code>            <em style="color:#003300;">[[ : snip! : ]]</em><code>
	};
	rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}
</code></pre>
<p>We start with a comment indicating the text encoding used in the file, UTF-8. Presumably other encodings are possible, however in practice all project files use UTF-8. You will notice other comments (C-style: <code>/* ... */</code>) sprinkled throughout the project file. While presumably Xcode&rsquo;s lexer handles multi-line comments, Xcode itself does not generate multi-line comments. If one were attempting the read or write project.pbxproj files, the parser would need to be able to handle multi-line comments, while ideally avoiding writing them (unless preserving existing comments).</p>
<p>A set of brackets { } enclose a record of key-value pairs. The keys are:</p>
<ul>
<li><code>archiveVersion</code>; It is set to 1 in all versions of Xcode that use the file format described here.</li>
<li><code>classes</code>; A list of classes, usually empty.</li>
<li><code>objectVersion</code>; This relates to which object types are used in this project.pbxproj, and which keys are defined. This changes based on the version of Xcode that wrote the project; it is controlled by the â€œProject Formatâ€ popup menu in Xcode&rsquo;s &ldquo;Project Info&rdquo; window. The value 45 corresponds to &ldquo;Xcode 3.1-compatible&rdquo;.</li>
<li><code>objects</code>; This is a list (actually, a record, or hash) of objects in the project. This is the meat of the file format.</li>
<li><code>rootObject</code>; This identifies the root object, the object that represents the project itself.</li>
</ul>
<p>Now let&rsquo;s take a look at the objects in general. There is an object for every file, group, target, build phase, and so on. Each object is identified by a <a href="http://en.wikipedia.org/wiki/UUID">UUID</a>. If they are universally-unique, then any number of projects from any number of original machines can be opened at the same time by a single copy of Xcode without any problems. These UUIDs are 12 bytes&mdash;24 hexadecimal digits without any separating hyphens. Each object has a set of properties, one of which, &ldquo;<code>isa</code>&rdquo; specifies the class of the object. The other properties are determined by this class.</p>
<h3>Object classes</h3>
<p>The object classes supported depends upon the <code>objectVersion</code>. Here is a partial list:</p>
<ul>
<li><code>PBXBuildFile</code></li>
<li><code>PBXFileReference</code></li>
<li><code>PBXFrameworksBuildPhase</code></li>
<li><code>PBXGroup</code></li>
<li><code>PBXNativeTarget</code></li>
<li><code>PBXProject</code></li>
<li><code>PBXResourcesBuildPhase</code></li>
<li><code>PBXSourcesBuildPhase</code></li>
<li><code>PBXVariantGroup</code></li>
<li><code>XCBuildConfiguration</code></li>
<li><code>XCConfigurationList</code></li>
</ul>
<p>The most important one here is <code>PBXFileReference</code>; every file referenced by the project (source files, headers, libraries, frameworks, xcconfig files, other projects&#8230;)<sup>1</sup> is represented by a <code>PBXFileReference</code>.</p>
<pre><code>
	089C165DFE840E0CC02AAC07 /* English */ = {
		isa = PBXFileReference;
		fileEncoding = 4;
		lastKnownFileType = text.plist.strings;
		name = English;
		path = English.lproj/InfoPlist.strings;
		sourceTree = "<group>";
	};
</code></pre>
<p>There are two different types of files: input (e.g. source files) and output (e.g. the output application or library). <code>lastKnownFileType</code> is present and set for input files. The list of possible values can be found in Xcode in the file &ldquo;Get Info&rdquo; window. Additional values are, of course, possible.</p>
<pre><code>
	8D1107320486CEB800E47090 /* MyProject.app */ = {
		isa = PBXFileReference;
		explicitFileType = wrapper.application;
		includeInIndex = 0;
		path = MyProject.app;
		sourceTree = BUILT_PRODUCTS_DIR;
	};
</code></pre>
<p>Output files always have the <code>explicitFileType</code> key, <code>includeInIndex</code> (typically set to 0, or false, for binaries and packages). Both input and output files have a <code>path</code> and <code>sourceTree</code> specified. Path names are not normally quoted unless necessary (for example, if the pathname includes a semicolon, space, or other special character).</p>
<p>In part 2, I&rsquo;ll look at PBXVariantGroup, XCBuildConfiguration, and XCConfigurationList.</p>
<p>&para;</p>
<hr />
<sup>1</sup> There are exceptions; two of the most well-known are <code>Info.plist</code> files and precompiled header source (<code>.pch</code>) files. These two files are always identified either by absolute pathname, or by a path relative to the <code>.xcodeproj</code> project.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/10/xcode-pbxproject-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rendering Text for Fun &amp; Profit on Mac OS X</title>
		<link>http://danwright.info/blog/2010/06/antialiasing-text-on-mac-os-x/</link>
		<comments>http://danwright.info/blog/2010/06/antialiasing-text-on-mac-os-x/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 19:53:18 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[antialiasing]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=186</guid>
		<description><![CDATA[<em>In which we ponder the Great Imponderables of text on Mac OS X, and the many, varied, and bone-headed ways by which we can stymie proper anti-aliasing.</em>]]></description>
			<content:encoded><![CDATA[<p><em>In which we ponder the Great Imponderables of text on Mac OS X, and the subtle, obtuse, and bone-headed means by which we may stymie proper anti-aliasing.</em></p>
<style type="text/css">
img.figure {
display:block;
margin-left:auto; margin-right:auto;
border: 4px solid #457; }
p.caption {
font-size: 90%;
color:#555;
width:400px;
margin-left:auto; margin-right:auto;
}
div.sidebar {
display:block;
float:right;
border-left: 2px solid #457;
background: #eef5ff;
color: #555;
line-height: 1.5;
width: 250px;
padding: 4px 2px 4px 8px;
margin: 4px;
}
</style>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/basic-antialiased-text.png" alt="" width="474" /></p>
<p class="caption">Fig. 1: Basic anti-aliased text, magnified 2x.</p>
<p><em>Aliasing</em> is a term used in computer graphics to describe artifacts created when a shape is rendered into a grid of pixels; these artifacts are commonly known as &ldquo;the jaggies.&rdquo; <em>Anti-aliasing</em>, then, is the process of rendering graphics in a way that conceals these artifacts. Let&rsquo;s take a brief look at how <em>text</em> is anti-aliased on Mac OS X, and then we&rsquo;ll look at how things can go wrong.
</p>
<div class="sidebar"><strong>Pro Tip: You can examine the text on your screen with a magnifying glass, or you can use Universal Access to magnify your screen pixels in place. To use Universal Access, press Command Option 8 to toggle zooming on and off, and press Command Option = or Command Option &#8211; to zoom in or out, respectively. You should do this on an LCD display, preferably an Apple display.</strong></div>
<p>Completely unaliased text looks horrible (Fig. 2); in the mid- to late-nineties, Mac OS became accustomed to anti-aliased text, as in Fig. 1 (above). LCD displays became widely available and inexpensive enough to push out CRTs at the same time, not just because they are lighter and thinner, but for excellent contrast and very sharp pixels&mdash;and sub-pixels.</p>
<p>Each pixel is actually comprised of three components, red, green, and blue, and on LCDs the operating system can take advantage of that fact to improve anti-aliasing through a method called sub-pixel rendering. <strong>ClearType</strong> is Microsoft&rsquo;s patented method of sub-pixel rendering; it differs from the method used in Mac OS X primarily in its intent: ClearType is designed to make small text as <em>readable</em> as possible, while Mac OS X attempts to accurately maintain the shape of the individual glyphs. That&rsquo;s all I will say about ClearType here.</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/aliased-text.png" alt="" width="478" /></p>
<p class="caption">Fig. 2: Aliased text has lots of jagged edges, and crooked curves. This is what most text looked like in 1995.</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/subpix-aa-text.png" alt="" width="474" /></p>
<p class="caption">Fig. 3a: Text with sub-pixel anti-aliasing (Mac OS X). At low magnification (2x here), the eye sees smoother shapes rather than color fringing. Compare the horizontal bars in the letter &lsquo;e&rsquo;, or the descenders in the letter &lsquo;g&rsquo;, with those in Fig. 1.</p>
<p>It is possible to draw text on Mac OS X with anti-aliasing completely disabled, as in Fig. 2, by calling <code>CGContextSetShouldAntialias(context, false)</code>. To draw text as in figure one, call <code>CGContextSetShouldAntialias(context, true)</code> and <code>CGContextSetShouldSmoothFonts(context, false)</code>.</p>
<p>Now let&rsquo;s take a closer look at sub-pixel anti-aliasing. This is the default drawing method. Figure 3a shows text zoomed to twice its actual size. To see how sub-pixel anti-aliasing works, we need to zoom in more&mdash;4x (Figure 3b) or even more (Figure 3c).</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/subpix-aa-engrossed.png" alt="" width="404" /></p>
<p class="caption">Fig. 3b: At 4x magnification, color fringing starts to become apparent, if mostly subtle.</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/subpix-aa-engr.png" alt="" width="430" /></p>
<p class="caption">Fig. 3c: 10x magnification. Color-fringing is now obvious.</p>
<p>At 10x magnification, we can clearly see the use of red pixels on the left side of glyphs and blue pixels on the right. But does it always work this way? Consider Figure 3d&mdash;white text on a black background.</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/subpix-aa-engr-inverse.png" alt="" width="530" /></p>
<p class="caption">Fig. 3d: Inverse&mdash;white text on a black background. Notice how the red and blue edges are reversed.</p>
<p>Blue on the left, red on the right! The question you might ask: Is this because the text is now white, the background is now black, or both? Well, what do we get if we change the text back to black, and change the background to a moderately dark color?</p>
<p><img class="figure" src="http://danwright.info/blog/wp-content/uploads/2010/06/subpx-aa-color-back.png" alt="" width="440" /></p>
<p class="caption">Fig. 3e: Black on a dark orange background. To the eye, the sub-pixels look similar black-on-white (<em>c.f. Fig. 3c</em>). A more careful look reveals differences: Are the right edges blue here?</p>
<p>We see here that the color of the <em>text</em> matters most. But if we look closely at Figure 3e, we can see that the left edge isn&#8217;t the same color as in Figure 3c, and the right edge pixels are <em>very</em> different. This leads us to important, if unexpected lesson:</p>
<p><strong><em>Sub-pixel anti-aliasing depends on both the color of the text and the color of the background. It is impossible to correctly apply sub-pixel anti-aliasing unless we know what the background contains.</em></strong></p>
<p>These brings us to the practical portion of this article. Under what conditions will sub-pixel anti-aliasing fail (not appear, or appear incorrectly)?
<ul>
<li>The application has called <code>CGContextSetShouldAntialias(context, false);</code></li>
<li>The application has called <code>CGContextSetShouldSmoothFonts(context, false);</code></li>
<li>The application has called <code>CGContextSetAllowsAntialiasing(context, false);</code></li>
<li>The context has no background (or has been filled with a color with alpha=0)</li>
<li>The application draws text first, then later fills in the background color (for example, to highlight text or show the selection). You should always draw highlighting <em>before</em> you draw the text.</li>
<li>If you change a view to use a CALayer (for CoreAnimation), you will now be drawing that view without any background, unless that view draws its own background. In Interface Builder, check &ldquo;Draws Background&rdquo; and explicitly set the background color, usually to <code>windowBackgroundColor</code>.</li>
</ul>
<p>There are a couple more &ldquo;gotchas.&rdquo; First, Mac OS X Snow Leopard does not recognize all third-party display as being compatible with sub-pixel rendering, and may therefore disable it system wide.<sup>1</sup> If you suspect this is happening to you, try the following command at a Terminal prompt:<br />
<code>defaults -currentHost write -globalDomain AppleFontSmoothing -int 2</code></p>
<p>Also, Core Graphics has, by default, a y-axis that extended upwards, rather than downwards, as in most other graphics systems. It is tempting to reverse the y-axis, draw offscreen, then flip it back when blitting to the screen. But there&rsquo;s a catch: this breaks text anti-aliasing (the chief symptom is blurry serifs and other horizontal lines). Do not draw upside-down unless you intend the text to be viewed upside-down. I hope I don&rsquo;t need to tell you that drawing text backwards and flipping will have terrible results.</p>
<p><sup>1</sup> <a href="http://www.macosxhints.com/article.php?story=20090828224632809" target="footnote">10.6: Re-enable LCD font smoothing for some monitors</a></p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/06/antialiasing-text-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stephen Fry on the iPad</title>
		<link>http://danwright.info/blog/2010/04/stephen-fry-on-the-ipad/</link>
		<comments>http://danwright.info/blog/2010/04/stephen-fry-on-the-ipad/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 02:05:34 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[iPad]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=162</guid>
		<description><![CDATA[&#8220;One melancholy thought occurs as my fingers glide and flow over the surface of this astonishing object: Douglas Adams is not alive to see the closest thing to his Hitchhiker&#8217;s Guide [to the Galaxy] that humankind has yet devised.&#8221; &#8211; Stephen Fry Read more]]></description>
			<content:encoded><![CDATA[<blockquote><p>&ldquo;One melancholy thought occurs as my fingers glide and flow over the surface of this astonishing object: Douglas Adams is not alive to see the closest thing to his <em>Hitchhiker&rsquo;s Guide [to the Galaxy]</em> that humankind has yet devised.&rdquo; <br /><em>&ndash; Stephen Fry</em></p></blockquote>
<p><a href="http://bit.ly/9RISNd" target="_blank">Read more</a></p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/04/stephen-fry-on-the-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Carl at 2&#189; months</title>
		<link>http://danwright.info/blog/2010/03/carl-at-2-12-months/</link>
		<comments>http://danwright.info/blog/2010/03/carl-at-2-12-months/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 20:26:44 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[family]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[Carl]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=157</guid>
		<description><![CDATA[A new photo set, Carl with his mom, is now on Flickr.]]></description>
			<content:encoded><![CDATA[<p>A new photo set, Carl with his mom, is now <a href="http://www.flickr.com/photos/80168386@N00/sets/72157623742787510/" target="_blank">on Flickr</a>.</p>
<p><a href="http://www.flickr.com/photos/80168386@N00/sets/72157623742787510/show/"><img src="http://farm3.static.flickr.com/2546/4479369811_cfdbc6e156_m.jpg" width="160" height="240" alt="carl-and-anna-6323"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/03/carl-at-2-12-months/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web site browser agents (2010 edition)</title>
		<link>http://danwright.info/blog/2010/03/web-site-browser-agents-2010-edition/</link>
		<comments>http://danwright.info/blog/2010/03/web-site-browser-agents-2010-edition/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 19:46:29 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=155</guid>
		<description><![CDATA[Okay, it has now been a year since I published web browser statistics for my various sites, so this seems like a good time to take stock of how things have changed over the past year. Take Internet Explorer 6 users (please!), for instance. Surely their numbers have fallen? Here are my overall numbers for [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, it has now been a year since I published <a href="/blog/2009/03/web-site-browser-agents/">web browser statistics for my various sites</a>, so this seems like a good time to take stock of how things have changed over the past year.</p>
<p>Take Internet Explorer 6 users (<em>please!</em>), for instance. Surely their numbers have fallen?</p>
<p>Here are my overall numbers for March 2009 to March 2010:</p>
<ul>
<li>64% MSIE</li>
<li>20% Firefox</li>
<li>10% Safari</li>
<li>6% Others (3% Chrome, 2% Opera)</li>
</ul>
<p>So for the past year, MSIE usage actually <em>increased</em>, Firefox and Safari fell; Others held their own.</p>
<p>The Internet Explorer breakdown:</p>
<ul>
<li><strong>38% MSIE 6.0</strong></li>
<li>36% MSIE 7.0</li>
<li>26% MSIE 8.0</li>
</ul>
<p>MSIE 8 has now been released for just over 12 months; and yet, it is only the third most popular version of Internet Explorer. Internet Explorer is the <em>only</em> browser with an upside-down adoption rate. Last year, MSIE 7 was the most popular version; this year, perversely, it is MSIE 6. MSIE 6 went up six points compared to last year.</p>
<p><em>Sigh.</em></p>
<p>Firefox:</p>
<ul>
<li>42% Firefox 3.5</li>
<li>42% Firefox 3.0</li>
<li>8% Firefox 2.0</li>
<li>7% Firefox 3.6</li>
</ul>
<p>Firefox 3.6 has only been out for about two months, so it&rsquo;s on track for a 42% share of the Firefox segment. Firefox 2.0 had the most share last year, at 48%. Quite a contrast with MSIE.</p>
<p>Safari:</p>
<ul>
<li>57% Safari 4.0</li>
<li>15% Safari 4.0 (mobile &#8211; iPhone/iPod Touch)</li>
<li>10% Safari 3.2</li>
<li>6% Safari 3.1</li>
<li>5% Safari 3.1 (mobile)</li>
<li>7% Safari 3.0, 4.1, and 2.x</li>
</ul>
<p>iPhone/iPod share has increased slightly, from 15 to 20%. A year ago, 3.2 was new, and version 3.1 had the largest share.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/03/web-site-browser-agents-2010-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode Run Script Build Phase error reporting</title>
		<link>http://danwright.info/blog/2010/03/xcode-run-script-build-phase-error-reporting/</link>
		<comments>http://danwright.info/blog/2010/03/xcode-run-script-build-phase-error-reporting/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 17:14:35 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://danwright.info/blog/?p=151</guid>
		<description><![CDATA[I thought about blogging about this several months ago, but never got around to it. And don&#8217;t skip reading the comments.]]></description>
			<content:encoded><![CDATA[<p>I thought about blogging about <a href="http://briksoftware.com/blog/?p=120" target="_blank">this</a> several months ago, but never got around to it. And don&rsquo;t skip reading the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwright.info/blog/2010/03/xcode-run-script-build-phase-error-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

