Categorie
Information and Communications Technology

VBA Macro Example to Update Outlook Contacts

This is a simple macro example that describes how to update outlook contacts:

Sub updateContacts()
    Dim ContactsFolder As Folder
    Dim Contact As ContactItem
    Set ContactsFolder = Session.GetDefaultFolder(olFolderContacts)
    i = 0
    For Each Contact In ContactsFolder.Items
        first_name = Contact.FirstName
        middle_name = Contact.MiddleName
        last_name = Contact.LastName
        If middle_name <> "" Then
            Contact.FirstName = first_name & " " & middle_name
            Contact.MiddleName = ""
            Contact.Save
            i = i + 1
        End If
    Next
    MsgBox ("Contacts Found: " & ContactsFolder.Items.Count & ", Updated: " & i)
End Sub
Categorie
Information and Communications Technology

GNU ddrescue log SVG graph

This is a perl script that creates the svg code that matches a ddrescue log file.
SVG module is required. Edit the $INPUT_FILE and $SCALE_FACTOR variables as needed.
The SVG code is outputted to standard output. The messages to standard error.
Use ddrescue-svg-log.pl > output.svg to output to file.

#!/usr/bin/perl
use strict;
use warnings;
use SVG;
use Math::BigInt;
##############################
my $SCALE_FACTOR = 10240000;
my $SCALE_FACTOR_LABEL = 1024 * 1024 * 1024; #giga
my $INPUT_FILE = "sda-80gb-log.txt";
##############################
my $ddlogfile;
open $ddlogfile, "<$INPUT_FILE";
my $svg = SVG->new(width=>1000,height=>200);
# use explicit element constructor to generate a group element
my $svg_disc_group=$svg->group(id => 'disc_group');
while (<$ddlogfile>) {
    my $row = $_;
    chomp $row;
    # STATUS CHARACTERS: +,-,/,*,?
    if($row =~ m/^(0x[0-9A-z]*)\s*(0x[0-9A-z]*)\s*(\+|-|\/|\*|\?)/) {
        my $start = $1;
        my $size = $2;
        my $status = $3;
        
        print STDERR $row;
        
        #CALCULATE SVG COORDINATES USING $SCALE_FACTOR
        my $bigint_start_scaled = Math::BigInt->new($1);
        my $bigint_size_scaled = Math::BigInt->new($2);
        my ($_qx, $_rx) = $bigint_start_scaled->bdiv($SCALE_FACTOR);
        my ($_qw, $_rw) = $bigint_size_scaled->bdiv($SCALE_FACTOR);
        my $x = $_qx->numify() + ( $_rx->numify() / $SCALE_FACTOR ) ;
        my $w = $_qw->numify() + ( $_rw->numify() / $SCALE_FACTOR ) ;
       
        #LABEL VALUES
        my $bigint_start_label = Math::BigInt->new($1);
        my $bigint_size_label = Math::BigInt->new($2);
        my ($_q_start_lbl, $_r_start_lbl) = $bigint_start_label->bdiv($SCALE_FACTOR_LABEL);
        my ($_q_size_lbl, $_r_size_lbl) = $bigint_size_label->bdiv($SCALE_FACTOR_LABEL);
        my $start_lbl = $_q_start_lbl->numify() + ( $_r_start_lbl->numify() / $SCALE_FACTOR_LABEL ) ;
        my $size_lbl = $_q_size_lbl->numify() + ( $_r_size_lbl->numify() / $SCALE_FACTOR_LABEL ) ;
        my $rect_label = sprintf("%.2f", $start_lbl) . "[" . sprintf("%.2f", $size_lbl) . "]($status)";
               
        my $svg_sector_group = $svg_disc_group->group();
        my $rect_style = ($status eq '+')?{ fill=>"green" }:{ fill=>"red", stroke=>"red" };
        
        # add a rectangle to the group
        $svg_sector_group->rectangle(
                x     => $x,
                width => $w,
                y => 0,
                height => 30,
                style => $rect_style
            );
               
        $svg_sector_group->text(x=>$x, y=>40, -cdata=> $rect_label, style=>'font-size: 2px');
        
        print STDERR ("START: $start, SIZE: $size, STATUS: $status\n");
    }
    
}
# now render the SVG object, implicitly use svg namespace
print $svg->xmlify;
Categorie
Information and Communications Technology

