Posts Tagged 'Programming'

Twitter News Backend

Well, put this one down in the “too obvious to occur to us” category:

Using Twitter as a Backend(!)

Do you need a simple news feed for your application? You could probably rent a piece of server and code something in PHP, Ruby or Python, you could for example use google app engine as your backend.

But did you think about using Twitter?

No. No, we’ve implemented custom server managed news feeds, RSS news feeds, and probably half a dozen others that escape us at the moment … but using Twitter, that never occurred to us. And now that we think about it, there’s no functionality our various news implementations provided that couldn’t have been shoehorned into tweets. And the savings in coding time and management time, why yes indeed those are decidedly non-trivial. Next time the question of a news feed comes up, you can be sure that this will be the first suggestion we throw out, yes indeed it will.

And as a nice piece of synchronicity with that idea, we just noticed the availability of an open source Twitter client which looks quite well suited to this application:

… This time, we extended the functionality of the Twitter client with (1) a parser for Tweets and (2) the follower list.

The Twitter Parser looks for occurrences of special Tweets, which describe Service requests which occur in Tweetflows. Internally, the Twitter Parser uses regular expressions that describe the patterns which are searched for. If a Tweet matches the regular expression, the result is encapsulated in the TweetParserResult. We trigger the Tweet parser as soon as the delegate method statusesReceived of the Twitter Engine is called…

So there you go, then, save yourself a bunch of effort next time you want to put a news feed in an app!

h/t: @coffeedan, iphonesdk!

Continue Reading →

Simulator Automation: Sikuli

Now this is pretty nifty — Project Sikuli is a framework for automated GUI testing that works visually using screenshots, and it works on apps in the Simulator! Like this example:

… Select iPhone Simulator, bring URL bar up, enter, submit, type in sikuli as search term, wait for the results and click all visible star icons. This can take a bit to go through multiple times in a row and can become very tedious and frustrating. With sikuli you can run that as an automated script…


OK, now that’s some cool stuff. Looks well worth looking into for implementing automated usability regression testing on your apps, indeed!

h/t: iphonewebdev!

Continue Reading →

Animation Curves

Looking for some calculation functions for animation curves? Like, a lot of animation curves? Like …

More Animation Curves Than You Can Shake A Stick At


Not quite sure if it measures up to its billing, as hey we’ve got a pretty mean stick shake going; but why yes indeed it is a rather substantial number. Handy for all your custom motion needs!

h/t: ManiacDev!

Continue Reading →


Here’s an interesting modification to UISlider — OBSlider, which adds variable scrubbing speeds:

The iPod app on the iPhone has a nice feature: the user can slow down the scrubbing speed of the time slider by moving their finger vertically while dragging the slider. Yesterday, the question how to do this in our own code turned up on StackOverflow, which inspired me to find a solution. (By the way: I find this is an awesome way to improve my own coding skills. Find a question on SO that I cannot answer and try to work out a solution.)

The result is OBSlider, a drop-in replacement for UISlider with the addition of variable scrubbing speeds…

Looks like a pretty slick behaviour to add to your media-scrubbing sliders!

h/t: @joe_carney!

Continue Reading →

Custom Allocators

Here’s another of those digging into the runtime guts posts of Mike Ash’s worth reading:

Friday Q&A 2010-12-17: Custom Object Allocators in Objective-C

Finding your allocations too slow? Well, go write your own caching (or whatever) allocator then!

Another good reason to know how to do this, as pointed out in the comments, is if you’re working with crypto code (or any sensitive information, really) and it would be prudent to zero out memory after yourself when dealloced.

Continue Reading →


So everyone who’s done any Cocoa programming probably has an NSLog wrapper conditionally compiled on DEBUG for their development ease, but we seem to have seen quite a bit of gushing lately about this NSLogger project on github, so let’s take a look at the description and the Slideshare presentation here and see if it’s really all that, shall we?

NSLogger is a high perfomance logging utility which displays traces emitted by client applications running on Mac OS X or iOS (iPhone OS). It replaces your usual NSLog()-based traces and provides powerful additions like display filtering, image and binary logging, traces buffering, timing information, etc.

NSLogger feature summary:

  • View logs using the Mac OS X desktop viewer, accept connections from local network clients (using Bonjour) or remote clients connecting directly over the internet
  • Online (application running and connected to NSLogger) and offline (saved logs) log viewing
  • Buffer all traces in memory or in a file, send them over to viewer when a connection is acquired
  • Secure logging (connections use SSL by default)
  • Advanced log filtering options
  • Save viewer logs to share them and/or review them later
  • Export logs to text files
  • Open raw buffered traces files that you brought back from client applications not directly connected to the log viewer
  • You’ll find instructions for use in the NSLogger wiki.

Your application emits traces using the NSLogger trace APIs. The desktop viewer application (running on Mac OS X 10.6 or later) displays them.

Clients automatically find the logger application running on Mac OS X via Bonjour networking, and can optionally connect to a specific remote host/port. You have no setup to do: just start the logger on your Mac, launch your iOS or Mac OS X application then when your app emits traces, they will automatically show up in NSLogger if the viewer is running locally on your network. Until a logger is found, logs are buffered on the client so you don’t lose anything…

