Wednesday, December 31, 2014

Drop that Internet Explorer!

What about the globe icon?
Should you drop support for Internet Explorer 8? Why not? My comic never supported it in the first place.

Well, maybe that's a little unfair. My comic doesn't support it because it has no support for SVG images, which are a major part of the comic's design. Also, CSS3 support is not there, which makes things look pretty bad. I just don't have time to develop a completely different site design for the roughly 9% of Internet users still on the antique browser. I doubt they are my target audience anyway (actually, only about 10% of my comic audience uses any version of IE).

Yeah, that's the one I remember
Internet Explorer 8 is the last version available on Windows XP, which is itself no longer supported. I liked XP and kept it around for a really long time myself, but Windows 7 and 8 are just fine operating systems and both support decent versions of IE.

But for further reading, look at these:

Is it Time to Drop Support for IE8?

The Internet Explorer 8 Countdown

Microsoft IE8 browser support ending in 17 months

Now there are even rumors that Microsoft will replace Internet Explorer with a totally new browser in Windows 10! While you might think that retiring the frustrating surfing tool is great news, just wait until you have to support TWO DIFFERENT weird non-standards-compliant Microsoft browsers instead of just one! It's not like every computer on earth is going to suddenly upgrade to Windows 10. There will be people hanging around on Windows 7 for years, and I doubt they'll get this new browser.

In case you are wondering, it's not until Internet Explorer 10 that 100% of my comic is supported. It does look fine in IE9 though. I just don't know what happened to Internet Explorer. I remember it being much better than Netscape Navigator 4, but it lost its way somewhere around version 5. Nobody stays on top forever. I wonder when someone will come out with a better browser than Chrome...

Amphibian.com comic for 31 December 2014

Monday, December 29, 2014

Atomic Feed!

There just aren't enough ways to get my comic delivered to you. In the old days, a newspaper would be dropped off at your house each morning and would contain a page full of comics. You didn't have to go to the publisher and get them. But today, there are no newspapers (well, maybe a few are left) and I am my own publisher. You have to remember to go to amphibian.com every Monday, Wednesday, and Friday to see the comics. Who can remember to do that, with all the other stuff you have to remember every day?
How do you get your comics? (photo by cartese)

I had the idea that I should be supplying an RSS or Atom feed of my comic so those people who use readers like Feedly will be automatically given the new comics when they are available.

Since my comic server application is JavaScript on Node, of course I looked for a module on npm that would enable me to easily create feeds. The top one is simply called feed. And it worked fine. But I found a few limitations and quirks with it when I was creating Atom format.

First, the validation was a little off from the Atom specification. Link is not technically a required element of the feed element, but an error was generated if I didn't include it. It was also putting in a "hub" type link, but that's not an Atom thing - it's from the RSS 2.0 type. There was an option for "image" which mapped to the logo element, but there was not an option for specifying the icon element. The logo should be more like a banner (twice as wide as it is tall) and the icon should be square.

For individual entries in the feed, again link was mandatory when it doesn't have to be. It was also missing the published date option for entries.

Now don't get me wrong, it's a great package. The issues I found are relatively minor, so I forked the project on GitHub and made changes to correct them. My version is available at https://github.com/cwleonard/feed.

I am still playing around with how to structure the content and which optional elements make a difference to readers such as Feedly, so I don't recommend subscribing to the feed just yet. But here's an example of how I am currently using it:

var feed = new Feed({
    id: "http://amphibian.com",
    title: "Amphibian.com",
    description: "A web comic about frogs who run a technology company.",
    link: "http://amphibian.com",
    feed: "http://amphibian.com/feeds/atom",
    icon: "http://amphibian.com/simg/og_logo.png",
    copyright: "All rights reserved 2014, Casey Leonard",
    author: {
        name: "Casey Leonard",
        email: "casey at amphibian.com",
        link: "http://caseyleonard.com"
    }
});

var comics = loadComics(); // get the latest comics

for (var c in comics) {

    feed.addItem({
        title: comics[c].title,
        link: "http://amphibian.com/" + comics[c].id,
        description: "Amphibian.com comic for " + comics[c].pubDate,
        date: comics[c].pd,
        content: "comic html goes here"
    });

}

feed.updated = comics[0].pd; // date of the newest comic

var atom = feed.render("atom-1.0");

I'll be sure to announce when I think it's done and hope to get the comic listed in the "comics" category on Feedly as well.

Amphibian.com comic for 29 December 2014

Friday, December 26, 2014

What did you get for Christmas?

Another Christmas has passed and the new year will be here in a week. I still haven't had 2 minutes to write anything about the new JavaScript library I've been using off-and-on for the last few weeks, but hopefully that will change this weekend and all 3 of you that read this blog can be treated to that next week.

But let's take a moment to reflect on the gifts we've received for Christmas.

This year I got some coffee aged in oak barrels previously used to age Cabernet. I also got a stapler that looks like a frog.

When I was 12 years old, I got Visual Basic 3.0 (on floppy disks). That was an exciting Christmas. It was quite expensive at the time and I believe it might have been the only thing I got from my parents that year.

In 2001, I got two 15-inch LCD monitors from my girlfriend. I gave her an engagement ring that same year, and we've been married since September 2002. I would have given her the ring even if she hadn't given me the monitors.

