Follow leybzon on Twitter

Thursday, September 15, 2011

Vampire post-mortum on how to create TV-scale applications

Had fine time yesterday watching MTV's Deadliest Warrior on big TV screen and Loyalize's servers on my laptop screen crunching numbers from users' vote during the show. Personally, I have more passion for software then for Zombies or Vampires, so I found it to be much more fun watching my laptop screen then TV. What struck me is that just a few years back, numbers that I saw on my laptop will be if not impossible but extremely difficult to achieve. So, I am glad to report, that common (open source) technology is finally is at the level that it allows a relatively small team of good engineers to write an application that works for TV-audience scale.

What worked for us is the combination of:

Of cause, it's a lot of work to make them work together in scalable and reliable fashion but, at least, finally, we do not need to mix sand and clay to make bricks first if we want to build a house - all bricks are are readily available for download.

Tuesday, January 25, 2011

Amazon Simple Email Service (Amazon SES) and PHP

This morning Amazon announced availability of a bulk email delivery service called "Simple Email Service". Anyone who knows how much pain is it to set-up scalable email solution (and it is not just spammers who need it!) should celebrate the occasion. I know of a company that spent several years cleaning ip addresses it sends email and found itself locked into the contract with internet provider since it would take forever to reach required level of email deliver ability anywhere else.

Anyway, this evening I decided to check the Amazon claim that the service is "simple". Found out that it is indeed simple!
Since there is not much in terms of the documentation yet, here is my code where I used AWS PHP library:

// Enable full-blown error reporting.

// Set plain text headers
header("Content-type: text/plain; charset=utf-8");

// Include the SDK
require_once '../sdk.class.php';

// Instantiate the Amazon class
$ses = new AmazonSES();

//what's our quota?
$rQuota = $ses->get_send_quota();
$quota24 = (int) $rQuota->body->GetSendQuotaResult->Max24HourSend;
$sentCnt = (int) $rQuota->body->GetSendQuotaResult->SentLast24Hours;
"we can send max of $quota24 per 24 hrs and we sent $sentCnt so far\n");

//verify sender email (do it once per sender!)

//send email
$source = '';
$destination = CFComplexType::map(array('ToAddresses'=>'', 'CcAddresses'=>''));

$message = CFComplexType::map(array('Subject.Data'->'test email', 'Body.Text.Data'->'test message ' . rand(100, 1000)));
$rSendEmail = $ses->send_email($source, $destination, $message);

if (
$rSendEmail->status==200) {
$emailId = $rSendEmail->body->SendEmailResult->MessageId;
"sent test email with id: $emailId\n");
else {