:::: MENU ::::

Monthly Archives / March 2014

  • Mar 25 / 2014
  • 0

Download Flash Video Fragmented (F4F/F4M)

Today, for network usage optimization purposes, a lot of videos are streamed and sent to the users as fragmented packets instead of one file. According to Adobe, F4F file is Flash MP4 Video Fragment created and used by Adobe Media Server for HTTP Dynamic streaming like CloudFront, Akamai, … If you want to download this video, you will have to download the script file KSV (download this script on Github) and execute it on a system with php enabled (install PHP on Windows).

Once you’re on the page where video is loading, you have to look for manifest file in source code or network exchanges. This file has F4M extension, correspondig to manifest, which is the file containing the inventory of all the video fragments. It will be necessary for the script execution.

Here is an example of how the command-line should look like (you can modify the quality parameter, and you have to specify the path for manifest file, and output file):

Here are the different options you can use to customize command-line:

All the original sources are available on GitHub : https://github.com/K-S-V/

  • Mar 18 / 2014
  • 0

Install VMware Tools on ESXi for Ubuntu Guest

If you want to install VMware Tools on ESXi for an Ubuntu Guest, there is two possibilities:

  1. Use the package provided on distribution (but can be not up-to-date and so not approved)
  2. Install directly from official sources provided in vSphere Client (will be automatically recognized)

Use the pre-package distribution

This solution is the easiest way to install tools. You just have to use apt on your guest to install it:

Use the official sources available in vSphere Client

This solution is not as simple as the previous one but is really sure and well-guided.

  1. Connect to your ESXi server using vSphere Client
  2. At this moment, ensure that you have a CDROM hardware available for your VM Guest (in Settings)
  3. Start your VM Guest running Ubuntu
  4. Check that you have already needed packages installed (most of time, they are not installed with a standard configuration):
    • gcc
    • build-essential
    • binutils

    You can use this command line to install them:

  5. You can now connect VMware Tools on your VM Guest using vSphere Client:
    • Right-click on your VM name
    • Select “Guest” > “Install/Upgrade VMware Tools”
    • Wait a few seconds

    This action will automatically (and transparently) mount the VMwre Tools CD into your VM Guest Ubuntu.

  6. Open a console on your VM Guest to mount the CDROM you just connected:

  7. Copy the VMwareTools-x.x.x-xxxxxxx.tar.gz file from the CDROM to a local folder (‘x’ values depend on version used):

  8. Unzip the VMware tools package you just copied:

  9. Go to the new folder created while unzipping file and run the installer script (perl script):

  10. From now, just follow the instructions displayed on the screen to install VMware tools.

Once all of this is done, you will see on vSphere, in VM details, that the vMware Tools are correctly installed.

  • Mar 14 / 2014
  • 0
Python, web2py

Unserialize web2py requests and allow concurrent access

With a default configuration for your web2py application, you will notice that when you are launching an action, if this one is quite long to execute, you won’t be able to open a new tab to run another request on the same application. This can be explained because when you are launching an action, your browser is sending session informations to the server and your session file on server-side is so opened in writing mode for being updated. A lock is set on this file, blocking any other action to be executed for this session while the lock is not released.

This problem is effectively not existing if you are using a database for your session management instead of a file system. To use a database system, you just need to declare your database:

and initiate the connection to this database for sessions:

A table will so be automatically created, named web2py_session_appname and will contain following fields:

If you want to use the file system for your sessions, you will need to use the following command to allow the session file release:

You will notice that this command must only be called if the action you want to execute do not require to session informations. For example, if you are loading dynamically some contents via Ajax calls on several parts of the page, you can add this command for each call to allow the concurrential execution knowing that the connection informations are saved while main page is loading.

As testing, you can use following code:

If you’re calling previous code by deleting the session.forget() command call, you will get this as a result:

If you’re calling the same code with the session.forget() command call, you will get:

We can notice that between both cases, we have a concurrential execution thanks to the session.forget() function, and that we can hardly optimize the page loading time.

Please note that most of browsers won’t allow you to execute more than 6 requests at the same time, hence the result we are getting with the last test where we can see that the six first requests are executed together whereas the following ones are executed afterwards (on a second flow but concurrent also).

  • Mar 07 / 2014
  • 0

Handling HTTP errors with Apache and Tomcat using mod_jk

