Churches are Full of the Sith - The Return of the Jedi.

To become a Jedi Knight (in the fictional movies Star Wars) a trainee, called a Padawan would go through up to 20 years of training to prove themselves. Being a Jedi was something that required intense dedication to the goal, but also to their Master. They were required to grow in knowledge, skill and character as all of these things contributed to becoming who they need to be as a knight.

Love God, Love Others, Love Yourself

God wants all to love each other like we love him. Think about it if you love God you wont go and push someone in the mud. Would you go and push Jesus in the mud? If I was to answer that I would say no. I personally love God sooo much. I read my Bible every night.God has a lot to say in the Bible you just have to let him speak to you through it. The Bible is a really interesting book when you really think about it. Its like one of those books with a bunch of different fairy tales in them like Cinderella the three little pigs etc.

The Two Francises

In the course of my life I have read both biographies for St Francis of Assissi and St Francis Xavier. I was compelled and moved by both and even named my son Xavier after reading about the latter. Both men deserve to be recognised as saints formally and whilst I believe that all believers are saints, because the scripture says so, that both of these men were certainly great role models and we can learn a lot from their lives.

Panda, Penguin - Will Pigeon be Next? The future of Google Algorithm Updates.

I have a theory - it could just be a crazy theory and time will probably prove me wrong, however here it goes.

Most people who own a website or work with sites, design, servers, hosting or anything SEO related know all about the Panda Update. Panda was a major search algorithm adjustment by Google which resulted in a wide changes in SERPs (Search Engine Result Placements) and upset a LOT of webmasters. Personally, only 1 of my websites was affected by Panda.

Random Number Generator - Generate Millions of Random Numbers

If you have ever needed a large list of random numbers for the purposes of testing or some other scripting need - then you will have done what I just did and searched for a random number generator. I found a few websites but none of them did exactly what I needed, and one that did limited me to only 1000 numbers. So I've written my own number generator right here.

You can generate numbers of varying lengths and of varying amounts. You can access this in 2 ways. Use the random number generator right on this page to generate up to 10,000 numbers - or download the script and install in your own website to generate up to millions of numbers depending on what settings you choose.

Preventing Cron Collisions - Stop PHP Scripts Running Twice Simultaneously

What happens when you have a cron job that you want to run fairly regularly - let's say every minute or every two minutes. Now what happens if the server is under load and it doesn't complete the job before the next call - you get a cron collision. Sometimes that's not a big deal, but often that can cause problems.

For example if you have an email queue, or sms queue and it is called twice - you could end up sending out each message twice. If there is an API call you could end up with duplicate data or worse case information could be deleted.

There are several ways around this - the 3rd is the best and easist:

1. Firstly you could use the flock() function in php. This is a function which will lock a file - and if it locks you then do what you want, unlock it when finished and then exit. If another copy comes along wanting to lock the file - it is already locked and the file exits quickly. There are more options than this which you can read about at http://php.net/manual/en/function.flock.php

Here is an example of how you would use flock() to protect from a cron collision

<?php

$fp

= fopen("http://www.website.com/examplescript.txt", "r+");

     if (

flock($fp, LOCK_EX))
          {
// acquire an exclusive lock
          //Do whatever scripting you want here

         

fflush($fp);            // flush output before releasing the lock
         
flock($fp, LOCK_UN);    // release the lock
         
}
     else
          {
          echo
"Couldn't get the lock!";
          }

fclose($fp);

?>

2. Another alternative is to create your own lock file using file() and other file functions in php. For this you will need several files. You will need the file that is called from cron - let's call it flock.php. Then you need the actual lock file - let's call it flock-timestamp.txt and then you need the php script you will actually use.

What you do is you call the flock.php file from cron and have it run every minute. Flock.php opens flock-timestamp.txt and gets whatever data is inside it which will be something like 0 or 1. If its locked it will be 1, if its not locked it will be 0. If the file is 1 (or locked) simply exit and cron will call again in a minute. If its not locked - first thing is to write to the file with fwrite() and lock it by overwriting the 0 with a 1. Then call the script you want with $page = file_get_contents('filename');. After this unlock the file by writing over again and exit.

However one more thing to keep in mind - each time you check if the file is locked - check the file time as well because if its has been locked for a long time like 10 or 15 minutes - its possible that some error has happened and it has frozen and you will want to allow for it to manually be unlocked. You can setup an email notification or sms notification so that you will find out if it gets stuck being locked.

3. This third method is in my opinion the easiest - you need to be using a Linux based server with flock installed. All you need is the script you are wanting to run and another text file which doesn't even have to have any contents. Just call them from cron with a few extra parameters.

For example. If you had an account called octopus (let's pick a name) on a linux server and your script is names script.php and your text file is text.txt and both files are located in the main directory you would call cron like this.

flock -n /home/octopus/public_html/text.txt curl --silent --compressed curl http://www.yourdomainname.com/script.php

That's all there is to it. Every time cron runs it will try to lock text.txt and if successful will run script.php with curl. You can modify whatever command you want after the text.txt to do whatever you want there. If the file was not able to be locked (because it aleady was) it just exits and waits. You can setup email alerts to check it for the first 5 or 6 times to make sure it's working.

If using drupal or another content management system which redirects URLS with the apache redirect module - you will need to make sure that the flock command in the cron command is calling a real file and not a URL rewritten file. The second command can be a "fake" file if needed.

For more information about what commands you can use along with the flock command visit this page - http://linux.die.net/man/1/flock

If you need to add flock to your server you can locate the package here - ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/ and to check if it is installed go to usr/bin/flock because that is where it normally is.

In the course of the last few months I've played with all 3 methods of locking files and if you find that this has saved you time - don't hesitate to give me a backlink

How to Create an eBay Template in Dreamweaver

This short tutorial will take you through how to create a ebay template using Dreamweaver. This tutorial describes the procedure that was taken using CS5, although it will be similar for other versions of the dreamweaver software.

1. Create a folder anywhere in your directory where you'll put all your files for this template.

2. Create a template design in Photoshop. It must have a header, a body, and a footer (make sure to designate a space for the For Search and Categories of products). For Feather Touch Hair, I made its width as 990px.

Pages