About me

Paolo Iannelli Picture

Paolo Iannelli

Big Daddy at Mega Labs

Location
Amsterdam Area, Netherlands
Industry
Information Technology and Services
Interests
C, Python, Big Data, Scalability, High Availability, Performance
Description
Expert Software Engineer with more than 12 years of experience.
Strong in critical thinking, problem solving and high performance architectures.
Paolo Iannelli Labs Rss

Developing applications with Python

Posted on : 28-10-2012 | By : Paolo Iannelli | In : Python, Software Development

Tags: , , , , , , , ,

1

Ever wondered what is Python or the way it works?

Friend of mine actually wrote an interesting website (Python for Beginners) where you can find all you need to start writing your first Python code.

I must warn you : once you start developing in Python it will soon become your primary language, trust me !

So, if you want to see in one shot how beautiful this language is, take a look at : Python Cheatsheet

Htscanner-enhanced improves webhosting provider’s life

Posted on : 13-10-2012 | By : Paolo Iannelli | In : Linux administration, Performance Engineering, PHP

Tags: , , , , , , , , , , , , , , , , , ,

0

Short version

Today I spent a little bit of my time to write a small patch for the PHP htscanner module that you can normally find in PECL.

If you use Apache with mod_fcgi and you need something that parses nested .htaccess files, then you need the htscanner inclusive of the patch I wrote. Get it here :
https://github.com/piannelli/htscanner-enhanced

Long version

For who is this module?

The reason why I wrote it is because I run on a scenario where I had to set specific PHP values for each vhost in my cPanel based server that is running Apache + mod_fcgi.

So this module is for anyone, such as cPanel users, that serve vhosts and want to customize PHP values per vhost in a transparent way to the user.

The problem

Since the only way to update PHP configuration values when using mod_fcgi is only by setting them inside your own PHP script, I gave a try to the htscanner module available in PECL.
The module itself is able to scan the directory where you run the PHP script and if it contains a .htaccess file it will parse it, looking for any php_value entries inside the <IfModule> directive and execute them.

That’s fine, but..

The real issue  is that it will only process .htaccess files that are in the same directory. This means that any .htaccess in the previous level won’t have any effect.

The scenario

Let’s say I host my vhosts in the /home/<username>/public_html directory.

On some vhosts I want to have the memory_limit set to default and on some set to 256MB.
Meanwhile, as a big fan of New Relic, I want to give to each vhost a specific application name, so that I can visualize its performance nicely in my New Relic dashboard.

Normally I would ask the user (or do it myself) to put an .htaccess file in the directory the scripts run (ie. the /home/<username>/public_html) :

But what if we just want to set values like this in a transparent way to the user ?
Does he really need to know that I’m setting the newrelic.appname ?
But also, what if the user replace the file or delete it accidentally?
Should I put again the file there or tell the user to fix it?
Will my dashboard in New Relic stop collecting data ?

What I can do is instead is to create an .htaccess file in /home/<username> and don’t give permissions to the user to modify it or delete it.
In this way, the user can in all cases maintain his  “own” .htaccess file in his own public_html directory, without bothering too much about settings he doesn’t have to know.

Of course he will be able to override anytime my settings anytime, but this is not in the scope of this document.

What does my modification do ?

My enhancement is very small, but what you can get with it can be valuable.

Basically, beside any other htscanner default parameters, my modification will allow you to always force the module to use the default_docroot entry.

In fact, the module will always try to find the document_root of the script that is running and look for an .htaccess.
With my mod, you can force the module to use always the default_docroot so that it will pick up each .htaccess contained in that directory and lower levels.

In this way all the .htaccess files between the default_docroot you set and the directory where the script runs will be parsed and the settings applied.

In my case, I have these settings :

Since all my vhosts are hosted using the /home/<username>/public_html structure, placing an .htaccess inside each <username> directory will let me set specific options for PHP based on the user’s vhost.

Where do I get your module ?

The module and the instructions on how to install and setup it are in its own github project page, reachable at the following address :

https://github.com/piannelli/htscanner-enhanced

I hope this module can be useful to everyone and if you have any questions or concerns please let me know !

Make wordpress faster with WP Super Cache plugin

Posted on : 08-10-2012 | By : Paolo Iannelli | In : Performance Engineering

Tags: , , , , , , , , , , , , ,

1

Have you wondered how to make your wordpress faster?

I just find out a very interesting post from Lucas Rolff on how to improve performances of your WordPress based blogs.

Simply installing WP Super Cache and enabling just few options you can have your WordPress blog fly. All in less than 5 minutes!

Make wordpress faster

Check out its post clicking here or the image and let me or him know if you have any troubles.

Skype bug that posts an emoticon on everyline you type

Posted on : 22-12-2011 | By : Paolo Iannelli | In : Bugs

Tags: , , , , ,

0

Hey hey,

here there is a nice Xmas bug for you.

If you, like me, are running the version 5.5.0.124 here there is a small How To that allows you to send each message with an emoticon post-pended to it.

The issue can be reproduced any time in any chat window, until is closed.

Here there is how it works :

  1. Open a friend’s chat window
  2. Type a message to your friend containing an emoticon
  3. Press the UP arrow to edit the message
  4. Copy paste the emoticon bazillion of times (I actually make a row of around 15 emoticons, copy it and then paste it keeping pressed CTRL+V for around ten seconds)
  5. Press enter
  6. Now type your messages to your friend: each line should have an emoticon !

If it doesn’t work for you, try to put more emoticons while editing the message.

How To connect to Virtual Machines (VMWare) using VNC

Posted on : 16-07-2011 | By : Paolo Iannelli | In : System Administration, Virtualization

Tags: , , , , , , , , , , , , , , , , , ,

2

If you need to connect to a Virtual Machine but you cannot use the VMWare console for different reasons (for instance you are travelling and you have only your macbook pro with you, that doesn’t run VMWare vSphere), you might be interested in this how to.
You will be able to connect to a virtual machine, simply using a VNC client like RealVNC or UltraVNC, as soon as the virtual machine is running.

To achieve this, your virtual machine needs to be turned off and you should go to the settings page.

Go now to Options -> General -> Configuration parameters… and add 4 new rows :

  • RemoteDisplay.vnc.enabled = TRUE
  • RemoteDisplay.vnc.key = leave empty, will be auto-filled
  • RemoteDisplay.vnc.password = 8 characters password
  • RemoteDisplay.vnc.port = anything between 5000 and 5999

Once you filled up all the fields, you may click OK and start the virtual machine.

Using a VNC client, you should be able to connect now to the VM using the VM Host ip address (or FQDN) and the port specified, along with your 8 bytes password.

Although this is a cool feature, you have to take in account that VNC uses a week password encryption protocol and that VNC traffic is sent thru the network unencrypted. You may connect to VNC also tunneling through a SSH connection, but this is not part of this tutorial.

Briefly, I would recommend to use this functionality only if you plain to encrypt data via the above-mentioned tunnel or when you have no other choices rather than the official VMWare management console (that encrypt communication using SSL certificates). It might also still be appreciable to use this feature only on private environments, where no data is exposed to the Internet.
I hope this post was useful  and if you have any questions, just let me know!