Development

Still studying Cocoa, making progress on iPhone app programming

Tuesday, May 18th, 2010

I’m still working my way through the iPhone application class Stanford put online, specifically the Winter 2010 CS193P course. I’d highly recommend the course for anyone wanting to reinforce their knowledge of object oriented programming concepts, regardless whether they plan to ever write an app for iPhone, iPad, or Mac.

Below is a screenshot of my version of assignment #3 running on my iPhone. Every control on that screen works as expected, it’s pretty neat. Most importantly, I finally understand how and why.

You can find the lecture slide PDFs and other materials on Stanford’s website, and video of each of the class lectures are available as a free podcast in “iTunesU”.

Bing vs. Google –- browser load times compared

Tuesday, August 4th, 2009
I remember back in the early days of the internet, before Google’s search engine produced results that were so clearly better than everyone else’s1, I immediately favored it because their uncluttered webpage and the search results loaded at lightning-speed when compared to the competition.

These days Google is king of search and their remaining competitors are also-rans. Microsoft, in a major play for the search market has revamped their search engine. Not content to merely improve the engine, Microsoft has also decided to change its name.2 So The engine previously known as “MSN Search”, then “Windows Live Search”, then “Live Search”, has been rechristened to “Bing”. I maintain that they were undoubtedly inspired to use the name “Bing” as an homage to this great moment in the film “Groundhog Day”.3

My cursory test of Bing shows that it’s a decent search engine, but I don’t have to scan as far through Google’s results to find links I consider relevant. For example, in a search for “Bing” on both engines, Google returns Microsoft’s search engine’s page as its first non-sponsored result4 and the wikipedia article on the service as the 3rd result. Microsoft Bing’s results first show several “News about Bing” links at the top, followed by a link to the Bing page, and then the “Bing Crosby” article at Wikipedia. The wikipedia page on Bing is two links later, halfway down the page. Since I was not looking for news articles on Bing, Google’s search results were better for me, with everything I wanted within the first 3 results. This isn’t a dealbreaker. I could still find what I needed in Bing’s results, and I’d be shocked if Microsoft doesn’t continue to improve their service –starting with algorithms that move more frequently-clicked results for a given query to the top of the list5.

Google edges ahead in this cursory test, but not enough to cause me to scowl and turn away from Bing in disgust. How about speed? I cleared my browser cache, opened up Safari’s Network Timeline, and loaded google.com and bing.com one after the other. The results are telling:

Graph of time to load bing

graph of time to load google

A proper fail. Bing’s page is obviously bloated compared to Google’s, and took about 5x longer to appear in my browser and 10x longer to completely load than Google (4.26 seconds vs. 478ms). This isn’t just due to Bing including 82kb of pretty pictures in the front page, there’s also a significant difference in the speed at which results pages load. When I executed an identical search on both pages, Google’s results appeared in less than a second and Bing’s again took several times longer. I’d consider such a difference in the metric known in tech circles as “Teh Snappy” a dealbreaker, but for two factors:

  1. Bing organizes its search results, particularly product and video search results, in interesting ways. I have yet to properly experiment with this.
  2. Microsoft pays users6 to use their search engine to shop for products. Yay, money.

So for now, I’ll occasionally use Bing for net searches for the sake of variety and experimentation, and I always use Bing as a gateway to eBay or other online vendors, so that I get money back for purchases made (amounts vary — I think the cashback for eBay purchases is around 8%). 25% of the purchase price of my iPhone was given back to me due to my use of this cashback feature back when the engine was called “Live Search”. I like to think that Microsoft paid me to buy an iPhone, but the reality is probably much more complicated.

To my mind, Bing isn’t a home run, but it’s interesting, particularly if they continue to pay me to use it. That may sound like faint and cynical praise, but it’s more than I can say of any search engine that’s tried to compete with Google in years. I look forward to seeing how the engine develops.

  1. I remember being partial to huskysearch, savvysearch, and metacrawler in the days pre-Google. []
  2. This can probably be read as a tacit acknowledgement by Microsoft that there are few users of the previous incarnations of the search engine to confuse. Bing! []
  3. Or perhaps the name change is just Microsoft’s way of stimulating the “product branding consultant” sector of the economy. Bing! []
  4. And also as the sole sponsored result. Microsoft is paying to advertise their search engine in the search results of their chief competitor’s search engine. []
  5. If Mr. Crosby is really a more popular result than the article on their search engine, MSFT’s marketing team needs to work harder. Perhaps an ad in which a couple listen to a Bing Crosby song and then the wife vomits on the husband? Bing! []
  6. Or do vendors who list products on Bing pay users for using Microsoft’s search engine to find their products? I’m not exactly sure where the money comes from or why. []

