Archive for category Example Code

How to run Football Manager 2009 in a window on Mac OS X

I was very frustrated to find that you cannot set Football Manager 2009 to run in a window from the in-game preferences as you could with previous versions. I’ve figured out a quick fix using Terminal (which you will find in your /Applications/Utilities folder). Type (or copy and paste) the following command into Terminal to launch Football Manager 2009 in a window:

/Applications/Sports\ Interactive/Football\ Manager\ 2009/fm.app/Contents/MacOS/fm -windowed -small_screen

There’s a more user friendly way of doing this, which I’ll explain at another time. For now, I’ve got teams to manage…

4 Comments

PHP mail() and ssmtp on Debian Linux

If, like me, you have a dedicated mail server that you want your PHP scripts to use, you may have come across ssmtp. ssmtp is a cut-down MTA that simply sends mail off to another server - ideal for scenarios where you don’t need to receive mail on your web server, but you do want to be able to use the PHP mail() function. Read the rest of this entry »

15 Comments

PHP - include all files in a folder

Ever wondered how to include every file, or a series of files in a folder without having to reference them individually? It’s easily done with PHP’s glob() function. Read the rest of this entry »

2 Comments

Using Recursive Functions in PHP to Manage Hierarchy

The recursive function is an essential tool for anybody developing PHP sites that feature multiple levels of categories, pages etc. In fact, they are great for managing hierarchical relationships (sometimes referred to as parent/child relationships). There are many applications of this, but the example I’m going to show you is categories, such as you might use in an eCommerce site. This is one of those wonderfully simple techniques that once grasped, will open up a myriad of possibilities for the programmer.

Read the rest of this entry »

13 Comments

PHP Random Secure Password Generator Class

UPDATE: If you don’t want to spend the time implementing this code, and just want to generate some passwords, I’ve put it on a separate website: www.random-password.net.

I just recently had to create a function to generate random passwords on a site I was developing and thought it would be an ideal thing to expand upon and put into a class. If you’re not familiar with using classes, I also have integration code below.

This source code is provided free of charge under the condition that my name remains upon it. Any modifications, improvements and suggestions will be gratefully received.

Read the rest of this entry »

1 Comment