Developers Archive for January, 2007

Why visitors will return to your site

Why visitors will return to your site Wednesday, January 31st, 2007

According to a survey, here are the top reasons why visitors come back to your site:

1. Content (74%) - The main reason for a user to not visit your site again was most of the time “non-sense� or irrelivant content.

2. Enjoyability of the site (71%) - It was either something interesting in the layout or the interface that made them come back.

3. Organization of content (68%) - Users returned to sites that were well organized with a good layout & no text not all over the place.

4. Uniqueness of the site (66%) - Uniqueness is a big factor in sites, if it is something they’ve seen before, chances they won’t come back to your site.

5. Ease of access (64%) - The easier users can find content and information on your site, they more they returned to it.

6. Visually attractive (58%) - Good looking sites with effort put into the theme of the site had a reasonable amount of people come back.

7. Easy to navigate (54%) - This one is self-explaintory. Navigation should always be in a clear place, such as under the header or to the left side (mostly).

8. Website speed (53%) - Sure we all share this one, if a site is slow at loading, chances that we’ll never visit the site again because it’s “slow�.

Bitwise Operators

Bitwise Operators Wednesday, January 31st, 2007

Bitwise Operators

Bitwise operators allow you to turn specific bits within an integer

on or off. If both the left- and right-hand parameters are strings, the bitwise

operator will operate on the characters in this string.
Bitwise operators in PHP is similar to the bitwise operator in C &

C++.

Example:

echo 12 ^ 9; // Outputs ‘5′

echo “12″ ^ “9″; // Outputs the Backspace character (ascii 8)
// (’1′ (ascii 49)) ^ (’9′ (ascii 57)) = #8

echo “hallo” ^ “hello”; // Outputs the ascii values #0 #4 #0 #0 #0
// ‘a’ ^ ‘e’ = #4

Managing limited number of files in directory

Managing limited number of files in directory Wednesday, January 31st, 2007

We can manage the amount of files in a particular directory using the following function. Every time a new file is uploaded the oldest one must be removed (using the unlink() function) if a maximum limit is already reached. The second parameter is optional and will set the limit whenever the check must happen or not.

<?php
function get_oldest_file($directory) {
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if (is_file($directory.$file)) { // add only files to the array (ver. 1.01)
$files[] = $file;
}
}
if (count($files) <= 12) {
return;
} else {
foreach ($files as $val) {
if (is_file($directory.$val)) {
$file_date[$val] = filemtime($directory.$val);
}
}
}
}
closedir($handle);
asort($file_date, SORT_NUMERIC);
reset($file_date);
$oldest = key($file_date);
return $oldest;
}
// this example will show you the oldest file if there are more then 10 in the dir
echo get_oldest_file(”/path/to/directory/”, 10);
?>


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.