mercoledì 29 dicembre 2010

Estrarre i dati in formato SQL


Ci sono vari software a pagamento, tra i software gratuiti si può provare kettle, spoon, in altre parole Pentaho ETL !

La trasformazione è semplice

Table input --> SQL File Output


Però se dovete installare kettle solo per questo forse è meglio non perdere tempo e andiate a comprare qualcosa del tipo Altova DatabaseSpy

martedì 26 ottobre 2010

Eliminare e ricreare un md device (RAID 1 software)

A volte capita di dover cambiare la configurazione dei device md sul software raid


Cancellare un device MD


mdadm --manage /dev/mdfoo --fail /dev/sdfoo
mdadm --manage /dev/mdfoo --remove /dev/sdfoo
mdadm --manage --stop /dev/mdfoo


Ricrearlo

mdadm --create --level=1 --raid-devices=2 /dev/md2 /dev/sda3 /dev/sdb3


Rifare il file di configurazione

echo DEVICE partitions > /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf
/sbin/mdadm --assemble --scan

giovedì 14 ottobre 2010

WD vs linux

Gli hard disk WD Green hanno una caratteristica interessante di mettere a riposo le testine dopo 8 secondi di non utilizzo.

Questo fa risparmiare energia (Green) ma non va molto d'accordo con Linux.... che fa in modo che ogni minuto l'hard disk vada i modalità di risparmio energetico 3 volte al minuto usurando la meccanica del disco e andando fuori parametro S.M.A.R.T. nel giro di soli 10 mesi circa.

Per visualizzare il parametro:
smartctl --all /dev/sda | grep Load_Cycle


Per ovviare a questo problema WD è venuta incontro con un'utility chiamada wdidle3 che permette di settare il tempo di idle dopo il quale mandare a riposo il disco.

Utilizzando l'opzione wdidle3 /D viene disabilitata la modalità di ilde del disco.


Si consumerà di più energia ma il disco non si usura. !!!




martedì 5 ottobre 2010

RICERCA FIREFOX

COME CONFIGURARE LA BARRA DI RICERCA CON FIREFOX


http://www.rakshitk.com/blog/2008/05/13/how-to-configure-firefox-address-bar-with-search-engines/


martedì 7 settembre 2010

Come cambiare i permessi di directory o files ricorsivamente

Recursively chmod directories only

June 19th, 2006

find . -type d -exec chmod 755 {} \;

This will recursively search your directory tree (starting at dir 'dot') and chmod 755 all directories only.

Similarly, the following will chmod all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;



Cerchi qualcosa ? (un file che contiene una certa stringa ?)

Grep all files in a directory for a string

grep -i -r somestring ./

-i means ignore case
-r means recursive

Simple stuff, but useful nonetheless.


from
http://movabletripe.com/

venerdì 3 settembre 2010

JQuery UI Vs Tool (alias una poltrona per due)

Far convivere JQuery UI e JQuery Tool


Queste due ottime librerie apparentemente non possono essere usate contemporaneamente... in realtà il problema a quanto pare sta solo nel tabs. Quindi una soluzione che per ora sembra funzionare è quella di non includere i tab in una delle due librerie.

mercoledì 1 settembre 2010

Mdadm spedisce una mail quando un md device fallisce

Getting E-mail notifications when MD devices fail

I use the MD (multiple device) logical volume manager to mirror the boot devices on the Linux servers I support. When I first started using MD, the mdadm utility was not available to manage and monitor MD devices. Since disk failures are relatively common in large shops, I used the shell script from my SysAdmin article Monitoring and Managing Linux Software RAID to send E-mail when a device entered the failed state. While reading through the mdadm(8) manual page, I came across the "–monitor" and "–mail" options. These options can be used to monitor the operational state of the MD devices in a server, and generate E-mail notifications if a problem is detected. E-mail notification support can be enabled by running mdadm with the "–monitor" option to monitor devices, the "–daemonise" option to create a daemon process, and the "–mail" option to generate E-mail:

$ /sbin/mdadm --monitor --scan --daemonise --mail=root@localhost

Once mdadm is daemonized, an E-mail similar to the following will be sent each time a failure is detected:

From: mdadm monitoring 
To: root@localhost.localdomain
Subject: Fail event on /dev/md1:biscuit

This is an automatically generated mail message from mdadm
running on biscuit

A Fail event had been detected on md device /dev/md1.

Faithfully yours, etc.

preso da http://prefetch.net/blog/index.php/2006/08/20/getting-e-mail-notifications-when-md-devices-fail/

smartmontools debian lenny

Hard disk health monitoring in Debian Lenny using smartmontools

impostazioni per il settaggio di S.M.A.R.T. su debian lenny --> very cool


Install smartmontools from the repository.

thinkpad:~# aptitude install smartmontools

Enable SMART monitoring on the SATA drive.

thinkpad:~# smartctl -s on  -d ata /dev/sda

Check the health of the drive.

thinkpad:~# smartctl -d ata -H /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

Run a short self test on the drive and check the test log.

thinkpad:~# smartctl -t short /dev/sda
thinkpad:~# smartctl -l selftest /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      4156         -

In order to configure smartd to monitor the hard disk, enable it in /etc/default/smartmontools.

# uncomment to start smartd on system startup
start_smartd=yes

Set the schedule and monitoring options by editing /etc/smartd.conf.


Comment out all the DEVICESCAN lines and add a line for the main hard drive.

# First (primary) ATA/IDE hard disk.  Monitor all attributes, enable
# automatic online data collection, automatic Attribute autosave, and
# start a short self-test every day between 2-3am, and a long self test
# Saturdays between 3-4am. Send mail on SMART failures
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m naveen@localhost

Start the smart daemon.

thinkpad:~# /etc/init.d/smartmontools restart
* Restarting S.M.A.R.T. daemon smartd            [ OK ]


martedì 3 agosto 2010

Free Font Compilation

Cercando info sui font ho trovato questa utile "Compilation" di fonts

http://fonts.debian.net/

Aggiungere Font a JAVA

Problema

Utilizzando Jasper Report mi è capitato che su debian lenny risultava un errore perchè non veniva trovato il font Verdana.
Avevo installato Java manualmente scaricandolo dal sito della sun-oracle

Soluzione

Dopo avere installato il pacchetto di fonts
apt-get install msttcorefonts

sono andato a copiare a mano tutti i font sulla cartella jre/lib dell'installazione di java

cp /usr/share/fonts/truetype/msttcorefonts/*.ttf $JAVA_HOME/jre/lib/fonts