Coderguy’s Blog

Thoughts on code

About

Hello, my name is Daniel Ice. I am a software developer in the Dallas, TX area. I enjoy learning about new technology. I mostly focus on PHP and Ruby on Rails.

Trying out Nginx

February 16th, 2010

So, I have heard about nginx (engine x) as a great alternative to apache. Apache is a very robust web server. Nginx is a very minimal server. It doesn’t to a lot of stuff, but that is fine because it does the things I need it to do. Being a PHP developer the big hurdle for adopting nginx was getting it to run PHP. Up until now I had always used PHP as an apache module. Nginx does not support apache modules, so I have to run PHP in cgi mode. It required a little bit more configuration than a normal PHP install, but it seems to be very fast. You can check out my latest project the bookticker and let me know what you think.

Twitter Surveillance

February 11th, 2010

So I just installed nagios on my server at work. I configured it to check our companies websites every 5-10 minutes. I even got a couple of the sites setup to check if it was able to log in via the web inject plugin. That’s not really that or earth shattering.

Things got interesting when I tweeted that I had installed nagios. A few hours later I was followed by Icinga. Icinga appears to be a competing source monitoring system. They seem to have a twitter bot that is search for the #nagios tag and then following anyone who mentions them. I find this a pretty clever way to market to new customers.

Show Forgein Keys in MySQL

November 25th, 2009

Here is a handy query I found the mysql reference manual for how to see all the foreign keys in a database:

SELECT ke.referenced_table_name parent, ke.table_name child, ke.constraint_name
FROM information_schema.KEY_COLUMN_USAGE ke
WHERE ke.referenced_table_name IS NOT NULL
ORDER BY ke.referenced_table_name;

Couchdb CURL gotcha

October 5th, 2009

So this is one of those stupid little development issues that eats up an hour of your time.  I am documenting this in hopes that it will save someone from wasting an hour of your time.

I am learning couchdb and using curl to interact with it’s RESTful api.  I wrote a view and was trying to limit it by a key.  I was issuing the commands:

curl -X GET http://127.0.0.1:5984/blog/_design/posts/_view/by_author?key="rob"

I was getting a 500 error for invalid json.  When I pasted the URL in the web browser I got a valid response.  The problem was that you needed to escape the quotes on the curl call as %22 not “.

curl -X GET http://127.0.0.1:5984/blog/_design/posts/_view/by_author?key=%22rob%22

Keep in mind you only have to put the quotes around string values a not around numeric values.

Learning to Test: Email Signup

September 30th, 2009

Background

A big part of the DSNews.com website is its Daily Dose. The Daily Dose is a daily email that includes the top 4 stories on the site. We send it out to a lot of people and it is opened and people click through to stories. Before the re-launch in August, this email was the site’s main source of traffic.

Since the email was a big source of our traffic, I thought I would take a look and see if we could optimize it. I looked over the original signup form. When I first clicked the signup button I cringed, the site had committed the most common web design sin: asking for more data than you need. In order to receive the email you had to enter your name, mailing address, phone number, and finally your email. These were not optional fields; they were required. This was way too much commitment for people, who just want to receive a daily email. All we really needed to know was their email, their name would be nice as well, but at the end of the day just their email.

I asked around the company and found out that we did nothing with the extra data we collected, but most people reassured me that it was valuable data. I agree that it could be valuable data, but the customer signing up for the email just wants an email. I thought of Seth Godin’s rules on permission marketing. You communications must be anticipated, relevant, and desired. With this in mind I axed all the fields on the signup for down to just an email. If we wanted to send them something in the mail then we could ask for the extra data later. Removing the excess fields in the form and a boost in traffic resulted in a 238% increase in signups.

The lesson learned: DON’T ASK FOR IT IF YOU DON’T NEED IT.

I am saddened to think about the hundreds if not thousands of customers that we have no interaction with because our signup requirements were to high.

Moving to Mailchimp

Our company had been using Constant Contact for all of their emails. I watched the painstaking process of our editor cutting and pasting the top headlines and summaries from the old CMS into the Constant Contact interface. I had played around with MailChimp in the past as well as Aweber. I ultimately decided to go with MailChimp because of its API. Constant Contact has an API, but it is not nearly as mature or simple as the MailChimp API.

MailChimp’s API has made it very simple to allow our editors to queue up stories for the Daily Dose email. It took me about 2 hours to set it up the API and saves the editors at least an hour a day. Setting up the email template took me longer than setting up the API.

In addition to the time saved, we have found that MailChimp has a better delivery rate resulting in 50% higher opens and 50% higher click-thrus. We were using the same list with the same basic layout, but getting much better response. MailChimp also auto prunes the email list of email addresses that hard bounce or soft bounce 3 times.

On a side note: I have plans to play around with their split test functions later. I am very interested in finding out if the titles we use on our emails are hurting or helping us.

Getting Noticed

