KDE Dolphin thumbnail video preview

14 marzo 2011 Nessun commento

If you want to see the preview of your video in Dolphin on your Kubuntu system you can simply install MPlayerThumbs.

sudo apt-get install mplayerthumbs

How to configure Xdebug on Ubuntu with Zend Server

17 febbraio 2011 Nessun commento

I assume you have properly installed and configured Zend Server CE from the repository.

First of all you need to install automake:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install automake

Install Xdebug with PECL as root:

# pecl install xdebug

Note: if you don’t have PECL in your path you can prepend the absolute path before the command

# /usr/local/zend/bin/pecl install xdebug

Now you must edit php.ini file.

sudo nano /usr/local/zend/etc/php.ini

Add these lines at the end of file:

; Xdebug
zend_extension = /usr/local/zend/lib/php_extensions/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Note: Xdebug is incompatible with theZend Debugger extension. To disable this component you can log into Zend Server control page at https://localhost:10082 and navigate to tab Server Setup > Components then turn off Zend Debugger. Remember to click the Restart PHP button to apply the changes.

Links:

Install KDE 4.6 on Kubuntu

8 febbraio 2011 Nessun commento

Kde 4.6 was released on January 26, 2011. If you want to try this new version you can follow this simple steps.

Add backports repository

sudo add-apt-repository ppa:kubuntu-ppa/backports

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade

Then

sudo apt-get dist-upgrade

After reboot you can see Kde 4.6 in action.

Categorie:(K)Ubuntu, KDE Tag:

Set up a simple VNC server

13 ottobre 2010 Nessun commento

Using built in VNC server for KDE or Gnome I ran into several problems, like screen freeze or lost connection.

If you need a VNC server for your current desktop session in (K)Ubuntu you can use x11vnc.

1. install packages

sudo apt-get install x11vnc

2. set a password

x11vnc -storepasswd

3. start the server

x11vnc -forever -noxdamage -usepw

If you want to access your desktop via browser using a java applet you have to installa vnc-java package and use this commans:

sudo apt-get install vnc-java
x11vnc -forever -noxdamage -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

Categorie:(K)Ubuntu, Debian, KDE, Linux Tag: , ,

Call-time pass-by-reference has been deprecated

19 febbraio 2010 Nessun commento

If you recently upgraded PHP to version 5.3.0 or higher, you have probably encountered a message like this:

Deprecated: Call-time pass-by-reference has been deprecated in filename.php

Use & when you call a function foo(&$var) generates the warning message.

Remember that in 5.3 version of PHP only Call-time pass by reference is deprecated but not Passing by reference.

See the example below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// normal passing by reference
function functionA(&$var) {
    $var++;
}
 
// call-time passing by reference
function functionB($var)
{
    $var++;
}
 
// correct call
functionA($var);
 
// deprecated
functionB(&$var);

If you can’t edit existing code, for example, third-party software, you can use these work-arounds:

  1. Turn off error messages: is always a good idea hide any type of error message in a production site. You can use error_reporting(0) function or if you want you can use the @ symbol before any statement. This is not a good solution of this problem.
  2. Allow call-time pass-by-reference in your php.ini file: in your php.ini file you can set allow_call_time_pass_reference = on but this is a temporary solution only until the next version.

Resources:

UTF-8 problem with Spreadsheet Excel Writer

27 gennaio 2010 Nessun commento

Spreadsheet Excel Writer is a PEAR package that allows you to generate Excel documents.

When we try to generate an new Excel document using UTF-8 string we ran into a display error.

There is a simple way to fix this problem. See the example below:

$workbook = new Spreadsheet_Excel_Writer();
$workbook->send("file.xls");
 
// add this row
$workbook->setVersion(8);
 
$worksheet =& $workbook->addWorksheet("My worksheet");
 
// add this row
$worksheet->setInputEncoding("UTF-8");
 
$workbook->close();

Create a PHP data structure accessible like an array and an object simultaneously

26 gennaio 2010 Nessun commento

Often we need to operate with objects that sometimes we have to use as an array.
For example we can get an attribute from an object:

$attr = $myObject->attr;

or by array access from the same object

$attr = $myObject['attr'];

We can set data simply like an array or directly.

Categorie:PHP, Programmazione Tag: , ,

Impostare l’ambiente di sviluppo per Zend Framework su Ubuntu

18 gennaio 2010 2 commenti

Se vogliamo iniziare a conoscere il fantastico mondo di Zend Framework sarà necessario creare un ambiente di sviluppo adatto alle nostre esigenze. In questa guida vedremo come configurare la nostra distribuzione Ubuntu per poter lavorare in locale con tutti gli strumenti necessari.

