Category Archives: General

Trail camera – first outdoors test

Last night I packaged everything up in the trail camera lunch box and gave it the first outdoors test. The first thing it captured was this little guy!

I think there may still be a few things to sort out. The PIR sensor may not be very sensitive or the code may not be 100% functioning correctly (though it seemed to be in all other tests I ran indoors), as the videoing stopped before I would have thought it should. However, as the very first thing it captured was the hedgehog I am very pleased with the result!

Did you like this? Share it:

Dynamically control PiCamera record length: motion sensor fun with the Raspberry Pi

One thing I’ve always wanted to do with my Raspberry Pi was to build a trail camera, and when the Pi Zero was released with a camera port I thought that it was about time I stopped wanting to do it and actually just do it.

It took a while to get parts delivered from various places, but eventually in the last week or so I have finally built a trail camera. I’ll probably post more about that at a later date, but the most intriguing part for me was the programming…

Most of the trail cameras I had seen on the internet that people had built would either take a photo when a PIR sensor was triggered or would take just time lapse photos all night. Neither of these solutions really appealed to me. What I wanted was a video, and more than that I didn’t just want a video to record for a few seconds and stop. I wanted it to keep recording as long as there was movement triggered by a PIR.

In the end I came up with quite a nice small solution using Python and I’ve put it up on GitHub so feel free to fork and use or improve.

What I like about my solution is that when the PIR is triggered it will start recording for a definable number of seconds. If the PIR is triggered within that time it’ll just extend the record time by that many seconds again, and so on and so on until the PIR hasn’t been triggered for at least that many seconds at which point the recording will end.

Easy to use and exactly what I wanted. So feel free to grab my trailcam phython script on GitHub.

Did you like this? Share it:

phpiwire updated – now with PWM!

I’ve pushed a few changes to phpiwire can now use the PWM functions in wiringPi.  You can use either the hardware PWM pins or any of the GPIOs by using software PWM.  A couple new examples of how to do this have also been added to the repository.

With software PWM comes the requirement to include pthreads, so that’s also linked when you compile the zephir extension.

I’d recommend you do a full clean first before compiling with:

zephir fullclean
zephir install
Did you like this? Share it:

PHP South Coast 2015

I’ve just arrived back from the inaugural PHP South Coast Conference.  It was a really great event that seemed to go without a hitch, had a fantastic range of speakers and a nice bunch of people that attended.  So first of all, a really big thank you! to PHP Hampshire, BrightonPHP and PHP Dorset for putting on a top-notch event – you really wouldn’t have known it was their first one as everything seemed so professional! Continue reading PHP South Coast 2015

Did you like this? Share it:

BrightonPHP lightning talk on Zephir

Yesterday I was one of four people to do a lightning talk at BrightonPHP. As anyone who knows me; I hate public speaking with a passion. Anything over, say, four people (usually including me) and I just like to sit there quietly and not say much. But encouraged by @coderabbi’s Wisdom as a Service talk he did at BrightonPHP in February (read: told at the train station by coderabbi that I had to do a talk) and the fact that it was a lightning talk so I didn’t actually have to speak that long, I presented a very brief, high-level overview of Zephir.

If you think any of this is inaccurate, needs tweaking, etc., then please let me know and I’ll happily update it accordingly.

Well done also to Rich, Rowan and Tristan for their very informative talks on, xml/json and selenium (respectively)…  Although I’m the only one that didn’t get an applause after their talk, so you’re all dead to me. 😛

Did you like this? Share it:

‘Open in PhpStorm’ context menu for Windows

I’ve just started to use PhpStorm, which is a wonderful IDE. However, I wanted to make it even easier for myself to open files and folders. A context menu in Windows fits the bill quite nicely – just right-click on a folder and open in PhpStorm.

This batch file will do just that!

loading gist file...

Just set the path to whatever suits your system and then right-click and ‘run as administrator’ on the batch file.

Did you like this? Share it:

Book review: Instant simple botting with PHP

I had the chance recently to read the book Instant Simple Botting with PHP, written by Shay Anderson and published by Packt Publishing. The book is designed to be a very quick and easy (hence the title!) introduction in to creating bots to scan web pages and collect information from them.

The book seems squarely aimed at beginners in PHP and object orientated programming so lives up quite well to the “simple” aspect of the title. However, I wouldn’t really say “instant” because there are quite a few pages dedicated to setting up PHP and making sure it works with a simple “Hello world”. My preference would have been just to assume that  someone that wants to know how to create bots probably already has PHP set up and has at least a passing familiarity with it. But as it seems to cater to real beginners I suppose it needs to hand-hold people through the setup.

