Archive for 'Programming'

Free Books

Here’s an eminently bookmarkable site we hadn’t heard of before; E-Books Directory, devoted to listing free downloadable books:

E-Books Directory is a daily growing list of freely downloadable ebooks, documents and lecture notes found all over the internet. You can submit and promote your own ebooks, add comments on already posted books or just browse through the directory below and download anything you need.

With 1796 books and counting, there’s something for probably pretty much everybody, but we’d like to draw your attention in particular to the 338 books currently in the programming category. Not to mention the rest of the ‘Computers & Internet’ category, or the quite possibly useful to a programmer mathematics and engineering categories. Good stuff!

h/t: DZone!

Continue Reading →
0

Code: Color Picker

Here’s a nifty piece of code: a touch-based color picker for your iPhone application!

colorpicker

Not that we can think of a good reason to use it just at the moment … but it’s a nifty piece of code to check out anyways!

Continue Reading →
1

Unit Testing

So up ’til now there have been some options for doing unit testing on your iPhone applications, but they’ve involved enough effort and annoyance that, well, they just aren’t used as often as respectable programming practice would imply. Not around here, anyways; more like idly kick the idea around, grumble “Why hasn’t Apple seen fit to integrate OCUnit as nicely as in desktop Cocoa projects?” and continue on with non-test driven development.

Well, turns out that it’s actually been there since SDK 2.2, in the simulator at least, and rumour has it that device support may be coming soon! So, it behooves us to get started now, as even running unit tests in the simulator is a useful exercise, yes?

iPhone Unit Testing at the OCUnit authors’ website is a quick introduction with sample project.

iPhone Unit Testing with OCUnit at 6Tringle is a great detailed tutorial.

And at the mothership, read the introduction, walkthrough, Unit Testing Guide, and otest and RunTargetUnitTests documentation to get a handle on just why it’s so nice to be able to take advantage of Xcode’s support!

And on a not completely unrelated note, here’s a project on Google Code called Bromine that aims to let you create automated interface tests:

It maps your entire application to XML structures so you can access your views via xpath and verify values, scroll tables, simulate touches, edit text and more.

This project was inspired by Matt Gallagher’s article (Cocoa with Love: Automated user interface testing on the iPhone) which brings, among others, the base technique for this project: simulate touch.

That looks worth working into as well for a complete testing strategy, indeed.

Continue Reading →
4

Snippet: 306 Colors

So there was this thread on iPhoneSDK where a fellow was wondering what UIColor to use to imitate Settings.app’s non-editable text — R81, G102, B145 was the suggestion — and along with that came a post of 305 other colors, from alizarin through zinnwaldite. Which is already more new words than we learn in an average day. So we figured we just had to grab that!

We’d repost it but it’s a bit long and annoying to reformat from text, as we know having just done exactly that … so if you want to find out what UIColors “caputMortuum”, “razzmatazz”, “tyrianPurple” and another 300+ are, download TWUIColors.zip and check for yourself!

UPDATES:

And there’s another UIColor helper set in Erica Sadun’s github collection!

UIColor Helper Library Providing 100 Predefined Colors And Easy Color Scheme Creation

Continue Reading →
0

Code: llamasettings

So, been thinking about implementing your app’s settings internally, perhaps with the code we mentioned before? Well, here’s another fine-looking option, llamasettings at Google Code:

llamasettings is a series of classes to be used in your iPhone SDK application that provide a standard-looking settings list.

There are some screenshots that you can look at of it in action.

Advantages over Settings.app

  • Pre-canned, working code – You don’t need to fidget with creating tables, figuring out default settings, etc.
  • Standard PLIST file format – based heavily on Apple’s settings schema, so it’s already something you know.
  • Integrated within your application – the user doesn’t need to exit the app to change a setting
  • More extendable – all of the source is available, with an easy interface to add more widget types
  • More configurability out of the box – provides things like date pickers, color pickers, and so on, not available in Apple’s Settings.app

h/t: iPhoneSDK!

Continue Reading →
1

Tip: Multiple keychains

As you’re quite undoubtedly aware if you work for more than one client, the process of switching signing identities to select the correct provisioning profile is … non-optimal, shall we say? Our current “solution” actually involves manually deleting all except the currently in use certificate from the login keychain so Xcode doesn’t descend into hopelessly gibbering confusion by actually having more than one distribution option available. And Ad Hoc … well, we just don’t even try that on our development machine anymore.

