Latest Articles

Use the navigation at the bottom to see older articles

How to fix Core Data error: “Receiver type xxx for instance message is a forward declaration”

Core Data is great. But when you add it to an existing project Xcode throws some random error messages at you that make you doubt your sanity. Again. Legitimately copied and pasted code from Apple’s own templates generates totally useless errors such as Receiver type ‘NSManagedObjectContext’ for instance message is a forward declaration. This isn’t […]

How to add 64bit support to your iOS apps

Apple’s new A7 processors support 64bit under iOS 7 – but only if your app is specifically compiled for 64bit. Ideally you want to compile once and use 64bit if the architecture supports, and if not use 32bit for devices that have A4 – A6x processors. Since Xcode 5.0.2 you can do this, and here’s […]

How to read the contents of a file into a string in PHP

file_get_contents() can help us here. It reads a file and stores it in a string. Can be used with local files, as well as online content: $myLocalFile = file_get_contents(‘myfile.html’); $myOnlineFile = file_get_contents(‘http://wpguru.co.uk’); echo myOnline File; // would display the actual website This is different from the file() function which reads the contents of a file … Read more

How to replace text inside a string in PHP

If we have a string and would like to replace a portion of it, we can use the str_replace() function in PHP. It works like this: str_replace (‘whatToReplace’, ‘theReplacement’, ‘originalText’); It’s easy to remember… but I always get confused when I look this up in the manual. Here’s an example: $originalText = “Now is the … Read more

How to convert a timestamp into a readable date in PHP

A UNIX timestamp is something like a 10 digit (or less) integer number which represents the elapsed seconds since the 1st of January 1970 (also known as the Unix Epoch). It’s a very accurate representation of time, but not necessarily something us humans easily understand. A Unix Timestamp looks something like 1367805780. We can use … Read more

How to auto indent and collapse source code in Dreamweaver

I keep forgetting where and how to find this feature. Turns out the Command menu gives us such features: Commands – Apply Source Formatting (to Selection) Applies the correct indentations to the entire file, or your selection only. It’s the equivalent of Xcode’s “Editor – Structure – Re-Indent”. To manually move blocks of code, select … Read more