Category Archives: Articles in english

install ruby @ OS X

OS X comes with a pretty hung ruby (1.8.7) until ‘Mavericks’. ruby 1.8.7 had it’s planned EOL long ago, even debian/stable nowadays comes with a newer one. So if you’re still running Mountain Lion or older, you may need to install ruby. I chose rbenv and here’s how I did: RTFM install rbenv: $ brew […]

redmine (rails) + puma + lighttpd

Running redmine with a lightweight ruby on rails/webserver stack on a debian server – puma and lighttpd: Assumed you’ve got both redmine and lighttpd already installed: install puma gem: $ sudo gem install puma caution: ArgumentError on ruby 1.8.7 get tools/jungle/init.d/puma to /etc/init.d/ get tools/jungle/init.d/run-puma to /usr/local/bin/ add a puma app: $ sudo /etc/init.d/puma add /your/app/path www-data $ […]

Catch JavaScript exceptions in UIWebViews

A small but useful category method on UIWebView: Turn uncaught JavaScript Exception into a NSError! // // Created by Marcus Rohrmoser on 05.12.13. // Copyright (c) 2013 Marcus Rohrmoser mobile Software. All rights reserved. //   #import "UIWebView+JavaScriptNSError.h"   #define NSERROR_UIWEBVIEW_SCRIPT @"NSERROR_UIWEBVIEW_SCRIPT" #define NSERROR_UIWEBVIEW_SCRIPT_CODE 1   @implementation UIWebView(JavaScriptNSError)   -(NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script error:(NSError * __autoreleasing *)error […]

UIColor from hex string, once again

I end up doing this once per year – at least it’s getting leaner each time. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 […]

git version sha in iOS apps

there’s tons of recipes out there how to do this – nevertheless I want to add another one: create a new build phase (here named “Git Sha -> Info.plist”) paste 1 2 3 4 5 6 7 8 # write git version SHA into Info.plist # # inspired by # – http://kswizz.com/post/2686511526/git-xcode-versioning # – http://stackoverflow.com/a/12658311 […]

Rank sql(ite) text search results

When searching for text snippets in sql databases you might want to rank the results according to “how good did it match”. And: the ranking shouldn’t make the query slower. Let’s take a simple example using the LIKE operator. (I know, FTS does a better job, but let’s stick to like for now). Assume the […]

Ruby: Simple Fast Fourier Transform

by far not as powerful as the Fastest Fourier Transform in the West but maybe sometimes useful for a quick data analysis or de-noising. Reads stdin and writes to stdout. Algorithm taken from Meyberg, Vachenauer: Höhere Mathematik II and ported to plain ruby myself. 1 2 3 4 5 6 7 8 9 10 11 12 […]

High-Res UIImage remote load

Loading UIImages automatically in high-resolution works fine for locally stored images – but if you want to fetch them via remote URL you have to code yourself. A simple, blocking but backward compatible (iOS >= 3.0, maybe even 2.0 but untested)  implementation could look like this: 1 2 3 4 5 6 7 8 9 […]

High-Res Artwork Management Automation

The iPhone4 comes with a super high-res display and to leverage that encourages App Developers to provide all artwork twofold – once “normal” and once in double resolution named equally with a “@2x” suffix. To ease my designers’ life and avoid confusion (and designers are easily confused I found) I ask them to provide the […]

Upgrade iOS SDK 4.0 -> 4.1 with custom location

again, for my custom install location I need to prepare: cleanly uninstall and remove cruft: $ dir=/Users/Developer.SnowLeopard $ sudo sh $dir/Library/uninstall-devtools $ sudo rm -r $dir/* $ sudo mv /Developer /Developer.deleteme then do the custom-location install and finally restore some hotfix softlinks: $ dir=/Users/Developer.SnowLeopard $ sudo ln -s $dir/Platforms /Developer/Platforms $ sudo ln -s $dir/SDKs […]