<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I’m the co-founder and CTO of Spotlight Mobile.

@nfarina/ twitter



  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-139239-11’]);
  _gaq.push([‘_trackPageview’]);

  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    (document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(ga);
  })();</description><title>Nick Farina</title><generator>Tumblr (3.0; @nfarina)</generator><link>http://nfarina.com/</link><item><title>iPhone 4: &lt;i&gt;No Italics!&lt;/i&gt;</title><description>&lt;p&gt;This sounds crazy, but seems to be true: &lt;code&gt;+[UIFont italicSystemFontOfSize:]&lt;/code&gt; simply returns a regular non-italic font on iPhone 4 hardware.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://developer.apple.com/iphone/library/releasenotes/General/RN-iPhoneSDK-4_0/index.html"&gt;release notes&lt;/a&gt; state:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;iPhone 4 uses a different system font than earlier devices. 
  References to the Helvetica font in nib files will be 
  decoded as the system font on these newer devices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The “different system font” appears to be Helvetica Neue, for which there is no italic version included.&lt;/p&gt;

&lt;p&gt;Since you’ll always want to use the system font for your user interface, what this means is: &lt;em&gt;no italics for your UI&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This absolutely must be intentional and not a bug. Changing the system font on a new iPhone model for which a primary new feature is better font rendering, is a &lt;em&gt;huge deal&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I’m not complaining about it, I think it’s a fine decision, but also extremely interesting, don’t you think?&lt;/p&gt;</description><link>http://nfarina.com/post/738543430</link><guid>http://nfarina.com/post/738543430</guid><pubDate>Sat, 26 Jun 2010 08:12:11 -0700</pubDate></item><item><title>How to check out new music on Rdio</title><description>&lt;p&gt;1) First, search for an artist you’re interested in:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cAgRdP" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Now scroll down to “Popular Songs.” See that Play button?&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/c91HnU" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;2) That’s the one. Press that. Press it.&lt;/p&gt;

&lt;p&gt;3) Now you’re listening to some &lt;em&gt;awesome&lt;/em&gt; music. How easy was that?!&lt;/p&gt;

&lt;p&gt;For extra fun, share it with your friends:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cmzdn1" alt=""/&gt;&lt;/p&gt;</description><link>http://nfarina.com/post/722107169</link><guid>http://nfarina.com/post/722107169</guid><pubDate>Mon, 21 Jun 2010 08:16:03 -0700</pubDate></item><item><title>Improvements to Google Wave Notifier</title><description>&lt;p&gt;&lt;em&gt;&lt;a href="https://nfarina.s3.amazonaws.com/google-wave-notifier/GoogleWaveNotifier.zip"&gt;Download the notifier now&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I tried out the &lt;a href="http://github.com/hiroshi/Unofficial-Google-Wave-Notifier"&gt;Unofficial Google Wave Notifier&lt;/a&gt; and liked its functionality, but wasn’t thrilled with the UI:&lt;/p&gt;

&lt;div style="text-align:center; margin-bottom: 20px"&gt;
    &lt;img src="http://2.bp.blogspot.com/_qsyweV0vXTA/St57xQfwoeI/AAAAAAAAAJU/oCCiTBmIlqQ/s400/unofficial+google+wave+notifier.png"/&gt;
&lt;/div&gt;

&lt;p&gt;So I made some changes:&lt;/p&gt;

&lt;div style="text-align:center; margin-bottom: 20px"&gt;
    &lt;img src="http://ctu.appspot.com/lbECU1/UEC/WaveNotifierOpen.png"/&gt;
&lt;/div&gt;

&lt;p&gt;The icon glows blue when you have unread waves, inspired by &lt;a href="http://www.atebits.com/tweetie-mac/"&gt;Tweetie for Mac&lt;/a&gt;:&lt;/p&gt;

&lt;div style="text-align:center"&gt;
    &lt;img src="http://ctu.appspot.com/7E3gj2/HKC/WaveNotifier.png" style="margin-bottom:25px"/&gt;
&lt;/div&gt;

&lt;p&gt;I also added a selector for choosing which browser the Notifier opens Google Wave in when you click things.&lt;/p&gt;