Oh-kay, that is indeed the Unquestioned Champion Of Hardcore Logging Frameworks that we’ve ever heard of, certainly. Particularly of note is logging images directly — we can think of more than a few times that would’ve been kinda handy — and these remote features, why we can think of many instances indeed these would have been wonderful:

  • Instrument your code to use a logger you instantiate on demand, in a release build. Combined with the ability to connect to the viewer remotely over the internet, this lets you distribute builds to testers or even customers, that have the capacity to connect directly to your viewer when running. One of the potential uses is live troubleshooting of issues in software running at remote locations.
  • Buffer logs to a file that you can later transmit to a server. The NSLogger desktop viewer can read this raw file (provided that is has the .rawnsloggerdata extension).

So yes, next time you have teh hardcore debugging needs, looks like this would be an excellent tool to pull out of your bag of tricks. Strikes us as just a little too much effort to go to without an obvious reason, so we’ll stick with our pretty basic DEBUG-conditionalized and not Objective-C dependent twlog() family of macros for the usually minimal logging needs we have … but next time we have one of Those Problems that just plain don’t appear on our test devices no matter how closely we follow the client instructions, yes out comes NSLogger to show us just what on earth is happening in the wild wacky client world, no doubt!

h/t: @holtwick, @openiphonedev!

Continue Reading →

State of the App Store

Here’s some interesting information for you:

The State of the iOS App Store [INFOGRAPHIC]

Splits up available apps by price, category, platform, etc.

Particularly intriguing was this data point:

“Number of unique developers: 62,126″

Presumably they mean “the number of developer accounts offering apps for download”. But how many is that, actually? Take us, for instance, personally we’re the only developer behind all the apps in one, two, three … twelve different accounts total it looks like. So if everyone was like us, there’s less than 5,200 actual iOS programmers out there. However, no doubt our ratio of 1/12th of a programmer per developer account — and counting!! — is on the unusual side. Probably a good number of those other 62,114 accounts have multiple programmers, in fact. So one does wonder what the actual number of active iOS programmers out there is. How about all of you? How many different client developer accounts are you responsible for?

h/t: @justinlbaker!

Continue Reading →

Illustrator Level Design

This is an interesting read for you:

How to use Illustrator, SVG, TouchXML and XPath for simple level design, meshes and other game data

… we wanted to try using Illustrator as a level/track design tool. Whilst we could’ve easily used Vertex Helper or similar for the Dwarf Derby project, Dead West has a complicated, layered set of co-ordinate-based game data (that Illustrator is well suited to managing).

The plan (and thus far successful execution) was this:

  1. Create nav mesh (just triangles for the purpose of this) in Adobe Illustrator
  2. Export from Illustrator to SVG
  3. Load that SVG in-game using TouchXML
  4. Build whatever data structures we need in memory by querying the XML/SVG document with XPath statements

This required some specific methods and tweaks, so I’ve brought those together below in a deliberately basic how-to…

It seems not completely dissimilar from the approach taken in the LevelSVG cocos2d project mentioned here, which as we mentioned in the BallZOut writeup uses Inkscape as its editor …

… in which case it would be nice to merge the two. Really nice. As Inkscape is … well, there are more painful programs to work with, but not very many. And Illustrator is not numbered amongst them!

Continue Reading →

iPod Library Sampling

So you want to play with audio from the user’s iPod library? You good with requiring 4.1 for your app? Then you should read

From iPod Library to PCM Samples in Far Fewer Steps Than Were Previously Necessary

iOS 4.1 added a number of new classes to AV Foundation (indeed, these were among the most significant 4.1 API diffs) to provide an API for sample-level access to media. The essential classes are AVAssetReader and AVAssetWriter. Using these, we can dramatically simplify and improve the iPod converter.

I have an example project, (70 KB) …

The ‘previously necessary steps’, in case you’d missed those too, were

In a July blog entry, I showed a gruesome technique for getting raw PCM samples of audio from your iPod library, by means of an easily-overlooked metadata attribute in the Media Library framework, along with the export functionality of AV Foundation. The AV Foundation stuff was the gruesome part — with no direct means for sample-level access to the song “asset”, it required an intermedia export to .m4a, which was a lossy re-encode if the source was of a different format (like MP3), and then a subsequent conversion to PCM with Core Audio…

Yes, that’s quite the process so it is. Meriting that post’s title,

From iPhone Media Library to PCM Samples in Dozens of Confounding, Potentially Lossy Steps

indeed. But hey, if you absolutely have to support anything besides the latest and greatest, then you’ll need to know that too!

Continue Reading →

Tip: iOS Fonts

Would you like a handy reference for rendered images of all the currently available fonts on iPhone and iPad? Here you go then:

iOS Fonts – ‘A Place for Happy Typography’

h/t: @Dylan_Beadle!

Continue Reading →
Page 40 of 87 «...1020303839404142...»