Blupixel IT Blog – Computer Science and Web Developing Articles

Offical Blog of Blupixel IT Srl

Launch a second instance of skype on Linux Ubuntu

Sometimes a second instance of skype is needed to work with two different accounts.

Here you can find steps to follow to launch a second instance on a generic Linux system and later to add the icon to the Launch Bar on the left side in Ubuntu.

First of all create a new folde rinto your home

mkdir ~/.personalSkype

Then “duplicate” the skype executable to make the new windows are correctly linked to the new instance:

sudo ln -s /usr/bin/skype /usr/bin/skype2nd

Now you can runa the second instance using the command:

skype2nd --dbpath=~/.personalSkype


If you have Ubuntu and want to create an icon in the Launch bar, follow these steps:

1. Create a new icon for skype (for example a green “S”), call it skype-personal.png (you can use another name but you will have to edit the next file) and save it into /usr/share/icons/hicolor/64×64/apps/ (root privileges are needed)

2. Create a new file call SkypePersonal.desktop into the folder /usr/share/applications (you should be root) with this content

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Skype 2nd
Exec=skype2nd --dbpath=~/.personalSkype
Name=Skype 2nd

3. Open the folder /usr/share/applications in the File Manager and drag the new created file into the launch bar (usually on the left side of the scree)

Now you can launch the second instance by clicking the added icon.

Find a string in an array using C/C++

Unfortunately C/C++ is not easy as PHP.
To find a value inside an array, especially if arrays are of type char** instead of vector, you haven’t standard libraries to use.

The first negative aspect of char** is that you cannot use iterator and you need to know the length of the array to avoid to fall in “Segmentation Fault” error.

For who doesn’t know this error, it happens, usually, when you try to read or write an element of the array that’s not set or is outside the instantiated one.
So, if you have the array

int* arr = new int[5];


You can access arr[0], arr[1], arr[2], arr[3], arr[4] but if you try to access arr[5] o arr[10] you’ll get “Segmentation fault”

To search a tring inside an array is then needed to know the length of the vector.

Let’s see the function


using namespace std;

int array_search(char** input, int input_length, char* search) {

    int result = -1;
    string tmp;

    for(int i = 0; i < input_length; i++) {
        if (strcmp(input[i], search) == 0) {
              result = i;

    return result;



In the function we take as input: the array char** to look into, its length and the word to search for.
The function iterate all the array and breaks if the result is found.
It return -1 if nothing is found or the word index if it’s found.

Note that the function is case sensitive, so “Mickey mouse” is different from “mickey mouse”. To make it insensitive a little more work is needed.

See you soon

Reverse counting using javascript

To execute an operation in javascript after a number of seconds, showing for example a counter which do a reverse counting until the execution of the task, create an HTML element like this:

La finestra si chiuderà tra
<span id=”conteggio_chiusura”>10</span>


Then add this script:

<script type=”text/javascript”>
    // Seleziono l’elemento nella pagina con attributo id = “conteggio_chiusura”
    var element=document.getElementById(‘conteggio_chiusura’);

    // traduco il contenuto dell’elemento selezionato in un intero equivalente in secondi
    var time = parseInt(element.innerHTML);

    // eseguo la funzione che procede alla riduzione del conteggio
    var timer = setInterval(function(){
        if( time ){
            element.innerHTML = –time;
        } else {
    }, 1000);


The last command execute the defined function every 1000 msec (1 second). The function does:
- check if the number in the html block is different from 0
- if it is different it decrement it (-time) and replae the previous number in the HTML
- if it is equal to 0 it deletes the instance of setInterval deleting the timer and execute an action (in this case it closes the window)

The number of seconds to start from is set by the initial HTML content and you can replace the window.close() command with the one you want to execute.

See you soon