3, 2, 1, we have liftoff

Tags: February 19, 2005 (0 comments)

Countdown Scripts, we all need one somewhere, even if it just until our next birthday :P So, here's mine:

<?phpfunction countdown ($count) {$difference = $count - time();$abs_difference = abs($difference); $days = floor($abs_difference/60/60/24);$hours = floor(($abs_difference - $days*60*60*24)/60/60); $minutes = floor(($abs_difference - $days*60*60*24 - $hours*60*60)/60); if ($difference != $abs_difference) {return "It was $days days$hours hours and $minutes minutes ago!";} else {return "Only $days days$hours hours and $minutes minutes to go!";} }?>

To use it, you pass a *nix timestamp in the function call, eg. countdown (1108774476);
Remember you can also use the mktime function, eg. countdown (mktime (3, 20, 0, 4, 20, 1992));
Lastly, it returns the string, it doesn't output it, so to output it you'll need to use echo or print, eg. echo countdown (1108774867);

Regent Street Apple Store

Tags: February 16, 2005 (0 comments)

So, I just got back from London, and the Apple Store, so, what did I think? Big.

235 Regent Street is one huge building, and with the middle of it empty, so when you walk in, you see the displays on both sides, and the glass stair case. The effect this gives is incredible.

Head to the right, and you'll find consumer products, and to the left, professional products. Upstairs, there is software, the genius bar, the studio and lastly a theatre.

While it looks good in photos, they give you no scale of the size of it, think of how big you think it is, then times that by 10, then you're closer to the real size.

Lastly, what did I buy?

  • iWork '05
  • iLife '05
  • iSight
  • Virtual PC 7 Mac Upgrade

Geoffers' 1.1

Tags: February 7, 2005 (3 comments)

So, I've finally finished it, so, basically, the question is: "What do people think of it?"

History

  • Images come online - 1st February (Evening)
  • I think about what to do - 1st February until 6th February
  • I show a couple of people an early beta version - 6th February (Evening)
  • Post at CF to eliminate final bug - 6th February (Night)
  • Read the post at CF, then apply the changes to the CSS - 7th February (Evening)
  • Tidy up the CSS - 7th February (Evening)
  • Version 1.1 becomes Golden Master - 7th February (Evening)

The forgotten command: switch

Tags: February 4, 2005 (15 comments)

Everyday, I see lots of people using code looking something like this:

<?php $rand = mt_rand(1,10); if ($rand == 1) {echo 'What ever you want to do if $rand == 1';} elseif ($rand == 2) {echo 'What ever you want to do if $rand == 2';} elseif ($rand == 3) {echo 'What ever you want to do if $rand == 3';} elseif ($rand == 4) {echo 'What ever you want to do if $rand == 4';} elseif ($rand == 5) {echo 'What ever you want to do if $rand == 5';} elseif ($rand == 6) {echo 'What ever you want to do if $rand == 6';} elseif ($rand == 7) {echo 'What ever you want to do if $rand == 7';} elseif ($rand == 8) {echo 'What ever you want to do if $rand == 8';} elseif ($rand == 9) {echo 'What ever you want to do if $rand == 9';} elseif ($rand == 10) {echo 'What ever you want to do if $rand == 10';} ?>

When, surely, it is easier to use the switch command, which will require less code (although more whitespace is common) and will be more readable, it'd look something like this:

<?php $rand = mt_rand(1,10); switch ($rand) { case 1:echo 'What ever you want to do if $rand == 1';break; case 2:echo 'What ever you want to do if $rand == 2';break; case 3:echo 'What ever you want to do if $rand == 3';break; case 4:echo 'What ever you want to do if $rand == 4';break; case 5:echo 'What ever you want to do if $rand == 5';break; case 6:echo 'What ever you want to do if $rand == 6';break; case 7:echo 'What ever you want to do if $rand == 7';break; case 8:echo 'What ever you want to do if $rand == 8';break; case 9:echo 'What ever you want to do if $rand == 9';break; case 10:echo 'What ever you want to do if $rand == 10';break; } ?>

Of course, use of switch is not limited to number generated by the mt_rand command, it's just what I've chosen to use in my example here, partly because I've been using mt_rand quite a lot recently...

Relevent PHP Manual Pages:

Imaged by popular demand

Tags: February 1, 2005 (2 comments)

After many people have complained about the lack of images, I've finally given in, and here they are. There are 8 6 images, randomly chosen by the server on every page, hope you like them :)

I've put all the images onto the next page...

[Edit]New design, images aren't online anymore[/Edit]

Page:  1 … 26 27 28