Lo scopo di questo tutorial è quello di ottenere un sistema di sviluppo per Zend Framework

Configurazione del sistema operativo

Quello che noi vogliamo ottenere è un server LAMP configurato ah hoc per le nostre applicazioni web. Per prima cosa installiamo MySQL:

sudo apt-get install mysql-server mysql-client

Se vogliamo rendere accessibile il server MySQL dall’esterno dobbiamo modificare il file /etc/mysql/my.conf

sudo nano /etc/mysql/my.conf

e commentare la linea

#bind 127.0.0.1

Questa configurazione del sistema utilizzerà Zend Server CE che comprende la propria versione di PHP e le librerie vere e proprie di Zend Framework. Fortunatamente Zend ha messo ha disposizione i repository contenenti tutti i pacchetti per le varie distribuzioni di Linux tra cui Debian/Ubuntu. Seguiamo quindi le indicazioni fornite aggiungiamo il nostro repository al file /etc/apt/source.list.

deb http://repos.zend.com/zend-server/deb server non-free

Prosegui la lettura…

Creare la struttura di un menu con Zend Navigation

15 gennaio 2010 Nessun commento

La gestione di un menu e delle relative pagine è molto semplice grazie alla classe Zend Navigation.
Il manuale di Zend Framework spiega molto bene come utilizzare questo componente. In breve il principio di funzionamento consiste nel creare oggetti pagina (Zend_Navigation_Page) che a loro volta possono contenere altre pagine. Questa struttura dati verrà poi data in pasto alla classe Zend_Navigation che si occuperà di mettere a disposizione tutti i metodi necessari per la gestione del menu.

Possiamo creare un metodo privato all’interno del nostro Bootstrap per inizializzare il menu e renderlo disponibile agli helper nella view.

protected function _initNavigation()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();
 
        // create pages
        $pages = array(
                array(
                        'label'         => 'Home',
                        'module'        => 'default',
                        'controller'    => 'index',
                        'action'        => 'index',
                        'order'         => -100 // first page
                ),
                array(
                        'label'         => 'Posts',
                        'module'        => 'default',
                        'controller'    => 'posts',
                        'action'        => 'index',
                        'visible'       => true,
                        'pages'         => array(
                                array(
                                        'label'         => 'Add',
                                        'module'        => 'default',
                                        'controller'    => 'posts',
                                        'action'        => 'add'
                                )
                        )
                ),
                array(
                        'label'      => 'Administration',
                        'module'     => 'admin',
                        'controller' => 'index',
                        'action'     => 'index',
                        'resource'   => 'mvc:admin', // resource
                )
        );
 
        // create container from array
        $navigation = new Zend_Navigation($pages);
        Zend_Registry::set('Zend_Navigation', $navigation);
        $view->navigation($navigation);
    }

Tunnel SSH

12 gennaio 2010 Nessun commento

L’idea di poter creare un canale virtuale cifrato tra due computer remoti attraverso internet  permette di scambiare dati in modo sicuro e apre le porte a numerose applicazioni.

Immaginiamo di dover accedere alla nostra rete privata di casa senza l’uso di VPN da una postazione esterna alla LAN.

Chiameremo server il pc di casa che accetta la connessione dall’esterno sulla porta 22 e client il pc remoto dal quale vogliamo connetterci. Per creare il nostro tunnell SSH non dobbiamo far altro che lanciare il seguente comando dal client:

ssh -N -D 9999 user@server.mydomain.com

Verrà creato un socket tra client e server, l’opzione -N impedisce che vengano eseguiti comandi remoti mentre l’opzione -D 9999 specifica che vogliamo creare un socket sulla porta 9999 del client. A questo punto abbiamo un canale collegato direttamente al nostro server accessibile dal nostro browser. Per poter navigare come se fossimo sul server è necessario configurare firefox in modo che utilizzi il socket. Abbiamo due opzioni, una consiste nel modificare le preferenze direttamente nel browser, la seconda consiste nell’installare l’estensione Foxy Proxy. Quest’ultimo è comodo per facilitare il passaggio tra navigazione diretta e navigazione tramite socket. Nel primo caso andiamo nelle preferenze di Firefox, selezioniamo la tab Avanzate, poi la tab Rete e clicchiamo su Impostazioni di rete, selezioniamo quindi la voce “Configurazione manuale del proxy“. Scriviamo localhost nella casella Proxy HTTP e 9999 nella casella Porta. Prosegui la lettura…

Categorie:Linux Tag: , , ,