Wednesday, December 13, 2017 02:14 am EST

Bri's blog

Bri's picture

Configuring Drupal 6 With Google AdSense Module

I had some trouble when I initially tried setting up AdSense ads on my drupal 6 site. Here are some instructions to help you get it working if you are experiencing trouble.

If you haven't already, download the AdSense module form http://drupal.org/project/adsense

Bri's picture

Changing folder ownership thru SSH

If you ever need to change ownership of a folder using SSH here is how:

You'll need to login to the root of the server, and then run the command

chown -R ownername:groupname /path/to/the/folder/that/needs/to/be/changed

The "-R" will make this a recursive ownership change, changing all folders that are included below the path you have specified.

Bri's picture

Remove / Delete Directory and Its Contents in Linux

rm -rf

This command will remove a directory and its contents without prompting you to make sure you want to delete each file in the directory. Substitute with the actual directory name.

Bri's picture

Randomly Shuffle an Array Using ActionScript 3

If you have ever wanted to randomly re-arrange the elements of an array after they are already set, try using this function.


function randomizeArray(array:Array):Array
{
var newArray:Array = new Array();
while(array.length > 0){
var randomIndex = Math.floor(Math.random()*array.length);
newArray.push(array[randomIndex]);
array.splice(randomIndex, 1)
}
return newArray;
}

The function takes in the array that you want to be modified and returns a new one.

Bri's picture

PHP Email Address Validation

Email address validation is a very common thing and it's pretty easy in php 5.2 or greater. You no longer need to use a regular expression. You can use this simple script below, making use of the filter_var function.


$email = 'mail@example.com';
$validation = filter_var($email, FILTER_VALIDATE_EMAIL);

if($validation)
$output = 'proper email address';
else
$output = 'wrong email address';

echo $output;

Syndicate content