Since the re-launch we have had a lot more traffic from Google. One of our goals has been to take that one time traffic and convert them to repeat visitors. Allowing people to receive the Daily Dose is a great way to meet that goal. I did some research and found that while we spent most of our time developing our homepage, more people were landing directly on an article page. I modified the article page to highlight the Daily Dose form. This modification only took me about 2 hours to design and code. The result has been a 632% increase over the original form on the old site and a 264% increase by adding the highlighted signup form. Keep in mind we also had a large increase in traffic, but the absolute numbers of signups is significantly up.

After

Before

After

After

Conclusion

These are great results eliminating the excess fields and highlighting the feature has really boosted our signups. There is a strong correlation in between spikes of new visitors and Daily Dose signups. When time permits I am going to try testing some variations on the call to action headlines and possibly some other tweaks to increase my conversion further.

Shameless Plugs

If you would like to signup for the Daily Dose you can here.

If you would like to signup up for MailChimp, you can use this link to give me the credit.

Learning to Test: Images vs Text

September 19th, 2009

We recently redesigned DSNews.com.  We had a tight deadline so some of the polishing elements have been added on over time.  Rather than add them in a careless manner, I decided to develop my testing skill set by always introducing new elements with a 2 or 3 variation test.

The first new feature to be developed and deployed with a test was the incorporation of a “Recent Articles” list at the bottom of every article.  The recent articles widget filled a large whitespace on some of the shorter articles.  In addition to that, the site picked up by the Google news service, which resulted in an uptick in traffic landing on the article page rather than the homepage.  We wanted to encourage this traffic view a couple of stories.

before

Before

This would be my second test with the shiny new to me Google Website Optimizer.  I chose to set the test up as a multi-variant test.  I liked the multi-variant test because I could easily use a bit of ajax to load the different versions of the “Recent Articles” list.  Since the test was going to be on every article page, this was much simpler then trying to develop an A/B test, which would involve having multiple URLs for every article.

The test had 1 variable with 2 variations. The two variations I chose were to use an image with a headline or just a text headline.  When we designed the site we wanted to make sure that every article had a picture.  I made sure that the list would not show two articles with the same picture, other than that the headlines were identical.

Headlines with Pictures

Headlines with Pictures

Text Headlines

Text Headlines

I set up the test rather quickly.  I had run one other multi-variant ajax test in the past and converting the code for this test was a breeze.  Since our goal was to get them to view additional articles, I placed the conversion code on a click of a recent article from the list.

My prediction was that the image version would perform better than the text only version because people like pictures.  I let the test run and got some pretty quick feedback.  The text only version took the lead out of the gate and never gave it up.

I let the test run for two weeks.  We had 24,000 runs of the test, split evenly between the two variations.  The text version converted at 9.5-11.7% during the course of the test.  The image version converted at 6.8-7.8% during the test.  At the end of the day the text version was a 42.9% improvement.  This was a substantial win.  Since the article page accounts for 55-60% of the sites page views the benefit of this test can be calculated by:

% of page views the article page represents * % of clicks on a recent article

60% * 9.5% = a 5.7% increase in overall page views (Text only)
60% * 6.8% = a 4.1% increase in overall page views (Image and Text)

Bottom line: My intuition was wrong on this test.  People seem to find the large text only headlines more clickable than the images.  A 5.7% increase in page views is huge for our site. The winning variation added an extra 1.6% to the top line.

The Winning Combo

The Winning Combo

If you would like to see the winning version in action you can check it out here.

Get the Mime Type of a File

August 6th, 2009

If you would like to know the mime type of the file you can use the file command with the -i -b options.  Example:

> file -i -b 20090731.flv

application/octet-stream

I was working on a 404 page today.  The pages that detected the 404 and routed it to the 404 page, would try and set the $_SESSION['404'] variable.  After setting the variable I was able to use it on that page.  However, after the redirect the variable was missing.  I could set other variables, and they would remain from page to page.  I put in some extra debugging and received the message:

Notice: Unknown: Skipping numeric key 404

This lead me to rename my variable to $_SESSION['url404'], which would stay set on the redirect.  I have not found any documentation that says that numeric keys are illegal for sessions vars, but I believe it to be the case.

Hope this saves you time in your PHP coding.

Here is nifty little tip.  If you need to have your command line MySQL autocomplete enabled or refresh the just type \# at the command line.

mysql>\#

This is great for those times when you creating a lot of tables.

As new versions of SVN come out, I enviably run into the error message:

svn: This client is too old to work with working copy ‘.’.

I have spent countless hours looking for a good way to upgrade the SVN client on my Mac. The offical SVN page, includes links to MacPorts and Fink versions. I don’t want to install all of that just to upgrade my SVN. I just recently noticed that they also had a link to a company that provides a nice simple installer to upgrade your SVN client on your Mac.

Here is the link: http://www.open.collab.net/downloads/community/

BTW: You don’t have to fill out to register to download.