free iPhone Application Programming class

Friday, June 12th, 2009
Screenshot of the listing for the iPhone Application Programming class in iTunes U.
Apple’s iTunes music store has a section of free podcasts called “iTunes U”, which feature lecture media (videos, audio, PDF notes) for classes at a number of universities.

Someone recently mentioned to me that Stanford University’s “iPhone Application Programming” class1 is available2.

I’m thinking I may try to work my way through this set of lessons for a few reasons:

  • It would be good for me to gain a better grasp of object oriented programming principles.
  • The iPhone looks like a fun platform for which to program, with rich APIs that run the gamut from UI to animations to data storage (with SQLite as an option!).
  • I’ve been running a lot of iPhone apps lately, and thinking of apps that should exist and might be interesting to develop.
  • Free development tools, based in part on the gnu C compiler, with which I’m already a little familiar.
  • If I managed to program anything worthwhile, there are a ton of potential users, and distribution (and sales if it’s a commercial app) would be remarkably easy due to the existence of the app store.

I’m amazed by the apparent number of other classes available for free download in “iTunes U”. I look forward to one day having enough spare time to actually look through more of them.

  1. If iTunes is installed on your computer, clicking that link will take you to the page in iTunes from which you can download individual classes or subscribe to the entire feed. []
  2. I noticed that the class is co-taught by Alan Cannistraro, a former coworker of mine. It’s nice to see a familiar name. []

Blog redesign in progress

Saturday, March 14th, 2009
screenshot of blog redesign in progress

I’ve started to tire of my blog’s design and have begun to tear it down1 in order to rebuild. “In LA v2.0″ will be wider2, mostly free of sans-serif fonts3, with larger images, more whitespace, a redesigned theme and header –and the page will display in 3D4 if you look at it through polarized glasses.
  1. er, I’m tearing down and rebuilding an auxiliary copy []
  2. because I refuse to continue to design for 800×600 resolution displays []
  3. blocks of text with serifs are easier to read by word shape, unless you’re on an OS that doesn’t render them properly :) []
  4. or at least with 50% less glare []

Palm Pre Thoughts — a bit of perspective

Monday, February 23rd, 2009
I want to talk a bit about the upcoming and wildly anticipated smartphone from Palm, the “Palm Pre“. The Palm Pre is the latest in a long line of hyped iPhone killers. Tech journalists have declared,”The Palm Pre has it all, making the iPhone look almost like — dare we say it — a version 1.0 device” and that it is,”maybe the most important handset to be announced in two years1.

I think the Palm Pre is a very nice piece of hardware, with a set of supplied applications that look very nice, but this smartphone is massively overhyped and has a huge, gaping problem: The lack of an SDK that allows the compilation of native applications –incidentally this is the same problem that initially kept me from considering the purchase of an iPhone.

The iPhone was roundly criticized for the same defect, but the makers of the Palm Pre have been shockingly successful at that which Apple failed to do: to give a positive spin to this policy/design-defect. In the case of the iPhone, Apple was able to recant their initial position and fix the issue, leveraging technologies they had been developing for years2. Palm will not be able to issue so seamless a fix, as the Palm Pre’s OS is brand new, and I doubt Palm has very robust development tools or frameworks they can prepare quickly and distribute to the eager developers who will gather as soon as Palm Pre users tire of applications that are glorified web sites and want to do things with their phones that simply can’t be done using javascript and html.

To gain a bit of perspective on the Palm Pre, I think it is necessary to take…

Iphone Apps

…A look back at developer response to the initial iPhone announcement

When Apple first announced the iPhone, they announced there would be no way for developers to compile native binaries that run on the device, but instead announced that developers could create wonderfabulous web 2.0 applications that would run on the phone:
Developers can create Web 2.0 applications which look and behave just like the applications built into iPhone, and which can seamlessly access iPhone’s services, including making a phone call, sending an email and displaying a location in Google Maps

The response from grateful, would-be iPhone app developers? Try this google search for “iPhone no SDK”. A couple of choice quotes from the results:

Apple took a ton of heat from developers and users for their initial decision, and eventually did release an SDK to allow developers to write native applications for the iPhone. The iPhone runs OS X as its operating system, and Apple has a long history of creating and distributing tools for OS X development as well as Frameworks to simplify the creation of rich applications3. Not only are these tools and frameworks feature-rich, mature, reasonably well-known, and stable, they are also the same tools and frameworks used by Apple to build the operating system and the applications they supply on the iPhone.

