Blog

Enabling Dwarf DSYM Debug Information Format in Xcode

Posted in | »

Enabling Dwarf DSYM debugging brings a number of benefits as listed in http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html.

Most developers will have Xcode's debug build configuration set up to build for the local architecture will all the deployment options firmly disabled.

When building for release however we want to build for all architectures, we may want the deployment options on and may wish to extract our debug symbols into separate DSYM files.

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 13:37

How to Crash a Cocoa App for Testing Purposes (aka Abnormal Termination on Demand)

Posted in | »

Sometimes you need to crash your Cocoa app to analyse its crash behaviour.

Apple offers some guidance on this http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html

#define CRASH_CODE 1
#if CRASH_CODE
	(void)strlen((const char *)1);
#endif

On Leopard with Xcode 3.1.3 and GCC 4.2 it seems that something more is required.

The most reliable way to ensure abnormal termination is courtesy of stdlib.h:

abort(); 

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 13:13

Code Signing for Auxiliary Executables Causes SSL Error kCFStreamErrorDomainSSL

Posted in | »

KosmicTask utilises SSL/TLS to ensure the privacy of network communications.

The app also utilises code signing to gain seamless access to the keychain and to permit incoming communications to be routed through the application firewall (see http://developer.apple.com/technotes/tn2007/tn2206.html).

Debug builds of the application worked as expected and SSL communications were established and operative.

Building for release though was another story. SSL communications failed with error kCFStreamErrorDomainSSL code -9800 (Operation could not be completed).

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 10:09

A Very Simple NSNumberFormatter Currency Subclass

Posted in | »

NSNumberFormatter is the class of choice when formatting numeric input for text fields. If you choose to use a currency symbol prefix then the default behaviours can be less than ideal.

If the user inputs the currency symbol then all is well. If not (inputting say 1.50 instead of £1.50) then the formatter raises an error and the user is nagged that a formatting error has occurred.

A simple fix is to subclass NSNumberFormatter and add the missing currency symbol if it is missing. The modified string can then be forwarded to the base class.

Submitted by Jonathan Mitchell on Tue, 08/11/2009 - 13:46

Drupal on mac OS X using XAMPP with virtual hosts.

Posted in | »

The use of virtual hosts allows us to effectively develop using XAMPP in a way that is similar to final deployment. It also allows for multiple installs of Drupal and permits developing for multiple sites using a single Drupal installation.

In this case we are aiming to set up a development virtual host installation with a URL of www.mugginsoft.local

Submitted by Jonathan Mitchell on Sat, 08/01/2009 - 21:50

Make Drupal 6 View Filter Selection Match View Argument

Posted in | »

The Issue here is that when filtering a Drupal 6 view using an argument the block filter selection does not match the argument.

Submitted by Jonathan Mitchell on Thu, 07/02/2009 - 22:10

Create a Drupal 6 View Block Based on Taxonomy Term

Posted in | »

Your Drupal view can be expressed both as a page and as a block. You can also filter your views content according to a taxonomy term argument. And now you want to generate your block according to the presence of your taxonomy term in your URL (either within a menu path or view search block request generated URI).

Usage

Just call MyViewBlockFromURI() wherever you require it. Stick it in a block if required. Also very handy in the header of a view - you can tie the view header into the content using the taxonomy term extracted from the URI.

Code

Submitted by Jonathan Mitchell on Tue, 06/30/2009 - 11:23

Exporting PDF as WMF in Illustrator

Posted in | »

I had to convert 17 PDFs to the Windows WMF format for inclusion in an Excel worksheet. Illustrator CS3 on OS X does a good job of exporting to the WMF format but a 40KB PDF ballooned into a 348KB WMF.

I reopened the WMF in Illustrator and re-exported the WMF as another WMF. The newly re-exported WMF had a file size of of just 76KB.

My knowledge of Illustrator is very limited so I have no explanations, but it does seem like a useful technique.

Submitted by Jonathan Mitchell on Sun, 06/14/2009 - 15:50

Getting and Setting Cookies in drupal_http_request

Posted in | »

A Drupal 6 http client request is constructed so:

$http_results = drupal_http_request($url, array(), 'GET', NULL, 3);

Some URLs, however, require that a cookie is passed to each request to ensure that a correct response is issued. First, however, the cookie must be retrieved from an initial request.

$http_results = drupal_http_request($url, array(), 'GET', NULL, 3);
$cookie = $http_results->headers['Set-Cookie'];
$headers = array('Cookie' => $cookie);
Submitted by Jonathan Mitchell on Sat, 05/30/2009 - 15:13

Storing Drupal Hierarchy in Subversion

Posted in | »

Often it may prove desirable to push an entire Drupal hierarchy into subversion. The example only provides for local file access.

On Fedora 8 subversion is already installed. To check if installation already present.

rpm -q subversion

Login as root and create subversion root dir and children.

[root~]# mkdir /svndir
[root~]# mkdir -p /svndir/repos
[root~]# mkdir /svndir/users
[root~]# mkdir /svndir/permissions
[root~]# chown -fhR webmaster.apache svndir

Now create repository for our html dir.

Submitted by Jonathan Mitchell on Sat, 05/30/2009 - 13:03