Categories
News Programming

Pure is a responsive CSS framework

As the demand ramps up to make everything responsive, I’m out looking for ways to make it easier. This might help.

Pure

A set of small, responsive CSS modules that you can use in every web project.

Categories
News Programming

5 HTML5 Features you need to know

All good.

5 HTML5 Features you need to know – Adnane Belmadiaf’s Blog

HTML5 has been around for a while now, it introduces lots of new and exciting new JavaScript and HTML APIs for both mobile and desktop, so in this post you will discover some HTML5 features that will enhance your web apps and will save you a lot of time.

Categories
News Programming

PHP on Google App Engine

Seems like more trouble than it’s worth.

PHP Overview – Google App Engine — Google Developers

App Engine applications can be implemented using the PHP programming language. This developer guide introduces the standard interfaces and explains how to use them with App Engine, as well as the raw APIs and development tools included in the App Engine PHP SDK.

Categories
Programming

Scientific Cat Name Generation

This is one of the most interesting little projects I’ve done recently. I got to apply some of my interest in randomly generated content to a real marketing purpose. The Scoop Away brand is whimsical, which offered a great opportunity to build a complex engine for recommending cat names. The stakes were low as far as making recommendations. After all, it’s hard to argue definitively about the right name for a cat. Regardless, I built a system that allowed non-technical folks work their creative magic and mixed in some rules to make it seem like a very scientific name generate that produces consistent results. That is, if you answer the questions the same way, you will get the same results.

Configuration for the generator is done through two CSV files, one that outlines all questions and answers and one that contains all the recommended names. The first file has one row per question. After the text of the question, pairs of columns contain the answer text and an answer image filename. For example, the first question is as follows.

gender What gender cat are you naming? Male male.png Female female.png

The second file lists one name per row with the text answers in following columns. A truncated example row follows.

Ace Female Other Chocolate Pretty high

We have the name “Ace” as suggested for female cats with primarily brown fur (among ten other dimensions). This second CSV file is a big matrix that allows me to match an input set of answers to sort all the names based on how many answers match. All questions are treated with equal weight. This does produce some times. The tie-breaker is a pseudo-random number seeded by the current month number. This produces the same results for the same answers for a span of a month. Next month, the answers will be in a different order. A year later, the order will be same again.

One key piece that made this possible was a jQuery plugin for reading CSV files. I found Evan Plaice’s jquery-csv on google code. The docs are great and it was easy to get it going.

I implemented the generator as a jquery plugin itself. You can check out the code here: http://www.scoopaway.com/js/pages/cat-name-generator.js. Next, I hope to adapt this technique for a more serious product selector. Hopefully that exercises the code in way that shakes out any bugs in the logic.

Categories
Programming

Cleaning up failed multi-part uploads on Amazon S3

This problem hit me, too. I backup stuff with s3cmd every night. I kick off a sync at 2AM and kill the script at 6AM. For a while, I had one large file that could not finish. I built up a lot of orphaned file fragments. My monthly S3 bill kept growing and Amazon reported more and more storage being used, but if I used s3cmd to add up all the files, it was way below. It took awhile to sort it out because Amazon’s tools a somewhat primitive–and I think they discouraged third parties from developing tools for analyzing usage by changing formats frequently.

Anyway, now I’m cleaning out incomplete multi-part uploads every night using the technique described below.

Cleaning up failed multi-part uploads on Amazon S3

I’ve recently been using sc3cmd to back up a lot of data to Amazon S3. Version 1.1.0 (currently in beta) supports multi-part uploads. It has borked a few times half way through large uploads, without properly aborting the operation server-side. This meant that the parts uploaded so far were not removed from the server, and that’s bad because Amazon charges for this storage.

s3cmd doesn’t currently have any way to list or abort interrupted multi-part uploads, which meant I had to figure out some other way to do it. It turned out to be quite simple using Python and the boto library: