Archive for the ‘Tips’ Category
Thursday, October 18th, 2012
At work we're heavily depending on Unit and Functional Testing for our current Android application. For Unit testing we've set up a pure Java-based project that runs on Robolectric to provide a functional Android environment and we also added Mockito to the mix to ease some code paths with spied-on ...
Posted in android, Coding, Tips | No Comments »
Tuesday, September 27th, 2011
You know the times, when things should really go fast and easy, but you fall from one nightmare into another? Tonight was such a night... but lets start from the beginning.
To debug PHP you usually install the excellent XDebug and so did I with the port command sudo port install ...
Posted in Coding, MacPorts, Tips | 1 Comment »
Monday, July 25th, 2011
If you catch and rethrow exceptions in Java, you probably know about exception chaining already: You simply give the exception you "wrap" as second argument to your Exception like this
try { ... }
catch (Exception e) {
throw new CustomException("something went wrong", e);
}
and if you look at the stack trace ...
Posted in Coding, Tips | No Comments »
Wednesday, July 13th, 2011
If you're desperately trying to get the Menu button in an Android x86 installation working under VirtualBox on a Mac OS X host - whose keyboard of course doesn't have this "context" / "menu" key Windows keyboards have on the right - you might find the touch-only-device mode in Android ...
Posted in android, Free Software, Tips | No Comments »
Saturday, June 4th, 2011
This is a short follow-up of an earlier post where I explained how one can set ACLs on FreeBSD. Today now I'll do the same on another BSD variant, namely Mac OS X, and guess what, the guys from Cupertino implemented ACL management in a completely different manner.
The first thing ...
Posted in Tips | 3 Comments »
Thursday, May 26th, 2011
Migrating a database dump from SQLite to MySQL can be somewhat of a hassle. After various trials I came up with the following that worked for me quite well:
echo .dump | sqlite3 mydb.db |\
egrep -v "\b(BEGIN TRANSACTION|COMMIT|PRAGMA|sqlite_sequence)\b" |\
perl -pe 's/^([^'\''"]*)"([^"]+)"/\1`\2`/' |\
perl -pe 's/\bautoincrement\b/auto_increment/' |\
...
Posted in Free Software, Tips | No Comments »
Wednesday, August 11th, 2010
sed is usually my favourite tool to search and replace things from the command line, but sometimes Perl's regexes are far more convenient to use. Recently I found out another reason why Perls -pi -e is superior over plain sed: when you want to change multiple lines in a document!
Imagine ...
Posted in Coding, Tips | No Comments »
Thursday, February 4th, 2010
In case you have to access a very restricted SSH server which only accepts a single key (ie. the one which is set up in ~/.ssh/authorized_keys) and otherwise fails, its the easiest to set the specific key in your local ~/.ssh/config file as follows:
Host very.secure.server
IdentityFile ~/.ssh/id_dsa
...
Posted in Tips | 2 Comments »
Monday, January 25th, 2010
Imagine you have a business method in your model which needs to be accessed by two environments: once from a symfony task and once from the web. So far so good, now what if this business method should be able to log contents somewhere visibly, in case of the command ...
Posted in Coding, Tips, Work | 2 Comments »
Thursday, December 24th, 2009
The current version of Thunderbird comes with a terrific global search functionality, but sometimes its cumbersome to watch it reindex the email history if something corrupted the database or to get emails in the search results which you're absolutely not interested in (commit messages, f.e.).
Unfortunately Thunderbird 3 has only a ...
Posted in Tips | No Comments »