Create a POT file for themes and plugins

~$ cd /var/www/your-site-folder/wp-content/ ~$ svn export http://i18n.svn.wordpress.org/tools/trunk/ makepot ~$ cd plugins/your-plugin-folder/languages ~$ php /var/www/your-site-folder/wp-content/makepot/makepot.php wp-plugin ../ With the last option you need to specify if you are creating a POT for a plugin or for a theme (for themes, use “wp-theme” instead of “wp-plugin”) and the last command line parameter is the plugin/theme folder (in this case ../ is pointing […]

GIT – merge selective files

To selectively merge files from one branch into another branch, run where: branchX is the branch you want to merge from into the current branch The –no-commit option will stage the files that have been merged by Git without actually committing them. This will give you the opportunity to modify the merged files however you want to and then commit […]

WooCommerce XPay Cartasì

After almost two years since its first release WooCommerce XPay is a payment gateway for e-commerce based on WordPress and WooCommerce. Compatible with the offer of CartaSì and QuiPago, easy to install and configure, and constantly updated with direct technical support included. Throughout the month of January will be sold at a discounted price. Buy it now in my shop! […]

Extending Drupal Search on other User fields

The default Drupal “search by user” is performed by the hook search_execute implemented by the user module (here is the full code), which searches on the “name” field (if you can administer users it searches also on the email). But what about searching on other fields? As a user is an entity on Drupal 7, it can be extended with […]

Limiting concurrent connections per IP

After playing around with ab (apache benchmark) in a test server, I’ve found particulary annoying that with this simple tool I could break this test server. The problem is that a server have a limitate number of resources (CPU/RAM) and for that reason is not possible to accept too many concurrent requests from the same source. This is the base […]

Ubuntu Edge – Uno smartphone che è un PC ma anche un progetto ambizioso e rivoluzionario

E’ in corso una piccola rivoluzione tecnologica, sappiatelo! La notizia rimbalza tra i social network e i blog e non posso astenermi dal dare il mio contributo alla divulgazione di questo progetto tanto ambizioso quanto promettente. Nel primo paragrafo “What is Ubuntu Edge” presente nella pagina di indiegogo si può leggere: In the car industry, Formula 1 provides a commercial […]

A simple jQuery slider

Sometimes you need to handle custom sliders and you also need to listen for the user click event. This is the code I eventually used, perfectible (surely), but it seems to do its job very well. The really important parts are those in which you need to set the interval and the timeout, as well as those in which you […]

Fail2Ban: Set a permanent ban per IP

Fail2Ban is a really good piece of software that allows to understand when someone (a bot) is trying to offend your server using a brute force attack. Let’s say that you don’t want to apply a permanent ban as a default rule (because it is possibile, setting the bantime at -1 in the relative filter of the jail.conf file). Let’s […]

Drupal Faceted Search with Accordion Menu

Have you set up a cool faceted search and you want to use an accordion menu to offer a better visualization behaviour? To accomplish this task there are different ways, but the ones which works for me out of the box are these: Standard accordion behaviour Multi-opened Accordion (thanks to supersuphot for the multi-accordion version – see this stackoverflow question). […]

Drupal: the good Omega, the bad and the ugly IE8

It was January 2002 when the “king of all browsers” had the largest market share: 86%. After 10 years, the dictatorship is permanently collapsed, with only 16% of utilization. Considering that only 7-8% have IE8 (IE9 works pretty good) we are talking of a very small percentage of users, but this percentage is even more than the usage of Safari and Opera togheter; […]

Database backup on Amazon S3

I’ve forked a cool gist code, made by klangley here, to allow a more reasonable number of database backups using the Amazon S3 storage webservice. My forked version is available here: https://gist.github.com/4107260 and allows a rotating daily backup and a rotating weekly backup: in this way you’ll have 4-5 weekly backups (one for each week of the month) and 6 daily backups (one for […]

Move MySQL data directory

These are the steps to move the MySQL data directory to another folder: -(del) datadir = /var/lib/mysql +(add) datadir = /new_path/mysql -(del) /var/lib/mysql/ r, +(add) /new_path/mysql/ r, -(del) /var/lib/mysql/** rwk, +(add) /new_path/mysql/** rwk, Naturally, “don’t try this at home, kids!” ;)