Yii Console Log with Unit Testing

1. install phpunit correctly
pear install phpunit/PHPUnit
pear install phpunit/PHPUnit_Selenium
2. create the class CConsoleLogRoute in the components directory in the file CConsoleLogRoute.php with this code:
<?php
class CConsoleLogRoute extends CLogRoute {
protected function processLogs($logs)
{
foreach($logs as $log) {
echo $this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
}
}
}
3. configure YII to log when unit testing:
3a. add the log key in the components array in protected/config/test.php
‘log’=>array(
‘class’=>’CLogRouter’,
‘routes’=>array(
array(
‘class’=>’CConsoleLogRoute’,
‘levels’=>’error, warning, info, trace’,
),
),
),
3b. add some lines in protected/tests/bootstrap.php, the modified file should be this: (added the lines with YII_DEBUG, YII_TRACE_LEVEL, autoFlush and autoDump)
<?php
// change the following paths if necessary
$yiit=dirname(__FILE__).’/../../../framework/yiit.php’;
$config=dirname(__FILE__).’/../config/test.php’;
defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,true);
defined(‘YII_TRACE_LEVEL’) or define(‘YII_TRACE_LEVEL’, 0);
require_once($yiit);
require_once(dirname(__FILE__).’/WebTestCase.php’);
Yii::createWebApplication($config);
Yii::getLogger()->autoFlush = 1;
Yii::getLogger()->autoDump = true;

Categorie
Elettronica

Universal Remote Control RM-101 User's Guide

Page 1
Page 2

Categorie
Information and Communications Technology

Virtual Burners for HP Recovery Manager Media Creator ISO creation

With my new laptop i want to create the recovery discs into the iso format, without burning any real dvd.
Then i searched for a virtual dvd-r dvd-rw burner. I found TotalMounter 1.50 (free software). Then i created a virtual empty disc (a .iso file on the filesystem) and used HP Recovery Media Creator to burn to the dvd. This do not work, HP Recovery Media Creator gave me an error: REWRITEABLE MEDIA NOT SUPPORTED. TotalMounter mounted a virtual DVD-RW disc. And no option on TotalMounter to choose from DVD-R or DVD-RW to insert into the virtual burner.
Then i found Phantom Drive. That was the solution. Phantom Drive is another virtual burner software. It let me choose the type of virtual media: DVD-R, DVD+R, DVD-RW, and so on.
So first of all open Phantom Drive Starter and choose Phantom Settings. Uncheck the option:
“Reinsert image after burning if ejected
Then start the HP Recovery Media Creation process. When it asks for a blank dvd-r, go again to the Phanthom Drive Starter and choose Phantom Creator. Choose “DVD-R” as media type, then check “Create an iso image” and then choose the file location for the iso image, for example for the first DVD-R choose C:\Users\…\recovery_dvd1.phi (the phi extension will be replaced automatically with the iso extension because we choosed Create an iso image).
HP Recovery will recognize and use this virtual DVD-R.
Then when HP Recovery Media Creator ends burning (virtually) the first (virtual) DVD-R, it will ask you for the second blank DVD-R. Again use the Phantom Creator and change only the file location to another name recovery_dvd2.phi for example.
And so on for the other DVDs.
I think this method could be used for every media recovery creator as that from Acer, Asus and others. Thanks to Phantom Drive, great piece of software!!

Categorie
Informatica

Alice Gate ADSL Base [installazione, configurazione e connessione automatica]

LA SEGUENTE PROCEDURA È SPECIFICA PER WINDOWS 7

