A Few Key Posts

For those who feel 2+ years of a blog qualifies as TL;DR.

Posted in Feelings, myExperience | Leave a comment

My First Cron Job(s)

Learning from this great “Automated Tasks” page at CentOS.org

Normally, I prefer stuff like this in a well-written tutorial (see below awesomeness from DigitalOcean) but the above is … wow.

Tangent Sidebar: You know what’s kind of irritating? How I use DigitalOcean documentation all the time — not just because it’s higher in the Google results but it is so much better than the documentation of my actual host. Far more subjects, ridiculously specific, much better written, and far more accurate.

Two cases in point:

The latter is especially useful today because I keep getting emails from Let’s Encrypt reminding me to renew my shizzle.

But, as it turns out, none of those told me exactly what I needed but this did:

How to run PHP scripts from cron jobs

That’s my host. I’m very proud of them. And if their customer support is ever consistently good or consistently “not bad,” I’ll totally apologize. Interestingly, that tute gave me the final piece I needed but if I hadn’t read the other tutes first I’d still have no idea what to do because it only gave the final step, not the first several. That’s my host.

The first three (the good) tutorials taught me how to write a line in the crontab using the columns:

  • minute
  • hour
  • day
  • month
  • dayofweek
  • command

“How to Use Cron …” even gave me the “shortcut” of using @weekly instead of 00**0.

But Newbie: Intro to Cron which I think — sincerely and seriously — is a beautifully designed page, gave me the best tip in telling me to look for the following folders in my /etc directory:

  • cron.daily
  • cron.hourly
  • cron.monthly
  • cron.weekly

Dude. Just drop a script in one of those and viola!

And … and … earlier, one of those tutorials stated, “Cron is a daemon …” and I wondered, “What is a daemon?” That Newbie tute said,

Cron is a daemon, which means that it only needs to be started once, and will lay dormant until it is required. A Web server is a daemon, it stays dormant until it gets asked for a web page. The cron daemon, or crond, stays dormant until a time specified in one of the config files, or crontabs.

I wish cogNiTioN wrote every tutorial on all of the sites and I wish all of the sites were designed like that one.

Okay, so I write a line in my crontab telling it to change directories to where I keep a certain php file, then use php to run that file. Like so …

00 16 * * * user-name cd /my/directory/path; php -q myfile.php

It’s almost 3:30pm now so in a little over half an hour, I’ll check to see if it worked. I’d love that. I’m rather sick of trying to remember to do this particular task.

I had it change directories first because from what I understand, the relative paths in the file would get all confused and fail if the little crontab tried to run the commands from /etc.

If you’re still reading and you care, it’s a script that will go grab popularity scores from Spotify for a bunch of artists I’m tracking.

Another nifty thing I think is interesting is … I did a magical “save as” on the php file I’ve been using for this task and realized, wow, the crontab doesn’t need all of the html, css, jquery, etc. because that’s for me to see so I know the script worked. Not only do I know it worked but the crontab couldn’t care less so I stripped it all out of a new, dedicated file. I also rewrote (or, rather, wrote a new script based on) the script I’ve been using because part of the original added rows to a table that the crontab wouldn’t look at even if it existed. Because the crontab doesn’t have eyes. And doesn’t care.

Posted in CentOS, Linux, Server Admin, Site Admin, Spotify | Tagged | Leave a comment

Filling Empty Cells with Zero in Excel

I had an enormous spreadsheet I’d made by saving a PDF as an Excel workbook and rearranging the data.


Some 2016 presidential election results in Excel

I needed to get the data into MySQL but there were countless empty cells where candidates received no votes and I knew that wouldn’t fly. I needed zeroes.


Select all the empty cells by clicking Find & Select in the Editing section of the Home tab in the spawn-from-Hell ribbon-thing and choosing Go To Special.



Select Blanks and click OK.



Press F2 (function key at the top of your keyboard) to select one of the selected empty cells (using F2 prevents deselecting all the other empty cells).


Type “0” and press either Ctrl+Enter on Windows or Cmd+Return on a Mac.


Behold …


Posted in Tutorials | Tagged , | Leave a comment

States Who Gained and Lost Electoral College Votes in the Last 30 Years

While working on a data visualization and web app project about presidential elections, I noticed that several states have either gained or lost votes (based on population) in the Electoral College with each census. Some states stayed the same throughout none of them gained-then-lost nor lost-then-gained.

States That Gained Votes Twice

  • Arizona
  • Florida
  • Georgia
  • Nevada
  • Texas

States That Lost Votes Twice

  • Illinois
  • Michigan
  • New York
  • Ohio
  • Pennsylvania

States That Stayed the Same

  • Alabama
  • Alaska
  • Arkansas
  • Hawaii
  • Idaho
  • Kansas
  • Kentucky
  • Maine
  • Maryland
  • Minnesota
  • Montana
  • Nebraska
  • New Hampshire
  • New Mexico
  • North Dakota
  • Oregon
  • Rhode Island
  • South Dakota
  • Tennessee
  • Vermont
  • Virginia
  • West Virginia
  • Wyoming


  • California, Colorado, North Carolina each -1 vote in 2004
  • Connecticut, Indiana, Mississippi, Oklahoma, Wisconsin each -1 vote in 2004
  • South Carolina, Utah, Washington each +1 vote in 2012
  • Iowa, Louisiana, Massachusetts, Missouri, New Jersey each +1 vote in 2012


Posted in myProjects, PrezPlayPro | Tagged | Leave a comment

My Second Schema Revising

“Hmm …” he says, realizing he’ll want data viz for multiple elections and many candidates run in multiple elections … and sometimes they change parties …

  • Where should the year go?
  • Where the party at?