But ho! Here’s some instructions from an obviously very clever fellow who’s sorted out how to set up individual client keychains with the appropriate certs and keys for each portal you’re involved with. The main trick it seems for getting from what ought to work to what actually works without having to completely wipe your phone and restart while flailing at it is knowing that the only tool that apparently is any good is managing this stuff is iPhone Configuration Utility from Apple, so you should use it for all your profile work, and just make iTunes and Xcode shut up and stay out of the way while the grownups sort things out!

[EDIT: But watch out for some versioning issues with the device communication frameworks; if you've installed a 3.0 beta SDK and then install iPCU, you'll have to reinstall the beta SDK -- not the 2.2.1 release! -- before iTunes/Xcode will see your devices again. Whoops!]

[EDIT: And here is a useful wiki for your clients which includes instructions for the team agent to create and mail you the distribution profile and certificate. A useful place to point them at, indeed!]

[EDIT: And here's a tip for a script to add to set the keychain to what you want for a project:

#!/bin/sh
/usr/bin/osascript - <<***
tell application "Keychain Scripting"
set current keychain to keychain named "mike.keychain"
end tell
***

Yes, never forget that AppleScript is usable from the command line!]

Continue Reading →
0

Code: zip

Feel like using .zip compressed files in your iPhone program? Here’s a couple wrappers for Minizip to make that process easy!

For super simple needs, there’s nuzip on github:

NuZip currently has a trivially simple interface, methods called “zip:” and “unzip:” that take a single argument, a string that would correspond to the command-line arguments given to the minizip and miniunz tools…

And if you need a little more, there’s ZipArchive found on Google Code:

… it’s easy to use, you can declare a instance and call initialize functions, and then call addFileToZip or UnzipFileTo to finish compression or uncompression…

Also note some good advice in this thread about dealing with NSData objects and .gz files.

UPDATES:

Open Source Libraries And Examples For Zip, Rar, and 7-Zip Compression

Open Source Easy To Use iOS Zip Compress Library

mattt / Godzippa: “GZip Compression / Decompression Category for NSData”.

Objective-C Library Providing A Clean Syntax For Unarchiving Zip, Rar, And 7zip Files

Open Source iOS Library Providing Direct Access To Data Stored Within Zip Files

Continue Reading →
0

Resources: cocos2d

So there seems to have developed a general consensus in the iPhone development community that if you’re planning to develop a sprite-based game, the cocos2d-iphone framework that we mentioned waaaaaay back when and a bit later on is the way to go. So since we’re planning on doing exactly that, here’s a roundup of resources for your cocos2d development!

Project and wiki on Google Code, for starters.

cocos2d-iphone.org is the official center for all things cocos2d.

Sapus Media is the creator’s home page with links to cocos2d related stuff as well. Note blog.

cocos2d for iPhone API reference is there as well. Also note wiki. And how to install in Xcode.

Sapus Tongue source and optional support is available at varying prices, and we strongly recommend you support the author by purchasing it — hey, we did!

cocos2d-iphone-discuss is the nice and active discussion list. Note the community pages there as well.

[UPDATE: Due to massive Google suckage, the community is now a bbPress forum!]

cocos2d.org is the original Linux/Mac/Windows library using Python instead of Objective-C, where more useful documentation can be found.

cocos Live is a Google App Engine-hosted service for high score submissions.

cocoslive-discuss is the companion list for cocos Live.

