"I bravi artisti copiano, i grandi artisti rubano."

Pablo Picasso

0 notes

Inventare il futuro

Inventare il futuro

2 notes

Jquery ajax call in 1 minute

Le funzioni showMessage() e logError() sono custom, vanno eventualmente implementate.

Ecco il codice.

$.ajax({

        url: ‘/url/to_call’,

        type: ‘post’,

        data: {

            variable_named_a: a_local_variable, 

            text_variable: “wow amazing, create post variable content!”

        },

        success: function(data, status, xhr) {

            var json = null;

            try {

                json = $.parseJSON(xhr.responseText);

            } catch (e) {

                logError(‘myFunction() json parse error:’ + e);

                showMessage(‘error’);

                return false;

            }

            myhtml = “”;

            if(!json.result) {

                logError(‘myFunction() json result error: ’ + xhr.responseText);

                showMessage(‘error’);

            } else {

                // rigth data

// process !

};                   

        },

        complete: function(xhr, status, error) {

// todo

// this codes will be executed all the time

        },

        error: function(xhr, status, error) {   

            if(status == “error”) {

                var message = “error: myFunction()\t” + “status: ” + status + “\terror: ” + error + “\txhr: ” + xhr;

                logError(message);

                showMessage(‘error’);

            }

        }

    })

1 note

Un ringraziamento a chi ci ha permesso di poter parlare di Comuni-Chiamo davanti a questa importantissima platea.

Un ringraziamento a chi ci ha permesso di poter parlare di Comuni-Chiamo davanti a questa importantissima platea.

(Source: comuni-chiamo)

3 notes

Amazon SES PHP

In questi giorni sto lavorando il servizio di posta di amazon per l’invio di mail.

E’ noto a molti che l’invio da server Amazon utilizzando sistemi classici desta qualche problema.

La ricerca di servizi SMTP di tipo Enterprise mi ha portato ha scegliere lo stesso Amazon SES. Dopo qualche minuto sono riuscito a scrivere alcune righe di codice php che permettessero l’invio di mail.

Vi riporto qui di seguito un piccolo sample.

$verified_mail_for_send = “verifiedmail@readyforsend.com”;
$subject = “my subject”;
$to = array(“receiver1@nohost.com”, “receiver2@nohost.com”);
$reply = array(“anothermail@nohost.com”);

try {
 $amazonSes = new AmazonSES(AWS_KEY, AWS_SECRET_KEY);
$amazonSes->verify_email_address($verified_mail_for_send);
} catch (Exception $e) {
// log error or handling exception
}

$response = $amazonSes->send_email(
$verified_mail_for_send,
array(‘ToAddresses’ => $to),
array(
‘Subject.Data’ => $subject,
‘Body.Text.Data’ => $message,
),
array(// Optional parameters
‘ReplyToAddresses’ => $reply
)
);

if (!$response->isOK()) {
// error! check this object at //http://docs.amazonwebservices.com/AWSSDKforPHP/latest/index.html#i=CFResponse

 return false;

} else {
return true;
}


0 notes