Under the Bridge

Source: SonoDraw

If you happen to be doing any desktop Cocoa programming that involves vector graphics, an excellent place to start from is GCDrawKit, part of the open source collection of Graham Cox. Chances are if you’ve looked for anything of that sort you’ve found it on your own already, but here’s something new: full source code to a CAD application using it!

I thought that people might be interested in the source code for the latest build of our in-house CAD application SonoDraw. A full source bundle, including all supporting frameworks, can be downloaded from here:


This version finally integrates work that Allan Daly and Michael Caron have done on the DXFReader framework and its connection to DrawKit.

Peruse the announcement thread on the DrawKit mailing list, and enjoy!


Yes, we’re over halfway now in The Great WordPress Client Test, and today’s victim is:


myWeblog 2.1!

Unfortunately, this one pretty much falls into the same category as MarsEdit; HTML editing only, no convenient rich text editing. And it’s not quite as polished as MarsEdit either. On the upside, it is much more focused directly on WordPress than anything else so far — particularly, this is the only tool (we think) that has support for WordPress pages as well as blog entries. Of course, we’re not actually using WordPress as a CMS so that’s not a compelling feature at the moment, but if we ever do get around to it we will *definitely* give myWeblog another goaround, since HTML-only editing would be ok for pages that we actually do want to craft in some detail, as opposed to our usual strategy of just throwing up something that we might want to search for later. In the meantime … we’ll give it a 6/10 tie with MarsEdit for the ‘semi-casual blogging’ problem space.

Continue Reading →

Accelerometer Simulator

What’s the biggest annoyance about iPhone programming in the simulator? Well, if you’ve written any programs that use the accelerometer, we’ll just bet that you’ll put “accelerometer doesn’t work in the simulator” right at the top of your list. But ho! Here is how you fix that!

Accelerometer Simulator is an iPhone/iPod Touch application that transfers accelerometer data from the device to your computer using UDP protocol.

The main use case for the application is to allow iPhone application developers to create applications that require accelerometer, without having to do all the debugging on the actual device. By inserting two files into their project, they can use the Accelerometer Simulator to provide accelerometer data to their application when debugging on the iPhone simulator…

Nothing special about the simulator, mind you, this code could also be applied to sending realtime data from an iPhone app to any other desktop app. Which has some intriguing possibilities. In the meantime, grab the project from Google Code, and using it really couldn’t be any simpler:

To embed Accelerometer Simulator capabilities into your own application, simply add the AccelerometerSimulation.h and AccelerometerSimulation.m files from the Simulator classes directory into your project. Then in the source file where you configure UIAccelerometer, simply add

#import “AccelerometerSimulation.h”

This will override the default behaviour of UIAccelerometer when run on the iPhone simulator. When building for device, nothing is changed in your application.

And note also this extension which lets you use your MacBook’s accelerometer to provide the data. Not that we can really think of an actual compelling use case for that … but hey, it’s a nifty hack, and who doesn’t love nifty hacks?

h/t: If ( … ) then { … }!


And it’s day 4 of The Great WordPress Client Test, and today we’re using:


MarsEdit 2.3.2!

Now this is a right switchup from yesterday, when we ran screaming from MacJournal because it doesn’t have a HTML editing view; today we’re tossing MarsEdit out of serious contention because it doesn’t have a WYSIWIG view. Yes, the live preview is excellent, and yes the immediate image uploading is well done, and there’s lots of other good things about it … but although we want optional control over all our HTML, we’re not interested in mandatory control, that’s just too much effort. So we’ll give MarsEdit a 6/10 for being a very nice tool indeed if you do want complete control, but being unduly complicated for semi-casual blogging like ours. Yes, we’re hard to please, we know. Just call us Goldilocks.

Continue Reading →

Advertising: AdMob v. AdWhirl

So we really haven’t gotten into the advertising side of iPhone programming that much, aside from casually noting a few links, but we’re starting to notice that some people are doing better at it than actually selling their programs. At least, there’s enough money in it now for people to FIGHT! So break out the popcorn and follow along with the developing Clash of the Juggernauts!

Juggernaut A in this case is AdMob, which it seems is the current biggest ad server in the mobile space, and Juggernaut B is AdWhirl, which makes a pretty compelling case to sign up with it by acting as a mediation layer instead of a direct provider. This did not go over well with Juggernaut A, so they decided to take their toys home with them:

Beginning July 22, AdMob will no longer serve ads requested from iPhone apps that employ ad network mediation layers such as AdWhirl or Tapjoy. This change will enable us to provide our publishers and advertisers, as well as end users, with the best possible experience and results…

Yeah, sure. We were raised on a dairy farm, so we know exactly what we’re smelling here. And so do most others; the discussion on the iphonesb list was … spirited, with threads like Who hates AdMob today? Hard to miss that sentiment, indeed. However, as you can see in the admob blocked adwhirl, now what? thread, Admob does indeed generally make up the bulk of revenues. Which is why, as this particularly perspicuous post portrays,