—- INSTALLAZIONE INIZIALE
1. Collegare e accendere il modem
1a. collegare il cavo telefonico alla presa telefonica
1b. collegare il modem al pc tramite cavo ethernet
2. Aspettare che il led rosso ADSL smetta di lampeggiare e diventi fisso
[se non rimane fisso controllare di aver collegato il cavo della linea telefonica]
[se il cavo e’ collegato correttamente, e il led lampeggia sempre, l’adsl non e’ attiva]
3. Start >> Pannello di Controllo (visualizzazione icone piccole)
4. Centro Connessioni di rete e condivisione
5. Cliccare su “Configura nuova connessione o rete”
6. Scegliere “Connessione a Internet” e cliccare su Avanti
7. Scegliere “Banda larga (PPPoe)”
8. Completare i campi nome utente e password con qualsiasi testo (non lasciarli vuoti)
Come nome connessione lasciare come impostato “Connessione a banda larga”
Mettere la spunta a “Memorizza Password”
Mettere la spunta a “Consenti l’utilizzo della connessione ad altri utenti”
9. Cliccare su Connetti
10. Viene visualizzata una finestra col testo “Prova della connessione internet in corso”
cliccare sul pulsante “Ignora” e poi sul pulsante “Chiudi”
(Se viene visualizzato connessione non riuscita cliccare su “Configura comunque la connessione”)
11. Ora la connessione e’ configurata. Adesso bisogna avviare la connessione
come descritto sotto.
—- AVVIO MANUALE DELLA CONNESSIONE
1. Start >> Pannello di Controllo (visualizzazione icone piccole)
2. Centro Connessioni di rete e condivisione
3. Modifica impostazioni scheda
4. In questa finestra deve essere presente una connessione col nome scelto,
nel nostro caso quello predefinito “Connessione a banda larga”
4b.(E’ possibile creare un collegamento sul desktop alla connessione trascinandola
sul desktop per accederci piu’ velocemente)
5. Cliccare col destro sulla connessione e scegliere Connetti
(o fare doppio clic sulla connessione)
6. Nella finestra che si aprira’ lasciare tutto cosi’ com’e’ e
cliccare sul tasto “Connetti”
7. Controllare se la connessione internet e’ funzionante
[Questo deve essere fatto ogni volta all’avvio del pc altrimenti
il pc non si connette in automatico. Per avviare la connessione in automatico
all’avvio del pc seguire le istruzioni seguenti]
—- AVVIO AUTOMATICO DELLA CONNESSIONE ALL’ACCENSIONE DEL PC
1. Start >> Tutti i programmi >> Accessori >> Utilita’ di sistema >> Utilita’ di pianificazione
2. Cliccare a destra su “Crea attivita’…”
SCHEDA GENERALE:
3. Dare un nome all’attivita’, per esempio Connessione ADSL automatica
4. Cliccare sul pulsante “Cambia utente o gruppo…”
5. Scrivere SYSTEM e cliccare su OK
SCHEDA ATTIVAZIONE (passare alla scheda Attivazione):
6. Cliccare su “Nuovo…”
7. Per “Avvia l’attivita’” scegliere “All’avvio” e cliccare su OK
8. Cliccare di nuovo su “Nuovo…”
9. Per “Avvia l’attivita’” scegliere “All’accesso”
10. Controllare che sia selezionato “Qualsiasi utente” e cliccare su OK
SCHEDA AZIONI (passare alla scheda Azioni):
10. Cliccare su “Nuova…”
11. Come “Operazione” lasciare selezionato “Avvio programma”
12. Nella casella di testo “Programma o script” scrivere il seguente testo:
rasdial “Connessione a banda larga” nicola nicola
(nicola e nicola sono il nome utente e la password della connessione che possono
essere un testo qualsiasi)
13. Cliccare su OK
14. Alla domanda proposta rispondere Si’
15. Cliccare su OK per creare l’attività
16. All’avvio del pc la connessione verra’ attivata in automatico.
17. Riavviare il pc e controllare se la connessione e’ attiva.

Categorie
Information and Communications Technology

