Author Archives

UILabel with a (custom) CGFont

UILabel’s font property accepts UIFonts – but strange enough there’s no way to get a custom loaded CGFont (from a ttf or otf file) converted into such an UIFont. You’re stuck with the iPhone’s pre-installed fonts – at least when you have to support iOS 3.0 devices. After googling a bit and searching Stackoverflow I found [...]

Visualise macports dependencies

to clean up your installed macports and remove cruft you need to uninstall them in the correct order – according to their dependencies. A graphical visualisation might help doing so: Call $ ./port-deps2dot.rb | dot -Tpdf -o port-deps.pdf ; open port-deps.pdf with the ruby script port-deps2dot.rb as follows: #!/usr/bin/ruby -w   # visualize macports dependencies. [...]

Develop with iOS 4 SDK on an OS 3.0 Device

After upgrading to iOS 4.0 SDK, iPhone OS 3.0 is no longer a valid “Base SDK”. Naively switching to iPhone 3.2 prevents deployment to a 3.0 device. But such “Project -> Edit Project Settings” work out fine: “Deployment Target” hint found here.

iOS 4 Simulator crash (when installed to custom folder)

just downloaded and installed the iOS 4 SDK and as my root OS X partition is rather (too) small, I put it into a custom location /Users/Developer.Snowleopard/. This causes the iPhone Simulator to crash and compiling gives an error like: ibtool failed with exception: Interface Builder encountered an error communicating with the iPhone Simulator. If [...]

XCode: missing “deprecated” warnings

when developing for long-term use, you want to use APIs that aren’t likely to be removed soon, a.k.a. “deprecated”. So, don’t use downward compatible calls below a point you really aim for. XCode helps with compiler warnings about “deprecated” calls – if “Project -> Edit Project Settings -> GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS” is set: But be careful, this [...]

Simple HTTP Access Authorisation

sometimes you may want to lock down RESTful APIs or plain HTTP GET resources for authorised access by your own client software only, without requiring authentication. You don’t know who (not authenticated), but you know she may access (is authorised). If the server has a valid SSL certificate based on a root certificate pre-installed on the [...]

Automatic gzip compression for Apache2 Webservers

after failing and failing again in the last months, I finally got it with the help of http://www.debian-administration.org/articles/137 The .htaccess configuration AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript requires Apache’s mod_deflate enabled via $ a2enmod deflate Module deflate installed; run /etc/init.d/apache2 force-reload to enable. Check the result with http://www.gidnetwork.com/tools/gzip-test.php Caution: There seems to be an [...]

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 [...]