&lt;div style="text-align:center; margin-bottom: 20px"&gt;
    &lt;img src="http://ctu.appspot.com/7E3gj2/mUH/WaveNotifierBrowsers.png"/&gt;
&lt;/div&gt;

&lt;p&gt;Creating this selector in Cocoa on OS X was a lot more involved than I thought going in. But at least it’s not Windows, which would have been 10 times more painful.&lt;/p&gt;

&lt;p&gt;I also refactored the notifier to be fully asynchronous so it doesn’t block the main thread and is always responsive.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://github.com/nfarina/Google-Wave-Notifier"&gt;Check it out on Github.&lt;/a&gt;&lt;/p&gt;</description><link>http://nfarina.com/post/475049089</link><guid>http://nfarina.com/post/475049089</guid><pubDate>Fri, 26 Mar 2010 09:55:27 -0700</pubDate></item><item><title>There, I fixed Xcode—You’re Welcome.</title><description>&lt;p&gt;&lt;em&gt;&lt;a href="http://code.google.com/p/xcode-auto-assistant/downloads/list"&gt;Download xcode-auto-assistant now&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In my &lt;a href="http://nfarina.com/post/389462700/code-completion-and-xcode"&gt;last installment&lt;/a&gt;, I discussed Xcode’s frustrating implementation of code completion.&lt;/p&gt;

&lt;p&gt;I’ve now &lt;a href="http://code.google.com/p/xcode-auto-assistant/"&gt;taken matters into my own hands&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://ctu.appspot.com/gdxI1/o27/screenshot.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;It turns out Xcode has an (undocumented) plugin system. And it also turns out that &lt;a href="http://ciaranwal.sh/"&gt;this guy&lt;/a&gt; created a &lt;a href="http://github.com/ciaran/xcode-bracket-matcher"&gt;really fantastic plugin&lt;/a&gt; for Xcode that automatically inserts a matching opening bracket ‘&lt;code&gt;[&lt;/code&gt;’ when typing the closing bracket ‘&lt;code&gt;]&lt;/code&gt;’.&lt;/p&gt;

&lt;p&gt;Now, it turns out Apple added this bracket-insertion feature on their own, possibly being inspired by this, so the plugin is now just reference material.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Really useful&lt;/em&gt; reference material for doing what I want to do.&lt;/p&gt;

&lt;p&gt;I’ll save the nitty-gritty details of how the plugin works for a later post (or just &lt;a href="http://code.google.com/p/xcode-auto-assistant/source/checkout"&gt;browse the source&lt;/a&gt;). Let’s just say that we have access to keystrokes as you type them in Xcode. How would we use that to achieve automatic completion list display?&lt;/p&gt;

&lt;h2&gt;Take 1: Popup all the time!&lt;/h2&gt;

&lt;p&gt;The most useful behavior, it seems, is for the popup list to appear as soon as you type a reasonable character that can be completed, such as an alphabetical character. Here we’ll type ‘&lt;code&gt;u&lt;/code&gt;’ because we want &lt;code&gt;UIViewController&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/b7u8TD" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;So that’s the first thing I implemented. Listen for alphabetical character, popup the list.&lt;/p&gt;

&lt;p&gt;The problem turns out to be that the list takes “a while” to appear, because we’re in Objective-C which is still &lt;strong&gt;C&lt;/strong&gt; and the number of legal symbols you can type in a particular location is &lt;em&gt;immense&lt;/em&gt;. I mean look at that tiny scrollbar! There’s all manner of detritus in there like &lt;code&gt;u_quad_t&lt;/code&gt; and &lt;code&gt;UIKIT_STATIC_INLINE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You might think, no problem, I’ll just ignore the popup and keep typing because the list will narrow itself down as I go. But, in practice, it turns out to be extremely annoying because you can’t type small words like “&lt;code&gt;if&lt;/code&gt;” and “&lt;code&gt;for&lt;/code&gt;” without the popup list slowing you down.&lt;/p&gt;

&lt;h2&gt;Examine our options&lt;/h2&gt;

&lt;p&gt;I imagine that Apple encountered this same problem, and it seems the way they addressed it was by analyzing the number of items that &lt;em&gt;would&lt;/em&gt; match and only giving you a suggested completion if the number of possible matches is small.&lt;/p&gt;

