# uname -a

mercredi 25 février 2015

Drupal 7 : create your own image effect for use in image styles

Drupal comes with many predefined effects, you can combine them in image styles to get the picture you want. But what if you have to make your own effect ? Here is how.

Lire la suite...

vendredi 20 février 2015

Set up an incremental backup with duplicity, rsync, and backupninja on Debian

Version française.

This is a not-so-concise how-to about setting up an incremental backup, using Backupninja with Duplicity backend on Debian.

Abstract

If you know what a backup is, you should know there are several types of backups :

  • A full backup is when you just copy all your files, hoping that the hard drive on the backup server will not explode after 3 backups.
  • An incremental backup consist in a base full backup, and the next backups are just "diffs" sent to the backup server, to keep track of modified files.

Obviously, a full backup is easier to read and to restore because it's just plain files, whereas an incremental backup has a specific file format to represent diffs. But considering the gain in speed, bandwidth, and disk space, your choice for a long-term backup solution should be the incremental backup.

The tools

Duplicity is an opensource software similar to rdiff-backup. It creates incremental backups. Duplicity can also encrypt your backups, so they can be safely sent to any remote disk provider. A classic setup for Duplicity would be using rsync as a backend to send files faster to the remote backup server, but you can also use a local drive, a remote FTP server, or an Amazon E3 cloud server. As the title says, I will be using rsync for that setup.

But what about databases ? Databases can't be saved by simply copying files, it could lead to corrupted and unusable data in your backups, so you would use a backup script to fetch your databases before sending it to Duplicity.

Good news : backupninja is the global solution you need. Backupninja is a sort of "backup-master" : it can fetch different type of data (files, databases...) from different sources and sent it to different destinations (plain backup, duplicity, etc). you just have to write a specific config file for each source !

We will use backupninja to fetch our databases, we will add these SQL archives to our files backup, send this to Duplicity backend, and finally send it to our backup server with rsync. And with just 3 config files (one by SQL type, one for Duplicity and rsync).

Let's go !

Lire la suite...

vendredi 5 décembre 2014

Drupal 7 : integrate a simple payment workflow with Payment module

Payment forms are common these days, and Drupal has already many out-of-the-box modules to implement a web shop.

But these modules are often very cumbersome, complicated, and not-so-easy to tweak for your own needs.

So, let’s (re)start from the beginning: let’s implement our own Payment form with Payment, and throw Ubercart, Commerce, and all his friends away.

Note that the use of Payment is compatible with Ubercart and Commerce, but please let me make it simpler.

Lire la suite...

lundi 10 novembre 2014

Drupal 7 : change page title on node form

Every rule has its exceptions, setting drupal_set_title directly on form_alter doesn’t work for node form title. To customize pages like “Add node”, or “Edit node” :

  • Make a module

  • Add a function to implement hook_form_alter

  • Add a form afterbuild in your hook_form_alter implementation: $form['#after_build'][] = '_my_callback_form_set_title'

  • In '_my_callback_form_set_title', use drupal_set_title to change the form title: drupal_set_title(...)

  • Update system table to have the weight of your module greater than Node module (on a default install, core modules are weighted 0, so set your module weight to 1).

  • Rebuild registry, clear caches.

samedi 19 juillet 2014

De la difficulté d'écrire un logiciel

Oui, oui, c'est joli... Mais sinon vous avez un vrai métier à côté ?

Source de l’image : monmacon.tumblr.com

Écrire un logiciel, construire une voiture, dessiner un pont, construire une maison, tracer une route, finalement ces métier relèvent de la compétence d’un ingénieur. Alors pourquoi en informatique on arrive à des retards records, qui vont jusqu’à l’abandon pur et simple du projet par le client, dans certains cas ?

Parce que justement, ingénieur en informatique, c’est pas un métier comme les autres. Explications.

Nota Bene : dans cet article, les allégories et paraboles douteuses seront mises en italique.

Lire la suite...

- page 11 de 32 -