Oh, man … the number of Electoral College votes a state gets can change (based on population) as well …

And, aw, crap! Two states (Nebraska and Maine) don’t follow the stupid “winner take all” rule. Normally, I’d like that but it’s a pain in my butt now.


Later changed “popVotes” table name to “results.” Considered having different results tables for different years but I think having affiliations and results structured the same will help me keep my code straight in my head.

Note how New York and Michigan lose votes with each census while Florida and Texas gain them (check out other examples in the screenshot below). The number of votes a state gets changes every ten years with the census so my electoralCollege table has columns for each first election of the decade so the following election years are grouped together.

  • 1992, 1996, 2000
  • 2004, 2008
  • 2012, 2016, 2020

Here’s what I made in Excel that I’ll save as a CSV.


It’s irritating how many different websites I have to visit to get these numbers, election results, etc.

News media get these results in real time so somebody has this information handy somewhere. Ugh.

It’s also irritating that, in an effort to find a faster way to convert the (sometimes PDF to) Excel to something usable in CSV I spend more time than if I just tediously copied and pasted. I do the same thing with my code. I think there must be a more elegant, faster way to do stuff when, nope, it’s only code, and it’s more simple and easy than I’m making it. Having said that, I’m unsure if this is the best way for this and other tables in this database to be organized, but here’s how I’m using the data for party affiliations.


In the original PDF from the Federal Election Commission (FEC), it looked like this:

Evan McMullin (CCS, IDP, IND, BFA, NP, UN)

I haven’t thought too much yet about how I’ll query for party affiliation and morph that into my broad-stroke “socialist” and “conservative” big tents so I tried to make it as simple and malleable as possible. I’m very anxious to get started — this concept has been wanted to be born for a long, long time — so I’m allowing myself to rush a bit. I don’t mind having to fix it later if I must — it’ll be a fun learning experience (I hope).

It’s late in the day and I’m not sure if this is the best schema because I’m rushing a bit so I’ll need to review this later but this is what I’m going with to start.


Yep. Some of those commas shouldn’t be there. Noticed when I tried pasting into my Terminal.

Posted in Databases, Elections, myProjects, MySQL | Tagged | Leave a comment

My Second Schema

Last time I really worked with results from the 2016 Presidential Election was recorded for posterity in a post from December 2016. Politico never did bother to finish entering complete election results so I’ve been waiting for the FEC to get around to releasing them officially. They finally have. Not in a format you can download or even in an Excel spreadsheet, mind you — of course not — but at least Acrobat Pro let me save the PDF as an Excel file that wasn’t too painful to clean up. Now to export that in a way that won’t be too painful to import into MySQL.

UPDATE Many Minutes Later: Wow. Who would have thunk designing a “simple” database for this would take this much thought?

Here’s what I’ll probably go with:

Originally, there were id columns for the parties and states tables. I may put those back but I like the human-readability of using party abbreviations and state abbreviations.

Posted in Data Visualization, MySQL | Leave a comment

PHP Beach Party

The post title was going to be “Swimming in PHP” but I’m also just relaxing on PHP Beach. And dancing on PHP Beach with Annette Funicello, Yvonne Craig and Bettie Page who all take turns praising my mad PHP skillz.

Totally real pictures of me with Bettie, Yvonne, and Annette.

Who knew this Spotify thing would be what I really needed to make my PHP learning really kick it up to the next level? Not me.

Posted in myLearning, myProgress, myProjects | Leave a comment

Everything Wrong (and Right) with eLearning in 2017

The night before last, my wife and I were talking about the radical difference in available opportunities between, say, 1990 (when I got out of the Air Force) and now.

In 1990, laptops and computers were expensive. Even if you had a laptop, there was no WiFi. Even if there were WiFi, what would you connect to? College — even community college (tuition plus books) — was expensive. Classes and majors for “non-traditional” students who worked during the day were non-existent. The only place you could access a computer if you couldn’t afford one of your own was the library (free but crappy hours unless you lived in Ann Arbor, MI) or you could rent one any time 24/7 at Kinko’s. But, again, what were you going to do with that computer to learn?

Everything Right with the State of eLearning in 2017

In the last several years:

  • laptops have plummeted in price
    • Free WiFi is everywhere
      • ¬†YouTube tutorials (free) by experts ranging from grade-schoolers to experienced adults
      • Khan Academy
      • Codecademy
      • FreeCodeCamp
      • StackExchange
      • Reddit
      • Udacity
      • Udemy
      • EdX
      • Countless personal sites (free and paid)
      • Countless org/corp sites (free and paid)
      • Freaking Meetups!
      • and so on …
  • The public library
    • Overdrive

Education now is like porn — why would you ever pay for it when there’s so much quality product out there for free?

I wish these opportunities had existed from 1990-2000. My life would be very different.

Sadly, for many — myself included — another, extremely ironic, difference is we had all the time in the world back then to study … but no way to study*. Now, there’s so little precious time what with full-time job, wife, and children. Some people have multiple jobs.

*And, like I said, nothing really to study. And most of what I’m studying now didn’t even exist (or barely existed) in 2000. I didn’t know what to do with what I did have access to.

But, thanks to everything listed above, we can at least make every precious moment count.

Everything Wrong with eLearning in 2017

The idea for this post started off pretty negative but I changed it to begin with a positive (above). It was actually born as “everything wrong with Instructional Design in 2017” and inspired by …

All the culprits responsible for crimes against humanity (Powerpoint, Articulate, and iSpring) in one place. Well, Captivate isn’t there … like the Joker, it seems to be off somewhere else … watching the world burn. On my list of evil organizations, Articulate is above ISIS and the Nazis.

Posted in Learning, elearning, Instructional Design | Leave a comment