Activate mod_filter in Apache on CentOS


When you install Apache HTTP on CentOS, mod_filter is not enabled by default then if you try to use some of its directives an error like this is raised: "Invalid command 'FilterDeclare', perhaps misspelled or defined by a module not included in the server configuration", so to resolve the above error is enough to add the following line to the httpd.conf.

Activate mod_filter in Apache on CentOS Read More »

Change the state of package from automatic to manual

Debian GNU/Linux
I have installed the basic packages of the XFCE desktop, by typing:

$ sudo apt-get install xfce4

The above command installs some packages that I do not use as: Orage so I typed:

$ sudo apt-get purge orage
 ...
 The following packages will be REMOVED:
  orage* xfce4*
 ...
 Do you want to continue[Y/n]? y

P. Now every time I try to install an application apt-get show a message that there are packages that were installed automatically, and which are not required but they are essential packages to keep my desktop running correctly. How to resolve this?

R. You must change the state of those packages from automatic installation to manual installation by typing:

$ sudo apt-mark manual paquete1 paquete2  ...
Further reading

– man apt-mark

Change the state of package from automatic to manual Read More »

How to pretty print XML on GNU/Linux

GNU/Linux
The obfuscated XML files are difficult to read because the content of the file occupies a single line. Today LibreByte offers 3 tools that allow you to format an XML file.

Tool 1: web browser, examples: Mozilla firefox, Google Chrome. The disadvantage of using a browser is that you can not edit the XML file, only useful if you if you want to view it and nothing more.

Tool 2: use xml_pp, xml_pp is part of the XML-Twig suite, to install it on Debian GNU/Linux type:

$ sudo apt-get install xml-twig-tools

You can then format the XML file by typing:

$ xml_pp -i mifichero.xml

If you want to save the formatted content in another file, type:

$ xml_pp mifichero.xml > mifichero_pp.xml 

If you want to edit the formatted file, you can use any text editor.

Tool 3: Use Geany editor and prettyprinter plugin, to install it on Debian GNU/Linux type:

$ sudo apt-get install geany geany-plugin-prettyprinter

After running the above command, you must perform the following steps to activate the plugin

1. Run Geany
XFCE:

Menu-> Development-> Geany

From the console, you can also type:

$ geany &

2. Find the Menu

Tools -> Plugin Manager

3. Activate the plugin XML PrettyPrinter

Once the plugin is activated, the option to format XML appears in the Menu:

Tools-> PrettyPtrinter XML

Further reading

– man xml_pp
Geany Project
XML-Twig
Geany un IDE ligero

How to pretty print XML on GNU/Linux Read More »

Anonymous functions in PHP

PHP
With the release of version 5.3.0, PHP development team incorporated what are called anonymous functions or closure.

An anonymous function, as its name implies, is nothing more than a function that has no name and that can be used as a callback allowing greater elegance and readability of source code, it is also possible to assign an anonymous function to a variable as were another data PHP type. PHP internally converts this variable in an instance of the Closure class.

Anonymous functions in PHP Read More »

Convert video file to watch on a DVD player

Libav_Logo.svg

Some DVD player do not support video in high definition resolution then it is necessary to convert it to a supported format, so

* Look for your DVD player specifications
* Look at the details of the video file that you want to convert using MediaInfo
* Use a video conversion tool, in this case we will use avconv which is part of the Libav suite

The following example assumes that your DVD supports:

* Video mpeg4 simple profile format,
* mp3 audio format
* 720 frame size (width) by 576 (high).

Install Libav and libmp3lame on Debian GNU/Linux
$ sudo apt-get install libav-tools libmp3lame0
Perform the conversion
$ avconv -i fichero-origen -f avi -vtag divx -c:v mpeg4 -c:a libmp3lame -s:v 720x576 -aspect 16x9 -qscale 3 fichero-destino

where:

-f, the destination file format, usually avconv guess the format from the extension of the destination file
-vtag, specifies that we will use fourcc divx video codec to mpeg4 (Simple Profile)
-c:v, video code that will be used during the conversion
-c:a, code of audio that we will use during the conversion
-s:v, the frame size
-aspect, aspect and ratio that will have the resulting file. Is recommended to be the same as the original file to achieve good picture quality
-qscale, value between 1-31. A value of 1 means that the resulting file will have the same quality as the original file

Further reading

– man avconv

Convert video file to watch on a DVD player Read More »