Sep 04
alexCode Snippets
If you want to organise or display data on a website, the best way is the php function ‘while’. Example of usage:
$i = 0;
while($i <= 6) {
echo $i;
$i++;
}
This code prints out the numbers 0 through 6 (0123456). Advancing this, you could have an array with 3 values in, and call them up like this:
$array = array('one', 'two', 'three');
$i = 0; // Remember Arrays start at 0
while($i <= 2) { // After I reaches 2, this loop stops - that gives the three values
echo $array[$i];
echo "<br>"; // html code for line break
$i++;
}
This code gives the following output:
one
two
three
I’ll advance on this later, but for now – it’s late.
Sep 01
alexCode Snippets
I’ve got this information whilst coding Navigate Nigel. The issue I was having was when checking for the current frame of a UIImageView, it would return the end point of the UIViewAnimation. This is because Core Animation sets the frame to the end point, then deals with the animation. To get round this, it’s just one bit of code. In the code, I have named the object I am checking the frame for as “view” – this could count for any object in your application.
[[view.layer presentationLayer] frame]
And that’s all!
Aug 28
alexUncategorized
Here’s the books i’ve got recently, and how you can get them yourselves. Not yet read through them.
Had these books for a while – in fact, bought them in Australia whilst on holiday. These have been really useful.
All links will take you to the Amazon UK website. If you’re in another country, just replace “.co.uk” with your own country extension. (i.e.. .com, .fr)
Off to do some reading..
Aug 26
alexMini Posts
Well, as I’m sure you’ve heard, HP are discontinuing webOS and the same goes for the devices using it. In the US, the price for the 16GB version was slashed to $99, a saving of about $300. In the UK, HP announced earlier this week that they were slashing the prices from £349 to £89. This, of course, caused consumers from all over the UK to source one of these for themselves. Turns out, they’d sold out by tuesday night. I was too late.
Or so I thought…
As I went into work this evening, I checked the stock levels of them, and surprisingly we had 80 in stock! I grabbed one straight away, and after about an hour, we had none. Turns out we have some of the 32GB models still, so I think i’ll get a couple of those too tomorrow. Anyway, with discount, it came to £78.
I’ll post again once I collect it/them on Thursday.
Aug 26
alexMini Posts

Got one more coming – “The Android Developer’s Cookbook”. From that, i’ll decide whether I want to move into Android development as well.
I took the image with an iPad – I can’t get over how they can call it a HD camera when it’s as grainy as it is.
Aug 26
alexArticles
So, you’ve started to develop applications, but you don’t know who to use for your website etc? Personally, I use a VPS from www.lcn.com. A VPS (Virtual Private Server) may be overkill for your needs, but if you’re serious about iPhone development, you’ll need one. If you’re creating and hosting your own achievement/leaderboard system, you’ll enjoy the flexibility of a VPS much more. You can also make it a lot more secure than shared hosting, and it’s much, much more reliable – especially with LCN.
I’ve used all sorts of different VPS providers – BurstNET, QualityServers, 123Systems – but in my opinion, none of them have lived up to expectations as LCN have. It’s probably to do with the fact that the server just works – i’ve had 0 downtime since I created a VPS with them 3 months ago. The same can’t be said at all for the other 3 providers i’ve used – there always seemed to be some sort of urgent maintenance, or moving between servers. They didn’t seem like stable companies (with the exception of BurstNET, where there’s just too many people on one node). With LCN, you’re paying around 6x the cost for an equivalent server, but you’re getting 1000x the stability and support. More
Aug 26
alexTutorials
This tutorial marks the launch of the beginner iOS tutorial series. UIAlertViews are the blue boxes that pop up in the middle of the screen. They look like the image on the left hand side.
Standard UIAlertViews have 3 components that are editable by the developer – there are some advanced things people have done, such as add sliders etc, but it’s not standard interface procedure and it doesn’t look that good. The components are the title, which is shown in bold at the top of the alert, the message, which is the text in the middle – The alert view expands in height if the message is too long, and the buttons. In this first part of the series i’ll explain how to launch one of these UIAlertViews with 1 button which dismisses the alert.
Firstly, set up a new “View-based Application” project in Xcode. Set the product name to whatever you want – i’ll be setting mine to “UIAlertView App”. Leave everything else as default.
Once the project has loaded, select “{Your App Name}ViewController.m” You should see a bunch of code in the right hand side. Find this function:
-(void)viewDidLoad
It will be commented out, and show green. To un-comment it, remove these two markings:
/* ... */
They’ll wrap round the viewDidLoad function. Once you’ve done that, add the following code before this line:
[super viewDidLoad];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test" message:@"This is an alert view"
delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
This initiates a new UIAlertView with title “Test”, message “This is an alert view” and button “Dismiss”. Once you’ve identified those in the above code, you can change them to whatever you want. This isn’t the end of the code we need though. We need to tell the application to show the alert. To do this, add this piece of code directly underneath what you just wrote.
[alert show];
Again, that’s not all! There’s one more piece of code we need. It’s a bit of memory management, and not strictly necessary, but it’s good practice. Add this below the [alert show]; instruction:
[alert release];
And that should now work. You can now run the application, and pat yourself on the back.
Part two will be about how to use multiple buttons, and how to handle when they are pressed.
Aug 25
alexTutorials
Just found the perfect opportunity to post a mini-tutorial! Setting up this new site is proving productive. Anyway..
Firstly, you should know which theme is the current active theme. To do this, log into the admin dashboard, and go to “Appearance” -> “Themes”. It should be listed at the top of the page. Once you know this, you can move on.
There are a couple of options from here to access the file we need to change. One is FTP (which I hate) and the other is SSH (which I love). However you access the file, it doesn’t matter. Navigate to {wordpress root}/wp-content/themes/ on the server. Pick the theme which is currently active on your blog (it should be obvious, and named similar to what you found before).
Now, if you’re using FTP, download the page.php file. (Did I mention I hate FTP?) Edit the file as below and re-upload.
If you’re using SSH, use this command:
nano page.php
and edit the file as below. After editing save with Ctrl+O and Ctrl+X.
What to edit:
Find this in the file:
<?php comments_template(); ?>
Or at least, something similar to it. Now, change it to this:
<?php // comments_template(); ?>
Basically, “//” ‘comments’ out the comments and prevents it from loading.
And that’s all! Everything should be fine now, and you won’t have comments on pages.
Aug 25
alexNotices
Well, as you can probably see, i’m now running on a new website. I’ve decided that i’ll not only blog about my own development, and statuses on applications etc, but that I’ll also post mini-tutorals and code snippets as and when I use them. I’m keeping the content i’ll be creating quite vague, because I’ll probably be doing posts on Objective-C and PHP.
I’m coming to the end of the development of Navigate Nigel – I have 5 more levels to complete, the final piece of music to be handed over to me, and some other little things to polish the game off. It’s taken around 3 months from design to completion so far, however production has ramped up over these past few weeks. www.NavigateNigel.com will have the latest information when I get round to editing it, so keep checking back to it.