&lt;p&gt;This is why, with Apple’s completion, you must type “&lt;code&gt;nss&lt;/code&gt;” before it will automatically suggest something like “&lt;code&gt;NSString&lt;/code&gt;”. If you just type “&lt;code&gt;ns&lt;/code&gt;” you can sit there forever and it’ll never suggest anything. But if you type “&lt;code&gt;cl&lt;/code&gt;” it might suggest “&lt;code&gt;CLLocation&lt;/code&gt;” because there aren’t a lot of other things starting with “&lt;code&gt;cl&lt;/code&gt;”.&lt;/p&gt;

&lt;p&gt;My beef with this approach is that it’s &lt;a href="http://nfarina.com/post/389462700/code-completion-and-xcode"&gt;unpredictable&lt;/a&gt;. How do I know how many letters I’m supposed to type before I can press &lt;code&gt;enter&lt;/code&gt; and move on?&lt;/p&gt;

&lt;h2&gt;Take 2: Smart delay&lt;/h2&gt;

&lt;p&gt;The solution turned out to be surprisingly simple. Display the list after typing any alphanumeric character, but with a delay &lt;em&gt;proportional to the number of characters in the word entered thus far&lt;/em&gt;. On the 4th character and beyond, the list always appears immediately.&lt;/p&gt;

&lt;p&gt;This way you can type “&lt;code&gt;uivi[enter]&lt;/code&gt;” &lt;em&gt;as fast as possible&lt;/em&gt; and you get &lt;code&gt;UIViewController&lt;/code&gt; (depending on your typing history, but this is intuitive).&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cxUo2t" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;By the time you get to the 4th character, the list is almost always reasonably small and therefore much more helpful.&lt;/p&gt;

&lt;p&gt;If you just type “&lt;code&gt;u&lt;/code&gt;” and forget what you were doing, we’ll wait about 0.4 seconds before presenting the list to help you.&lt;/p&gt;