My theory goes as such: AdMob is frightened. They have a dominant position, but suddenly an influx of competitors has put the heat on 
them. I mean, frickin’ 800-pounds-ads-gorilla Google is getting into the game. And AdWhirl allows them to switch at a moment’s notice.
So, they make the decision to “balkanize” the target: “with us or against us”. They say: if we stop serving ads to AdWhirl now, when competitors can’t match our inventory and payouts, the large number of people having us as a primary revenue stream will have to switch to the AdMob SDK or lose us as a revenue stream. Makes sense in context.
Of course, this situation is not going to last. Competitors will eventually start to catch up to AdMob (I mean, frickin’ Google). And AdWhirl is a mid-to-long-term competitive advantage too large to drop…

Yep, we’d agree with that. There’s lots of other good insight in that thread worth checking out, too, but you get the gist of it.

Also note the thread My E-mail to AdMob about the adwhirl isssue, which sideslips into a discussion of new ad player MdotM, in which the founder shows up to fill in some background on it; and some more hard numbers on advertising return for your consideration in that thread as well.

And finally, if you haven’t come to a firm conclusion about which direction to take your ad-supported iPhone programming yet, then read this last thread, Thanks for all the support – AdWhirl, from one of the AdWhirl cofounders:

In terms of updates, we’ve been in communications with AdMob and the big requirement for them was not that developers couldn’t use both AdWhirl and AdMob, but rather, since they couldn’t tell when a developer was using AdWhirl to cycle through AdMob ads (since we requested directly from the library), they had to ban anyone using AdWhirl. That was why, after talking to them, we immediately pumped out a new version of the library that pulled AdMob’s SDK out, and differentiated our ads from AdMob’s ads. Developers can now safely implement both AdMob and AdWhirl with their own logic, but of course AdWhirl has no visibility into what is happening with AdMob and can’t help facilitate any optimization, customization, or ad tracking. (our blog post about this is here: http://www.adwhirl.com/blog)
Keep in mind, though, AdWhirl isn’t just about maximizing revenue and optimizing fill-rates (although we do that, too!) – we allow developers to create their own custom ads dynamically (both icon+text as well as full-width banner images) and link to wherever they’d like to. We realize other ad networks / companies will soon be following suit with their own house-ads products, but keep in mind that, as an OPEN PLATFORM, AdWhirl is planning to open up our community of over 1000 publishers across over 1500 apps, such that you guys can soon start helping one another directly with cross-promotion and getting apps past the top 100 without paying several thousand dollars to an ad network. There’s value in this community as you guys have clearly known for awhile!
Plus, we’re going to be offering new ways to monetize soon that break the whole advertising paradigm.
The important thing is we’ve worked really hard to make sure you guys aren’t forced to make a choice, which is what our open platform is all about.

Well, we know who we’re going to bet on as the long term iPhone advertising success story here!


For day 3 of The Great WordPress Client Test, our post is courtesy of


MacJournal 5.1.3!

This one, well … it’s not called “MacBlog”, you may notice — and that is for good reason. Although I suppose this “journal” concept must appeal to some not insignificant body of people or else it wouldn’t be into version 5, it’s just not designed as a blog management tool. So there’s really no point listing specific issues with WordPress, we’ll just jump straight to the conclusion of “pick something else” and give it a 3/10 for getting a post up with a picture, although we had to sort out a really annoying amount of formatting and metadata afterwards, and HTML editing is just not available!, which puts MacJournal right off the WordPress coder geek reservation far as we’re concerned.

Continue Reading →

Snippet: Intercepting Touches

Ever wanted to intercept touches on a view that generally eats them, like MKMapView for instance?

I’d like to allow my user to double-tap the map view to place an annotation marker, rather than the default zoom behaviour. What’s the preferred method of having my program intercept touch events, then either passing them along (single-touch) or not (double-tap)?

Well, here’s a question on Stack Overflow that answers that for MKMapView and probably UIWebView as well: create a wrapper view that intercepts the various touch events, then place the functional view inside it, like this:

#import <MapKit/MapKit.h>
- (void)applicationDidFinishLaunching:(UIApplication *)application {

//We create a view wich will catch Events as they occured and Log them in the Console
viewTouch = [[UIViewTouch alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];

//Next we create the MKMapView object, which will be added as a subview of viewTouch
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[viewTouch addSubview:mapView];

//And we display everything!
[window addSubview:viewTouch];
[window makeKeyAndVisible];


Second day of The Great WordPress Client Test, and today we’re checking out


ecto 3.0!

Now this acts much more like a Mac program should. Interface is intuitive, category/tag/image composition beats Blogo all hollow, we like that ‘Amazon Helper’ plugin idea, … but there’s some quibbles here too:

  • The Preview window is resolutely blank. Blogo, now, it did a nice job of downloading all the appropriate templates from the blog. On the other hand, ecto actually uploaded it as expected and didn’t muck up the categories or lose text and so on … so we don’t count that as a major flaw.
  • Doesn’t seem to be a way to blockquote selected text, you have to click into blockquote mode then paste apparently. Not a dealbreaker I suppose, but I do rather like the online editor’s behavior that blockquotes the paragraph containing the insertion point.
  • It doesn’t maintain the Undo stack between HTML/text view changes either, even if you don’t actually do anything but switch between the two views.
  • Whilst in general the HTML creation and paste handling is excellent, and it’s a brilliant feature to actually force the HTML to be correct before leaving the HTML editor and offer to fix it for you like ecto does … in the particular circumstance where we’d like to paste source code in and slap <pre> tags around it, this feature actually gets in your way as it insists on making every line a new paragraph, which is not what we want as it loses the indentation. Perchance there’s a way around this, but it’s not immediately obvious.
  • The initial publish disallowed trackbacks/pingbacks. Presumably that’s a trivial setting fix somewhere, but allowing them really should be the default we think…

So yeah, we like this ecto thing overall, we’ll give it a solid eight from first impressions. Definitely worth an indepth evaluation probably … but we’ll see if we’re completely starstruck by any of the remaining five!

Continue Reading →

Game Design

And something a little different for you today: Whilst digging around Gamasutra for stuff interesting to iPhone developers, we stumbled across this article dissecting a variety of CPRGs. If you’re at all interested in designing a CRPG at some point — and we do feel the iPhone has not been overly well served in that realm to date — this is an interesting read.

[In the latest in his popular Game Design Essentials series, which has previously spanned subjects from Atari games through ‘mysterious games’‘open world games’‘unusual control schemes’ and ‘difficult games’, writer John Harris examines 10 games from the Western computer RPG (CRPG) tradition and 10 from the Japanese console RPG (JRPG) tradition, to figure out what exactly makes them tick — and why you should care.]

Those other articles in the series all look quite interesting as well!

Continue Reading →

Code: Plausible Blocks

So you’re all pumped up about this deft-sounding “Block” (aka Closure) concept that Grand Central Dispatch is going to bring to us in Snow Leopard … but it’s not out yet, and Snow Leopard does not run on the iPhone! So what do you do?

Well, if you’re really excited, you … implement it yourself.

If you caught the sessions on blocks at WWDC, you may be as excited as
I am to make use of them. Unfortunately, they’re only available for
Snow Leopard.

As a result, I decided to back-port block support to iPhoneOS 3.0 and
Mac OS X 10.5…

Dude. That’s hardcore. Here’s the announcement of Plausible Blocks; project page on Google Code; and a tutorial demonstrating its use with NSOperationQueue and UIActionSheet with sample code on github. Enjoy!

UPDATE — More good posts on blocks:

Using Blocks: Understanding the Memory Management Rules

Blocks, Episode 1

Blocks, Episode 2: Life Cycles

UPDATE 2 — Recommendations from the 1.0 release announcement:

Joachim Bengtsson’s Programming with C Blocks

Mike Ash’s Series on Blocks, Part I

Mike Ash’s Series on Blocks, Part II

Landon Fuller’s Using Blocks 1 (as mentioned above)

Landon Fuller’s Using Blocks 2

Google Code Project FAQ

h/t: iPhoneSDK!

Continue Reading →

Library: ParseKit

Now here’s something pretty darn nifty: ParseKit, a super-duper set of goodies for both string tokenization

ParseKit provides general-purpose string tokenization services through thePKTokenizer and PKToken classes. Cocoa developers will be familiar with theNSScanner class provided by the Foundation Framework which provides a similar service. However, the PKTokenizer class is much easier to use for many common tokenization tasks, and offers powerful configuration options if the default tokenization behavior doesn’t match your needs…

and grammar-based language parsing. Neat.

ParseKit allows users to build parsers for custom languages from a declarative, BNF-style grammar without writing any code (well, ok.. a single line of code). Under the hood, grammar support is implemented using the ParseKit Objective-C API, so the grammar syntax closely mirrors the features of the Objective-C API…

Cool, huh? This is an Objective-C implementation of the tools described in Building Parsers With Java apparently, and runs on Leopard and iPhone of course; check out the Google Code project page for code and more documentation!

Continue Reading →

Tutorial: UIPasteboard

Yet another not quite as thorough but still worth a gander 3.0 tutorial over on Mobile Orchard today, Copy & Paste With UIPasteboard:

There are two system pasteboards: a General system-wide pasteboard that’s used for copy-paste operations and a Find pasteboard that holds the last search string.

Additionally, applications can create their own pasteboards that can be used by other apps. For example, a point-of-sales app and a credit card terminal app could use a shared pasteboard to pass payment details back and forth…

Fairly straightforward stuff, especially if you’ve delved into NSPasteboard on the desktop … but since we actually never had any particular reason to do so all that deeply, it was still a worthwhile read!

Continue Reading →
Page 91 of 120 «...6070808990919293...»