Congratulations, You Can Mail-Merge!

I had this exact thought the other day and need to share this great article by Morgan Stewart. Quick quote:

I’ve received over 500 emails so far this year in which the subject line included my first name. “Morgan, Book Now & Save on Top Travel Deals” “Morgan – Congratulations! Your Nomination to Cambridge Who’s Who!” “Morgan, Get Dad a 58″ Samsung Widescreen.”

When I see an email with my name in the subject line, my first thought is not “Phew! These guys know my name!” No, it’s become a red flag for spam.

He’s spot-on: these days seeing my name in the subject line is almost a sure sign of spam. Read the entire post here.

Good to know I share good company on the Cambridge Who’s Who list.

Twilio: Rolling My Wife’s Eyes in 31 Lines of PHP

And then she gives you that look
The Look - Flickr user Nabo, used under CC license

For some reason a certain number of my little side projects result in “The Look”, that rolled-eyes expression that let’s me know I’m such a nerd. Given that Valentine’s Day fell on a weekend this year and I had a little free time this Sunday morning, the look was inevitable.

Today I finally had a few minutes to try out Twilio, a new web services provider that helps to telephone-enable applications through an easy REST API. In the case of PHP it is made even easier through a helper library provided by Twilio on their developer site.

Twilio is free to sign up and they provide a generous starting credit to begin exploring their service in a sandbox environment (they let you use their sandbox number for incoming call tests and put a watermark message on the front of all your outgoing communications). You can send and receive calls, add interactive menus to the calls, use recorded voice clips or text-to-speech and even send and receive text messages, all through their APIs and XML formatted speech scripts.

My Hello World test for the morning was simple; I wanted to call my home number and deliver a Valentine’s Day greeting. To do so I first signed up with Twilio, then went to my Twilio dashboard for my API key and to download the twilio.php helper library.

I then created helloworld.php with the following:

<?php
require "twilio.php";
 
/* Twilio REST API version */
$ApiVersion = "2008-08-01";
 
/* Set our AccountSid and AuthToken */
$AccountSid = "ACxxxxxxxxxxxxxx";
$AuthToken = "xxxxxxxxxxxx";
 
/* Outgoing Caller ID you have previously validated with Twilio */
$CallerID = '2223334444';
 
/* Instantiate a new Twilio Rest Client */
$client = new TwilioRestClient($AccountSid, $AuthToken);
 
/* make Twilio REST request to initiate outgoing call */
$response = $client->request("/$ApiVersion/Accounts/$AccountSid/Calls",
    "POST", array(
        "Caller" => $CallerID,
        "Called" => '4445556666',
        "Url" => "http://mysite.com/helloworld.xml"
    ));
    if($response->IsError)
        echo "Error: {$response->ErrorMessage}";
    else
        echo "Started call: {$response->ResponseXml->Call->Sid}";
?>

Initiating a call just requires a number to “call from” (in reality it’s just the number the Twilio system presents as caller ID), a number to call to, and the Account ID and token. The URL specified in the request to call out is an XML document that defines what happens during the call, using a format referred to as TwiML:

<Response>
        <Say>Happy Valentine's Day!</Say>
</Response>

In this case things are pretty straightforward, the system also has the ability to play mp3 files, take responses and branch based on keypresses and perform a number of additional actions. It looks like one could easily build a menu system or a survey system.

All in all an interesting offering that I’ll be tinkering with more in the future.

We’re Hiring

One unfortunate side effect of the Oracle acquisition of Sun and therefore MySQL is that apparently a number of good people will no longer be part of that team. If any are reading and need a lead, we have a number of positions open at http://www.messagesystems.com/company/careers/:

Web Site Developer

Project Manager

Pre-Sales Engineer (UK)

Director of Sales (UK)

Sales Manager (North East)

Director of Quality Assurance

Director, Professional Services

Client Integration Specialist

Support Engineer

Software Engineer

If interested contact me (myfirstname @ this domain) and I’ll gladly get your resume to the right people. Of course, if you’re not former MySQL and interested you can also feel free to contact me.

Review – Joe Celko’s Trees and Hierarchies in SQL for Smarties

When I started looking into managing hierarchical data I found a lot of short articles that provided bits and pieces of the big picture, but nothing gave a good in-depth review of everything I needed to know to handle hierarchies.

