Advertisement
Advertisement
| 03.22.2008 at 03:52AM PDT, ID: 23261279 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.22.2008 at 04:31AM PDT, ID: 21185632 |
| 03.22.2008 at 04:32AM PDT, ID: 21185634 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: |
<?php
// File verification tests by Angelo Mandato (angelo [at] mandato {period} com)
// __crc32_file() is very slow, you can uncomment to test for yourself.
//require_once('crc32_file.php');
// Copy and paste the contents of the crc32_file() code found on
// the php.net crc32 PHP manual page in a new file and save
// as crc32_file.php in the same directory as this script.
// Get microseconds
function GetMicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
// file_crc() - function to test
function file_crc($file)
{
$file_string = file_get_contents($file);
$crc = crc32($file_string);
return sprintf("%u", $crc);
}
$Methods = array('sha1_file()', 'md5_file()', 'file_crc()');
if( function_exists('__crc32_file') )
$Methods[] = '__crc32_file()';
$directory = '/path/to/directory/'; // Don't forget trailing backslash.
$files = scandir($directory);
for( $method_index = 0; $method_index < count($Methods); $method_index++ )
{
$start_time = GetMicrotime();
while( list($index,$file) = each($files) )
{
if( $file != '.' && $file != '..' && is_file($directory.$file) )
{
switch( $method_index )
{
case 0: { // sha1_file()
$value = sha1_file($directory.$file);
}; break;
case 1: { // md5_file()
$value = md5_file($directory.$file);
}; break;
case 2: { // file_crc()
$value = file_crc($directory.$file);
}; break;
case 3: { // __crc32_file()
$value = __crc32_file($directory.$file);
}; break;
}
}
else // It is not part of our test results, lets remove it from the array
{
unset($files[$index]);
}
}
$end_time = GetMicrotime();
echo sprintf("%s took %.03f seconds to calculate %d files.\n", $Methods[$method_index], $end_time-$start_time, count($files) );
reset($files); // Reset pointer in array
}
echo "file verification tests completed.\n";
?>
|
| 03.22.2008 at 04:32AM PDT, ID: 21185637 |
| 03.22.2008 at 04:34AM PDT, ID: 21185644 |
| 03.22.2008 at 04:35AM PDT, ID: 21185648 |