SanDisk Cruzer Blade Windows Icons

I created some .ico files for Cruzer Blade Flash Drive:

Cruzer Blade Icon
Cruzer Blade Straight Icon
Sandisk Icon
Categorie
Informatica

Modificare la qualità di piu' file jpg in contemporanea

1. Installare ImageMagick:
Scaricarlo dal sito, in questo momento il link è questo (versione a 32bit per windows, il file con l’indicazione “Win32 dynamic at 16 bits-per-pixel”):
http://www.imagemagick.org/download/binaries/ImageMagick-6.7.3-8-Q16-windows-dll.exe
e installarlo
2. Creare il comando cambiaqualitajpg.bat in questo modo:
TASTO WINDOWS + R
digitare la riga seguente e premere invio
notepad %SYSTEMROOT%\cambiaqualitajpg.bat
alla domanda creare un nuovo file rispondere si,
si aprirà il blocco note, scrivere questa riga
FORFILES /m *.jpg /c “cmd /c convert @file -quality %1 @file”
controllare che le virgolette siano quelle dritte (MAIUSC+2), non quelle inglesi e chiudere il blocco note e salvare il file alla chiusura.
[N.B. se la cartella contiene dei file jpg e altre sottocartelle con altri file jpg e si vuole convertire anche quelli nelle sottocartelle, inserire nel blocco note la stessa riga, ma col parametro /s prima di /c, così:
FORFILES /m *.jpg /s /c “cmd /c convert @file -quality %1 @file”
]
3. Eseguire il comando “cambiaqualitajpg <QUALITA’>” nella cartella contenente i file jpg da convertire. Avviare la riga di comando:
TASTO WINDOWS + R
digitare cmd e premere invio
Spostarsi nella cartella dove si trovano i file jpg (tramite il comando cd), per esempio:
C:
cd C:\Dati\Prova\Immagini
e digitare il seguente comando
cambiaqualitajpg 80
dove 80 è la qualità con la quale vengono salvati i file jpg. I file vengono sovrascritti, quindi fare prima delle prove con una copia della cartella contenente i file jpg.
La qualità può essere un numero tra 1 e 100. 100 rappresenta la qualità massima. Naturalmente all’aumentare della qualità aumenta la dimensione dei file. Fare delle prove con vari valori del parametro qualità.

Categorie
Information and Communications Technology

Using Empathy with MSN Telepathy Butterfly behind a proxy

According to the Empathy FAQs, the MSN telepathy butterfly component should correctly use a proxy if python-libproxy is correctly installed.
I’m using linux mint debian edition latest with:
telepathy-buttefly 0.5.15
python-libproxy 0.3.1
but for me empathy does not work behind a proxy.
I’m trying to resolve this issue, but i found a workaround, edit as root the file:
/usr/share/pyshared/butterfly/protocol.py
modify the _parameter_defaults as follow:

    _parameter_defaults = {
‘server’ : u’messenger.hotmail.com’,
‘port’ : 1863,
‘http-method’ : True,
‘http-proxy-server’: ‘proxy-host’,
‘http-proxy-port’: ‘3128’,
‘https-proxy-server’: ‘proxy-host’,
‘https-proxy-port’: ‘3128’,
}

replace proxy-host with the address of your proxy and 3128 with the port of your proxy

Categorie
Information and Communications Technology

Installing Windows 8 Beta Developer Preview on VMware Player

If you try to install Windows 8 Developer Preview on VMware Player 3.1 you will get an HAL_INITIALIZATION_FAILED error starting the installation of Windows 8. This error because VMware Player 3.1 do not support ACPI 2.
It’s possible to “virtual” install Windows 8 on VMware Player 4. But there is a problem, VMware 4 is not available for download as standalone (until now). You must download and install VMware Workstation 8 (demo version), that include a free version of VMware Player 4. This is the link to download it:
http://www.vmware.com/go/downloadworkstation
I installed the ubuntu version on xubuntu 11.04 and the installation of Windows 8 on VMware Player 4 went fine.