&lt;p&gt;More importantly, you can type “&lt;code&gt;for (int i = 0…&lt;/code&gt;” at normal typing speed without the popup appearing at all, and once you get stuck on something you’ll pause naturally and only then will the list appear.&lt;/p&gt;

&lt;h2&gt;Extras&lt;/h2&gt;

&lt;p&gt;Of course, you don’t want the list appearing on just &lt;em&gt;any&lt;/em&gt; alphanumeric character: If you’re writing a string or a comment, the list isn’t going to help you. So the plugin does some extra work to detect those situations. It’s not a full-on &lt;a href="http://en.wikipedia.org/wiki/Lexical_analysis"&gt;lexer&lt;/a&gt; but it seems to work 99% of the time.&lt;/p&gt;

&lt;p&gt;Additionally, if you type a period ‘&lt;code&gt;.&lt;/code&gt;’ to access a struct member or ObjC property, the list always appears immediately.&lt;/p&gt;

&lt;p&gt;One last neat feature: When you type a semicolon, it will be automatically moved to the &lt;em&gt;end&lt;/em&gt; of the line as necessary. I don’t know about you, but I often find myself in this kind of situation:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/9v8Gzx" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;…having just typed a method name and needing to cap off the line with a semicolon. Normally I’d have to go find the right arrow key first, but with the plugin you just type ‘&lt;code&gt;;&lt;/code&gt;’ and it puts it in the right place.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/98KQRr" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Pretty cool!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/xcode-auto-assistant/"&gt;Try the plugin here.&lt;/a&gt;&lt;/p&gt;</description><link>http://nfarina.com/post/428544140</link><guid>http://nfarina.com/post/428544140</guid><pubDate>Fri, 05 Mar 2010 09:18:47 -0800</pubDate></item><item><title>Code Completion and XCode</title><description>&lt;p&gt;&lt;em&gt;Update: I &lt;a href="http://nfarina.com/post/428544140/there-i-fixed-xcode-youre-welcome"&gt;wrote a plugin&lt;/a&gt; to address these issues.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The newish mac app &lt;a href="http://macrabbit.com/espresso/"&gt;Espresso&lt;/a&gt; contains a great (and uncommonly beautiful) implementation of code completion.&lt;/p&gt;

&lt;p&gt;It goes like this. Say you’re editing a CSS file:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/dniBii"/&gt;&lt;/p&gt;

&lt;p&gt;That’s a nice blue background, but you also want a border. You start by typing the letter “&lt;code&gt;b&lt;/code&gt;”:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/b3JlRQ"/&gt;&lt;/p&gt;

&lt;p&gt;Since Espresso knows that there are many possible options that start with “&lt;code&gt;b&lt;/code&gt;”, it presents them to you in this lovely but minimal popup. You can use the arrows and press &lt;code&gt;enter&lt;/code&gt; to select something from the list. &lt;em&gt;Or&lt;/em&gt;, you can pretend the list never appeared and keep typing. Once you type enough to eliminate all other options, the list disappears and you’re left with a more standard OS X “completion” highlight. You can still press &lt;code&gt;enter&lt;/code&gt; to accept this last suggestion.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cv2TCa"/&gt;&lt;/p&gt;

&lt;p&gt;The two things I want to emphasize about this workflow are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s &lt;strong&gt;predictable&lt;/strong&gt;. I trust Espresso to always give me all possible relevant options after each keypress. And I know that I just press &lt;code&gt;enter&lt;/code&gt; to accept and move on.&lt;/li&gt;
&lt;li&gt;It’s &lt;strong&gt;useful&lt;/strong&gt;. Whenever there are multiple options, they are presented to me in the list, and the list appears automatically when needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Predictable&lt;/h3&gt;

&lt;p&gt;XCode goes like this. Say you’re writing some Objective-C:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cUEAXD"/&gt;&lt;/p&gt;

&lt;p&gt;We need to make a new instance of &lt;code&gt;UIViewController&lt;/code&gt;, so we begin our journey of typing the class name.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/duhZ6e"/&gt;&lt;/p&gt;

&lt;p&gt;XCode does nothing so far. We know it has a set of suggestions to help us—if you press &lt;code&gt;ESC&lt;/code&gt; now, you’ll see a nice list of all the classes starting with “&lt;code&gt;UI&lt;/code&gt;”. But for some reason it’s decided not to jump in yet. &lt;span style="font-size:75%"&gt;(Note: My Code Sense delay is set to &lt;code&gt;Immediate&lt;/code&gt;)&lt;/span&gt;. We press on, typing “&lt;code&gt;v&lt;/code&gt;”:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/crjJlJ"/&gt;&lt;/p&gt;

&lt;p&gt;Ah ha, there it is! Clever XCode! That’s what we want—so we’ll press &lt;code&gt;enter&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/bnOWXY"/&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Curious&lt;/em&gt;. It has only &lt;em&gt;partially&lt;/em&gt; completed the word. See how before, only the ‘&lt;code&gt;i&lt;/code&gt;’ was highlighted? This is a (newish?) feature of XCode. It turns out there are a few other classes starting with the prefix “&lt;code&gt;UIVi&lt;/code&gt;” and it doesn’t want to assume that I want something starting with &lt;code&gt;UIView&lt;/code&gt; and not, say, &lt;code&gt;UIVideoEditorController&lt;/code&gt; which I never knew existed until just now.&lt;/p&gt;

&lt;p&gt;At this point if I press &lt;code&gt;enter&lt;/code&gt; again, it will go ahead and fill in the rest of the word.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cJbpuE"/&gt;&lt;/p&gt;

&lt;p&gt;So it eventually gave me what I wanted. But here’s a wrinkle: if I would have typed “&lt;code&gt;uivi&lt;/code&gt;” myself first, it would have suggested &lt;code&gt;UIViewController&lt;/code&gt; just the same, but in that case it would have completed the entire word when I pressed &lt;code&gt;enter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The problem here is that XCode is not &lt;strong&gt;predictable&lt;/strong&gt;. When I’m typing code, my brain is moving faster than my fingers. I can &lt;em&gt;decide&lt;/em&gt; to type &lt;code&gt;[[[UIViewController alloc] init] autorelease]&lt;/code&gt; a &lt;em&gt;hell&lt;/em&gt; of a lot faster than I can actually write it. And my brain can’t move on to a more interesting problem until it can give my fingers a known sequence of keys to press. XCode’s completion is a different back-and-forth conversation with the editor every time. How do I get it to finish &lt;code&gt;UIViewContoller&lt;/code&gt;? Do I press &lt;code&gt;enter&lt;/code&gt; once, twice, three times? It depends how many characters I typed first, which &lt;em&gt;also&lt;/em&gt; depends on factors like XCode tailoring its suggestions based on my code history.&lt;/p&gt;

&lt;h3&gt;Useful&lt;/h3&gt;

&lt;p&gt;Here’s another example. Let’s set the &lt;code&gt;frame&lt;/code&gt; of our new controller’s view, by first declaring a new &lt;code&gt;CGRect&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/9UKanr"/&gt;&lt;/p&gt;

&lt;p&gt;Now here I’ve typed the letters &lt;code&gt;cgrect&lt;/code&gt; just like that, and XCode hasn’t suggested anything at all. Maybe I have to type more than 6 characters before XCode jumps in? (Nope, that’s not it.)&lt;/p&gt;

&lt;p&gt;OK well, I’m done typing now, so I have to fixup this &lt;code&gt;cgrect&lt;/code&gt; by turning it into a real &lt;code&gt;CGRect&lt;/code&gt; with proper caps. Maybe XCode can help with this? I’ll press &lt;code&gt;ESC&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bit.ly/cCJxqL"/&gt;&lt;/p&gt;

&lt;p&gt;OK, so I got lucky, it happens to be the 2nd item in the list. (If this list was sorted alphabetically, as it is by default, &lt;code&gt;CGRect&lt;/code&gt; by itself wouldn’t even be on it). But still, I’ve written an exact match, shouldn’t that be what’s selected by default instead of &lt;code&gt;CGRectInset&lt;/code&gt;? Now I have to fiddle with arrow keys and scrolling and by this point I could have just typed out CGRect myself with proper carpal-tunnel-inducing capitalization and skipped all this business.&lt;/p&gt;

&lt;h3&gt;It gets worse&lt;/h3&gt;

&lt;p&gt;These are just two examples out of many. In fact, XCode’s completion is so unhelpful that I can only assume the engineers at Apple never have it turned on, and maybe just code everything in Vim anyway. To me, it feels like the sort of feature that was built to “satisfy” demand from non-Apple developers. &lt;em&gt;Look, fine, we’ll give you your ‘completion’, you Microsoft-coddled sissies, now please go away and let us work on OS X 10.7 already!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s just a bit sad for me, because I have tasted the sweet nectar of real, predictable, useful code completion, and it is wonderful and productive. This isn’t an intractable problem! It just needs some more TLC.&lt;/p&gt;

&lt;p&gt;If you agree with my findings, I encourage, nay, &lt;em&gt;command&lt;/em&gt; you to go fill out a &lt;a href="https://bugreport.apple.com"&gt;bug report&lt;/a&gt; with Apple (they really do read these).&lt;/p&gt;

&lt;p&gt;I have also reposted the issue on &lt;a href="http://openradar.appspot.com/radar?id=154402"&gt;Open Radar&lt;/a&gt;.&lt;/p&gt;</description><link>http://nfarina.com/post/389462700</link><guid>http://nfarina.com/post/389462700</guid><pubDate>Sun, 14 Feb 2010 12:27:00 -0800</pubDate></item><item><title>Transport!</title><description>&lt;p&gt;&lt;img align="right" src="http://media.tumblr.com/tumblr_kw25eng1LC1qar7wl.png"/&gt;I finally sat down and published &lt;a title="Transport" href="http://www.transport-app.com"&gt;Transport&lt;/a&gt;, a little app I’ve been using for quite a while to send files and screenshots and such. Mostly screenshots, because it turns out this is &lt;i&gt;incredibly &lt;/i&gt;useful when it only takes one keystroke. Communicating via images is sometimes a zillion times easier than typing 1000 words and all.&lt;/p&gt;</description><link>http://nfarina.com/post/327784819</link><guid>http://nfarina.com/post/327784819</guid><pubDate>Sun, 10 Jan 2010 16:52:00 -0800</pubDate></item></channel></rss>