One trend that began to develop was that the best information on the subject was coming from Joe Celko, a rather prolific author/speaker on all things SQL.

Joe Celko has a book in publication called SQL For Smarties, and this book had some basic information on handling hierarchies, which he followed up with Trees and Hierarchies in SQL for Smarties, a truly excellent book on the subject.

This book is not for the faint of heart, but it really is a must-read for those who are looking to handle hierarchies in SQL.

The book only addresses MySQL once, and while in that section it repeats Joe’s opinion of MySQL not being a real database, users of MySQL 5 can rest assured that the stored procedure examples in the book work without modification (thanks to Joe and MySQL 5 both using the standard PL/PSM stored procedure syntax).

Overall this is an excellent book for those looking to implement hierarchical data in SQL.

Compiling Darwin Streaming Server for Centos 5 x86-64

Darwin Streaming Server works well on Linux, and on my preferred platform CentOS 5, but not without compiling it yourself. Linux is not a supported platform in the code provided by Apple, but fortunately a patched version of the source has been provided by a member of the DSS community.

To use Darwin Streaming Server on CentOS 5, follow these steps:

1) Get and install RPM building tools and the source RPM:

yum install rpm-build gcc make gcc-c++ perl-Net-SSLeay
wget http://www.abrahamsson.com/DarwinStreamingServer-6.0.3-2.src.rpm
rpm -i DarwinStreamingServer-6.0.3-2.src.rpm

2) Build the source RPM:

cd /usr/src/redhat/SPECS/
rpmbuild -bb DarwinStreamingServer.spec

3) Install the built RPM:

cd /usr/src/redhat/RPMS/x86_64/
rpm -U DarwinStreamingServer*

4) The install will hang after warning you to change the password with qtpasswd (you certainly should do so), resolve it by killing the DSS daemon from another shell session:

killall -9 DarwinStreamingServer

And that’s it. There are plenty of resources out there for using and configuring DSS that can take you from here, but you can find the config at /etc/dss/streamingserver.xml, the logs are at /var/log/dss/ and the video files are at /var/dss/movies. By loading rstp://<yourserver>:554/sample_100kbit.mp4 you can verify everything is working.

Mailchimp Makes Project Omnivore Public

Pretty impressive blog post at MailChimp today, in which they make public the details of their Project Omnivore: http://www.mailchimp.com/blog/project-omnivore-declassified.

In short:

Omnivore is a program that runs in the background and analyzes email campaign and user account data. Non-stop.

When it finds anything suspicious about a MailChimp user or his campaigns, it’ll do one of two things:

  1. Send the user a warning for something that looks problematic.
  2. Suspend a user’s account for something bad, send them a warning, and alert our abuse team to investigate the account.

The long version is at the link and the impressive part is how much data and prediction they are incorporating into the tool to help them avoid sending campaigns that will damage their sending reputation in the long run. It’s not just about filtering the mail stream to make sure it’s not going to trip filters, but watching the list management practices of their customers.

This is the kind of thing that all ESPs are going to have to start doing moving toward, using internal systems to ensure that the right message is being sent to the right people, then combined with tools like Adaptive Delivery and real-time bounce and feedback loop processing to make sure that the messages are being sent in the right way.

Some days I’d just like to see what a company like MailChimp would do with our toolset, give them a messaging server with internal scripting that can hook into their datasources and I’d wager some very cool things would come out.

Resolving PHP-MySQL Connection Issues

I ran into an interesting issue when installing WordPress on my re-installed server, I could not get a database connection during installation. I added some debugging and discovered that I had a “Can’t connect to MySQL server on” error returned after the call to mysql_connect() in PHP.

To check the source of the issue I then tried to connect on the command-line using the mysql client, which occurred successfully, confirming that I was using the correct credentials and host address (this was a remote MySQL server).

I next created a test PHP script with a simple mysql_connect() call, and executed it with “php test.php” from the command-line, which was also successful.

Finally I accessed test.php through a browser, where again the connection failed.

So I was dealing with a situation where it was Apache in particular that was unable to connect to the remote MySQL server. Thanks to Wez Furlong‘s ideas I was able to narrow this down to SELinux blocking outgoing communications by Apache.

So, if you’re having issues with Apache and specifically connecting out, you may want to disable SELinux for Apache.