Skip to content

Darren Nolan

Computer Tech… and stuff

MySQL: Return dates between two dates – Make Intervals Procedure

- Author: - 5 Comment(s)

Full credit to Ron Savage over at Stack Exchange. He's written this fantastic function which creates a temporary table with two columns, 'interval_start' and 'interval_end'.

You call this function with a MySQL datetime ('2011-02-23 05:00:00'), and a MySQL end datetime ('2011-02-23 16:00:00'). You then specify what you want returned back to you (Seconds, Minutes, Hours, Days etc. See the function below for the full list of options).

What is returned is below will be similar;

interval_start interval_end
2011-02-23 05:00:00 2011-02-23 05:59:59
2011-02-23 06:00:00 2011-02-23 06:59:59
2011-02-23 07:00:00 2011-02-23 07:59:59
2011-02-23 08:00:00 2011-02-23 08:59:59
2011-02-23 09:00:00 2011-02-23 09:59:59
2011-02-23 10:00:00 2011-02-23 10:59:59
2011-02-23 11:00:00 2011-02-23 11:59:59
2011-02-23 12:00:00 2011-02-23 12:59:59
2011-02-23 13:00:00 2011-02-23 13:59:59
2011-02-23 14:00:00 2011-02-23 14:59:59
2011-02-23 15:00:00 2011-02-23 15:59:59
(more…)

Categories: MySQL | Programming

PHP and HTML – Keep it clean, keep it separate

- Author: - 2 Comment(s)

I've been helping out of couple of friends with their University assignments recently and one thing that has bugged me to no end, is how they're not being shown how to keep code clean and manageable.

Take the following example (which is close to what their University lecture's have been giving out as an example).

<?php
	$fruitArray	= array(
					"apple" => "green",
					"tomato" => "red", 
					"banana" => "yellow", 
					"grape" => "purple", 
					"orange" => "orange");
	
	echo "<table>";
	echo "<tr>";
	echo "<th>Fruit</th>";
	echo "<th>Colour</th>";
	echo "</tr>";
	ksort($fruitArray);
	foreach ($fruitArray as $fruit => $colour) {
		echo "<tr>";
		echo "<td>" . $fruit . "</td>";
		echo "<td>" . $colour . "</td>";
		echo "</tr>";
	}
	echo "</table>";
?>
(more…)

Categories: PHP | Programming

New Site Design!

- Author: - 0 Comment(s)

Should have written this a few days ago, but as you’ve no doubt noticed, the Darren Nolan website has gotten a real design now!  One I absolutely love and promise not to change for at least 3 months.

So sporting in this fantastic new theme designed by my ever so talented flat mate Karl Short who works at Always Interactive, is a really cool Page Not Found 404 Error Page – because every personal website requires more black holes, folding sidebar (for viewers of screens less than 960px) and a temporary Mobile version of this site.  Which can be found by going to mobile.darrennolan.com on your handset or down the bottom of every page is a “Switch to Mobile Theme” link.

(more…)

Categories: Website

Insomnia has gotten the best of me

- Author: - 0 Comment(s)

So!  Here’s the site update.  In all it’s broken glory!  I promise to resolve the site issue tomorrow.  This my fellow readers is why it’s important to back wordpress up before switching themes… Wordpress deleted all your data for custom menus or widgets.  Shame on me.

Moving on – it’s time for bed as I’m required tomorrow morning at 9 for work.  Will get it all back and working tomorrow some time.

Cheers,

Categories: Website

REBOOT! The best kind of site renewal.

- Author: - 1 Comment(s)

While certainly not breaking any new grounds in terms of visual appealing effects – the site reboot brings just more structure to the previous site.  Being happy with the two fixed columns layout, as wordpress plugins like the Sharaholic or the Syntax plugin didn’t like sitting within the old layout.

This I believe was a little problematic as content sometimes got pushed down past the right floating sidebar, leaving a huge gap before scrolling down and seeing the page still continued.  But now it all sits nicely.  Until Karl gets the shits with my site and redesigns it that is.  =D

Hope you enjoy it 🙂

Categories: Website

<< Older Entries Newer Entries >>