Most of the third-party apps I frequently run on my iPhone (most prominently: Beatmaker, Evernote, Fring, Brushes, and iTalk) would not be possible to create as web apps with Ajax and Javascript. Those that could possibly be programmed in javascript, such as the iPhone OmniFocus app, probably shouldn’t be. They’re complicated enough that it would be difficult to design them as web apps that have good performance4 and manageable code.

My final rant

As far as I can tell, there’s no native development environment for the Palm Pre, nor is there one that will be popping up soon. Would-be developers face the same silly web-app-only idea for which Apple was roundly criticized when they first launched the iPhone. It’s actually the same silly web-app-only idea which has probably contributed to the lack of applications for the Sony Mylo devices5.

Unless the built-in applications are spectacular and completely fill the needs of most smartphone consumers, real third-party applications will be necessary for the Palm Pre to make more than an initial blip in the smartphone market. I don’t expect there’ll be many interesting apps available for the Pre until they give developers a bunch of useful frameworks and the ability to compile binaries for the device. The iPhone has a huge advantage here in that iPhone developers get to develop and compile apps for a mature platform based on an OS and frameworks that have been around for years.

As a long-time Palm user and advocate, I’m glad they’re back in the game, and I look forward to being proven wrong on all counts.

Notably ommitted from this analysis because I tired of thinking and typing: Windows Mobile, Nokia6, Android, OpenMoko.

  1. An endorsement that is simultaneously breathless AND wishy-washy. []
  2. Some of the OS X development technologies are approximately 20 years old, having been born at NeXT. []
  3. See previous footnote. []
  4. Web apps are slow enough when running in web browsers on multi-gigaherz multi-core computers, let alone puny 600Mhz power-saving mobile processors with limited ram. []
  5. And this lack of apps might be part of the reason nobody’s ever heard of the Mylo, which like the Palm Pre has decent hardware []
  6. Nokia sells way more smartphones than any other player, more than twice as many as Apple. It does seem odd sometimes that the question is “What’s to be the iPhone killer”. []

Testing the iphone wordpress blogging app

Wednesday, July 30th, 2008
One of the free apps in Apple’s new “app store” for iPhone and iPod touch is “wordpress”. Looks like it is not only free, but nice.

Without me ever telling them my idea, they’ve set it up to post a mostly blank blog entry, and then snarf in the entry to extract the blog’s template. The app then uses the captured template to generate an accurate wysiwyg preview so you can evaluate your post before submitting. Nice.

I guess I don’t have to write my own iPhone blogging client now. This one will likely do.

convert frames to 24p ND timecode in Excel

Friday, April 11th, 2008
Frame To Timecode Conversion
In this example, column G is determining a timecode value, 10:45:46:2 based on the frame number in B, 0929906. That timecode value should end in :02, and will once I figure a good way to add leading zeros in an Excel formula.

The other day I was presented with an Excel spreadsheet listing a bunch of clips by frame number, and I needed to find the scene and shot numbers for each clip from an EDL1 which listed the clips by timecode.

Rather than spend a lot of time with a timecode calculator converting each frame number to 24fps non-drop SMPTE timecode, I came up with a formula that would automatically generate and display the timecode for a given frame number. I didn’t spend the time to figure out how to coerce excel into adding leading zeros where necessary, so it doesn’t always generate timecodes that are formatted properly, but it was good enough for my purposes. I’m posting the formula here in case any other filmmakers find it useful, and if you happen to know how to modify this formula so that it does add leading zeros, please consider posting your code as a comment here. We’re all in this together. On that note, on to the formula.

For a given frame number in column 2, row B, the following formula will convert that frame number to timecode (24p, ND):

CONCATENATE( ROUNDDOWN(B2/86400,0),":", ROUNDDOWN(MOD(B2,86400)/1440,0), ":", ROUNDDOWN(MOD(MOD(B2,86400),1440)/24,0), ":", MOD(MOD(B2,1440),24))

–Update: A tip from Ken Case led to the solution. The finished formula, which produces properly formatted smpte 24p non-drop timecodes, is the following:

CONCATENATE( TEXT(ROUNDDOWN(B2/86400,0),"00"),":", TEXT(ROUNDDOWN(MOD(B2,86400)/1440,0),"00"), ":", TEXT(ROUNDDOWN(MOD(MOD(B2,86400),1440)/24,0),"00"), ":", TEXT(MOD(MOD(B2,1440),24),"00"))

  1. acronym for Edit Decision List []