как поставить заголовок Return-Path к письму посылаемому командой mail
я уже писал в блоге что можно поправить php.ini добавив
mail.force_extra_parameters = "-f your@emailaddres.ru"
но более удобно использовать пятый аргумент функции mail:
$email = "mail@yourdomain.ru"; $return_path = "mail@yourdomain.ru"; $from_path = "admin@yourdomain.ru"; $subject = "text message"; $content = "content of email"; $headers = "Content-Type: text/plain;\n"; $headers .= "Content-Transfer-Encoding: 7bit;\n"; $headers .= "Return-Path: <".$return_path.">\n"; $headers .= "From: <".$from_path.">\n"; $extra = '-f '.$return_path; mail($email, $subject, $content, $headers, $extra);
Как сделать скриншот из flv файла
1. Ставим на сервер ffmpeg
> svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ./ffmpeg
> cd ./ffmpeg
> ./configure
> make
> make install
2. Для создания GD картинки можно использовать, например вот такую функцию:
function Video2GD($filename){
$descriptors = array(
0 => array("pipe","r"),
1 => array("pipe","w"),
2 => array("pipe","w")
);
$cmd = 'ffmpeg -i '.$filename.' -vframes 1 -f image2 /dev/stdout';
$cwd = '/tmp';
$env = array();
$process = proc_open($cmd, $descriptors, $pipes );
if (is_resource($process)) {
fclose($pipes[0]);
$data = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$error = stream_get_contents($pipes[2]);
fclose($pipes[2]);
return imagecreatefromstring($data);
}
return false;
}
пример использования функции Video2Gd:
$im = Video2GD('/yourvideofile.flv');
header('Content-Type: image/png');
imagepng($im);
Третья сигнальная
Если естественный язык свойственный представителям homo sapiens называют второй сигнальной системой, то можно ли рассматривать языки программирования как третью сигнальную?
Перегрузка операторов в Python
Оказывается перегрузка операторов есть не только в C++, но и в Питоне тоже...
A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by defining methods with special names.This is Python's approach to operator overloading, allowing classes to define their own behavior with respect to language operators.

