Monthly Archives: May 2011

strlen and count in PHP5

strlen and count in PHP5 – The Basics If you are new to strlen and/or count in PHP, then you have come to the right place. In this article I will cover the basics you need to understand their uses, and move toward effectively implementing them in your own PHP projects. Both functions are used to count things, however what they count, and how they count them, are completely different. Understanding how they each work by themselves will allow you to use them together to accomplish some very useful things. However, for now, let’s start at the very beginning. […]

By | May 17th, 2011|PHP, PHP, PHP Articles|Comments Off on strlen and count in PHP5

Creating an MD5 on Linux with md5sum

An MD5 is a type of Hash, also, a Checksum. An MD5 hash is a one way verification sum which can be used to verify a string or contents of a file. Once you have a file and an MD5 checksum, the recipient of the file can also perform an MD5 calculation to ensure that the file’s contents are unchanged. They may have been changed maliciously such as in the case of a binary file, or simply by data corruption. An MD5 is NOT a type of encryption. It can not be reversed. […]

By | May 17th, 2011|PHP Articles|Comments Off on Creating an MD5 on Linux with md5sum

Modulo Operator

All major programming languages have it, it’s the modulo operator, and it has multiple uses. First I’m going to explain what it is, then I’m going to demonstrate one very simple, very powerful use. Programatically, the modulo operator is most commonly denoted with a percentage ‘%’ symbol. Given two numbers as input, the modulo operator returns the remainder after division. p = a%b; will return the remainder after a is divided by b. […]

By | May 17th, 2011|PHP Articles|Comments Off on Modulo Operator

PHP and cURL

Using curl with PHP is incredibly easy. Firstly you’ll need to make sure that you have the PHP curl library installed on your system. On Debian, this is as easy as apt-get install php5-curl Now you can try the following: […]

By | May 17th, 2011|PHP, PHP, PHP Articles|0 Comments

Robot voice control

I’ve set up a new mic and used cvoicecontrol (with some bug fixes) to perform voice control. I’ve integrated cvoicecontrol into my C HAL layer. Each voice model needs training and saving, however once done, they can be reused in the code. For example; if (listen(“yesno”)) { … } is all that’s required to listen for a yes or a no, assuming that “yesno.cvc” has been trained in advance. I’ve also integrated the clap switch across the one of the Phidgets digital inputs. The software requires two toggles within 8 seconds of each other, and the hardware configuration requires two claps to generate one output toggle. This seems the best way to filter out other noise from triggering it. The result is two sets of two claps are required to activate the voice control. Here’s an example: […]

By | May 2nd, 2011|Projects, Robot|0 Comments

Linux robot automatically charging

Since the robot’s rebuild, I finally tackled the automatic charging situation. There are a number of ways to get the device to autocharge. If it always has line of sight to it’s charger, it can spin until it finds it using infra red, then follow the beam – this however doesn’t work without line of sight. It could use a compass, although there are too many magnetic fields, and this requires advance knowledge of positioning. The simplest method would be to always start on charge, and just store movement history, reversing it when it was necessary to charge. Problem here is that even with good wheel alignment, AND accelerometers, even after few movements, simply reversing them is often not good enough to get it even close to it’s original position. […]

By | May 2nd, 2011|Projects, Robot, Technology|0 Comments

Rebuilding the Robot

It had been a while since I’d worked on the robot, and I wanted to work on some movement algorithms. I’ve done some AI work lately on a separate project, and thought that this would help with the automated movement task. Unfortunately, the Robot had a little accident, namely falling out of the loft whilst I was bring it down. It’s been long overdue the removal of some of the excess hardware, and also needed some bugfixes that I now had no choice but to perform. […]

By | May 1st, 2011|C/C++, Development, Hardware, PHP, Robot, Technology|0 Comments