Amphibian.com comic for 26 December 2014

Wednesday, December 24, 2014

Merry Christmas!

'Twas the night before Christmas...

Yes, it is Christmas Eve. I hope you have all your shopping done, if you're one of those people who buys gifts at Christmas.

My 5-part Christmas poem on amphibian.com wraps up today. I'll be spending this evening with my family in our traditional manner - pizza, Christmas Eve service at our church, and watching the Muppet Christmas Carol. The best film adaptation of Dickens' work, in my opinion.

The frogs will be back to their usual shenanigans on Friday, as will most of the world. I hope you have a Merry Christmas, and come back to read my blog when I return to writing about software development next week!

Amphibian.com comic for 24 December 2014

Monday, December 22, 2014

A Little More Daylight

Today there is more daylight than yesterday, but you probably didn't notice.

Yesterday, the 21st of December, was what people here in the northern hemisphere like to call "the shortest day of the year." I like to call it my father's birthday as well, but that's not the point. The point is, all days are actually the same length (unless they add a leap second or some crazy nonsense). Yesterday wasn't the shortest day of the year, but it was the day when the Earth received the smallest amount of solar radiation, due to the tilt of the planet's axis. Winter has officially started.

Today, the 22nd of December, will get slightly more sunlight. But just by a few seconds. Here in central Pennsylvania, we had 9 hours and 16 minutes of daylight yesterday. It won't be until the 26th when we can say we got 9 hours and 17 minutes.

But we're starting to pick up some momentum...we only have to wait until the 28th to get 9 hours and 18 minutes of sun, and we can add another minute on the 20th. At the beginning of January 2015, we'll be adding 1 minute per day, and by the end of the month we'll add 2 minutes per day.

By mid-March, we'll be enjoying around 12 hours of sunlight (when daylight and darkness hours are equal, Spring begins) and we are adding around 3 minutes daily. It slows down as we get closer to June 21, when we max-out at 15 hours and 5 minutes.

I like tables of this kind of information. Here you can find the daylight/darkness table for someplace close to where you live: Duration of Daylight/Darkness Tables

Amphibian.com comic for 22 December 2014

Friday, December 19, 2014

Finally Backing Up

I did something today that I should have done a long time ago - set up automatic backups of my amphibian.com database.

As you may or may not know (depending on how many of my blog posts you've read before), all of the data for my web comics is stored in a MySQL database. The words coming out of the frogs mouths, their positions in each cell, and the SVG images of the frogs themselves - all stored in simple tables in MySQL. I needed to be doing backups.

I set it up with cron and mysqldump. I wrote a simple bash script that will call mysqldump to create the complete backup of my amphibian database. It looks something like this:

#!/bin/bash
fn=/path/to/backups/amphibian-$(date +%d-%b-%Y).dump
mysqldump amphibian > "$fn"

To make sure each backup file gets a unique name, I create the fn variable which includes a section made out of the formatted date, in DD-Mon-YYYY format. To the Linux date command, that is %d-%b-%Y. Then I simply call mysqldump giving it a single parameter: the database name. I redirect the output to a file of the name I made above...and that's it.

Wait, why didn't it prompt for a user name and password to dump that database? Good question! That was my initial problem - I didn't want to put the password right in the script file. I found that if I make a file in my home area named .my.cnf and have it contain a section like this,

[mysqldump]
user = username
password = pw12345

...I can use mysqldump with a default user and without being prompted for a password. As long as the .my.cnf file has 0600 (read-write only owner) file permissions, it is reasonably secure.

I set my backup script to be called once per week by cron and I'm feeling much better now. I made an additional script that automatically copies the backup files offsite to a remote server for added safety. Being prepared for catastrophic data loss will really let me sleep better tonight.

Amphibian.com comic for 19 December 2014

Wednesday, December 17, 2014

You Know, That Christmas Poem

Okay, so my comic up until Christmas Eve is clearly a parody of "A Visit from St. Nicholas." You may know it better as "The Night Before Christmas", which is not actually its title but part of the first line.

This classic poem, written by Clement Clarke Moore way back in 1823, is largely responsible for our modern ideas about Santa Claus. My poem will most likely have no cultural impact whatsoever. But it is a chance for us all to think for a few minutes about the level of effort required for Santa's operation to make it on time every year. To meet his requirements, Santa can't be up there in his workshop hand-assembling dolls. He needs to be an expert at managing a production line of impossible size, and use the most advanced techniques for both planning and execution. Knowing the current wakefulness state of every child on earth, their position on the naughty/nice scale, and their desired gift list at any moment is clearly a monumental achievement of data science that is the envy of everyone from Google to the NSA.

And we haven't even gotten to the whole delivery phase of the operation yet. Amazon can experiment with flying delivery drones all they want, but only Santa Claus has a team of flying reindeer out delivering packages at speeds which imply some sort of controlled distortion of space-time.

There's no company on earth that wouldn't like to send someone to Santa for training - he's clearly mastered things that the rest of us don't even know exist yet.

I'm not the only one considering things of this nature. As part of your Christmas preparations this year, be sure to read Are Santa’s Reindeer Used for Propulsion or Navigation?, in which an MIT graduate student delves into the interesting question using Moore's original poem as evidence.

Amphibian.com comic for 17 December 2014