When you are working with web server in frontend (Apache in this example) and backend application servers (Tomcat here), you may wish to customize your error pages depending on the HTTP error code returned (either from the web server or application server).


For the following example, you will need as pre-requisites at least those versions:

  • Web Server Apache >= 2.2.x
  • Mod JK >= 1.2.27 (rule extensions are not available in earlier versions)

Apache configuration

If you want to handle any error coming from your web server or from your application servers, you will need to perform some changes in your configuration to allow the handling. First of all you will need to set up some parameters in your Apache configuration file (in apache2.conf file directly or in your VirtualHost definitions).

In my example, I am handling any HTTP error code between:

  • HTTP 400 and HTTP 405
  • HTTP 500 and 504

I am using an only file (written in PHP) allowing me to send back a simple HTML page to the user depending on the HTTP error code received.

Here is what I’ve configured in my apache2.conf file for handling any error listed above:

The errorhandler.php file could be like that (feel free to customize it as you want with a beautiful CSS theme, for the example I’ve used a basic configuration ;)):

mod_jk configuration

Once you’re done with the main configuration of Apache, you will have to specify to Apache that you want to handle any HTTP error coming from the application servers. For that, you will have to use the rule extension use_server_errors when mounting an access point to a worker through mod_jk.

By default, for a mounting point you are using:

But if you want to handle any HTTP 40x error coming from this worker, you will have to add the use_server_errors extension to your mounting point:

To handle any HTTP 50x error:

Or another option to handle both errors using just one command:

You are now handling any error received from your application server with your web server allowing you to customize it as you want.

Feel free to read more about this rule extension on the official website.

  • Mar 06 / 2014
  • 0

How to compile and install its own Linux kernel

The Linux Kernel is the operating system kernel. It is the core of the system and provide an interface between the hardware and the software layers.

Most of Linux distributions are coming with a pre-compiled and ready-to-use kernel for most of standard usage. However, some functionalities are sometimes missing in the kernel to allow the execution of specific functions or the support of some hardware (cards, …). In these cases, you will need to use the source code of the needed kernel, recompile it and reinstall it to replace the existing one. All the official soruces of the different kernels are available for free on the website kernel.org.

I will show you here how to modify the source code, compile and install your own kernel for your system (command-lines provided are working under Debian/Ubuntu based system, you will probably need to adapt them depending on the system you are running).


In a first time, check that you got the different packages necessary for the operation:

Once these packages are correctly installed, you can go on the official website to retrieve the source and the configuration files for the kernel you want to use: http://www.kernel.org. In our example, we will use the kernel on version 3.13.5 (latest stable version available today).

Let’s move to the /usr/src directory and then download the kernel archive that we will uncompress immediately:

Kernel sources are now uncompressed in the /usr/src/linux-3.13.5 folder and we can go ahead with its configuration.


Let’s move in the directory you just created and start with the use of command make menuconfig to launch the configuration tool:

At this time, you can activate any feature you want on the kernel. For example:

  • To activate the virtualization and its specific functions, move on Virtualization and then press the Space bar to get access to the different available functionalitiesuis  (that you can activate/deactivate as you want)
  • To activate the modules support, move on Enable loadable module support and choose the modules you want to enable by pressing the Space bar (activated items will be checked)


Once you’re done with this configuration, choose Exit and confirm the save of your configuration. This one will be saved in the current directory under the .config file (that you can manually edit with a simple text editor if necessary).


Now that the kernel is configured, you will have to compile it so that it can be used on your system. For that, you will need to execute several commands for the different compilation steps:

  • Dependencies compilation (now useless with latest versions)
  • Kernel image compilation
  • Modules compilation
  • Modules installation

At this time, your kernel has been compiled and is ready to be set up on your system.


To install your own kernel, you just need to execute the command-line below:

This command will create the following files in the /boot start directory:

  • vmlinuz-3.13.5 : the current kernel
  • config-3.13.5 : the kernel configuration file
  • System.map-3.13.5 : the symbol table exported by the kernel
  • initrd.img-3.13.5 : the root file used temporarily during the boot process

This command should update automatically the Grub configuration file (grub.cfg). You won’t need to perform the update manually.

If it’s not done automatically, you can execute it manually with the command-line below:


In order to check that your kernel has correctly been loaded and is used, you need to reboot your system. Once restarted, you can check which kernel is used with the uname command:

You are now using your own kernel with the functionalities you wanted.

Question ? Contact