[UPDATE: Now it's part of the above bbPress forum too!]

And more good stuff found around the web includes

Whitepaper: Introduction to Cocos2d iPhone from the experiences of the authors creating touchDefense with it.

Also see the cocos2d tag on one of the touchDefense authors’ blog … and on the other one’s too. Particuarly this post and source project about sprite colouring.

Here is a tutorial series covering setup through collisions and particle systems; also check out others with the cocos2d tag on that blog.

Cocos2d: Bouncing Ball Example is a walkthrough of creating a scripted animation.

Cocos2d Example – Bouncing Ball is, oddly enough, completely different than the last one, a walkthrough of creating non-scripted animation!

Scripting cocos2d-iPhone actions with XML is for your really hard-core scripting needs.

This fellow has open sourced his ABC123 game and a tile based game shell with accompanying tile map editor; see lots of good blog posts as well. Not to mention a cocos Live WordPress plugin, of all things.

Gorillas is another open sourced cocos2d game.

In case you missed it in the discussion links above, more sample games and miscellaneous files can be found at cocos2d-iphone-discuss.

Texture Atlas Creator is a nifty web application for, well, creating texture atlases, eponymously enough.

Speaking of which, Using Cocos2D AtlasSpriteManager has useful advice on using them.

Making Seamless Repeating Backgrounds is a helpful tutorial.

The SilentMac Design blog has some good cocos-tagged entries too.

Cocos2d Iphone Dynamically Touch Detection has some advice on implementing touchable sprites.

An introduction to game physics with Chipmunk gives you an excellent tutorial on the physics engine that comes with cocos2d.

If you like videos, here’s a Hello World app creation walkthrough.

And there’s various project templates in the above links, but here’s another and yet another on github. And even yet another on Google Code. And yet^4 another … and yet^5 another … they’re just everywhere!

… and finally, here is a bit of amusement for you. Remember when we posted that 3D engine roundup, and said “we’re definitely going to follow his experiences with the engines of choice!” Well, here’s your followup: he ended up using cocos2d with the Box2d engine port!

Over Easter I decided to drop a dimension in my iPhone project to go from a 3D evolution game simulator to 2D… It was obvious that cocos2d had already solved the problem of a simple game engine, and then some.

I was decided. The rapid progress I was able to affect in 2D with both chipmunk and box2d as well as the ready-to-exploit and well documented cocos2d game engine convinced me…

Well, with an endorsement like that, we know we’re on the right track here, yes?

[UPDATES:

BIT-101 Blog has some useful posts on curves, colors, menus, ... cocos2d tutorials gathered here!

Any more to suggest, Dear Readers?]

Continue Reading →
14

Tools: Clang

So we’ve mentioned the LLVM/Clang Static Analyzer already in passing, but there’s enough resources springing up all over to merit some more attention:

Bug Finding With Clang: 5 Resources To Get You Started has usefully descriptive links.

Automated Clang From Xcode has an AppleScript to enhance the convenience.

And for the ultimate in convenience, here is AnalysisTool: a GUI application which allows running both official and their custom analyses!

Well, we wouldn’t want to recommend anything without actual personal experience, so let’s run it over the project we submitted to Apple end of last week…

… OMFG!! 145 — ONE HUNDRED FORTY-FIVE — BUGS!! OK, deep breaths, deep breaths, let’s look at what they are. OK, those are in libvorbis, not actually a problem; and these are in libfaac, nothing immediately fatal there either; and libflac has some too, again no need to panic; and precisely one (a shadowed variable in framing.c, since you asked) in libogg.

And in my source … not a single one. No, not ‘just false positives’, actually no not a single quibble anywhere. We’re not completely certain if that makes us actually as clever as we’d like you to think we are, or just utterly OCD on our coding hygiene. Of course, there’s always the both option isn’t there?

In any case, we thoroughly recommend that no matter what you’re programming for, you familiarize yourself with Clang!

Continue Reading →
0

Tip: iPhone Virtual Memory

“What?” you’re no doubt thinking, “is he going on about? Everyone knows there’s no virtual memory on the iPhone!”

Ah, young padawan, let us correct your misconception. It turns out that, indeed, there actually is. Take a look through this moderately amusing rant about the indeterminacy of memory allotments on the iPhone and into the comments. There’s a variety of suggestions about killing other processes, hogging memory to your own process, and in general going out of your way to not play nice with others; which, well, that’s not the iPhone way, is it now? But then, there’s this piece of solid gold:

There actually is a virtual memory system pager. However you have to manually set it up.
Search for ‘mmap’ in Apple’s iPhone Developer Forum and you’ll find a very informative thread.
Basically, it works like this: In place of malloc, you create a file of the appropriate size and then memory map that file using mmap. The virtual memory pager will page in and out the memory pages as needed. This works both for read-only data (you can just use [NSData dataWithContentsOfMappedFile: ] for that) as well as read-write memory.

Woah. We were utterly and completely unaware that was supported on the iPhone. mmap FTW!

h/t: iPhoneKicks!

Continue Reading →
3
Page 78 of 95 «...5060707677787980...»