365 (Re)Launch

August 26th, 2008
"Aaaargh"

It's 5 to midnight and I'm still yet to take an interesting photo of the day for my 365 gallery, when I say an interesting photo, I mean it in the sense of somebody who has lived in a box for any length of time and has been oblivious to the invention of the internet, tv or any other form of mainstream entertainment would find it interesting.
You'll then see me quickly run around the house trying to find something vaguely worth taking a photo of, normally a picture of my room or an attempt to get the kids to do something random.

Luckily this doesn't happen all that often, although more often than I'd like. Back when I started my 365 Gallery in 2006 I never really expected it to last too long but over the last 18 or so months It has changed my life significantly.

So getting to the point, if there ever was a point, I'm now proud to say that the website has been relaunched and rebranded into my current website as there seems no hope of me stopping it in the forseeable future.

"Yay" I hear you all cry! but wait, there's more..

You can now add comments! Exciting stuff eh, not to mention bigger pictures, faster downloads and 24/7 access, even when I've got half a dozen torrents on the go ;-)

So please go take a look over at http://scrivna.com/365/ and while you're at it subscribe to the RSS Feed

Love you all!

Jade (dog-face) Goody

August 19th, 2008



--- Start Rant ---

This woman is just such a bitch, I mean who is she? she's a nobody! and she's BBC front page news today. I have to say her agent is a fuckin miracle worker, but my god.

I think it just sums up what this nation is like, everyone is sooo interested in this nobody's life.

So she goes on a national T.V program is racist and offends 90% of the country, possibly the world, then she does this blatant publicity stunt to go on Indian T.V to say how anti-racist and great she is.

So by now the British population is back in love with her.. then oh wait, here comes the big one.. she conveniently gets cancer and now we are all meant to feel sorry for the racist greedy slag.

I wouldn't put it past her that in a few weeks we'll all hear that she's fine and it as really just a cheap and nasty trick to get herself out of the house before she says some other dipshit comment and gets herself lynched.

Anyone in this country who cares what this bint is doing should be shot!

--- End Rant ---

PHP File Diff

August 9th, 2008
So for anybody that has ever used Trac to look at your SVN repo's you'll know that there is a cool diff tool they use that shows the differences between change sets.

The tool shows the additions / deletions of the code highlighted in different colours with line numbers and some clever shizzle.

So anyway, I thought that was pretty cool so decided to have a go at it in PHP. You can see my attempt over here and the code for that page is available here.

It's a pretty simple class which compares and highlights all the differences between 2 files or strings located on your server. I was going to do loads of cool stuff with this but never got round to it. Hopefully his will be a helpful start to someone else.

Status Update

July 29th, 2008
Hey All!

So it would seem that I've finally got so annoyed with wordpress that I've written my own blogging software. It's taken a few weeks off and on and I've just finished writing the back-end so I can post entries, w00p!

The software is still a work in progress, I cant even add tags yet!

Hopefully there aren't too many bugs, hope you enjoy the new look!

Love you!

365... so far

June 21st, 2008
So thought i'd put together a compilation of my 365 project so far.. and here it is!

New Homepage!

June 15th, 2008
W00p!

So i've finally had the opportunity to re-vamp my personal site, it's reminded me how hard designing and trying to be creative actually is.

Anyway, you can find it over here... http://scrivna.com

x x x

PHP Force Download

April 22nd, 2008
So today I needed to force a file to download in a web browser where the browser would normally just output the file. It will also work in IE6 over a secure (HTTPS) connection.. which was a bit like hard work.

function forceDownload($file,$name=false,$contenttype="application/octet-stream",$delete=false){
	if (!$name) $name = $file;
	
	header("Cache-Control: public, must-revalidate");
	header("Pragma: hack");
	header("Content-Type: " . $contenttype);
	header("Content-Length: " .(string)(filesize($file)) );
	header('Content-Disposition: attachment; filename="'.basename($name).'"');
	header("Content-Transfer-Encoding: binary\n");
					  
	$fp = fopen($file, 'rb');
	$buffer = fread($fp, filesize($file));
	fclose ($fp);
	echo $buffer;
	if ($delete){
		unlink($file);
	}
}

Example Usage:
So I wanted to create a temporary file, write some contents to it then force the file to be outputted via the browser and deleted on completion of download.
$data = 'what a load of content';    // data to write to a file

$filename = 'cache/tmpfile.txt';     // the file to write the data too, must be writable
file_put_contents($filename,$data);  // write the data to the file

// force the download and delete the file afterwards
forceDownload($filename,'whateverfilenameyoulike.txt','text/plain',true);

Flashbacks Of A Fool

April 18th, 2008
Flashbacks of a FoolA really good, touching British Movie, set mostly in the 70's this is about Joe Scott a failing Hollywood actor played by Daniel Craig who "sees the light" (so cliche), but in spite of that this is a really unique film that gets you thinking.

The director (Baillie Walsh) obviously knew his market perfectly as the first 15 minutes are basically just Daniel Craig walking around naked. Fortunately this doesn't last throughout the whole film.

Special note deserves to go to Felicity Jones who plays Ruth Davies, a young sweetheart who Joe Scott (Harry Eden (Young Daniel Craig)) falls for. Her acting is great and she, along with the awesome soundtrack really expresses what the 70's must have felt for teens, glam make-up and a very funny Bowie scene.

Flashbacks of a Fool is one of those films that really makes you appreciate being young, and if your of an older generation than myself would probably bring back some good memories.

Got to be a 7/10 from me.

Worlds Best PHP Function

April 15th, 2008
pr($array)
Yes, I know wht you're thinking, how can Scrivna have written the ultimate time saving function? Well to be honest... I haven't... someone else did it and I've ripped it off :-)

Basically, what really annoys me is that when your writing code with big arrays of data and you need to view that data, print_r is your friend, it outputs an array to the page, only problem is it doesn't output it as html, the most common way to remedy this is to either...

A) View the source of the page so it appears formatted correctly
B) Wrap your print_r statement in
 tags
C) Do nothing and struggle like hell to read the output
D) Use my fabtabulous function below (trust me, this will save you hours)

And now for the big moment... here it comes.. are you ready for this?

Wait for it, drum roll please....

function pr($arrayness){
	echo '
';
	print_r($arrayness);
	echo '
';
}


Da na!! Yup, isn't it great!

Not only is it shorter than typing print_r all the bloody time, it also formats your output properly.
If you really are crazy you could do some kind of crazy merge with the function over HERE to buffer the output and put it into a variable... but that's for another day.

Thankyou and goodnight.

Official UK Top 40 Singles Chart (RSS Feed)

April 14th, 2008
So having got frustrated with their being no Official UK Top 40 Singles or Album chart RSS feeds I decided i'd make my own...

Singles Chart or Album Chart

It's currently just a page scrape of the BBC Charts page so it might not be that reliable.. or that comprehensive.
.
© Ross Scrivener 2008 | Contact