gnu/linux

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 »

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 »

MediaInfo – detailed information of an audio or video file

MediaInfo_90x90

MediaInfo is an utility that allows you to:

  • Read various audio and video formats
  • Show information in several formats: text, html, spreadsheet, hierarchical,…
  • Customize the previous views
  • Exporting information as text, csv, html…

The following is the information dumped by MediaInfo:

  • General: title, author, director, album, size, …
  • Video: codec, aspect, frame per second (fps), bitrate, width, height, …
  • Audio: codec, channels, language, bitrate, …
  • Text: subtitle language

MediaInfo supports following formats:

  • Video: mkv, ogm, avi, divx, quicktime, mpeg-1, mpeg-2, mpeg-4, …
  • Audio: ogg, mp3, wav, acc, m4a, …
  • Subtitles: srt, ssa, ass, sami, …

MediaInfo can be used through its graphical interface, command line interface or integrated into an application using the API.

To install MediaInfo (cli) in Debian GNU/Linux type:
$ sudo apt-get install mediainfo
In order to obtain information from a file type:
$ mediainfo buffers_listed_and_hidden.ogv
General
ID                                       : 280403682 (0x10B69EE2)
Complete name                            : buffers_listed_and_hidden.ogv
Format                                   : OGG
File size                                : 4.61 MiB
Duration                                 : 3mn 28s
Overall bit rate mode                    : Variable
Overall bit rate                         : 186 Kbps
Writing application                      : ffmpeg2theora-0.25
SOURCE_OSHASH                            : 3fd514e6b64347ca

Video
ID                                       : 889190165 (0x34FFF715)
Format                                   : Theora
Duration                                 : 3mn 28s
Bit rate                                 : 89.5 Kbps
Nominal bit rate                         : 297 Kbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 30.000 fps
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.010
Stream size                              : 2.22 MiB (48%)
Writing library                          : Xiph.Org libtheora 1.1 20090822 (Thusnelda)

Audio
ID                                       : 1236641633 (0x49B5A761)
Format                                   : Vorbis
Format settings, Floor                   : 1
Duration                                 : 3mn 28s
Bit rate mode                            : Variable
Bit rate                                 : 80.0 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 1.99 MiB (43%)
Writing library                          : libVorbis 20090709 (UTC 2009-07-09)

Further reading

– man mediainfo
MediaInfo project

MediaInfo – detailed information of an audio or video file Read More »

VIM a powerful and flexible text editor

VIM

The first version was released in November 1991, for the Amiga platform. A year later came the first version for UNIX. Its author, Bram Moolenar, was inspired by VI editor, very popular among the UNIX followers. Vim inherits the features of VI and adds new ones, being a 99% compatible with its predecessor when it starts in compatible mode.

Its development model under a GPL compatible license and the new built-in features made VIM gain a lot of followers very quickly becoming one of the most popular editors. Currently the most GNU/Linux distributions incorporate it as the text editor by default.

Basic modes

  • Normal. Using key combinations you can perform actions such as: copy and delete words, groups of words, lines, go to start, at the end of the file, etc. It is the default mode when you start the editor
  • Insert. Allows you to edit the file on which we are working
  • Command-line, Cmdline. Allows to execute complex commands such as: searches by key words, searches using regular expressions, read an external file, open an external file, etc.
  • Visual. Allows you to select a block of text in a simple and flexible way and execute operations such as: delete, copy, change to upper case or to lower case as applicable, space to the right, to the left, etc.
  • Select. Similar to selection mode implemented by OpenOffice/LibreOffice by typing a printable character delete the selection and starts the insert mode
  • Ex. Similar to the Cmdline mode, but after running a command mode remains
Change from one mode to another
From / to Normal Insert Cmdline Visual Select Ex
Normal i, Shift i :, /, ?, ! v, Shift v, Ctrl v gh, g Shift h, g Ctrl h Shift q
Insert Esc
Cmdline Enter, Esc, Ctrl c :start
Visual Esc, v c, Shift c : Ctrl g
Select * ** Ctrl o, Ctrl g
Ex :vi

* You can change from Select selection to Normal mode pressing one of the buttons ← → ↑ ↓
** You can enter in insert mode holding any printable character

Relevant characteristics

  • Highlighting of syntax for more than 200 programming languages (Java, Perl, PHP, Python, Bash, etc.)
  • Integration with a large number of compilers, interpreters and debuggers (GCC, MANX AZTEC C, TEX COMPILER, other)
  • Autocomplete
  • Search by key words
  • Allows to execute operations (searches, substitutions of words) based on regular expressions
  • Undo and redo
  • Command completion (similar to bash)
  • Horizontal, vertical, or multiple windows which allow you to edit various file at the same time
  • Flexible architecture that allows the integration of additional functionality through scripts developed by contributors
  • Online documentation and integrated to the editor

Vim also has a user interface (gVim), which may be more friendly for beginners, however veterans administrators prefer use it in text mode

The latest stable version is the 7.4.x Also the binary is available for the following platforms: UNIX, MS-DOS / MS-Windows, Macintosh, Amiga, OS/2, Cygwin, other.

Further reading

Schulz, Kim. Hacking Vim
http://en.wikipedia.org/wiki/Vim

VIM a powerful and flexible text editor Read More »

Integrate GTK applications in KDE style

KDE
P. I installed the KDE desktop, but my preferred applications: Iceweasel and GIMP look horrible how to fix this?

R. In order your GTK+ 2.x and GTK+ 3.x applications have the same appearance as the native KDE applications you should install the following packages.

– gtk2-engines-oxygen
– gtk3-engines-oxygen
– kde-config-gtk-style

To do this, type the following command in Debian GNU/Linux

sudo apt-get install gtk2-engines-oxygen gtk3-engines-oxygen kde-config-gtk-style

then go:

1. Start Menu
2. Select System Settings (KDE 4) / Settings > System Settings (KDE 5)
3. Select Application Appearance
4. Set the options shown in the figure below

[caption id="attachment_1515" align="alignleft" width="640"]Appearance of GTK + applications in KDE Appearance of GTK+ applications in KDE[/caption]

Recommended reading

KDE project

Integrate GTK applications in KDE style Read More »