Convinced (or perhaps bribed) the kiddo to read this book

I love The Hobbit, it’s one of my all time favorite books.  Try as I might, one could say that I’ve been quite unsuccessful in getting anyone one else in this household to read it.  And I’m not below bribery to try and get that interest sparked (stop judging me!)

Someone finally took the bait and I’m so stoked.  She’s gonna love it.  Was hoping for a more candid shot here, but the light-assist focus was on and caught her eye. Dangit.

DSC_1445

Update to yesterdays post

Yesterday, I wrote about making your own reminder service using Google Sheets. Today I made some improvements to that code to look for a date as well, so it’s more viable.

A couple of notes:

  • The timzone function in google scripts seems to be off by an hour, not sure why. So you may have to adjust that.
  • If there’s no date in the spreadsheet, that item is repeated daily.
  • Make sure you’re the date field is set to plain text, and that the date you enter will match the format of the date inside the script: 04-18-2014
  • If you run into trouble, the Logger function is invaluable.  “View > Execution Transcript” will show you everything about the last run.

I think that’s about it. So without much ado, here’s the updated script, basic as it may be:


function sendEmails() {

 var sheet = SpreadsheetApp.getActiveSheet();
 var startRow = 2; // Start on row 2, row 1 is the legend
 var numRows = 100; // How many rows to check? Set high.
 var dataRange = sheet.getRange(startRow, 1, numRows, 5)
 var data = dataRange.getValues();

 var todaysDate = Utilities.formatDate(new Date(), "GMT-4", "MM-dd-yyyy");
 // This works but the TZ is off by an hour, looking into this
 var currentTime = Utilities.formatDate(new Date(), "GMT-4", "HH:mm"); 

 for (i in data) {
 var row = data[i];
 var emailAddress = row[0];
 var subject = row[1];
 var date = row[2];
 var time = row[3];
 var message = row[4]; 

 if ((date == '') && (time == currentTime)) {
 MailApp.sendEmail(emailAddress, subject, message);
 }

 if ((date == todaysDate) && (time == currentTime)) {
 MailApp.sendEmail(emailAddress, subject, message);
 } 

}
}

Creating your own reminder service

Yesterday, a colleague of mine posted about a service called IFTTT (If this then that) which can create relationships between different services like Facebook, Gmail and Twitter.  Through the use of triggers, you can do some cool stuff.  Be sure to check out Dan’s writeup, it’s probably much more interesting than what you’re about to read.

For me, IFTTT is a little overkill, I usually stick with Google Calendar to remind me about stuff I’m planning on ignoring, but it got me thinking about creating my own very basic version of a crontab in the cloud for some notifications. Like submitting expense reports etc.

Enter Google Sheets and time-driven triggers.  Oh, and before you ask what the point is, the answer is just a little fun.  And if you’re wondering why my idea of fun is working on spreadsheets… ummm… data. mmmmmmm.

So first, we create a new Google Sheets document with some basic details: email address to notify, subject, date, time and message body:

Screen Shot 2014-04-17 at 11.20.31 PM

Once you have a few entries in there (notice the date is blank, I haven’t worked on that just yet – future post) click on Tools > Script Editor

Screen Shot 2014-04-17 at 10.17.57 PM

Here’s the code to add:

function sendEmails() {

 var sheet = SpreadsheetApp.getActiveSheet();
 var startRow = 2; // Start on row 2, row 1 is the legend
 var numRows = 100; // How many rows to check? Set high.
 var dataRange = sheet.getRange(startRow, 1, numRows, 5)
 var data = dataRange.getValues();

 var todaysDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd");
 // This works but the TZ is off by an hour, looking into this
 var currentTime = Utilities.formatDate(new Date(), "GMT-4", "HH:mm"); 

 for (i in data) {
 var row = data[i];
 var emailAddress = row[0];
 var subject = row[1];
 var date = row[2];
 var time = row[3];
 var message = row[4]; 

 if (time == currentTime)
 {
 // Function to send email, lets wrap it.
 MailApp.sendEmail(emailAddress, subject, message);
 }
 }
}

What does this do?  Right now nothing unless you run it manually using the play button in the toolbar.  For the automation magic, you need to add a trigger.  Click on ‘Resources’ in the toolbar, then ‘All your triggers’:

Screen Shot 2014-04-17 at 10.55.51 PM

Now click on the ‘Add a new trigger’ link and fill it out:

Screen Shot 2014-04-17 at 10.56.05 PM

You’ve now scheduled your app to run every 60 seconds, checking for upcoming events.  If the time in your spreadsheet matches the current time, emails get sent out.  I’ll probably make some changes and add date support as well.

So, is this better than a commercial service like IFTTT, Google Calendar or a plain old crontab entry set to send an email? Probably not.  Was it more fun to work on? You betcha!

Akismet 3.0 is now available!

The latest and greatest version of Akismet is no longer just a release candidate and is now available for download!  Version 3.0 includes a bunch of new features and overall improvements, you can read the official release post here.

A few of the changes:

  • Move Akismet to Settings menu
  • Drop Akismet Stats menu
  • Add stats snapshot to Akismet settings
  • Add Akismet subscription details and status to Akismet settings
  • Add contextual help for each page
  • Improve Akismet setup to use Jetpack to automate plugin setup
  • Fix Update Check for Spam to use ajax to avoid page timing out
  • Fix Akismet settings page to be responsive
  • Drop legacy code
  • Tidy up CSS and Javascript
  • Replace the old discard setting with a new “discard pervasive spam” feature.

One thing you may notice is that there is no longer two separate areas to look in for stats and configuration changes – they’re both in the same place.  If you’re a Jetpack user, the Akismet link will appear under the Jetpack menu.  If not, the link will show in Settings, oh and of course on the plugins page.

And if you’re looking to drill into your stats, use the ‘Summaries’ link located on the top right of the page to see the same great graphs and stats you’re used to seeing.

Happy blogging!