Blog

How to test if your server is running Windows from PHP

Posted by on 9:15 pm in Knowledge Base | Comments Off on How to test if your server is running Windows from PHP

If we’re executing shell commands via PHP we need to know if the server is running Windows or Linux. Thanks to a magic constant in PHP we can find out like this: echo PHP_OS; This will give us a single value like Linux Darwin Windows WINNT With that info at hand, we can write a function that delivers a boolean result (courtesy of the PHP manual): if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { echo 'This server is running Windows!'; } else { echo 'This server is NOT running Windows!'; } This takes the...

read more

How to install Mac OS X onto an external hard drive

Posted by on 12:09 pm in Knowledge Base | Comments Off on How to install Mac OS X onto an external hard drive

How to install Mac OS X onto an external drive http://support.apple.com/kb/ht5911 http://support.apple.com/kb/ph11273 http://www.hongkiat.com/blog/clean-install-mountain-lion/

read more

How to tweak style code blocks in WP Code Highlight

Posted by on 3:00 pm in Knowledge Base, Plugins | Comments Off on How to tweak style code blocks in WP Code Highlight

I love the WP Code Highlight plugin by BoLiQuan. It brings well deserved colour to code blocks wrapped in PRE tags. I use them a lot, but until I discovered this plugin they all looked grey and bland. Since last year I was using them on my iOS Dev Diary and thought since both sites are now running the same layout I’d integrate code highlighting here to (new for 2014). Out of the box however it didn’t look as nice as I wanted it to: I’m using it with P2 (or P2 Categories actually) so it needed some pazzazz. Here’s what...

read more

How to share your posts on Google Plus publicly via JetPack

Posted by on 12:59 am in Knowledge Base | Comments Off on How to share your posts on Google Plus publicly via JetPack

I’ve decided to start using Google Plus more in 2014. Thanks to JetPack 2.7 it’s a breeze to publish my posts on Google Plus without having to share them manually. What I’ve noticed though was that by default all my posts were appearing as “privately shared” only. As I’d like the widest audience possible I would really like them to be shared publicly. I can do this when I manually post to Google Plus (for example via a Share button, or via the Google Plus app). Help is of course at hand – it’s...

read more

How to display a “spinning wheel” indicator in the centre of your screen

Posted by on 9:01 pm in Knowledge Base | Comments Off on How to display a “spinning wheel” indicator in the centre of your screen

Sometimes you want to tell the user that something’s happening behind the scenes and that there’s no need to panic. While your process is happening you can display a “spinning gear” in the middle of your screen. One way of doing this is via a UIActivityIndicatorView. You can create them in Interface Builder, but it’s very easy to create one and show it if and when necessary. Here’s how: - (UIActivityIndicatorView *)indicator { if (!_indicator) { _indicator = [[UIActivityIndicatorView...

read more

How to load a different storyboard depending on screen size in iOS

Posted by on 2:00 pm in Knowledge Base | Comments Off on How to load a different storyboard depending on screen size in iOS

As much as I appreciate the idea of Auto Layout, I don’t think it likes me very much. In turn, I don’t like Auto Layout very much. The pain and hassle it takes to make several UI elements fit well on a 4 inch screen as well as a 3.5 inch screen regularly drives me crazy. On paper it’s a great idea – but in reality not fit for prime time. It’s not a coincidence that we can choose completely different storyboards for iPads and iPhones. Let’s take the same approach when dealing with the two different iPhone...

read more

How to dismiss the iOS Keyboard when the done button is pressed

Posted by on 11:03 am in Knowledge Base | Comments Off on How to dismiss the iOS Keyboard when the done button is pressed

It has puzzled many generations how to get rid of the keyboard when the user is done entering text into an iOS text field. There doesn’t seem to be an obvious action we can attach to make this happen. That’s because rather than looking at the keyboard itself, we need to look at what actually brought it up in the first place: the UITextField. Even though the text field can trigger an action, we don’t want to touch that for dismissing the keyboard. All we need to do is to implement the following method from its delegate...

read more

Links to the latest Social Icons

Posted by on 10:51 pm in Knowledge Base | Comments Off on Links to the latest Social Icons

Facebook, Twitter & Co. change their brandings every now and again, and every time I need them for a project I keep scrambling to find the official links. Well no more – here’s a list of them all: Twitter: https://about.twitter.com/press/brand-assets Facebook: https://www.facebookbrand.com LinkedIn: http://developer.linkedin.com/documents/branding-guidelines Apple and App Store: https://developer.apple.com/app-store/marketing/guidelines/

read more

How to increase your Build Number automatically every time you build your Xcode Project

Posted by on 5:21 pm in Knowledge Base | Comments Off on How to increase your Build Number automatically every time you build your Xcode Project

Xcode includes something rather magical called the Apple Generic Versioning Tool. With this tool you can increase your Build Number automatically every time you hit “Build and Run” in Xcode. Here’s how you can add it to your project. I’m using Xcode 5.1 here with a new Single View iOS project. But this will work just fine in other versions of Xcode. By default, Version and Build are set to 1.0 (in your app target, under the General tab). We want to leave Version alone and only increase Build. Head over to the Build...

read more

How to read you App Version and Build from the Main Bundle

Posted by on 4:52 pm in Knowledge Base | Comments Off on How to read you App Version and Build from the Main Bundle

The required Version and Build numbers you add to Xcode make it into your app’s Main Bundle. You can retrieve those values from the Main Bundle and use them in your app. Here’s how: - (void)viewDidLoad { [super viewDidLoad]; // set version and build fields from bundle NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; // display in your own labels...

read more