Category Archives: Articles in english

iPhone: libxml2 & RELAX NG validation

Having a validating parser in place can reduce the required code to parse XML a lot – you know very well what you actually get. As mentioned in my last post about RELAX NG & trang, I prefer RELAX NG over W3C XML Schema – which doesn’t matter anyway because Apple’s suggested XML parser doesn’t [...]

XML Toolbox: RELAX NG & trang

e.g. when handling RESTful APIs you may want to validate the response XML – a custom one in most cases. I typically use tools already installed on every Mac and fire a http GET request with curl and immediately check it with xmllint like $ curl http://www.heise.de/newsticker/heise-atom.xml | xmllint –format –schema myschema.xsd – But I [...]

TextWrangler + tidy

as I didn’t get TidyService to work correctly with UTF8 umlauts, I created a UNIX Shell Script wrapper for html tidy as it comes with OS X that does the job at least for TextWrangler: open TextWranglers “Unix Filters Folder” create a file named e.g. “Tidy Html.sh”, paste the following lines into the file and [...]

Tooltip: doxygen & graphviz (OS X)

ever seen error messages like this when generating doxygen docs for an iPhone/Mac Objective C project: …/build/doxygen/html/a00136.png’ produced by dot is not a valid PNG! You should either select a different format (DOT_IMAGE_FORMAT in the config file) or install a more recent version of graphviz (1.7+) ? Happened to me this morning when running doxygen [...]

iPhone Unit Test Coverage

have a look at the CoverStory Howto, download CoverStory, open (with XCode) the XCode Project you want to measure, run the script EnableGCov.scpt linked to from the howto, run your tests and see a linker error, – dead end for the time being. http://groups.google.com/group/coverstory-discuss/browse_thread/thread/fbcbf5ed61d8d02b# have a look at the CoverStory Howto, download CoverStory, open (with [...]

iPhone: SQLite Fulltext Index

Most blogposts I found on this topic don’t explain it from the beginning, so it took me quite a while to figure out how simple and powerful the sqlite fulltext search API (FTS3) actually is. get the sqlite3 amalgamation sources (v3.6.22) and just unpack it into your iPhone project – sqlite3 as shipped on the [...]

Poignant: Xml meets Huffman

There’s a spec at the w3c about compressing (XML) named “Efficient XML Interchange” Format taking into account the grammar and likelihood of atoms within the document. They indeed use something similar the the Huffman Coding. The results are quite impressive – nice charts! There’s a spec at the w3c about compressing (XML) named “Efficient XML Interchange” Format [...]

NSCachedURLResponse / NSKeyedUnarchiver pain

as the iPhone SDK comes with a rather dysfunctional NSURLCache — Apple suggests to implement it from scratch yourself in the code examples about caching — I went for just this. Until I came across the [NSKeyedUnarchiver unarchiveObjectWithData:...] not restoring userInfo, storagePolicy and data of NSCachedURLResponse. Couldn’t believe it and spent almost the whole day verifying [...]

Binary Search NSArray

Though CFArray comes with binary search capability, NSArray does not – at least not within the iPhone SDK. The indexOfObject:inSortedRange:options:usingComparator: can’t be found. Plus the CFArrayBSearchValues doesn’t tell you whether the key actually is part of the list or not. That’s what the Java JDK does, so let’s implement some category methods -(NSInteger)binarySearch:(id)key; -(NSInteger)binarySearch:(id)key usingSelector:(SEL)comparator; [...]

underretain in CoreAnimation / iPhone Simulator

After upgrading to Snow Leopard and XCode 3.2.1 I’ve seen such console output CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0×3838000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug when rotating the iPhone Simulator in a project with base SDK 3.0. This can be reproduced as follows: Create a fresh [...]