Latest Publications

Removing Git submodules

There is no git submodule remove command, but you can follow the hints given here http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule

Community ID installation and issues

CommunityID is a good server for OpenID. You can run it and provide your own authentication server for all sites that support the OpenID protocol. Unfortunately I had a series of issues when installing the product, so here is a step-by-step guide of how I managed to get it running.

  • Create the Apache configuration file for your virtual host
  • Then export the source code from subversion into the directory defined in your Apache configuration
  • Change permissions and ownership as required by the installation docs
  • In the file communityid/libs/Auth/OpenID/BigMath.php locate this code

    and change it to
  • Now create the database (do not use the new utf8mb4 encoding as it will silently not create some of the tables and you’ll get a blank web site)
  • You should now be ready to point your browser to http://openid.yourdomain.com/ and follow the installation procedure…

UTF-8 and MySQL

The UTF-8 character set allows a text to encode any of the 1,112,064 code points in the Unicode standard using one to four 8-bit bytes (known as octets in the Unicode Standard). UTF-8 stands for UCS Transformation Format – 8bit and has quickly become the standard text encoding for most internet based communication.

Although MySQL has support for UTF-8, it only allows up to three bytes per character. This is enough to cover the BMP (Basic Multilingual Plane), which contains virtually all characters in common use. However, recently there has been a growing number of characters that is becoming very popular, but most these characters require four bytes and are outside the BMP: they represent emoji and several other icons that can be useful in chat and messaging systems.

Such characters cannot be saved into a MySQL database with “utf8″, and the text you are trying to update or insert will be truncated at the first occurrence of a four-byte sequence. The solution to this came with MySQL 5.5.3, where a new character set was added known as “utf8mb4″. This is really the same as the existing “utf8″, but with full support for the specification, including four-byte characters.

Here is a quick list of links with more information on the topic

http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
http://mathiasbynens.be/notes/mysql-utf8mb4
http://stackoverflow.com/questions/7814293/how-to-insert-utf-8-mb4-characteremoji-in-ios5-in-mysql
http://stackoverflow.com/questions/10153529/emoji-on-mysql-and-php-why-some-symbol-yes-other-not
http://stackoverflow.com/questions/10580186/how-to-display-emoji-char-in-html

Recursive Diffs

The scenario: You have one folder, you make a copy of it, then you go about making some changes to the various files in each of the two separate copies.
The problem: You then need to find out what you have changed where. In other words, you need a detailed list of the differences between the two folders…
The solution: Under Linux or Mac OS X you can you the diff command with the -r switch, like so

…and the list of all changes (including files missing or added) will be displayed to your console…

XIB File Internationalization

In a previous post I discussed options for internationalizing iOS apps. In this addendum to that article I’m sharing an amazing discovery that has saved me so much work and time. You can actually take all of the strings out of a XIB file using the ibtool command in the terminal. You then translate the resulting .strings file into the language of your choice and generate a new localized XIB file from the original one using the same command line tool.
(more…)

Creating custom gesture recognisers for iOS

A custom gesture recognisers allows you to simplify the job of detecting specific touch patterns on a iPhone or iPad. Although some basic gestures (long tap, double tap, pinching and zooming, and so on) are already available from Apple out of the box, more complex finger movements must be detected by yourselves. By implementing your detection logic as a gesture recogniser, you make that logic much more easily reusable within UIKit. So here’s how to do it. (more…)

SQL JOIN: inner and outer

When joining two tables in an SQL statement, there are two options. You can use an inner join, or you can use an outer join. Let’s see what the differences are. (more…)

Multiple SSH/SCP invocations

In writing shell scripts sometimes you want to be able to execute several SSH or SCP commands in a row. Unless you have set up authorised keys on the server, each one of the commands executed in the script will require that the user enter their password for the connection to be established. Or you can use a nice feature of SSH whereby you open a “master connection”. The master connection passes your user’s credentials to the server and then allows several “slave connections” to perform operations through itself without the need for reauthenticating. (more…)

Get 10% off at freeagentcentral.com

FreeAgent Central is a great online application that keeps accounts in order for freelancers and small businesses. If you use a referral code, both you and the referrer get a 10% discount. I have been using FAC for the past two years and am greatly satisfied with it. If you want to use it too, use my referral code and we can both benefit ;-)

My Referral Code:

365afsjd

Or follow this link:

http://fre.ag/365afsjd

 

Remove all subversion info from a working copy

If you want to make a plain directory out of a working copy, you could use the svn export command and then delete the working copy. But if you’re running under a *NIX system with a bash shell, it might be quicker to just go

find . -name ".svn" -type d -exec rm -Rf {} \;

inside the top level folder of your working copy. This goes through every subfolder of your working copy and gets rid of the .svn directory that makes your files a subversion working copy.