The code is clear throughout and easy for anyone to understand and follow and by the end of it you’ll have something that will very basically scrape a web page. If you’re a beginner I’d imagine you’d be left with some sense of accomplishment and something pretty simple with which you should be able to tinker without getting too caught up with a tonne of code or complexity. However, if you are any kind of seasoned developer then you will probably find the book too light-weight as there are no advanced techniques are really discussed. But then, what would you expect with just around 60 pages in the book?

However, as I’ve said, the code is nice an clean, the book for what it is is well written, and the author discusses some good practices.  Great for a beginner but probably not enough for a mid/seasoned developer.

Did you like this? Share it:

Zend Studio and SVN 1.8

I use SVN for most of my projects at work and have diligently kept it up-to-date with the latest versions of the work copies. What happens when the working copy structure changes, as it did from 1.7.x to 1.8.x, is that Zend Studio gives error messages about the SVN connector client not being compatible. Annoying! However, if like me you’ve recently updated your SVN version to 1.8 and want Zend Studio to be compatible then it’s just a matter of a few easy steps for you to take.

Continue reading Zend Studio and SVN 1.8

Did you like this? Share it:

Dreamhost and procmail – parsing your mail with a script

I have a Dreamhost account and have done for some while. Typically I’m happy with their service, but yesterday was the first real frustration I had with them. I wanted to use procmail to send email to a script for processing. I was sure I had done this before on Dreamhost, but couldn’t seem to get it to work in the wee hours of the night. So after a quick email to support asking if it was possible, they came back with this response:

Unfortunately this is not possible. We do
not offer or support any type of email to script functionality on our

And this pretty much backed up all the searches I had been doing on line in regards to Dreamhost and using procmail.

Now, where they may not support people doing this, it is my pleasure to tell you that it is possible! And here’s how you do it…
Continue reading Dreamhost and procmail – parsing your mail with a script

Did you like this? Share it:

Using CSS3 sucks (right now, but I’m sure it’ll get better)

Am I the only one to think that using a number of aspects of CSS3 right now really sucks? The potential it offers is great, but does anyone really think doing something like this for a gradient is a productive use of time?

    background: #9880cc; /* Old browsers */
    background: -moz-linear-gradient(top, #9880cc 0%, #bab3cc 93%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9880cc), color-stop(93%,#bab3cc)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #9880cc 0%,#bab3cc 93%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #9880cc 0%,#bab3cc 93%); /* Opera11.10+ */
    background: -ms-linear-gradient(top, #9880cc 0%,#bab3cc 93%); /* IE10+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9880CC', endColorstr='#BAB3CC',GradientType=0 ); /* IE6-9 */
    background: linear-gradient(top, #9880cc 0%,#bab3cc 93%); /* W3C */

Once upon a time, not that long ago, the trend setters/leaders of the web development community would have lynched you if you so much as dared to use a proprietary tag, be it in the css or the html. Now they’re actively encouraging the above kind of usage?! It’s ridiculous! Firefox, Chrome, Safari, IE and Opera all require different proprietary rules, and then you have the W3C recommended way and then the fallback for older browsers.

A Transform in CSS3 is just as bad:

-moz-transform: scale(0.8) rotate(deg) translate(px, px) skew(deg, deg);
-webkit-transform: scale(0.8) rotate(deg) translate(px, px) skew(deg, deg);
-o-transform: scale(0.8) rotate(deg) translate(px, px) skew(deg, deg);
-ms-transform: scale(0.8) rotate(deg) translate(px, px) skew(deg, deg);
transform: scale(0.8) rotate(deg) translate(px, px) skew(deg, deg);

And this time it’s not the rule value that’s different for each, it’s the rule name!

I think HTML5 (well, XHTML5 for me – I do love a properly closed tag!) and CSS3 are great, don’t get me wrong, and I think we’ve already seen a lot of examples of wonderful sites and demos created using them. But surely how it’s getting there and the asinine number of rules we have to put in for each browser is a major step backwards in what people were trying to achieve only a few years ago? (Ie, a nice compliant standard way of doing things.)

Incidentally; there are a couple great sites that help out doing fancy new CSS3 stuff:

The Ultimate CSS Gradient Generator
CSS3 Generator

Using sites like those can save a bit of sanity.

Did you like this? Share it: