-
Recent articles
Recent Comments
Calendar
Tag cloud
6502 Apple Arduino BBC BBCMicrobit books breadboardcomputer coding computing Doctor Who education fiction Flotilla FridgeGizmo Fridge Gizmo ICT iphone kindle LCD lenovo Linux London MakeyMakey maths Microbit music OLED osx Pimoroni PiRadio poetry printer Python radio Raspberry Pi RaspberryPi raspbian reading recently read scratch SenseHAT teaching twitter weather writing
Flickr Colour Picker
Posted in Uncategorized
Leave a comment
Drowning in Numbers
I was doing a Google image search for Drowning by Numbers when I found this.
A nice idea, and something I’d thought of doing but not got round to. This is lovely and French, though. The 35, 45 and 90 are just simple stencilling, but so beautiful.
The rest of the site is worth a gander also. Some rather artful polaroids and a nice trip round the streets of Marseille in the footsteps of a tagger named Love.
Posted in Uncategorized
Leave a comment
Simple PHP text file editor
I was looking around for some VERY simple PHP code that would allow me to edit a text file on a web server.
I came across this code, but for the life of me couldn’t get it to work. It would read the contents of the text file but never modify it.
I don’t know if it’s a PHP dialect issue, but I’ve now got it working on Apache on Mac OS 10.3 with the following tweaks:
if ($submit)
at the top of the original is now
if (($_POST['submit']) == “submit”)
This detects if the form has been submitted; if it has, it then goes on to rewrite the text file.
fwrite($fp, stripslashes($newdata));
is now
fwrite($fp, stripslashes($_POST['newdata']));
Maybe I’m missing something, but it seems logical that a form returns an array, and in order to process the form you need to access the individual elements of the array. Just writing ‘$newdata’ (rather than telling PHP it’s the ‘newdata’ bit of the submitted form) seems too simple!
Anyway, here’s my code. You’ll need a text file in the same directory called data.txt and you’ll need to change its permissions I suppose. I really must read up on Unix permissions and PHP next…
<?php
if (($_POST['submit']) == “submit”) {
$fp = fopen(“data.txt”,”w”);
fwrite($fp, stripslashes($_POST['newdata']));
fclose($fp);
}
// was stripslashes($newdata);
$fp = fopen(“data.txt”,”r”);
while (!feof($fp)) {
$data .= fgets($fp, 4096);
}
fclose($fp);
?>
<html>
<head>
<title>php form test</title>
</head>
<body>
<p>Adapted from http://www.onaje.com/php/article.php4/23
by othermachines.org
<p>The contents of a text file called data.txt is displayed in
the edit window below and you can edit it and save it by
clicking on the Submit button.
<form action=”<? print $PHP_SELF; ?>” method=”post”>
<textarea name=”newdata” rows=”10″ cols=”40″>
<?
print $data;
?>
</textarea>
<input type=”submit” name=”submit” value=”submit”>
</form>
</body>
</html>
Posted in Uncategorized
Leave a comment
Purrfect USB hub
I’m tempted, very tempted by this:
This USB Hello Kitty hub responds to your typing, by talking and moving. Works in English or Japanese. PC or Mac. A snip at $80.
Posted in Uncategorized
Leave a comment
How to punish consumers for not stealing intellectual property
I’m usually very happy to pay �10-15 or so for a DVD, especially if it’s one of the finer products of the good people at Pixar or Lucasfilm.
But I really hate having to sit through adverts (or skip through them) to get to the main feature, especially when a 2 year old is screaming he wants to watch Toy Story and he wants to watch it NOW, while the phone is ringing and the pan boiling over… Disney are especially bad at piling on the trailers which you cannot bypass by pressing ‘menu’.
But the Star Wars Clone Wars animated feature DVD has hit a new low.
You first get a short film about the evils of DVD piracy.
You then get a selection of text slides about the evils of DVD piracy, and in case you try to skip them YOU HAVE TO SIT THROUGH THEM ALL OVER AGAIN.
Oh and how we love the Australian copyright message. And the Norwegian one.
The irony of this is that if I got a pirated version of this DVD, all that crap would have been cut out and I, the shmuck who pays for legit DVDs get the lecture, and the people who buy dodgy copies from car boot sales get to go straight to the feature…
Posted in Uncategorized
Leave a comment
