
Recherche avancée
Autres articles (98)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Utilisation et configuration du script
19 janvier 2011, parInformations spécifiques à la distribution Debian
Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
Récupération du script
Le script d’installation peut être récupéré de deux manières différentes.
Via svn en utilisant la commande pour récupérer le code source à jour :
svn co (...)
Sur d’autres sites (6998)
-
Memcached protocol support
15 novembre 2013, par Mikko Koppanen — ImagickFor the past few days I’ve been adding Memcached binary protocol support to PECL memcached extension. The protocol handler provides a high-level abstraction for acting as a memcached server. There are quite a few things still missing and only binary protocol is supported at the moment, but the code seems to work reasonably well in small-scale testing.
I am not sure whether this is useful for anyone, but at least it allows things such as quick prototyping of network servers, exposing sqlite database over memcached protocol etc.
The code is quite simple and implementing a simple server responding to get and set would look roughly like the following :
-
< ?php
-
// Create new server instance
-
$server = new MemcachedServer() ;
-
-
// Create a simple storage class
-
class Storage {
-
private $values = array () ;
-
-
public function set ($key, $value, $expiration) {
-
$this->values [$key] = array (’value’ => $value,
-
’expires’ => time () + $expiration) ;
-
}
-
-
public function get ($key) {
-
if (isset ($this->values [$key])) {
-
if ($this->values [$key] [’expires’] < time ()) {
-
unset ($this->values [$key]) ;
-
return null ;
-
}
-
return $this->values [$key] [’value’] ;
-
}
-
else
-
return null ;
-
}
-
}
-
-
$storage = new Storage () ;
-
-
// Set callback for get command
-
$server->on (Memcached: :ON_GET,
-
function ($client_id, $key, &$value, &$flags, &$cas) use ($storage) {
-
echo "Getting key=[$key]" . PHP_EOL ;
-
if (($value = $storage->get ($key)) != null)
-
return Memcached: :RESPONSE_SUCCESS ;
-
-
return Memcached: :RESPONSE_KEY_ENOENT ;
-
}) ;
-
-
// Set callback for set command
-
$server->on (Memcached: :ON_SET,
-
function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) use ($storage) {
-
echo "Setting key=[$key] value=[$value]" . PHP_EOL ;
-
$storage->set ($key, $value, $expiration) ;
-
return Memcached: :RESPONSE_SUCCESS ;
-
}) ;
-
-
// Run the server on localhost, port 3434. Will block
-
$server->run ("127.0.0.1:3434") ;
-
?>
And the client that communicates with the server :
-
< ?php
-
-
$cache = new Memcached() ;
-
$cache->setOption(Memcached: :OPT_BINARY_PROTOCOL, true) ;
-
$cache->setOption(Memcached: :OPT_COMPRESSION, false) ;
-
$cache->addServer(’localhost’, 3434) ;
-
-
$cache->set (’set_key1’, ’This is the first key’, 10) ;
-
var_dump ($cache->get (’set_key1’)) ;
-
-
$cache->set (’set_key2’, ’This is the second key’, 2) ;
-
var_dump ($cache->get (’set_key2’)) ;
-
?>
The code is still work in progress but it’s available in github : https://github.com/mkoppanen/php-memcached/tree/feature-server. Note that you need to compile libmemcached with –enable-libmemcachedprotocol and the PECL memcached extension with –enable-memcached-protocol.
-
-
Perspective transformations
Finally (after a long break) I managed to force myself to update the PHP documentation and this time it was distortImage code example. Things have been hectic lately but that does not quite explain the 6 months(?) break between this and the previous post. As a matter of a fact there is no excuse for such a long silence so I will try to update this blog a bit more often from now on.
Back in the day I used to blog the examples and update the documentation if I remembered but I am trying to fix this bad habit. Most of the latest examples have been updated in to the manual. In the case of the two last examples I updated the documentation first and then blogged on the subject.
I took some time to actually understand the perspective transformations properly using the excellent ImageMagick examples (mainly created by Anthony Thyssen) as a reference. The basic idea of perspective distortion seems simple : to distort the control points to new locations. Grabbing the syntax for Imagick was easy, an array of control point pairs in the form of :
-
array(source_x, source_y, dest_x, dest_y ... )
The following example uses the built-in checkerboard pattern to demonstrate perspective distortion :
-
< ?php
-
/* Create new object */
-
$im = new Imagick() ;
-
-
/* Create new checkerboard pattern */
-
$im->newPseudoImage(100, 100, "pattern:checkerboard") ;
-
-
/* Set the image format to png */
-
$im->setImageFormat(’png’) ;
-
-
/* Fill background area with transparent */
-
$im->setImageVirtualPixelMethod(Imagick: :VIRTUALPIXELMETHOD_TRANSPARENT) ;
-
-
/* Activate matte */
-
$im->setImageMatte(true) ;
-
-
/* Control points for the distortion */
-
$controlPoints = array( 10, 10,
-
10, 5,
-
-
10, $im->getImageHeight() - 20,
-
10, $im->getImageHeight() - 5,
-
-
$im->getImageWidth() - 10, 10,
-
$im->getImageWidth() - 10, 20,
-
-
$im->getImageWidth() - 10, $im->getImageHeight() - 10,
-
$im->getImageWidth() - 10, $im->getImageHeight() - 30) ;
-
-
/* Perform the distortion */
-
$im->distortImage(Imagick: :DISTORTION_PERSPECTIVE, $controlPoints, true) ;
-
-
/* Ouput the image */
-
header("Content-Type : image/png") ;
-
echo $im ;
-
?>
Here is the source image :
And the result :
-
-
Revision 76d166e413 : Removing foreach_predicted_block_uv function. Adding function build_inter_predi
12 août 2013, par Dmitry KovalevChanged Paths :
Modify /vp9/common/vp9_blockd.h
Modify /vp9/common/vp9_reconinter.c
Removing foreach_predicted_block_uv function.Adding function build_inter_predictors_for_planes to build inter
predictors for specified planes. This function allows to remove
condition "#if CONFIG_ALPHA" and use MAX_MB_PLANE for general case.
Renaming 'which_mv' local var to 'ref', and 'weight' argument to 'ref'.Change-Id : I1a97160c9263006929d38953f266bc68e9c56c7d